From 93d101f0c3b2b7b6909d6f98a0d04b978b4ae29a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Feb 2009 11:58:58 +0000 Subject: mesa/st: support l8 as well as i8 in bitmap code Also don't send the partial program fragment down to hardware -- the program will never be used in that form. --- src/mesa/state_tracker/st_cb_bitmap.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 66d7cbf8e6..f55a5e713f 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -142,6 +142,10 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) /* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */ p->Instructions[ic].Opcode = OPCODE_KIL; p->Instructions[ic].SrcReg[0].File = PROGRAM_TEMPORARY; + + if (ctx->st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM) + p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_XXXX; + p->Instructions[ic].SrcReg[0].Index = 0; p->Instructions[ic].SrcReg[0].NegateBase = NEGATE_XYZW; ic++; @@ -157,7 +161,11 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) stfp = (struct st_fragment_program *) p; stfp->Base.UsesKill = GL_TRUE; - st_translate_fragment_program(ctx->st, stfp, NULL); + + /* No need to send this incomplete program down to hardware: + * + * st_translate_fragment_program(ctx->st, stfp, NULL); + */ return stfp; } @@ -786,6 +794,10 @@ st_init_bitmap(struct st_context *st) PIPE_TEXTURE_USAGE_SAMPLER, 0)) { st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM; } + else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0)) { + st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM; + } else { /* XXX support more formats */ assert(0); -- cgit v1.2.3 From b1ac00dc8d283f82a7f74bc435b5131311b2df86 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Feb 2009 12:00:47 +0000 Subject: st/wgl: silence some debug --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 44 ++++++++++++++++++---------- 1 file changed, 29 insertions(+), 15 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 8ae6aa1f3e..faf7f2f410 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -36,6 +36,7 @@ #include "shared/stw_public.h" #include "icd/stw_icd.h" +#define DBG 0 static GLCLTPROCTABLE cpt; static boolean cpt_initialized = FALSE; @@ -81,7 +82,8 @@ DrvDescribeLayerPlane( UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd ) { - debug_printf( "%s\n", __FUNCTION__ ); + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); return FALSE; } @@ -97,8 +99,9 @@ DrvDescribePixelFormat( r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd ); - debug_printf( "%s( %p, %d, %u, %p ) = %d\n", - __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); + if (DBG) + debug_printf( "%s( %p, %d, %u, %p ) = %d\n", + __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); return r; } @@ -111,7 +114,8 @@ DrvGetLayerPaletteEntries( INT cEntries, COLORREF *pcr ) { - debug_printf( "%s\n", __FUNCTION__ ); + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); return 0; } @@ -124,7 +128,8 @@ DrvGetProcAddress( r = stw_get_proc_address( lpszProc ); - debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r ); + if (DBG) + debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r ); return r; } @@ -135,7 +140,8 @@ DrvRealizeLayerPalette( INT iLayerPlane, BOOL bRealize ) { - debug_printf( "%s\n", __FUNCTION__ ); + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); return FALSE; } @@ -152,7 +158,8 @@ DrvSetCallbackProcs( INT nProcs, PROC *pProcs ) { - debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs ); + if (DBG) + debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs ); return; } @@ -510,8 +517,9 @@ DrvSetContext( DHGLRC dhglrc, PFN_SETPROCTABLE pfnSetProcTable ) { - debug_printf( "%s( 0x%p, %u, 0x%p )\n", - __FUNCTION__, hdc, dhglrc, pfnSetProcTable ); + if (DBG) + debug_printf( "%s( 0x%p, %u, 0x%p )\n", + __FUNCTION__, hdc, dhglrc, pfnSetProcTable ); /* Although WGL allows different dispatch entrypoints per */ @@ -534,7 +542,8 @@ DrvSetLayerPaletteEntries( INT cEntries, CONST COLORREF *pcr ) { - debug_printf( "%s\n", __FUNCTION__ ); + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); return 0; } @@ -548,7 +557,8 @@ DrvSetPixelFormat( r = stw_pixelformat_set( hdc, iPixelFormat ); - debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); + if (DBG) + debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); return r; } @@ -558,7 +568,8 @@ DrvShareLists( DHGLRC dhglrc1, DHGLRC dhglrc2 ) { - debug_printf( "%s\n", __FUNCTION__ ); + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); return FALSE; } @@ -567,7 +578,8 @@ BOOL APIENTRY DrvSwapBuffers( HDC hdc ) { - debug_printf( "%s( %p )\n", __FUNCTION__, hdc ); + if (DBG) + debug_printf( "%s( %p )\n", __FUNCTION__, hdc ); return stw_swap_buffers( hdc ); } @@ -577,7 +589,8 @@ DrvSwapLayerBuffers( HDC hdc, UINT fuPlanes ) { - debug_printf( "%s\n", __FUNCTION__ ); + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); return FALSE; } @@ -586,7 +599,8 @@ BOOL APIENTRY DrvValidateVersion( ULONG ulVersion ) { - debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion ); + if (DBG) + debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion ); /* TODO: get the expected version from the winsys */ -- cgit v1.2.3 From 66ddf1a00f7f730831c32b27e46515a0369487ff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Feb 2009 20:23:00 -0700 Subject: cell: added null ptr check in xm_flush_frontbuffer() --- src/gallium/winsys/xlib/xlib_cell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c index c87564f4dc..40bcdfe42a 100644 --- a/src/gallium/winsys/xlib/xlib_cell.c +++ b/src/gallium/winsys/xlib/xlib_cell.c @@ -222,7 +222,8 @@ xm_flush_frontbuffer(struct pipe_winsys *pws, * This function copies that XImage to the actual X Window. */ XMesaContext xmctx = (XMesaContext) context_private; - xlib_cell_display_surface(xmctx->xm_buffer, surf); + if (xmctx) + xlib_cell_display_surface(xmctx->xm_buffer, surf); } -- cgit v1.2.3 From d6677fd9bc19050c18e0509815123990455b785b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 08:33:50 -0700 Subject: softpipe: minor code movement in softpipe_get_tex_transfer() --- src/gallium/drivers/softpipe/sp_texture.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 28a9784b16..41127101cd 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -283,14 +283,13 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, { struct softpipe_texture *sptex = softpipe_texture(texture); struct softpipe_transfer *spt; - struct pipe_transfer *pt; assert(texture); assert(level <= texture->last_level); spt = CALLOC_STRUCT(softpipe_transfer); - pt = &spt->base; if (spt) { + struct pipe_transfer *pt = &spt->base; pt->refcount = 1; pipe_texture_reference(&pt->texture, texture); pt->format = texture->format; @@ -302,12 +301,13 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, pt->nblocksx = texture->nblocksx[level]; pt->nblocksy = texture->nblocksy[level]; pt->stride = sptex->stride[level]; - spt->offset = sptex->level_offset[level]; pt->usage = usage; pt->face = face; pt->level = level; pt->zslice = zslice; + spt->offset = sptex->level_offset[level]; + if (texture->target == PIPE_TEXTURE_CUBE || texture->target == PIPE_TEXTURE_3D) { spt->offset += ((texture->target == PIPE_TEXTURE_CUBE) ? face : @@ -317,8 +317,9 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, assert(face == 0); assert(zslice == 0); } + return pt; } - return pt; + return NULL; } -- cgit v1.2.3 From 8f3c1cddaa9c307f70fca0e1a917397a7d85c238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Feb 2009 15:44:09 +0000 Subject: util: Don't use 0-sized arrays. Not supported by MSVC. --- src/gallium/auxiliary/util/u_debug_memory.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_memory.c b/src/gallium/auxiliary/util/u_debug_memory.c index 758541c282..7623cb9398 100644 --- a/src/gallium/auxiliary/util/u_debug_memory.c +++ b/src/gallium/auxiliary/util/u_debug_memory.c @@ -73,7 +73,9 @@ struct debug_memory_header const char *file; unsigned line; const char *function; +#if DEBUG_MEMORY_STACK struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK]; +#endif size_t size; unsigned magic; @@ -140,7 +142,9 @@ debug_malloc(const char *file, unsigned line, const char *function, hdr->size = size; hdr->magic = DEBUG_MEMORY_MAGIC; +#if DEBUG_MEMORY_STACK debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK); +#endif ftr = footer_from_header(hdr); ftr->magic = DEBUG_MEMORY_MAGIC; @@ -296,7 +300,9 @@ debug_memory_end(unsigned long start_no) debug_printf("%s:%u:%s: %u bytes at %p not freed\n", hdr->file, hdr->line, hdr->function, hdr->size, ptr); +#if DEBUG_MEMORY_STACK debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK); +#endif total_size += hdr->size; } -- cgit v1.2.3 From 0be216c526c29726a73a26a37dcd5a00cfbefc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Feb 2009 15:49:21 +0000 Subject: pipebuffer: Allow asymmetric guard sizes for under/overflow detection. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr.h | 5 +++-- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 16 ++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h index fec8db91c7..74077f8277 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h @@ -200,10 +200,11 @@ pb_ondemand_manager_create(struct pb_manager *provider); /** * Debug buffer manager to detect buffer under- and overflows. * - * Band size should be a multiple of the largest alignment + * Under/overflow sizes should be a multiple of the largest alignment */ struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size); +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size); #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 070bf3f517..21079b8bfd 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -78,7 +78,8 @@ struct pb_debug_manager struct pb_manager *provider; - size_t band_size; + size_t underflow_size; + size_t overflow_size; }; @@ -301,7 +302,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, if(!buf) return NULL; - real_size = size + 2*mgr->band_size; + real_size = mgr->underflow_size + size + mgr->overflow_size; real_desc = *desc; real_desc.usage |= PIPE_BUFFER_USAGE_CPU_WRITE; real_desc.usage |= PIPE_BUFFER_USAGE_CPU_READ; @@ -327,7 +328,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, buf->base.vtbl = &pb_debug_buffer_vtbl; buf->mgr = mgr; - buf->underflow_size = mgr->band_size; + buf->underflow_size = mgr->underflow_size; buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size; pb_debug_buffer_fill(buf); @@ -356,7 +357,8 @@ pb_debug_manager_destroy(struct pb_manager *_mgr) struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size) +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size) { struct pb_debug_manager *mgr; @@ -371,7 +373,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size) mgr->base.create_buffer = pb_debug_manager_create_buffer; mgr->base.flush = pb_debug_manager_flush; mgr->provider = provider; - mgr->band_size = band_size; + mgr->underflow_size = underflow_size; + mgr->overflow_size = overflow_size; return &mgr->base; } @@ -381,7 +384,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size) struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size) +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size) { return provider; } -- cgit v1.2.3 From dd9742dc9ffc976d3caae87c1302b7b5ed7d3838 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 14:30:51 -0700 Subject: mesa: use quotes for #include --- src/mesa/main/glheader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 482a36de93..ad095321e3 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -52,7 +52,7 @@ #define GL_GLEXT_PROTOTYPES #include "GL/gl.h" #include "GL/glext.h" -#include +#include "GL/internal/glcore.h" #ifndef GL_FIXED -- cgit v1.2.3 From 18d2745765715b03f9fda9a4c31d3678dc0bc457 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 14:59:54 -0700 Subject: glsl: silence warning --- src/mesa/shader/slang/slang_builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index c0f4c79e13..9858a0f7fd 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -494,7 +494,7 @@ emit_statevars(const char *name, int array_len, } else if (type->type == SLANG_SPEC_STRUCT) { const slang_variable_scope *fields = type->_struct->fields; - GLuint i, pos; + GLuint i, pos = 0; for (i = 0; i < fields->num_variables; i++) { const slang_variable *var = fields->variables[i]; GLint p = emit_statevars(var->a_name, 0, &var->type.specifier, -- cgit v1.2.3 From bfdbbfb0251bcd17c1a559668d0f4a0d36847a84 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 17:53:39 -0700 Subject: mesa: fix merge conflict (in comment) --- src/mesa/main/version.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 9287e8515c..f5bf6e2c85 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -1,10 +1,6 @@ /* * Mesa 3-D graphics library -<<<<<<< HEAD:src/mesa/main/version.h * Version: 7.5 -======= - * Version: 7.4 ->>>>>>> origin/gallium-0.2:src/mesa/main/version.h * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * -- cgit v1.2.3 From c92dc32dc26263c28a3446bc4829cfd972c8252b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Feb 2009 23:55:03 +0100 Subject: i915: Clean up i915_winsys.h a bit --- src/gallium/drivers/i915simple/i915_screen.c | 1 + src/gallium/drivers/i915simple/i915_screen.h | 4 --- src/gallium/drivers/i915simple/i915_winsys.h | 29 ++++++++++++++-------- src/gallium/winsys/drm/intel/gem/intel_be_device.c | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c index b7bd3b3b74..49471287a2 100644 --- a/src/gallium/drivers/i915simple/i915_screen.c +++ b/src/gallium/drivers/i915simple/i915_screen.c @@ -36,6 +36,7 @@ #include "i915_context.h" #include "i915_screen.h" #include "i915_texture.h" +#include "i915_winsys.h" static const char * diff --git a/src/gallium/drivers/i915simple/i915_screen.h b/src/gallium/drivers/i915simple/i915_screen.h index a371663453..5284c32595 100644 --- a/src/gallium/drivers/i915simple/i915_screen.h +++ b/src/gallium/drivers/i915simple/i915_screen.h @@ -75,10 +75,6 @@ i915_transfer( struct pipe_transfer *transfer ) } -extern struct pipe_screen * -i915_create_screen(struct pipe_winsys *winsys, uint pci_id); - - #ifdef __cplusplus } #endif diff --git a/src/gallium/drivers/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h index 81904c2a74..39f3f5a849 100644 --- a/src/gallium/drivers/i915simple/i915_winsys.h +++ b/src/gallium/drivers/i915simple/i915_winsys.h @@ -30,7 +30,8 @@ * This is the interface that i915simple requires any window system * hosting it to implement. This is the only include file in i915simple * which is public. - * + * + * This isn't currently true as the winsys needs i915_batchbuffer.h */ #ifndef I915_WINSYS_H @@ -45,10 +46,9 @@ extern "C" { #endif -/* 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. +/* Pipe drivers are 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, @@ -64,7 +64,7 @@ struct pipe_screen; /** * Additional winsys interface for i915simple. - * + * * 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 @@ -110,12 +110,21 @@ struct i915_winsys { #define I915_BUFFER_USAGE_LIT_VERTEX (PIPE_BUFFER_USAGE_CUSTOM << 0) -struct pipe_context *i915_create_context( struct pipe_screen *, - struct pipe_winsys *, - struct i915_winsys * ); +/** + * Create i915 pipe_screen. + */ +struct pipe_screen *i915_create_screen( struct pipe_winsys *winsys, + uint pci_id ); + +/** + * Create a i915 pipe_context. + */ +struct pipe_context *i915_create_context( struct pipe_screen *screen, + struct pipe_winsys *winsys, + struct i915_winsys *i915 ); #ifdef __cplusplus } #endif -#endif +#endif diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index a2163a1e6d..1c771b4ff5 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -9,7 +9,7 @@ #include "intel_be_fence.h" -#include "i915simple/i915_screen.h" +#include "i915simple/i915_winsys.h" #include "intel_be_api.h" -- cgit v1.2.3 From f0d09bfc1cb775ba6f9c0c3899f4ee5afa26ee46 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Feb 2009 23:58:11 +0100 Subject: i915: Fix some warnings --- src/gallium/drivers/i915simple/i915_state_emit.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c index 26e03f5127..1e1fb968b4 100644 --- a/src/gallium/drivers/i915simple/i915_state_emit.c +++ b/src/gallium/drivers/i915simple/i915_state_emit.c @@ -214,7 +214,6 @@ i915_emit_hardware_state(struct i915_context *i915 ) unsigned ctile = BUF_3D_USE_FENCE; struct i915_texture *tex = (struct i915_texture *) cbuf_surface->texture; - struct pipe_buffer *buffer = tex->buffer; assert(tex); if (tex && tex->tiled) { @@ -238,7 +237,6 @@ i915_emit_hardware_state(struct i915_context *i915 ) unsigned ztile = BUF_3D_USE_FENCE; struct i915_texture *tex = (struct i915_texture *) depth_surface->texture; - struct pipe_buffer *buffer = tex->buffer; assert(tex); if (tex && tex->tiled) { -- cgit v1.2.3 From 25b32eb8d00e303958497df9211ec2c45268b6af Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 25 Feb 2009 01:52:38 +0100 Subject: st/drm: Bring drm_api.h up to date with latest changes --- src/gallium/include/state_tracker/drm_api.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 54480fa047..588fa3a312 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -4,12 +4,14 @@ struct pipe_screen; struct pipe_winsys; +struct pipe_buffer; struct pipe_context; +struct pipe_texture; struct drm_api { /** - * Special buffer function + * Special buffer functions */ /*@{*/ struct pipe_screen* (*create_screen)(int drmFB, int pciID); @@ -17,11 +19,12 @@ struct drm_api /*@}*/ /** - * Special buffer function + * Special buffer functions */ /*@{*/ - struct pipe_buffer* (*buffer_from_handle)(struct pipe_winsys *winsys, const char *name, unsigned handle); - unsigned (*handle_from_buffer)(struct pipe_winsys *winsys, struct pipe_buffer *buffer); + boolean (*buffer_from_texture)(struct pipe_texture *texture, struct pipe_buffer **buffer, unsigned *stride); + struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, const char *name, unsigned handle); + unsigned (*handle_from_buffer)(struct pipe_screen *screen, struct pipe_buffer *buffer); /*@}*/ }; -- cgit v1.2.3 From 36348ff1da9064ac93802dc4e10cef74de0a1f47 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Feb 2009 23:22:34 +0100 Subject: i915: Enable winsys to get buffer from texture --- src/gallium/drivers/i915simple/i915_texture.c | 18 ++++++++++++++++++ src/gallium/drivers/i915simple/i915_winsys.h | 13 +++++++++++++ 2 files changed, 31 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c index 957726523f..6aead3e75e 100644 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ b/src/gallium/drivers/i915simple/i915_texture.c @@ -42,6 +42,7 @@ #include "i915_texture.h" #include "i915_debug.h" #include "i915_screen.h" +#include "i915_winsys.h" /* * Helper function and arrays @@ -765,3 +766,20 @@ i915_init_screen_texture_functions(struct pipe_screen *screen) screen->texture_blanket = i915_texture_blanket; screen->tex_surface_release = i915_tex_surface_release; } + +boolean i915_get_texture_buffer( struct pipe_texture *texture, + struct pipe_buffer **buf, + unsigned *stride ) +{ + struct i915_texture *tex = (struct i915_texture *)texture; + + if (!tex) + return FALSE; + + pipe_buffer_reference(texture->screen, buf, tex->buffer); + + if (stride) + *stride = tex->stride; + + return TRUE; +} diff --git a/src/gallium/drivers/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h index 39f3f5a849..ff5b34f193 100644 --- a/src/gallium/drivers/i915simple/i915_winsys.h +++ b/src/gallium/drivers/i915simple/i915_winsys.h @@ -56,6 +56,7 @@ extern "C" { */ struct i915_batchbuffer; +struct pipe_texture; struct pipe_buffer; struct pipe_fence_handle; struct pipe_winsys; @@ -123,6 +124,18 @@ struct pipe_context *i915_create_context( struct pipe_screen *screen, struct pipe_winsys *winsys, struct i915_winsys *i915 ); +/** + * Used for the winsys to get the buffer used for a texture + * and also the stride used for the texture. + * + * Buffer is referenced for you so you need to unref after use. + * + * This is needed for example kms. + */ +boolean i915_get_texture_buffer( struct pipe_texture *texture, + struct pipe_buffer **buf, + unsigned *stride ); + #ifdef __cplusplus } #endif -- cgit v1.2.3 From d7c6ffbc5f658979b6cddf0b2b6b1165c8d45511 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 25 Feb 2009 01:54:03 +0100 Subject: intel: Adopt to the new drm_api.h --- src/gallium/winsys/drm/intel/gem/intel_be_api.c | 4 +++- src/gallium/winsys/drm/intel/gem/intel_be_device.c | 6 +++--- src/gallium/winsys/drm/intel/gem/intel_be_device.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c index 6cffed5134..e79ff0c6a3 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c @@ -1,12 +1,14 @@ #include "intel_be_api.h" +#include "i915simple/i915_winsys.h" struct drm_api drm_api_hocks = { /* intel_be_context.c */ .create_context = intel_be_create_context, - /* intel_be_screen.c */ + /* intel_be_device.c */ .create_screen = intel_be_create_screen, + .buffer_from_texture = i915_get_texture_buffer, .buffer_from_handle = intel_be_buffer_from_handle, .handle_from_buffer = intel_be_handle_from_buffer, }; diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index 1c771b4ff5..c0ba834006 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -133,10 +133,10 @@ err: } struct pipe_buffer * -intel_be_buffer_from_handle(struct pipe_winsys *winsys, +intel_be_buffer_from_handle(struct pipe_screen *screen, const char* name, unsigned handle) { - struct intel_be_device *dev = intel_be_device(winsys); + struct intel_be_device *dev = intel_be_device(screen->winsys); struct intel_be_buffer *buffer = CALLOC_STRUCT(intel_be_buffer); if (!buffer) @@ -163,7 +163,7 @@ err: } unsigned -intel_be_handle_from_buffer(struct pipe_winsys *winsys, +intel_be_handle_from_buffer(struct pipe_screen *screen, struct pipe_buffer *buf) { drm_intel_bo *bo = intel_bo(buf); diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h index c4837e65fa..5bf7d3fc4f 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h @@ -52,7 +52,7 @@ struct intel_be_buffer { * Takes a reference. */ struct pipe_buffer * -intel_be_buffer_from_handle(struct pipe_winsys *winsys, +intel_be_buffer_from_handle(struct pipe_screen *screen, const char* name, unsigned handle); /** @@ -61,7 +61,7 @@ intel_be_buffer_from_handle(struct pipe_winsys *winsys, * If buffer is destroyed handle may become invalid. */ unsigned -intel_be_handle_from_buffer(struct pipe_winsys *winsys, +intel_be_handle_from_buffer(struct pipe_screen *screen, struct pipe_buffer *buffer); static INLINE struct intel_be_buffer * -- cgit v1.2.3 From bd0370cd26e4fe9bc84afdb3d087e46b38022961 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 20:10:36 -0700 Subject: cell: don't need tex transfer for drawing surfaces --- src/gallium/drivers/cell/ppu/cell_pipe_state.c | 54 ++++++++++++-------------- 1 file changed, 24 insertions(+), 30 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 facd9551fe..ccd0fef6e8 100644 --- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c +++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c @@ -285,28 +285,22 @@ cell_map_surfaces(struct cell_context *cell) for (i = 0; i < 1; i++) { struct pipe_surface *ps = cell->framebuffer.cbufs[i]; if (ps) { - cell->cbuf_transfer[i] = - screen->get_tex_transfer(screen, ps->texture, ps->face, - ps->level, ps->zslice, - PIPE_TRANSFER_READ_WRITE, - 0, 0, ps->width, ps->height); - - cell->cbuf_map[i] = - screen->transfer_map(screen, cell->cbuf_transfer[i]); + struct cell_texture *ct = cell_texture(ps->texture); + cell->cbuf_map[i] = screen->buffer_map(screen, + ct->buffer, + (PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE)); } } { struct pipe_surface *ps = cell->framebuffer.zsbuf; if (ps) { - cell->zsbuf_transfer = - screen->get_tex_transfer(screen, ps->texture, ps->face, - ps->level, ps->zslice, - PIPE_TRANSFER_READ_WRITE, - 0, 0, ps->width, ps->height); - - cell->zsbuf_map = - screen->transfer_map(screen, cell->zsbuf_transfer); + struct cell_texture *ct = cell_texture(ps->texture); + cell->zsbuf_map = screen->buffer_map(screen, + ct->buffer, + (PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE)); } } } @@ -322,24 +316,24 @@ cell_unmap_surfaces(struct cell_context *cell) uint i; for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - if (cell->cbuf_transfer[i] && cell->cbuf_map[i]) { - /* unmap color buffer/surface [i] */ - screen->transfer_unmap(screen, cell->cbuf_transfer[i]); - cell->cbuf_map[i] = NULL; + struct pipe_surface *ps = cell->framebuffer.cbufs[i]; + if (ps && cell->cbuf_map[i]) { + struct cell_texture *ct = cell_texture(ps->texture); + assert(ps->texture); + assert(ct->buffer); - /* get rid of transfer object [i] */ - screen->tex_transfer_release(screen, &cell->cbuf_transfer[i]); - assert(cell->cbuf_transfer[i] == NULL); + screen->buffer_unmap(screen, ct->buffer); + cell->cbuf_map[i] = NULL; } } - if (cell->zsbuf_transfer && cell->zsbuf_map) { - screen->transfer_unmap(screen, cell->zsbuf_transfer); - cell->zsbuf_map = NULL; - - /* get rid of transfer object */ - screen->tex_transfer_release(screen, &cell->zsbuf_transfer); - assert(cell->zsbuf_transfer == NULL); + { + struct pipe_surface *ps = cell->framebuffer.zsbuf; + if (ps && cell->zsbuf_map) { + struct cell_texture *ct = cell_texture(ps->texture); + screen->buffer_unmap(screen, ct->buffer); + cell->zsbuf_map = NULL; + } } } -- cgit v1.2.3 From 192b7f20ebbe6e5ed7d7c8d8cb25ace019723689 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 20:58:46 -0700 Subject: cell: overhaul cell teximage code Updated to use the new pipe_transfer functions, etc. Texturing is working again. Though there's some bugs in mipmap texturing but I believe those predate the pipe_transfer changes. --- src/gallium/drivers/cell/ppu/cell_context.h | 6 - src/gallium/drivers/cell/ppu/cell_fence.c | 12 +- src/gallium/drivers/cell/ppu/cell_state_emit.c | 18 +- src/gallium/drivers/cell/ppu/cell_texture.c | 332 ++++++++----------------- src/gallium/drivers/cell/ppu/cell_texture.h | 17 +- 5 files changed, 119 insertions(+), 266 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h index ca03dc1511..5c3188e7f9 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.h +++ b/src/gallium/drivers/cell/ppu/cell_context.h @@ -127,15 +127,9 @@ struct cell_context struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; uint num_vertex_elements; - struct pipe_transfer *cbuf_transfer[PIPE_MAX_COLOR_BUFS]; - struct pipe_transfer *zsbuf_transfer; - ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS]; ubyte *zsbuf_map; - struct pipe_surface *tex_surf; - uint *tex_map; - uint dirty; uint dirty_textures; /* bitmask of texture units */ uint dirty_samplers; /* bitmask of sampler units */ diff --git a/src/gallium/drivers/cell/ppu/cell_fence.c b/src/gallium/drivers/cell/ppu/cell_fence.c index 867b5dcaa0..32dbf5706c 100644 --- a/src/gallium/drivers/cell/ppu/cell_fence.c +++ b/src/gallium/drivers/cell/ppu/cell_fence.c @@ -153,16 +153,12 @@ cell_add_fenced_textures(struct cell_context *cell) for (i = 0; i < cell->num_textures; i++) { struct cell_texture *ct = cell->texture[i]; if (ct) { - uint level; - for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) { - if (ct->tiled_buffer[level]) { #if 0 - printf("Adding texture %p buffer %p to list\n", - ct, ct->tiled_buffer[level]); + printf("Adding texture %p buffer %p to list\n", + ct, ct->tiled_buffer[level]); #endif - cell_add_buffer_to_list(cell, list, ct->tiled_buffer[level]); - } - } + if (ct->buffer) + cell_add_buffer_to_list(cell, list, ct->buffer); } } } diff --git a/src/gallium/drivers/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c index ff529fe22c..9479c0898f 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_emit.c +++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c @@ -287,19 +287,23 @@ cell_emit_state(struct cell_context *cell) for (i = 0;i < CELL_MAX_SAMPLERS; i++) { if (cell->dirty_textures & (1 << i)) { STATIC_ASSERT(sizeof(struct cell_command_texture) % 16 == 0); - struct cell_command_texture *texture - = (struct cell_command_texture *)cell_batch_alloc16(cell, sizeof(*texture)); + struct cell_command_texture *texture = + (struct cell_command_texture *) + cell_batch_alloc16(cell, sizeof(*texture)); + texture->opcode[0] = CELL_CMD_STATE_TEXTURE; texture->unit = i; if (cell->texture[i]) { + struct cell_texture *ct = cell->texture[i]; uint level; for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) { - texture->start[level] = cell->texture[i]->tiled_mapped[level]; - texture->width[level] = cell->texture[i]->base.width[level]; - texture->height[level] = cell->texture[i]->base.height[level]; - texture->depth[level] = cell->texture[i]->base.depth[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->target = cell->texture[i]->base.target; + texture->target = ct->base.target; } else { uint level; diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index fa52e2cbea..74724393f7 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -62,7 +62,7 @@ cell_texture_layout(struct cell_texture *ct) ct->buffer_size = 0; - for ( level = 0 ; level <= pt->last_level ; level++ ) { + for (level = 0; level <= pt->last_level; level++) { unsigned size; unsigned w_tile, h_tile; @@ -90,7 +90,7 @@ cell_texture_layout(struct cell_texture *ct) ct->buffer_size += size; - width = minify(width); + width = minify(width); height = minify(height); depth = minify(depth); } @@ -131,33 +131,19 @@ cell_texture_release(struct pipe_screen *screen, if (!*pt) return; - /* - DBG("%s %p refcount will be %d\n", - __FUNCTION__, (void *) *pt, (*pt)->refcount - 1); - */ if (--(*pt)->refcount <= 0) { /* Delete this texture now. * But note that the underlying pipe_buffer may linger... */ struct cell_texture *ct = cell_texture(*pt); - uint i; - /* - DBG("%s deleting %p\n", __FUNCTION__, (void *) ct); - */ + if (ct->mapped) { + pipe_buffer_unmap(screen, ct->buffer); + ct->mapped = NULL; + } pipe_buffer_reference(screen, &ct->buffer, NULL); - for (i = 0; i < CELL_MAX_TEXTURE_LEVELS; i++) { - /* Unreference the tiled image buffer. - * It may not actually be deleted until a fence is hit. - */ - if (ct->tiled_buffer[i]) { - ct->tiled_mapped[i] = NULL; - pipe_buffer_reference(screen, &ct->tiled_buffer[i], NULL); - } - } - FREE(ct); } *pt = NULL; @@ -294,107 +280,6 @@ untwiddle_image_uint(uint w, uint h, uint tile_size, uint *dst, } -/** - * Convert linear texture image data to tiled format for SPU usage. - */ -static void -cell_twiddle_texture(struct pipe_screen *screen, - struct pipe_surface *surface) -{ -#if 0 // XXX fix me - struct cell_texture *ct = cell_texture(surface->texture); - const uint level = surface->level; - const uint texWidth = ct->base.width[level]; - const uint texHeight = ct->base.height[level]; - const uint bufWidth = align(texWidth, TILE_SIZE); - const uint bufHeight = align(texHeight, TILE_SIZE); - const void *map = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_READ); - const uint *src = (const uint *) map; - - switch (ct->base.format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_B8G8R8A8_UNORM: - case PIPE_FORMAT_S8Z24_UNORM: - { - int numFaces = ct->base.target == PIPE_TEXTURE_CUBE ? 6 : 1; - int offset = bufWidth * bufHeight * 4 * surface->face; - uint *dst; - - if (!ct->tiled_buffer[level]) { - /* allocate buffer for tiled data now */ - struct pipe_winsys *ws = screen->winsys; - uint bytes = bufWidth * bufHeight * 4 * numFaces; - ct->tiled_buffer[level] = - ws->buffer_create(ws, 16, PIPE_BUFFER_USAGE_PIXEL, bytes); - /* and map it */ - ct->tiled_mapped[level] = - ws->buffer_map(ws, ct->tiled_buffer[level], - PIPE_BUFFER_USAGE_GPU_READ); - } - dst = (uint *) ((ubyte *) ct->tiled_mapped[level] + offset); - - twiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst, - surface->stride, src); - } - break; - default: - printf("Cell: twiddle unsupported texture format %s\n", - pf_name(ct->base.format)); - } - - screen->surface_unmap(screen, surface); -#endif -} - - -/** - * Convert SPU tiled texture image data to linear format for app usage. - */ -static void -cell_untwiddle_texture(struct pipe_screen *screen, - struct pipe_surface *surface) -{ -#if 0 // XXX fix me - struct cell_texture *ct = cell_texture(surface->texture); - const uint level = surface->level; - const uint texWidth = ct->base.width[level]; - const uint texHeight = ct->base.height[level]; - const void *map = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_READ); - const uint *src = (const uint *) ((const ubyte *) map + surface->offset); - - switch (ct->base.format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_B8G8R8A8_UNORM: - case PIPE_FORMAT_S8Z24_UNORM: - { - int numFaces = ct->base.target == PIPE_TEXTURE_CUBE ? 6 : 1; - int offset = surface->stride * texHeight * 4 * surface->face; - uint *dst; - - if (!ct->untiled_data[level]) { - ct->untiled_data[level] = - align_malloc(surface->stride * texHeight * 4 * numFaces, 16); - } - - dst = (uint *) ((ubyte *) ct->untiled_data[level] + offset); - - untwiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst, - surface->stride, src); - } - break; - default: - { - ct->untiled_data[level] = NULL; - printf("Cell: untwiddle unsupported texture format %s\n", - pf_name(ct->base.format)); - } - } - - screen->surface_unmap(screen, surface); -#endif -} - - static struct pipe_surface * cell_get_tex_surface(struct pipe_screen *screen, struct pipe_texture *pt, @@ -409,38 +294,25 @@ cell_get_tex_surface(struct pipe_screen *screen, ps->refcount = 1; pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - //ps->block = pt->block; ps->width = pt->width[level]; ps->height = pt->height[level]; - //ps->nblocksx = pt->nblocksx[level]; - //ps->nblocksy = pt->nblocksy[level]; - //ps->stride = ct->stride[level]; ps->offset = ct->level_offset[level]; - ps->usage = usage; - /* XXX may need to override usage flags (see sp_texture.c) */ - - pipe_texture_reference(&ps->texture, pt); + ps->usage = usage; ps->face = face; ps->level = level; ps->zslice = zslice; - if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) { -#if 0 // XXX fix me - ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) * - ps->nblocksy * - ps->stride; -#endif + if (pt->target == PIPE_TEXTURE_CUBE) { + ps->offset += face * pt->nblocksy[level] * ct->stride[level]; + } + else if (pt->target == PIPE_TEXTURE_3D) { + ps->offset += zslice * pt->nblocksy[level] * ct->stride[level]; } else { assert(face == 0); assert(zslice == 0); } - - if (ps->usage & PIPE_BUFFER_USAGE_CPU_READ) { - /* convert from tiled to linear layout */ - cell_untwiddle_texture(screen, ps); - } } return ps; } @@ -450,24 +322,8 @@ static void cell_tex_surface_release(struct pipe_screen *screen, struct pipe_surface **s) { - struct cell_texture *ct = cell_texture((*s)->texture); - const uint level = (*s)->level; struct pipe_surface *surf = *s; - if ((surf->usage & PIPE_BUFFER_USAGE_CPU_READ) && (ct->untiled_data[level])) - { - align_free(ct->untiled_data[level]); - ct->untiled_data[level] = NULL; - } - - if ((ct->base.tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) && - (surf->usage & PIPE_BUFFER_USAGE_CPU_WRITE)) { - /* convert from linear to tiled layout */ - cell_twiddle_texture(screen, surf); - } - - /* XXX if done rendering to teximage, re-tile */ - if (--surf->refcount == 0) { pipe_texture_reference(&surf->texture, NULL); FREE(surf); @@ -476,6 +332,11 @@ cell_tex_surface_release(struct pipe_screen *screen, } +/** + * Create new pipe_transfer object. + * This is used by the user to put tex data into a texture (and get it + * back out for glGetTexImage). + */ static struct pipe_transfer * cell_get_tex_transfer(struct pipe_screen *screen, struct pipe_texture *texture, @@ -485,14 +346,13 @@ cell_get_tex_transfer(struct pipe_screen *screen, { struct cell_texture *ct = cell_texture(texture); struct cell_transfer *ctrans; - struct pipe_transfer *pt; assert(texture); assert(level <= texture->last_level); ctrans = CALLOC_STRUCT(cell_transfer); - pt = &ctrans->base; if (ctrans) { + struct pipe_transfer *pt = &ctrans->base; pt->refcount = 1; pipe_texture_reference(&pt->texture, texture); pt->format = texture->format; @@ -504,23 +364,26 @@ cell_get_tex_transfer(struct pipe_screen *screen, pt->nblocksx = texture->nblocksx[level]; pt->nblocksy = texture->nblocksy[level]; pt->stride = ct->stride[level]; - ctrans->offset = ct->level_offset[level]; pt->usage = usage; pt->face = face; pt->level = level; pt->zslice = zslice; - if (texture->target == PIPE_TEXTURE_CUBE || - texture->target == PIPE_TEXTURE_3D) { - ctrans->offset += ((texture->target == PIPE_TEXTURE_CUBE) ? face : - zslice) * pt->nblocksy * pt->stride; + ctrans->offset = ct->level_offset[level]; + + if (texture->target == PIPE_TEXTURE_CUBE) { + ctrans->offset += face * pt->nblocksy * pt->stride; + } + else if (texture->target == PIPE_TEXTURE_3D) { + ctrans->offset += zslice * pt->nblocksy * pt->stride; } else { assert(face == 0); assert(zslice == 0); } + return pt; } - return pt; + return NULL; } @@ -542,16 +405,23 @@ cell_tex_transfer_release(struct pipe_screen *screen, } +/** + * Return pointer to texture image data in linear layout. + */ static void * -cell_transfer_map( struct pipe_screen *screen, - struct pipe_transfer *transfer ) +cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) { - ubyte *map; - struct cell_texture *spt; - unsigned flags = 0; + struct cell_transfer *ctrans = cell_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 stride = ct->stride[level]; + unsigned flags = 0x0; + unsigned size; assert(transfer->texture); - spt = cell_texture(transfer->texture); if (transfer->usage != PIPE_TRANSFER_READ) { flags |= PIPE_BUFFER_USAGE_CPU_WRITE; @@ -561,89 +431,82 @@ cell_transfer_map( struct pipe_screen *screen, flags |= PIPE_BUFFER_USAGE_CPU_READ; } - map = pipe_buffer_map(screen, spt->buffer, flags); - if (map == NULL) - return NULL; + if (!ct->mapped) { + /* map now */ + ct->mapped = pipe_buffer_map(screen, ct->buffer, flags); + } - /* May want to different things here depending on read/write nature - * of the map: + /* + * Create a buffer of ordinary memory for the linear texture. + * This is the memory that the user will read/write. */ - if (transfer->texture && transfer->usage != PIPE_TRANSFER_READ) - { - /* Do something to notify sharing contexts of a texture change. - * In cell, that would mean flushing the texture cache. - */ -#if 00 - cell_screen(screen)->timestamp++; -#endif + size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size; + + ctrans->map = align_malloc(size, 16); + if (!ctrans->map) + return NULL; /* out of memory */ + + 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) { + const uint *src = (uint *) (ct->mapped + ctrans->offset); + uint *dst = ctrans->map; + untwiddle_image_uint(texWidth, texHeight, TILE_SIZE, + dst, stride, src); + } + else { + // xxx fix + } } - - return map + cell_transfer(transfer)->offset + - transfer->y / transfer->block.height * transfer->stride + - transfer->x / transfer->block.width * transfer->block.size; + + return ctrans->map; } +/** + * Called when user is done reading/writing texture data. + * If new data was written, this is where we convert the linear data + * to tiled data. + */ static void cell_transfer_unmap(struct pipe_screen *screen, - struct pipe_transfer *transfer) + struct pipe_transfer *transfer) { - struct cell_texture *spt; - - assert(transfer->texture); - spt = cell_texture(transfer->texture); - - pipe_buffer_unmap( screen, spt->buffer ); -} - - -static void * -cell_surface_map(struct pipe_screen *screen, - struct pipe_surface *surface, - unsigned flags) -{ - ubyte *map; - struct cell_texture *ct = cell_texture(surface->texture); - const uint level = surface->level; - - assert(ct); - -#if 0 - if (flags & ~surface->usage) { - assert(0); - return NULL; + struct cell_transfer *ctrans = cell_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 stride = ct->stride[level]; + + if (!ct->mapped) { + /* map now */ + ct->mapped = pipe_buffer_map(screen, ct->buffer, + PIPE_BUFFER_USAGE_CPU_READ); } -#endif - map = pipe_buffer_map( screen, ct->buffer, flags ); - if (map == NULL) { - return NULL; - } - else { - if ((surface->usage & PIPE_BUFFER_USAGE_CPU_READ) && - (ct->untiled_data[level])) { - return (void *) ((ubyte *) ct->untiled_data[level] + surface->offset); + 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. + */ + const uint bpp = pf_get_size(ct->base.format); + if (bpp == 4) { + const uint *src = ctrans->map; + uint *dst = (uint *) (ct->mapped + ctrans->offset); + twiddle_image_uint(texWidth, texHeight, TILE_SIZE, dst, stride, src); } else { - return (void *) (map + surface->offset); + // xxx fix } } -} - - -static void -cell_surface_unmap(struct pipe_screen *screen, - struct pipe_surface *surface) -{ - struct cell_texture *ct = cell_texture(surface->texture); - - assert(ct); - pipe_buffer_unmap( screen, ct->buffer ); + align_free(ctrans->map); + ctrans->map = NULL; } - void cell_init_screen_texture_funcs(struct pipe_screen *screen) { @@ -655,6 +518,7 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen) screen->get_tex_transfer = cell_get_tex_transfer; screen->tex_transfer_release = cell_tex_transfer_release; + screen->transfer_map = cell_transfer_map; screen->transfer_unmap = cell_transfer_unmap; } diff --git a/src/gallium/drivers/cell/ppu/cell_texture.h b/src/gallium/drivers/cell/ppu/cell_texture.h index fc6486adbe..3ffc0bfdb5 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.h +++ b/src/gallium/drivers/cell/ppu/cell_texture.h @@ -43,20 +43,14 @@ struct cell_texture unsigned long level_offset[CELL_MAX_TEXTURE_LEVELS]; unsigned long stride[CELL_MAX_TEXTURE_LEVELS]; - /* The data is held here: - */ + /** The tiled texture data is held in this buffer */ struct pipe_buffer *buffer; unsigned long buffer_size; - /** Texture data in tiled layout is held here */ - struct pipe_buffer *tiled_buffer[CELL_MAX_TEXTURE_LEVELS]; - /** Mapped, tiled texture data */ - void *tiled_mapped[CELL_MAX_TEXTURE_LEVELS]; - - struct pipe_transfer *transfer; - - /** The original, linear texture data */ - void *untiled_data[CELL_MAX_TEXTURE_LEVELS]; + /** The buffer above, mapped. This is the memory from which the + * SPUs will fetch texels. This texture data is in the tiled layout. + */ + ubyte *mapped; }; @@ -65,6 +59,7 @@ struct cell_transfer struct pipe_transfer base; unsigned long offset; + void *map; }; -- cgit v1.2.3 From 981b7c08ae54b80cd4750dc15f4e63bd7bf0a0a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 24 Feb 2009 21:01:07 -0700 Subject: softpipe: minor code simplification for face/zslice offset calculation --- src/gallium/drivers/softpipe/sp_texture.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 41127101cd..142ce230fc 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -243,9 +243,11 @@ softpipe_get_tex_surface(struct pipe_screen *screen, ps->level = level; ps->zslice = zslice; - if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) { - ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) * - pt->nblocksy[level] * spt->stride[level]; + if (pt->target == PIPE_TEXTURE_CUBE) { + ps->offset += face * pt->nblocksy[level] * spt->stride[level]; + } + else if (pt->target == PIPE_TEXTURE_3D) { + ps->offset += zslice * pt->nblocksy[level] * spt->stride[level]; } else { assert(face == 0); @@ -308,10 +310,11 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, spt->offset = sptex->level_offset[level]; - if (texture->target == PIPE_TEXTURE_CUBE || - texture->target == PIPE_TEXTURE_3D) { - spt->offset += ((texture->target == PIPE_TEXTURE_CUBE) ? face : - zslice) * pt->nblocksy * pt->stride; + if (texture->target == PIPE_TEXTURE_CUBE) { + spt->offset += face * pt->nblocksy * pt->stride; + } + else if (texture->target == PIPE_TEXTURE_3D) { + spt->offset += zslice * pt->nblocksy * pt->stride; } else { assert(face == 0); -- cgit v1.2.3 From 9c0dea10e91752d5f43ed5ef9eac53248e5a05eb Mon Sep 17 00:00:00 2001 From: Benjamin Close Date: Tue, 24 Feb 2009 20:51:12 -0800 Subject: egl: Use -dlopen rather than -dl which is non portable Signed-off-by: Benjamin Close --- src/egl/main/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 89b4a200bc..a543f675a5 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -63,7 +63,7 @@ library: $(TOP)/$(LIB_DIR)/libEGL.so $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS) + -install $(TOP)/$(LIB_DIR) -dlopen $(OBJECTS) $(LIBS) install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) -- cgit v1.2.3 From afe139f629251f38afd5b477d5b00f47d17da60f Mon Sep 17 00:00:00 2001 From: Benjamin Close Date: Tue, 24 Feb 2009 20:51:11 -0800 Subject: gallium: Fix build when exiting CFLAGS contains a path with different gl.h If a path is in CFLAGS when building and that path contains gl.h then the wrong gl.h is used when building. This can lead to very confusing errors. The solution is rather than postpend the CFLAGS we prepend the paths as expected allowing compilation to occur as intended Signed-off-by: Benjamin Close --- src/gallium/state_trackers/egl/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile index ea4cec0bb8..d266ae2d62 100644 --- a/src/gallium/state_trackers/egl/Makefile +++ b/src/gallium/state_trackers/egl/Makefile @@ -6,14 +6,15 @@ TOP = ../../../.. include ${TOP}/configs/current -CFLAGS += -g -Wall -Werror-implicit-function-declaration -fPIC \ +CFLAGS:= -g -Wall -Werror-implicit-function-declaration -fPIC \ -I${GALLIUMDIR}/include \ -I${GALLIUMDIR}/auxiliary \ -I${TOP}/src/mesa/drivers/dri/common \ -I${TOP}/src/mesa \ -I$(TOP)/include \ -I$(TOP)/src/egl/main \ - ${LIBDRM_CFLAGS} + ${LIBDRM_CFLAGS} \ + ${CFLAGS} ############################################# -- cgit v1.2.3 From dbab39c6caacb974062ac574b365254412aea412 Mon Sep 17 00:00:00 2001 From: Benjamin Close Date: Tue, 24 Feb 2009 20:51:10 -0800 Subject: gallium: Add support for BSD operating systems, tested with FreeBSD BSD supports pipe in the same way as linux hence options which are safe for linux are also safe for BSD. Define PIPE_OS_BSD in include/pipe/p_config.h and adjust the defines to make use of it. Also define MAP_ANONYMOUS for BSD systems which use MAP_ANON Signed-off-by: Benjamin Close --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 4 ++-- src/gallium/auxiliary/rtasm/rtasm_execmem.c | 10 +++++++--- src/gallium/auxiliary/util/u_stream_stdc.c | 2 +- src/gallium/auxiliary/util/u_time.c | 12 ++++++------ src/gallium/auxiliary/util/u_time.h | 6 +++--- src/gallium/drivers/trace/tr_dump.c | 4 ++-- src/gallium/include/pipe/p_config.h | 8 ++++++-- src/gallium/include/pipe/p_thread.h | 10 +++++----- 8 files changed, 32 insertions(+), 24 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 556f26c0f0..533c0a15f3 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -36,7 +36,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include #include #endif @@ -559,7 +559,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) /* Wait on outstanding fences */ while (fenced_list->numDelayed) { pipe_mutex_unlock(fenced_list->mutex); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) sched_yield(); #endif _fenced_buffer_list_check_free(fenced_list, 1); diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 5acc5bcb7b..1f0923b683 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -37,8 +37,12 @@ #include "rtasm_execmem.h" +#if defined(PIPE_OS_BSD) +#define MAP_ANONYMOUS MAP_ANON +#endif -#if defined(PIPE_OS_LINUX) + +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) /* @@ -114,7 +118,7 @@ rtasm_exec_free(void *addr) } -#else /* PIPE_OS_LINUX */ +#else /* PIPE_OS_LINUX || PIPE_OS_BSD */ /* * Just use regular memory. @@ -134,4 +138,4 @@ rtasm_exec_free(void *addr) } -#endif /* PIPE_OS_LINUX */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ diff --git a/src/gallium/auxiliary/util/u_stream_stdc.c b/src/gallium/auxiliary/util/u_stream_stdc.c index ca80bef0f3..0ead45a749 100644 --- a/src/gallium/auxiliary/util/u_stream_stdc.c +++ b/src/gallium/auxiliary/util/u_stream_stdc.c @@ -32,7 +32,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) #include diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c index dde2c74fa8..357d9360c9 100644 --- a/src/gallium/auxiliary/util/u_time.c +++ b/src/gallium/auxiliary/util/u_time.c @@ -35,7 +35,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) #include @@ -77,7 +77,7 @@ util_time_get_frequency(void) void util_time_get(struct util_time *t) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) gettimeofday(&t->tv, NULL); #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) LONGLONG temp; @@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1, int64_t usecs, struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000; t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -124,7 +124,7 @@ int64_t util_time_diff(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return (t2->tv.tv_usec - t1->tv.tv_usec) + (t2->tv.tv_sec - t1->tv.tv_sec)*1000000; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) @@ -144,7 +144,7 @@ util_time_micros( void ) util_time_get(&t1); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL; #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE) util_time_get_frequency(); @@ -166,7 +166,7 @@ static INLINE int util_time_compare(const struct util_time *t1, const struct util_time *t2) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (t1->tv.tv_sec < t2->tv.tv_sec) return -1; else if(t1->tv.tv_sec > t2->tv.tv_sec) diff --git a/src/gallium/auxiliary/util/u_time.h b/src/gallium/auxiliary/util/u_time.h index 35d97d16c7..4346ce1fa4 100644 --- a/src/gallium/auxiliary/util/u_time.h +++ b/src/gallium/auxiliary/util/u_time.h @@ -38,7 +38,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include /* timeval */ #include /* usleep */ #endif @@ -58,7 +58,7 @@ extern "C" { */ struct util_time { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) struct timeval tv; #else int64_t counter; @@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start, const struct util_time *end, const struct util_time *curr); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #define util_time_sleep usleep #else void diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index d98cef221b..8757ac8bec 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -40,7 +40,7 @@ #include "pipe/p_config.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include #endif @@ -236,7 +236,7 @@ boolean trace_dump_trace_begin() trace_dump_writes("\n"); trace_dump_writes("\n"); -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) /* Linux applications rarely cleanup GL / Gallium resources so catch * application exit here */ atexit(trace_dump_trace_close); diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index 05cbd2fc4d..7f7657031d 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -111,6 +111,10 @@ #define PIPE_OS_LINUX #endif +#if defined(__FreeBSD__) +#define PIPE_OS_BSD +#endif + #if defined(_WIN32) || defined(WIN32) #define PIPE_OS_WINDOWS #endif @@ -122,9 +126,9 @@ * NOTE: There is no way to auto-detect most of these. */ -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #define PIPE_SUBSYSTEM_DRI -#endif /* PIPE_OS_LINUX */ +#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */ #if defined(PIPE_OS_WINDOWS) #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h index 8af3cd958b..e59b999b9a 100644 --- a/src/gallium/include/pipe/p_thread.h +++ b/src/gallium/include/pipe/p_thread.h @@ -38,7 +38,7 @@ #include "pipe/p_compiler.h" -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) #include /* POSIX threads headers */ #include /* for perror() */ @@ -210,7 +210,7 @@ typedef unsigned pipe_condvar; */ typedef struct { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) pthread_key_t key; #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) DWORD key; @@ -225,7 +225,7 @@ typedef struct { static INLINE void pipe_tsd_init(pipe_tsd *tsd) { -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { perror("pthread_key_create(): failed to allocate key for thread specific data"); exit(-1); @@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd) if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) { pipe_tsd_init(tsd); } -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) return pthread_getspecific(tsd->key); #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) assert(0); @@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value) if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) { pipe_tsd_init(tsd); } -#if defined(PIPE_OS_LINUX) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) if (pthread_setspecific(tsd->key, value) != 0) { perror("pthread_set_specific() failed"); exit(-1); -- cgit v1.2.3 From 501d6d49dd37597ef65dd8b62a8c7982e735143c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Feb 2009 07:58:17 -0700 Subject: egl: add comment/reminder to fix the CFLAGS in this Makefile --- src/gallium/state_trackers/egl/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile index d266ae2d62..537ca19cb2 100644 --- a/src/gallium/state_trackers/egl/Makefile +++ b/src/gallium/state_trackers/egl/Makefile @@ -6,6 +6,8 @@ TOP = ../../../.. include ${TOP}/configs/current +# XXX: We shouldn't be specifying special compiler flags here. +# Flags should come from the configuration file instead. CFLAGS:= -g -Wall -Werror-implicit-function-declaration -fPIC \ -I${GALLIUMDIR}/include \ -I${GALLIUMDIR}/auxiliary \ -- cgit v1.2.3 From c34c78b85381ced8bfa9f16faba9a5e9e6bf2a3a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Feb 2009 08:41:13 -0700 Subject: egl: use new EGL_LIB_DEPS to pass library dependencies to mklib when building libEGL EGL_LIB_DEPS may need fine-tuning for some platforms. It's only defined in configs/default ATM. --- src/egl/main/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index a543f675a5..5ee246dc3f 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -46,8 +46,6 @@ OBJECTS = $(SOURCES:.c=.o) # Undefined for now LOCAL_CFLAGS = -D_EGL_PLATFORM_X=1 -LIBS = -lX11 - .c.o: $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@ @@ -63,7 +61,8 @@ library: $(TOP)/$(LIB_DIR)/libEGL.so $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -dlopen $(OBJECTS) $(LIBS) + -install $(TOP)/$(LIB_DIR) \ + $(EGL_LIB_DEPS) $(OBJECTS) install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) -- cgit v1.2.3 From f2a5c6b42ce0272db10aff3fd476b1371912b0f4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Feb 2009 08:45:08 -0700 Subject: egl: remove compiler flags from CFLAGS The incoming CFLAGS already has -fPIC and -Wall. Don't want -g here either. --- src/gallium/state_trackers/egl/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile index 537ca19cb2..692a3c8b76 100644 --- a/src/gallium/state_trackers/egl/Makefile +++ b/src/gallium/state_trackers/egl/Makefile @@ -6,9 +6,7 @@ TOP = ../../../.. include ${TOP}/configs/current -# XXX: We shouldn't be specifying special compiler flags here. -# Flags should come from the configuration file instead. -CFLAGS:= -g -Wall -Werror-implicit-function-declaration -fPIC \ +CFLAGS := \ -I${GALLIUMDIR}/include \ -I${GALLIUMDIR}/auxiliary \ -I${TOP}/src/mesa/drivers/dri/common \ -- cgit v1.2.3 From 5726a5afa56e18b1662a8b03cf36c77e2d8b3114 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Fri, 20 Feb 2009 14:51:31 -0500 Subject: g3dvl: Update winsys stuff. --- src/gallium/winsys/g3dvl/xsp_winsys.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c index 40d683234f..acfb8ec4ea 100644 --- a/src/gallium/winsys/g3dvl/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xsp_winsys.c @@ -1,9 +1,10 @@ #include "vl_winsys.h" #include -#include +#include #include #include #include +#include #include /* pipe_winsys implementation */ @@ -96,12 +97,6 @@ static void xsp_buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buff free(xsp_buf); } -/* Borrowed from Mesa's xm_winsys */ -static unsigned int round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - static struct pipe_buffer* xsp_surface_buffer_create ( struct pipe_winsys *pws, @@ -119,11 +114,11 @@ static struct pipe_buffer* xsp_surface_buffer_create pf_get_block(format, &block); nblocksx = pf_get_nblocksx(&block, width); nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, ALIGNMENT); + *stride = align(nblocksx * block.size, ALIGNMENT); - return winsys->buffer_create(winsys, ALIGNMENT, - usage, - *stride * nblocksy); + 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) -- cgit v1.2.3 From a0dc286b5fecec1ede014cb5702368a60cbb22bc Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Wed, 25 Feb 2009 12:55:26 -0500 Subject: nouveau: nv04-nv40 texture transfer. --- src/gallium/drivers/nv04/Makefile | 1 + src/gallium/drivers/nv04/nv04_miptree.c | 47 +++---- src/gallium/drivers/nv04/nv04_screen.c | 26 +--- src/gallium/drivers/nv04/nv04_screen.h | 3 + src/gallium/drivers/nv04/nv04_state.h | 3 - src/gallium/drivers/nv04/nv04_state_emit.c | 17 ++- src/gallium/drivers/nv04/nv04_surface_2d.c | 43 +++--- src/gallium/drivers/nv04/nv04_surface_2d.h | 5 + src/gallium/drivers/nv04/nv04_transfer.c | 201 +++++++++++++++++++++++++++++ src/gallium/drivers/nv10/Makefile | 1 + src/gallium/drivers/nv10/nv10_miptree.c | 33 ++--- src/gallium/drivers/nv10/nv10_screen.c | 28 +--- src/gallium/drivers/nv10/nv10_screen.h | 4 + src/gallium/drivers/nv10/nv10_state_emit.c | 14 +- src/gallium/drivers/nv10/nv10_transfer.c | 201 +++++++++++++++++++++++++++++ src/gallium/drivers/nv20/Makefile | 1 + src/gallium/drivers/nv20/nv20_miptree.c | 69 ++++++---- src/gallium/drivers/nv20/nv20_screen.c | 28 +--- src/gallium/drivers/nv20/nv20_screen.h | 4 + src/gallium/drivers/nv20/nv20_state_emit.c | 14 +- src/gallium/drivers/nv20/nv20_transfer.c | 201 +++++++++++++++++++++++++++++ src/gallium/drivers/nv30/Makefile | 1 + src/gallium/drivers/nv30/nv30_miptree.c | 56 ++++---- src/gallium/drivers/nv30/nv30_screen.c | 80 +----------- src/gallium/drivers/nv30/nv30_screen.h | 3 + src/gallium/drivers/nv30/nv30_state.h | 3 - src/gallium/drivers/nv30/nv30_state_fb.c | 28 ++-- src/gallium/drivers/nv30/nv30_transfer.c | 201 +++++++++++++++++++++++++++++ src/gallium/drivers/nv40/Makefile | 1 + src/gallium/drivers/nv40/nv40_miptree.c | 47 +++---- src/gallium/drivers/nv40/nv40_screen.c | 83 +----------- src/gallium/drivers/nv40/nv40_screen.h | 3 + src/gallium/drivers/nv40/nv40_state.h | 3 - src/gallium/drivers/nv40/nv40_state_fb.c | 40 +++--- src/gallium/drivers/nv40/nv40_transfer.c | 201 +++++++++++++++++++++++++++++ 35 files changed, 1242 insertions(+), 452 deletions(-) create mode 100644 src/gallium/drivers/nv04/nv04_transfer.c create mode 100644 src/gallium/drivers/nv10/nv10_transfer.c create mode 100644 src/gallium/drivers/nv20/nv20_transfer.c create mode 100644 src/gallium/drivers/nv30/nv30_transfer.c create mode 100644 src/gallium/drivers/nv40/nv40_transfer.c (limited to 'src') diff --git a/src/gallium/drivers/nv04/Makefile b/src/gallium/drivers/nv04/Makefile index cf9deea851..7c14bacb1d 100644 --- a/src/gallium/drivers/nv04/Makefile +++ b/src/gallium/drivers/nv04/Makefile @@ -15,6 +15,7 @@ C_SOURCES = \ nv04_state.c \ nv04_state_emit.c \ nv04_surface.c \ + nv04_transfer.c \ nv04_vbo.c include ../../Makefile.template diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c index 993c5ef5dd..9acd613e2e 100644 --- a/src/gallium/drivers/nv04/nv04_miptree.c +++ b/src/gallium/drivers/nv04/nv04_miptree.c @@ -50,8 +50,6 @@ nv04_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) mt->base = *pt; mt->base.refcount = 1; mt->base.screen = pscreen; - mt->shadow_tex = NULL; - mt->shadow_surface = NULL; //mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; @@ -111,12 +109,6 @@ nv04_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt) FREE(mt->level[l].image_offset); } - if (mt->shadow_tex) { - assert(mt->shadow_surface); - pscreen->tex_surface_release(pscreen, &mt->shadow_surface); - nv04_miptree_release(pscreen, &mt->shadow_tex); - } - FREE(mt); } @@ -126,29 +118,26 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, unsigned flags) { struct nv04_miptree *nv04mt = (struct nv04_miptree *)pt; - struct pipe_surface *ps; + struct nv04_surface *ns; - ps = CALLOC_STRUCT(pipe_surface); - if (!ps) + ns = CALLOC_STRUCT(nv04_surface); + if (!ns) return NULL; - 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 = nv04mt->level[level].pitch; - ps->usage = flags; - ps->status = PIPE_SURFACE_STATUS_DEFINED; - ps->refcount = 1; - ps->face = face; - ps->level = level; - ps->zslice = zslice; - - ps->offset = nv04mt->level[level].image_offset; - - return ps; + 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.usage = flags; + ns->base.status = PIPE_SURFACE_STATUS_DEFINED; + ns->base.refcount = 1; + ns->base.face = face; + ns->base.level = level; + ns->base.zslice = zslice; + ns->pitch = nv04mt->level[level].pitch; + + ns->base.offset = nv04mt->level[level].image_offset; + + return &ns->base; } static void diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c index 9ef38bc244..f9f6d97426 100644 --- a/src/gallium/drivers/nv04/nv04_screen.c +++ b/src/gallium/drivers/nv04/nv04_screen.c @@ -119,28 +119,6 @@ nv04_screen_is_format_supported(struct pipe_screen *screen, return FALSE; } -static void * -nv04_surface_map(struct pipe_screen *screen, struct pipe_surface *surface, - unsigned flags ) -{ - void *map; - struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture; - - map = pipe_buffer_map(screen, nv04mt->buffer, flags); - if (!map) - return NULL; - - return map + surface->offset; -} - -static void -nv04_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface) -{ - struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture; - - pipe_buffer_unmap(screen, nv04mt->buffer); -} - static void nv04_screen_destroy(struct pipe_screen *pscreen) { @@ -226,10 +204,8 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) screen->pipe.is_format_supported = nv04_screen_is_format_supported; - screen->pipe.surface_map = nv04_surface_map; - screen->pipe.surface_unmap = nv04_surface_unmap; - nv04_screen_init_miptree_functions(&screen->pipe); + nv04_screen_init_transfer_functions(&screen->pipe); u_simple_screen_init(&screen->pipe); return &screen->pipe; diff --git a/src/gallium/drivers/nv04/nv04_screen.h b/src/gallium/drivers/nv04/nv04_screen.h index 540aec907b..ee6fb6db44 100644 --- a/src/gallium/drivers/nv04/nv04_screen.h +++ b/src/gallium/drivers/nv04/nv04_screen.h @@ -24,4 +24,7 @@ nv04_screen(struct pipe_screen *screen) return (struct nv04_screen *)screen; } +void +nv04_screen_init_transfer_functions(struct pipe_screen *pscreen); + #endif diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h index 15d4685ec1..0d51439e3f 100644 --- a/src/gallium/drivers/nv04/nv04_state.h +++ b/src/gallium/drivers/nv04/nv04_state.h @@ -35,9 +35,6 @@ struct nv04_miptree { struct pipe_buffer *buffer; uint total_size; - struct pipe_texture *shadow_tex; - struct pipe_surface *shadow_surface; - struct { uint pitch; uint image_offset; diff --git a/src/gallium/drivers/nv04/nv04_state_emit.c b/src/gallium/drivers/nv04/nv04_state_emit.c index bd8ef1adbf..eb2c1c57c6 100644 --- a/src/gallium/drivers/nv04/nv04_state_emit.c +++ b/src/gallium/drivers/nv04/nv04_state_emit.c @@ -93,7 +93,7 @@ static void nv04_emit_sampler(struct nv04_context *nv04, int unit) static void nv04_state_emit_framebuffer(struct nv04_context* nv04) { struct pipe_framebuffer_state* fb = nv04->framebuffer; - struct pipe_surface *rt, *zeta; + struct nv04_surface *rt, *zeta; uint32_t rt_format, w, h; int colour_format = 0, zeta_format = 0; struct nv04_miptree *nv04mt = 0; @@ -101,7 +101,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04) w = fb->cbufs[0]->width; h = fb->cbufs[0]->height; colour_format = fb->cbufs[0]->format; - rt = fb->cbufs[0]; + rt = (struct nv04_surface *)fb->cbufs[0]; if (fb->zsbuf) { if (colour_format) { @@ -113,7 +113,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04) } zeta_format = fb->zsbuf->format; - zeta = fb->zsbuf; + zeta = (struct nv04_surface *)fb->zsbuf; } switch (colour_format) { @@ -131,13 +131,13 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04) BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_FORMAT, 1); OUT_RING(rt_format); - nv04mt = (struct nv04_miptree *)rt->texture; + nv04mt = (struct nv04_miptree *)rt->base.texture; /* FIXME pitches have to be aligned ! */ BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2); - OUT_RING(rt->stride|(zeta->stride<<16)); + OUT_RING(rt->pitch|(zeta->pitch<<16)); OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); if (fb->zsbuf) { - nv04mt = (struct nv04_miptree *)zeta->texture; + nv04mt = (struct nv04_miptree *)zeta->base.texture; BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1); OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); } @@ -202,8 +202,11 @@ nv04_emit_hw_state(struct nv04_context *nv04) */ /* Render target */ + unsigned rt_pitch = ((struct nv04_surface *)nv04->rt)->pitch; + unsigned zeta_pitch = ((struct nv04_surface *)nv04->zeta)->pitch; + BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2); - OUT_RING(nv04->rt->stride|(nv04->zeta->stride<<16)); + OUT_RING(rt_pitch|(zeta_pitch<<16)); OUT_RELOCl(nv04->rt, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); if (nv04->zeta) { BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1); diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index 230cfd17dd..e8fd3166ab 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -101,6 +101,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, struct nouveau_grobj *sifm = ctx->sifm; struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src)); struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + const unsigned src_pitch = ((struct nv04_surface *)src)->pitch; const unsigned max_w = 1024; const unsigned max_h = 1024; const unsigned sub_w = w > max_w ? max_w : w; @@ -110,6 +111,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, /* POT or GTFO */ assert(!(w & (w - 1)) && !(h & (h - 1))); + /* That's the way she likes it */ + assert(src_pitch == ((struct nv04_surface *)dst)->pitch); BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1); OUT_RELOCo(chan, dst_bo, @@ -130,7 +133,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, for (cx = 0; cx < w; cx += sub_w) { BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(cx, cy) * - dst->block.size, NOUVEAU_BO_GART | + 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); @@ -146,11 +149,11 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SIZE, 4); OUT_RING (chan, sub_h << 16 | sub_w); - OUT_RING (chan, src->stride | + 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 * src->stride + - cx * src->block.size, NOUVEAU_BO_GART | + OUT_RELOCl(chan, src_bo, src->offset + cy * src_pitch + + cx * src->texture->block.size, NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); OUT_RING (chan, 0); } @@ -168,10 +171,12 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, struct nouveau_grobj *m2mf = ctx->m2mf; struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src)); struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); - unsigned dst_offset, src_offset; - - dst_offset = dst->offset + (dy * dst->stride) + (dx * dst->block.size); - src_offset = src->offset + (sy * src->stride) + (sx * src->block.size); + 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; + unsigned src_offset = src->offset + sy * src_pitch + + sx * src->texture->block.size; WAIT_RING (chan, 3 + ((h / 2047) + 1) * 9); BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2); @@ -188,16 +193,16 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, 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->stride); - OUT_RING (chan, dst->stride); - OUT_RING (chan, w * src->block.size); + OUT_RING (chan, src_pitch); + OUT_RING (chan, dst_pitch); + OUT_RING (chan, w * src->texture->block.size); OUT_RING (chan, count); OUT_RING (chan, 0x0101); OUT_RING (chan, 0); h -= count; - src_offset += src->stride * count; - dst_offset += dst->stride * count; + src_offset += src_pitch * count; + dst_offset += dst_pitch * count; } return 0; @@ -213,6 +218,8 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst, struct nouveau_grobj *blit = ctx->blit; struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src)); struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + unsigned src_pitch = ((struct nv04_surface *)src)->pitch; + unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; int format; format = nv04_surface_format(dst->format); @@ -225,7 +232,7 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst, OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4); OUT_RING (chan, format); - OUT_RING (chan, (dst->stride << 16) | src->stride); + OUT_RING (chan, (dst_pitch << 16) | src_pitch); OUT_RELOCl(chan, src_bo, src->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); @@ -242,6 +249,8 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst, int dx, int dy, struct pipe_surface *src, int sx, int sy, int w, int h) { + unsigned src_pitch = ((struct nv04_surface *)src)->pitch; + unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; int src_linear = src->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR; int dst_linear = dst->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR; @@ -257,7 +266,8 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst, * to NV_MEMORY_TO_MEMORY_FORMAT in this case. */ if ((src->offset & 63) || (dst->offset & 63) || - (src->stride & 63) || (dst->stride & 63)) { + (src_pitch & 63) || (dst_pitch & 63) || + debug_get_bool_option("NOUVEAU_NO_COPYBLIT", FALSE)) { nv04_surface_copy_m2mf(ctx, dst, dx, dy, src, sx, sy, w, h); return; } @@ -273,6 +283,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst, struct nouveau_grobj *surf2d = ctx->surf2d; struct nouveau_grobj *rect = ctx->rect; struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; int cs2d_format, gdirect_format; cs2d_format = nv04_surface_format(dst->format); @@ -287,7 +298,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst, OUT_RELOCo(chan, dst_bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4); OUT_RING (chan, cs2d_format); - OUT_RING (chan, (dst->stride << 16) | dst->stride); + OUT_RING (chan, (dst_pitch << 16) | dst_pitch); OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); OUT_RELOCl(chan, dst_bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.h b/src/gallium/drivers/nv04/nv04_surface_2d.h index 21b8f86960..82ce7189c8 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.h +++ b/src/gallium/drivers/nv04/nv04_surface_2d.h @@ -1,6 +1,11 @@ #ifndef __NV04_SURFACE_2D_H__ #define __NV04_SURFACE_2D_H__ +struct nv04_surface { + struct pipe_surface base; + unsigned pitch; +}; + struct nv04_surface_2d { struct nouveau_winsys *nvws; struct nouveau_notifier *ntfy; diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c new file mode 100644 index 0000000000..314d2045f7 --- /dev/null +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -0,0 +1,201 @@ +#include +#include +#include +#include +#include +#include "nv04_context.h" +#include "nv04_screen.h" +#include "nv04_state.h" + +struct nv04_transfer { + struct pipe_transfer base; + struct pipe_surface *surface; + 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) +{ + 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->block = pt->block; + template->nblocksx[0] = pt->nblocksx[level]; + template->nblocksy[0] = pt->nblocksx[level]; + template->last_level = 0; + template->compressed = pt->compressed; + template->nr_samples = pt->nr_samples; + + template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | + NOUVEAU_TEXTURE_USAGE_LINEAR; +} + +static struct pipe_transfer * +nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + struct nv04_miptree *mt = (struct nv04_miptree *)pt; + struct nv04_transfer *tx; + struct pipe_texture tx_tex_template, *tx_tex; + + tx = CALLOC_STRUCT(nv04_transfer); + if (!tx) + return NULL; + + tx->base.refcount = 1; + 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; + tx->base.level = level; + tx->base.zslice = zslice; + + /* Direct access to texture */ + if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || + debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) && + pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) + { + tx->direct = true; + tx->surface = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + nv04_usage_tx_to_buf(usage)); + return &tx->base; + } + + tx->direct = false; + + nv04_compatible_transfer_tex(pt, level, &tx_tex_template); + + tx_tex = pscreen->texture_create(pscreen, &tx_tex_template); + if (!tx_tex) + { + FREE(tx); + return NULL; + } + + tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, + face, level, zslice, + nv04_usage_tx_to_buf(usage)); + + pipe_texture_reference(&tx_tex, NULL); + + if (!tx->surface) + { + pipe_surface_reference(&tx->surface, NULL); + FREE(tx); + return NULL; + } + + if (usage != PIPE_TRANSFER_WRITE) { + struct nv04_screen *nvscreen = nv04_screen(pscreen); + struct pipe_surface *src; + + src = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + PIPE_BUFFER_USAGE_GPU_READ); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + /* TODO: Check if SIFM can un-swizzle */ + nvscreen->eng2d->copy(nvscreen->eng2d, + tx->surface, 0, 0, + src, 0, 0, + src->width, src->height); + + pipe_surface_reference(&src, NULL); + } + + return &tx->base; +} + +static void +nv04_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx) +{ + struct pipe_transfer *ptx = *pptx; + struct nv04_transfer *tx = (struct nv04_transfer *)ptx; + + if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + struct nv04_screen *nvscreen = nv04_screen(pscreen); + struct pipe_surface *dst; + + dst = pscreen->get_tex_surface(pscreen, ptx->texture, + ptx->face, ptx->level, ptx->zslice, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + nvscreen->eng2d->copy(nvscreen->eng2d, + dst, 0, 0, + tx->surface, 0, 0, + dst->width, dst->height); + + pipe_surface_reference(&dst, NULL); + } + + *pptx = NULL; + if (--ptx->refcount) + return; + + pipe_surface_reference(&tx->surface, NULL); + pipe_texture_reference(&ptx->texture, NULL); + FREE(ptx); +} + +static void * +nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv04_transfer *tx = (struct nv04_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)); + + return map + ns->base.offset + + ptx->y * ns->pitch + ptx->x * ptx->block.size; +} + +static void +nv04_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv04_transfer *tx = (struct nv04_transfer *)ptx; + struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture; + + pipe_buffer_unmap(pscreen, mt->buffer); +} + +void +nv04_screen_init_transfer_functions(struct pipe_screen *pscreen) +{ + pscreen->get_tex_transfer = nv04_transfer_new; + pscreen->tex_transfer_release = nv04_transfer_del; + pscreen->transfer_map = nv04_transfer_map; + pscreen->transfer_unmap = nv04_transfer_unmap; +} diff --git a/src/gallium/drivers/nv10/Makefile b/src/gallium/drivers/nv10/Makefile index 2b5fbd4f5a..62677f5194 100644 --- a/src/gallium/drivers/nv10/Makefile +++ b/src/gallium/drivers/nv10/Makefile @@ -14,6 +14,7 @@ C_SOURCES = \ nv10_state.c \ nv10_state_emit.c \ nv10_surface.c \ + nv10_transfer.c \ nv10_vbo.c include ../../Makefile.template diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index 9616135461..4747868a50 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -131,30 +131,31 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, unsigned flags) { - struct pipe_winsys *ws = screen->winsys; struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt; - struct pipe_surface *ps; + struct nv04_surface *ns; - ps = CALLOC_STRUCT(pipe_surface); - if (!ps) + ns = CALLOC_STRUCT(nv04_surface); + if (!ns) return NULL; - 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 = nv10mt->level[level].pitch; - ps->refcount = 1; + 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.usage = flags; + ns->base.status = PIPE_SURFACE_STATUS_DEFINED; + ns->base.refcount = 1; + ns->base.face = face; + ns->base.level = level; + ns->base.zslice = zslice; + ns->pitch = nv10mt->level[level].pitch; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset = nv10mt->level[level].image_offset[face]; + ns->base.offset = nv10mt->level[level].image_offset[face]; } else { - ps->offset = nv10mt->level[level].image_offset[0]; + ns->base.offset = nv10mt->level[level].image_offset[0]; } - return ps; + return &ns->base; } static void diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c index f417b06c94..6532a93c7b 100644 --- a/src/gallium/drivers/nv10/nv10_screen.c +++ b/src/gallium/drivers/nv10/nv10_screen.c @@ -116,30 +116,6 @@ nv10_screen_is_format_supported(struct pipe_screen *screen, return FALSE; } -static void * -nv10_surface_map(struct pipe_screen *screen, struct pipe_surface *surface, - unsigned flags ) -{ - struct pipe_winsys *ws = screen->winsys; - void *map; - struct nv10_miptree *nv10mt = (struct nv10_miptree *)surface->texture; - - map = ws->buffer_map(ws, nv10mt->buffer, flags); - if (!map) - return NULL; - - return map + surface->offset; -} - -static void -nv10_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface) -{ - struct pipe_winsys *ws = screen->winsys; - struct nv10_miptree *nv10mt = (struct nv10_miptree *)surface->texture; - - ws->buffer_unmap(ws, nv10mt->buffer); -} - static void nv10_screen_destroy(struct pipe_screen *pscreen) { @@ -215,10 +191,8 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) screen->pipe.is_format_supported = nv10_screen_is_format_supported; - screen->pipe.surface_map = nv10_surface_map; - screen->pipe.surface_unmap = nv10_surface_unmap; - nv10_screen_init_miptree_functions(&screen->pipe); + nv10_screen_init_transfer_functions(&screen->pipe); u_simple_screen_init(&screen->pipe); return &screen->pipe; diff --git a/src/gallium/drivers/nv10/nv10_screen.h b/src/gallium/drivers/nv10/nv10_screen.h index 60102a369a..ad829ee3fd 100644 --- a/src/gallium/drivers/nv10/nv10_screen.h +++ b/src/gallium/drivers/nv10/nv10_screen.h @@ -21,4 +21,8 @@ nv10_screen(struct pipe_screen *screen) return (struct nv10_screen *)screen; } + +void +nv10_screen_init_transfer_functions(struct pipe_screen *pscreen); + #endif diff --git a/src/gallium/drivers/nv10/nv10_state_emit.c b/src/gallium/drivers/nv10/nv10_state_emit.c index 5dec618b93..d8691ef9c6 100644 --- a/src/gallium/drivers/nv10/nv10_state_emit.c +++ b/src/gallium/drivers/nv10/nv10_state_emit.c @@ -103,7 +103,7 @@ static void nv10_state_emit_scissor(struct nv10_context* nv10) static void nv10_state_emit_framebuffer(struct nv10_context* nv10) { struct pipe_framebuffer_state* fb = nv10->framebuffer; - struct pipe_surface *rt, *zeta = NULL; + struct nv04_surface *rt, *zeta = NULL; uint32_t rt_format, w, h; int colour_format = 0, zeta_format = 0; struct nv10_miptree *nv10mt = 0; @@ -111,7 +111,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10) w = fb->cbufs[0]->width; h = fb->cbufs[0]->height; colour_format = fb->cbufs[0]->format; - rt = fb->cbufs[0]; + rt = (struct nv04_surface *)fb->cbufs[0]; if (fb->zsbuf) { if (colour_format) { @@ -123,7 +123,7 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10) } zeta_format = fb->zsbuf->format; - zeta = fb->zsbuf; + zeta = (struct nv04_surface *)fb->zsbuf; } rt_format = NV10TCL_RT_FORMAT_TYPE_LINEAR; @@ -142,18 +142,18 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10) if (zeta) { BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1); - OUT_RING (rt->stride | (zeta->stride << 16)); + OUT_RING (rt->pitch | (zeta->pitch << 16)); } else { BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1); - OUT_RING (rt->stride | (rt->stride << 16)); + OUT_RING (rt->pitch | (rt->pitch << 16)); } - nv10mt = (struct nv10_miptree *)rt->texture; + nv10mt = (struct nv10_miptree *)rt->base.texture; nv10->rt[0] = nv10mt->buffer; if (zeta_format) { - nv10mt = (struct nv10_miptree *)zeta->texture; + nv10mt = (struct nv10_miptree *)zeta->base.texture; nv10->zeta = nv10mt->buffer; } diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c new file mode 100644 index 0000000000..967e2cc20c --- /dev/null +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -0,0 +1,201 @@ +#include +#include +#include +#include +#include +#include "nv10_context.h" +#include "nv10_screen.h" +#include "nv10_state.h" + +struct nv10_transfer { + struct pipe_transfer base; + struct pipe_surface *surface; + 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) +{ + 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->block = pt->block; + template->nblocksx[0] = pt->nblocksx[level]; + template->nblocksy[0] = pt->nblocksx[level]; + template->last_level = 0; + template->compressed = pt->compressed; + template->nr_samples = pt->nr_samples; + + template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | + NOUVEAU_TEXTURE_USAGE_LINEAR; +} + +static struct pipe_transfer * +nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + struct nv10_miptree *mt = (struct nv10_miptree *)pt; + struct nv10_transfer *tx; + struct pipe_texture tx_tex_template, *tx_tex; + + tx = CALLOC_STRUCT(nv10_transfer); + if (!tx) + return NULL; + + tx->base.refcount = 1; + 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; + tx->base.level = level; + tx->base.zslice = zslice; + + /* Direct access to texture */ + if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || + debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) && + pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) + { + tx->direct = true; + tx->surface = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + nv10_usage_tx_to_buf(usage)); + return &tx->base; + } + + tx->direct = false; + + nv10_compatible_transfer_tex(pt, level, &tx_tex_template); + + tx_tex = pscreen->texture_create(pscreen, &tx_tex_template); + if (!tx_tex) + { + FREE(tx); + return NULL; + } + + tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, + face, level, zslice, + nv10_usage_tx_to_buf(usage)); + + pipe_texture_reference(&tx_tex, NULL); + + if (!tx->surface) + { + pipe_surface_reference(&tx->surface, NULL); + FREE(tx); + return NULL; + } + + if (usage != PIPE_TRANSFER_WRITE) { + struct nv10_screen *nvscreen = nv10_screen(pscreen); + struct pipe_surface *src; + + src = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + PIPE_BUFFER_USAGE_GPU_READ); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + /* TODO: Check if SIFM can un-swizzle */ + nvscreen->eng2d->copy(nvscreen->eng2d, + tx->surface, 0, 0, + src, 0, 0, + src->width, src->height); + + pipe_surface_reference(&src, NULL); + } + + return &tx->base; +} + +static void +nv10_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx) +{ + struct pipe_transfer *ptx = *pptx; + struct nv10_transfer *tx = (struct nv10_transfer *)ptx; + + if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + struct nv10_screen *nvscreen = nv10_screen(pscreen); + struct pipe_surface *dst; + + dst = pscreen->get_tex_surface(pscreen, ptx->texture, + ptx->face, ptx->level, ptx->zslice, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + nvscreen->eng2d->copy(nvscreen->eng2d, + dst, 0, 0, + tx->surface, 0, 0, + dst->width, dst->height); + + pipe_surface_reference(&dst, NULL); + } + + *pptx = NULL; + if (--ptx->refcount) + return; + + pipe_surface_reference(&tx->surface, NULL); + pipe_texture_reference(&ptx->texture, NULL); + FREE(ptx); +} + +static void * +nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv10_transfer *tx = (struct nv10_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)); + + return map + ns->base.offset + + ptx->y * ns->pitch + ptx->x * ptx->block.size; +} + +static void +nv10_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv10_transfer *tx = (struct nv10_transfer *)ptx; + struct nv10_miptree *mt = (struct nv10_miptree *)tx->surface->texture; + + pipe_buffer_unmap(pscreen, mt->buffer); +} + +void +nv10_screen_init_transfer_functions(struct pipe_screen *pscreen) +{ + pscreen->get_tex_transfer = nv10_transfer_new; + pscreen->tex_transfer_release = nv10_transfer_del; + pscreen->transfer_map = nv10_transfer_map; + pscreen->transfer_unmap = nv10_transfer_unmap; +} diff --git a/src/gallium/drivers/nv20/Makefile b/src/gallium/drivers/nv20/Makefile index 93e34f8e92..1305f26c59 100644 --- a/src/gallium/drivers/nv20/Makefile +++ b/src/gallium/drivers/nv20/Makefile @@ -14,6 +14,7 @@ C_SOURCES = \ nv20_state.c \ nv20_state_emit.c \ nv20_surface.c \ + nv20_transfer.c \ nv20_vbo.c # nv20_vertprog.c diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c index ef7e9c5428..2946240897 100644 --- a/src/gallium/drivers/nv20/nv20_miptree.c +++ b/src/gallium/drivers/nv20/nv20_miptree.c @@ -9,10 +9,14 @@ static void nv20_miptree_layout(struct nv20_miptree *nv20mt) { struct pipe_texture *pt = &nv20mt->base; - boolean swizzled = FALSE; uint width = pt->width[0], height = pt->height[0]; uint offset = 0; int nr_faces, l, f; + uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | + PIPE_TEXTURE_USAGE_DEPTH_STENCIL | + PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DISPLAY_TARGET | + PIPE_TEXTURE_USAGE_PRIMARY); if (pt->target == PIPE_TEXTURE_CUBE) { nr_faces = 6; @@ -26,25 +30,31 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt) pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - if (swizzled) - nv20mt->level[l].pitch = pt->nblocksx[l] * pt->block.size; + if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) + nv20mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64); else - nv20mt->level[l].pitch = pt->nblocksx[0] * pt->block.size; - nv20mt->level[l].pitch = (nv20mt->level[l].pitch + 63) & ~63; + nv20mt->level[l].pitch = pt->width[l] * pt->block.size; nv20mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); width = MAX2(1, width >> 1); height = MAX2(1, height >> 1); - } for (f = 0; f < nr_faces; f++) { - for (l = 0; l <= pt->last_level; l++) { + for (l = 0; l < pt->last_level; l++) { nv20mt->level[l].image_offset[f] = offset; - offset += nv20mt->level[l].pitch * pt->height[l]; + + 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); + else + offset += nv20mt->level[l].pitch * pt->height[l]; } + + nv20mt->level[l].image_offset[f] = offset; + offset += nv20mt->level[l].pitch * pt->height[l]; } nv20mt->total_size = offset; @@ -96,7 +106,8 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; else if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY | - PIPE_TEXTURE_USAGE_DISPLAY_TARGET)) + PIPE_TEXTURE_USAGE_DISPLAY_TARGET | + PIPE_TEXTURE_USAGE_DEPTH_STENCIL)) mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; else if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC) @@ -107,7 +118,11 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_R16_SNORM: + { + if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE)) + mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; break; + } default: mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; } @@ -152,33 +167,33 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, unsigned flags) { struct nv20_miptree *nv20mt = (struct nv20_miptree *)pt; - struct pipe_surface *ps; + struct nv04_surface *ns; - ps = CALLOC_STRUCT(pipe_surface); - if (!ps) + ns = CALLOC_STRUCT(nv04_surface); + if (!ns) return NULL; - 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 = nv20mt->level[level].pitch; - ps->usage = flags; - ps->status = PIPE_SURFACE_STATUS_DEFINED; - ps->refcount = 1; + 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.usage = flags; + ns->base.status = PIPE_SURFACE_STATUS_DEFINED; + ns->base.refcount = 1; + ns->base.face = face; + ns->base.level = level; + ns->base.zslice = zslice; + ns->pitch = nv20mt->level[level].pitch; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset = nv20mt->level[level].image_offset[face]; + ns->base.offset = nv20mt->level[level].image_offset[face]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset = nv20mt->level[level].image_offset[zslice]; + ns->base.offset = nv20mt->level[level].image_offset[zslice]; } else { - ps->offset = nv20mt->level[level].image_offset[0]; + ns->base.offset = nv20mt->level[level].image_offset[0]; } - return ps; + return &ns->base; } static void diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c index 5f2b7b4f71..7760ae27c0 100644 --- a/src/gallium/drivers/nv20/nv20_screen.c +++ b/src/gallium/drivers/nv20/nv20_screen.c @@ -116,30 +116,6 @@ nv20_screen_is_format_supported(struct pipe_screen *screen, return FALSE; } -static void * -nv20_surface_map(struct pipe_screen *screen, struct pipe_surface *surface, - unsigned flags ) -{ - struct pipe_winsys *ws = screen->winsys; - void *map; - struct nv20_miptree *nv20mt = (struct nv20_miptree *)surface->texture; - - map = ws->buffer_map(ws, nv20mt->buffer, flags); - if (!map) - return NULL; - - return map + surface->offset; -} - -static void -nv20_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface) -{ - struct pipe_winsys *ws = screen->winsys; - struct nv20_miptree *nv20mt = (struct nv20_miptree *)surface->texture; - - ws->buffer_unmap(ws, nv20mt->buffer); -} - static void nv20_screen_destroy(struct pipe_screen *pscreen) { @@ -211,10 +187,8 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) screen->pipe.is_format_supported = nv20_screen_is_format_supported; - screen->pipe.surface_map = nv20_surface_map; - screen->pipe.surface_unmap = nv20_surface_unmap; - nv20_screen_init_miptree_functions(&screen->pipe); + nv20_screen_init_transfer_functions(&screen->pipe); u_simple_screen_init(&screen->pipe); return &screen->pipe; diff --git a/src/gallium/drivers/nv20/nv20_screen.h b/src/gallium/drivers/nv20/nv20_screen.h index bf2f2c0d9f..d9fce2bced 100644 --- a/src/gallium/drivers/nv20/nv20_screen.h +++ b/src/gallium/drivers/nv20/nv20_screen.h @@ -21,4 +21,8 @@ nv20_screen(struct pipe_screen *screen) return (struct nv20_screen *)screen; } + +void +nv20_screen_init_transfer_functions(struct pipe_screen *pscreen); + #endif diff --git a/src/gallium/drivers/nv20/nv20_state_emit.c b/src/gallium/drivers/nv20/nv20_state_emit.c index 0f4df9ca31..4042f46d05 100644 --- a/src/gallium/drivers/nv20/nv20_state_emit.c +++ b/src/gallium/drivers/nv20/nv20_state_emit.c @@ -109,7 +109,7 @@ static void nv20_state_emit_scissor(struct nv20_context* nv20) static void nv20_state_emit_framebuffer(struct nv20_context* nv20) { struct pipe_framebuffer_state* fb = nv20->framebuffer; - struct pipe_surface *rt, *zeta = NULL; + struct nv04_surface *rt, *zeta = NULL; uint32_t rt_format, w, h; int colour_format = 0, zeta_format = 0; struct nv20_miptree *nv20mt = 0; @@ -117,7 +117,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20) w = fb->cbufs[0]->width; h = fb->cbufs[0]->height; colour_format = fb->cbufs[0]->format; - rt = fb->cbufs[0]; + rt = (struct nv04_surface *)fb->cbufs[0]; if (fb->zsbuf) { if (colour_format) { @@ -129,7 +129,7 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20) } zeta_format = fb->zsbuf->format; - zeta = fb->zsbuf; + zeta = (struct nv04_surface *)fb->zsbuf; } rt_format = NV20TCL_RT_FORMAT_TYPE_LINEAR | 0x20; @@ -148,18 +148,18 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20) if (zeta) { BEGIN_RING(kelvin, NV20TCL_RT_PITCH, 1); - OUT_RING (rt->stride | (zeta->stride << 16)); + OUT_RING (rt->pitch | (zeta->pitch << 16)); } else { BEGIN_RING(kelvin, NV20TCL_RT_PITCH, 1); - OUT_RING (rt->stride | (rt->stride << 16)); + OUT_RING (rt->pitch | (rt->pitch << 16)); } - nv20mt = (struct nv20_miptree *)rt->texture; + nv20mt = (struct nv20_miptree *)rt->base.texture; nv20->rt[0] = nv20mt->buffer; if (zeta_format) { - nv20mt = (struct nv20_miptree *)zeta->texture; + nv20mt = (struct nv20_miptree *)zeta->base.texture; nv20->zeta = nv20mt->buffer; } diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c new file mode 100644 index 0000000000..19de09486d --- /dev/null +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -0,0 +1,201 @@ +#include +#include +#include +#include +#include +#include "nv20_context.h" +#include "nv20_screen.h" +#include "nv20_state.h" + +struct nv20_transfer { + struct pipe_transfer base; + struct pipe_surface *surface; + 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) +{ + 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->block = pt->block; + template->nblocksx[0] = pt->nblocksx[level]; + template->nblocksy[0] = pt->nblocksx[level]; + template->last_level = 0; + template->compressed = pt->compressed; + template->nr_samples = pt->nr_samples; + + template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | + NOUVEAU_TEXTURE_USAGE_LINEAR; +} + +static struct pipe_transfer * +nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + struct nv20_miptree *mt = (struct nv20_miptree *)pt; + struct nv20_transfer *tx; + struct pipe_texture tx_tex_template, *tx_tex; + + tx = CALLOC_STRUCT(nv20_transfer); + if (!tx) + return NULL; + + tx->base.refcount = 1; + 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; + tx->base.level = level; + tx->base.zslice = zslice; + + /* Direct access to texture */ + if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || + debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) && + pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) + { + tx->direct = true; + tx->surface = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + nv20_usage_tx_to_buf(usage)); + return &tx->base; + } + + tx->direct = false; + + nv20_compatible_transfer_tex(pt, level, &tx_tex_template); + + tx_tex = pscreen->texture_create(pscreen, &tx_tex_template); + if (!tx_tex) + { + FREE(tx); + return NULL; + } + + tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, + face, level, zslice, + nv20_usage_tx_to_buf(usage)); + + pipe_texture_reference(&tx_tex, NULL); + + if (!tx->surface) + { + pipe_surface_reference(&tx->surface, NULL); + FREE(tx); + return NULL; + } + + if (usage != PIPE_TRANSFER_WRITE) { + struct nv20_screen *nvscreen = nv20_screen(pscreen); + struct pipe_surface *src; + + src = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + PIPE_BUFFER_USAGE_GPU_READ); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + /* TODO: Check if SIFM can un-swizzle */ + nvscreen->eng2d->copy(nvscreen->eng2d, + tx->surface, 0, 0, + src, 0, 0, + src->width, src->height); + + pipe_surface_reference(&src, NULL); + } + + return &tx->base; +} + +static void +nv20_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx) +{ + struct pipe_transfer *ptx = *pptx; + struct nv20_transfer *tx = (struct nv20_transfer *)ptx; + + if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + struct nv20_screen *nvscreen = nv20_screen(pscreen); + struct pipe_surface *dst; + + dst = pscreen->get_tex_surface(pscreen, ptx->texture, + ptx->face, ptx->level, ptx->zslice, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + nvscreen->eng2d->copy(nvscreen->eng2d, + dst, 0, 0, + tx->surface, 0, 0, + dst->width, dst->height); + + pipe_surface_reference(&dst, NULL); + } + + *pptx = NULL; + if (--ptx->refcount) + return; + + pipe_surface_reference(&tx->surface, NULL); + pipe_texture_reference(&ptx->texture, NULL); + FREE(ptx); +} + +static void * +nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv20_transfer *tx = (struct nv20_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)); + + return map + ns->base.offset + + ptx->y * ns->pitch + ptx->x * ptx->block.size; +} + +static void +nv20_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv20_transfer *tx = (struct nv20_transfer *)ptx; + struct nv20_miptree *mt = (struct nv20_miptree *)tx->surface->texture; + + pipe_buffer_unmap(pscreen, mt->buffer); +} + +void +nv20_screen_init_transfer_functions(struct pipe_screen *pscreen) +{ + pscreen->get_tex_transfer = nv20_transfer_new; + pscreen->tex_transfer_release = nv20_transfer_del; + pscreen->transfer_map = nv20_transfer_map; + pscreen->transfer_unmap = nv20_transfer_unmap; +} diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile index 4c29e2eab3..364c80d8f3 100644 --- a/src/gallium/drivers/nv30/Makefile +++ b/src/gallium/drivers/nv30/Makefile @@ -22,6 +22,7 @@ C_SOURCES = \ nv30_state_viewport.c \ nv30_state_zsa.c \ nv30_surface.c \ + nv30_transfer.c \ nv30_vbo.c \ nv30_vertprog.c diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index b11ed8c24e..ec0a8b8438 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -69,6 +69,8 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) { struct pipe_winsys *ws = pscreen->winsys; struct nv30_miptree *mt; + unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL | + NOUVEAU_BUFFER_USAGE_TEXTURE; mt = MALLOC(sizeof(struct nv30_miptree)); if (!mt) @@ -76,8 +78,6 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) mt->base = *pt; mt->base.refcount = 1; mt->base.screen = pscreen; - mt->shadow_tex = NULL; - mt->shadow_surface = NULL; /* Swizzled textures must be POT */ if (pt->width[0] & (pt->width[0] - 1) || @@ -107,11 +107,12 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) } } + if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC) + buf_usage |= PIPE_BUFFER_USAGE_CPU_READ_WRITE; + nv30_miptree_layout(mt); - mt->buffer = ws->buffer_create(ws, 256, - PIPE_BUFFER_USAGE_PIXEL | - NOUVEAU_BUFFER_USAGE_TEXTURE, + mt->buffer = ws->buffer_create(ws, 256, buf_usage, mt->total_size); if (!mt->buffer) { FREE(mt); @@ -163,12 +164,6 @@ nv30_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt) FREE(mt->level[l].image_offset); } - if (mt->shadow_tex) { - if (mt->shadow_surface) - pscreen->tex_surface_release(pscreen, &mt->shadow_surface); - nv30_miptree_release(pscreen, &mt->shadow_tex); - } - FREE(mt); } @@ -178,36 +173,33 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, unsigned flags) { struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt; - struct pipe_surface *ps; + struct nv04_surface *ns; - ps = CALLOC_STRUCT(pipe_surface); - if (!ps) + ns = CALLOC_STRUCT(nv04_surface); + if (!ns) return NULL; - 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 = nv30mt->level[level].pitch; - ps->usage = flags; - ps->status = PIPE_SURFACE_STATUS_DEFINED; - ps->refcount = 1; - ps->face = face; - ps->level = level; - ps->zslice = zslice; + 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.usage = flags; + ns->base.status = PIPE_SURFACE_STATUS_DEFINED; + ns->base.refcount = 1; + ns->base.face = face; + ns->base.level = level; + ns->base.zslice = zslice; + ns->pitch = nv30mt->level[level].pitch; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset = nv30mt->level[level].image_offset[face]; + ns->base.offset = nv30mt->level[level].image_offset[face]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset = nv30mt->level[level].image_offset[zslice]; + ns->base.offset = nv30mt->level[level].image_offset[zslice]; } else { - ps->offset = nv30mt->level[level].image_offset[0]; + ns->base.offset = nv30mt->level[level].image_offset[0]; } - return ps; + return &ns->base; } static void diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index c97a73f0b1..d395c5e1b7 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -135,82 +135,6 @@ nv30_surface_buffer(struct pipe_surface *surf) return mt->buffer; } -static void * -nv30_surface_map(struct pipe_screen *screen, struct pipe_surface *surface, - unsigned flags ) -{ - struct pipe_winsys *ws = screen->winsys; - struct pipe_surface *surface_to_map; - void *map; - - if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { - struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture; - - if (!mt->shadow_tex) { - unsigned old_tex_usage = surface->texture->tex_usage; - surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR | - PIPE_TEXTURE_USAGE_DYNAMIC; - mt->shadow_tex = screen->texture_create(screen, surface->texture); - surface->texture->tex_usage = old_tex_usage; - - assert(mt->shadow_tex->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR); - } - - mt->shadow_surface = screen->get_tex_surface - ( - screen, mt->shadow_tex, - surface->face, surface->level, surface->zslice, - surface->usage - ); - - surface_to_map = mt->shadow_surface; - } - else - surface_to_map = surface; - - assert(surface_to_map); - - map = ws->buffer_map(ws, nv30_surface_buffer(surface_to_map), flags); - if (!map) - return NULL; - - return map + surface_to_map->offset; -} - -static void -nv30_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface) -{ - struct pipe_winsys *ws = screen->winsys; - struct pipe_surface *surface_to_unmap; - - /* TODO: Copy from shadow just before push buffer is flushed instead. - There are probably some programs that map/unmap excessively - before rendering. */ - if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { - struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture; - - assert(mt->shadow_tex); - - surface_to_unmap = mt->shadow_surface; - } - else - surface_to_unmap = surface; - - assert(surface_to_unmap); - - ws->buffer_unmap(ws, nv30_surface_buffer(surface_to_unmap)); - - if (surface_to_unmap != surface) { - struct nv30_screen *nvscreen = nv30_screen(screen); - - nvscreen->eng2d->copy(nvscreen->eng2d, surface, 0, 0, - surface_to_unmap, 0, 0, - surface->width, surface->height); - - screen->tex_surface_release(screen, &surface_to_unmap); - } -} - static void nv30_screen_destroy(struct pipe_screen *pscreen) { @@ -391,10 +315,8 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) screen->pipe.is_format_supported = nv30_screen_surface_format_supported; - screen->pipe.surface_map = nv30_surface_map; - screen->pipe.surface_unmap = nv30_surface_unmap; - nv30_screen_init_miptree_functions(&screen->pipe); + nv30_screen_init_transfer_functions(&screen->pipe); u_simple_screen_init(&screen->pipe); return &screen->pipe; diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h index b11e470f94..8e36883975 100644 --- a/src/gallium/drivers/nv30/nv30_screen.h +++ b/src/gallium/drivers/nv30/nv30_screen.h @@ -34,4 +34,7 @@ nv30_screen(struct pipe_screen *screen) return (struct nv30_screen *)screen; } +void +nv30_screen_init_transfer_functions(struct pipe_screen *pscreen); + #endif diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h index 2023278e37..e6f23bf166 100644 --- a/src/gallium/drivers/nv30/nv30_state.h +++ b/src/gallium/drivers/nv30/nv30_state.h @@ -76,9 +76,6 @@ struct nv30_miptree { struct pipe_buffer *buffer; uint total_size; - struct pipe_texture *shadow_tex; - struct pipe_surface *shadow_surface; - struct { uint pitch; uint *image_offset; diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 77368cb205..ee0326011c 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -5,7 +5,7 @@ static boolean nv30_state_framebuffer_validate(struct nv30_context *nv30) { struct pipe_framebuffer_state *fb = &nv30->framebuffer; - struct pipe_surface *rt[2], *zeta = NULL; + struct nv04_surface *rt[2], *zeta = NULL; uint32_t rt_enable, rt_format; int i, colour_format = 0, zeta_format = 0; struct nouveau_stateobj *so = so_new(64, 10); @@ -21,7 +21,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) } else { colour_format = fb->cbufs[i]->format; rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i); - rt[i] = fb->cbufs[i]; + rt[i] = (struct nv04_surface *)fb->cbufs[i]; } } @@ -30,13 +30,13 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) if (fb->zsbuf) { zeta_format = fb->zsbuf->format; - zeta = fb->zsbuf; + zeta = (struct nv04_surface *)fb->zsbuf; } - if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { + 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]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)); + 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 | @@ -71,44 +71,44 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) } if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) { - uint32_t pitch = rt[0]->stride; + uint32_t pitch = rt[0]->pitch; if (zeta) { - pitch |= (zeta->stride << 16); + pitch |= (zeta->pitch << 16); } else { pitch |= (pitch << 16); } - nv30mt = (struct nv30_miptree *)rt[0]->texture; + nv30mt = (struct nv30_miptree *)rt[0]->base.texture; so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1); so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR, nv30->nvws->channel->vram->handle, nv30->nvws->channel->gart->handle); so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2); so_data (so, pitch); - so_reloc (so, nv30mt->buffer, rt[0]->offset, rt_flags | + so_reloc (so, nv30mt->buffer, rt[0]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); } if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) { - nv30mt = (struct nv30_miptree *)rt[1]->texture; + nv30mt = (struct nv30_miptree *)rt[1]->base.texture; so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1); so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR, nv30->nvws->channel->vram->handle, nv30->nvws->channel->gart->handle); so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2); - so_reloc (so, nv30mt->buffer, rt[1]->offset, rt_flags | + so_reloc (so, nv30mt->buffer, rt[1]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); - so_data (so, rt[1]->stride); + so_data (so, rt[1]->pitch); } if (zeta_format) { - nv30mt = (struct nv30_miptree *)zeta->texture; + nv30mt = (struct nv30_miptree *)zeta->base.texture; so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1); so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR, nv30->nvws->channel->vram->handle, nv30->nvws->channel->gart->handle); so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1); - so_reloc (so, nv30mt->buffer, zeta->offset, rt_flags | + so_reloc (so, nv30mt->buffer, zeta->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); /* TODO: allocate LMA depth buffer */ } diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c new file mode 100644 index 0000000000..df4dc4b1f6 --- /dev/null +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -0,0 +1,201 @@ +#include +#include +#include +#include +#include +#include "nv30_context.h" +#include "nv30_screen.h" +#include "nv30_state.h" + +struct nv30_transfer { + struct pipe_transfer base; + struct pipe_surface *surface; + 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) +{ + 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->block = pt->block; + template->nblocksx[0] = pt->nblocksx[level]; + template->nblocksy[0] = pt->nblocksx[level]; + template->last_level = 0; + template->compressed = pt->compressed; + template->nr_samples = pt->nr_samples; + + template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | + NOUVEAU_TEXTURE_USAGE_LINEAR; +} + +static struct pipe_transfer * +nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + struct nv30_miptree *mt = (struct nv30_miptree *)pt; + struct nv30_transfer *tx; + struct pipe_texture tx_tex_template, *tx_tex; + + tx = CALLOC_STRUCT(nv30_transfer); + if (!tx) + return NULL; + + tx->base.refcount = 1; + 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; + tx->base.level = level; + tx->base.zslice = zslice; + + /* Direct access to texture */ + if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || + debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) && + pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) + { + tx->direct = true; + tx->surface = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + nv30_usage_tx_to_buf(usage)); + return &tx->base; + } + + tx->direct = false; + + nv30_compatible_transfer_tex(pt, level, &tx_tex_template); + + tx_tex = pscreen->texture_create(pscreen, &tx_tex_template); + if (!tx_tex) + { + FREE(tx); + return NULL; + } + + tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, + face, level, zslice, + nv30_usage_tx_to_buf(usage)); + + pipe_texture_reference(&tx_tex, NULL); + + if (!tx->surface) + { + pipe_surface_reference(&tx->surface, NULL); + FREE(tx); + return NULL; + } + + if (usage != PIPE_TRANSFER_WRITE) { + struct nv30_screen *nvscreen = nv30_screen(pscreen); + struct pipe_surface *src; + + src = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + PIPE_BUFFER_USAGE_GPU_READ); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + /* TODO: Check if SIFM can un-swizzle */ + nvscreen->eng2d->copy(nvscreen->eng2d, + tx->surface, 0, 0, + src, 0, 0, + src->width, src->height); + + pipe_surface_reference(&src, NULL); + } + + return &tx->base; +} + +static void +nv30_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx) +{ + struct pipe_transfer *ptx = *pptx; + struct nv30_transfer *tx = (struct nv30_transfer *)ptx; + + if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + struct nv30_screen *nvscreen = nv30_screen(pscreen); + struct pipe_surface *dst; + + dst = pscreen->get_tex_surface(pscreen, ptx->texture, + ptx->face, ptx->level, ptx->zslice, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + nvscreen->eng2d->copy(nvscreen->eng2d, + dst, 0, 0, + tx->surface, 0, 0, + dst->width, dst->height); + + pipe_surface_reference(&dst, NULL); + } + + *pptx = NULL; + if (--ptx->refcount) + return; + + pipe_surface_reference(&tx->surface, NULL); + pipe_texture_reference(&ptx->texture, NULL); + FREE(ptx); +} + +static void * +nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv30_transfer *tx = (struct nv30_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)); + + return map + ns->base.offset + + ptx->y * ns->pitch + ptx->x * ptx->block.size; +} + +static void +nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv30_transfer *tx = (struct nv30_transfer *)ptx; + struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture; + + pipe_buffer_unmap(pscreen, mt->buffer); +} + +void +nv30_screen_init_transfer_functions(struct pipe_screen *pscreen) +{ + pscreen->get_tex_transfer = nv30_transfer_new; + pscreen->tex_transfer_release = nv30_transfer_del; + pscreen->transfer_map = nv30_transfer_map; + pscreen->transfer_unmap = nv30_transfer_unmap; +} diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile index 8c738aefa6..0ecae2b491 100644 --- a/src/gallium/drivers/nv40/Makefile +++ b/src/gallium/drivers/nv40/Makefile @@ -22,6 +22,7 @@ C_SOURCES = \ nv40_state_viewport.c \ nv40_state_zsa.c \ nv40_surface.c \ + nv40_transfer.c \ nv40_vbo.c \ nv40_vertprog.c diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index e38b1e7f5c..638d279aa5 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -78,8 +78,6 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) mt->base = *pt; mt->base.refcount = 1; mt->base.screen = pscreen; - mt->shadow_tex = NULL; - mt->shadow_surface = NULL; /* Swizzled textures must be POT */ if (pt->width[0] & (pt->width[0] - 1) || @@ -165,12 +163,6 @@ nv40_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt) FREE(mt->level[l].image_offset); } - if (mt->shadow_tex) { - if (mt->shadow_surface) - pscreen->tex_surface_release(pscreen, &mt->shadow_surface); - nv40_miptree_release(pscreen, &mt->shadow_tex); - } - FREE(mt); } @@ -180,36 +172,33 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, unsigned flags) { struct nv40_miptree *mt = (struct nv40_miptree *)pt; - struct pipe_surface *ps; + struct nv04_surface *ns; - ps = CALLOC_STRUCT(pipe_surface); - if (!ps) + ns = CALLOC_STRUCT(nv04_surface); + if (!ns) return NULL; - 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 = mt->level[level].pitch; - ps->usage = flags; - ps->status = PIPE_SURFACE_STATUS_DEFINED; - ps->refcount = 1; - ps->face = face; - ps->level = level; - ps->zslice = zslice; + 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.usage = flags; + ns->base.status = PIPE_SURFACE_STATUS_DEFINED; + ns->base.refcount = 1; + ns->base.face = face; + ns->base.level = level; + ns->base.zslice = zslice; + ns->pitch = mt->level[level].pitch; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset = mt->level[level].image_offset[face]; + ns->base.offset = mt->level[level].image_offset[face]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset = mt->level[level].image_offset[zslice]; + ns->base.offset = mt->level[level].image_offset[zslice]; } else { - ps->offset = mt->level[level].image_offset[0]; + ns->base.offset = mt->level[level].image_offset[0]; } - return ps; + return &ns->base; } static void diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index 2372bc8441..0d4baefaea 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -144,81 +144,6 @@ nv40_surface_buffer(struct pipe_surface *surf) return mt->buffer; } -static void * -nv40_surface_map(struct pipe_screen *screen, struct pipe_surface *surface, - unsigned flags ) -{ - struct pipe_winsys *ws = screen->winsys; - struct pipe_surface *surface_to_map; - void *map; - - if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { - struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture; - - if (!mt->shadow_tex) { - unsigned old_tex_usage = surface->texture->tex_usage; - surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR | - PIPE_TEXTURE_USAGE_DYNAMIC; - mt->shadow_tex = screen->texture_create(screen, surface->texture); - surface->texture->tex_usage = old_tex_usage; - - assert(mt->shadow_tex->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR); - } - - mt->shadow_surface = screen->get_tex_surface - ( - screen, mt->shadow_tex, - surface->face, surface->level, surface->zslice, - surface->usage - ); - - surface_to_map = mt->shadow_surface; - } - else - surface_to_map = surface; - - assert(surface_to_map); - map = ws->buffer_map(ws, nv40_surface_buffer(surface_to_map), flags); - if (!map) - return NULL; - - return map + surface_to_map->offset; -} - -static void -nv40_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface) -{ - struct pipe_winsys *ws = screen->winsys; - struct pipe_surface *surface_to_unmap; - - /* TODO: Copy from shadow just before push buffer is flushed instead. - There are probably some programs that map/unmap excessively - before rendering. */ - if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { - struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture; - - assert(mt->shadow_tex); - - surface_to_unmap = mt->shadow_surface; - } - else - surface_to_unmap = surface; - - assert(surface_to_unmap); - - ws->buffer_unmap(ws, nv40_surface_buffer(surface_to_unmap)); - - if (surface_to_unmap != surface) { - struct nv40_screen *nvscreen = nv40_screen(screen); - - nvscreen->eng2d->copy(nvscreen->eng2d, surface, 0, 0, - surface_to_unmap, 0, 0, - surface->width, surface->height); - - screen->tex_surface_release(screen, &surface_to_unmap); - } -} - static void nv40_screen_destroy(struct pipe_screen *pscreen) { @@ -240,7 +165,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen); struct nouveau_stateobj *so; - unsigned curie_class; + unsigned curie_class = 0; unsigned chipset = nvws->channel->device->chipset; int ret; @@ -265,8 +190,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) if (NV6X_GRCLASS4497_CHIPSETS & (1 << (chipset & 0x0f))) curie_class = NV44TCL; break; - default: - break; } if (!curie_class) { @@ -372,10 +295,8 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) screen->pipe.is_format_supported = nv40_screen_surface_format_supported; - screen->pipe.surface_map = nv40_surface_map; - screen->pipe.surface_unmap = nv40_surface_unmap; - nv40_screen_init_miptree_functions(&screen->pipe); + nv40_screen_init_transfer_functions(&screen->pipe); u_simple_screen_init(&screen->pipe); return &screen->pipe; diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h index 4500aa0e5c..7b503bd207 100644 --- a/src/gallium/drivers/nv40/nv40_screen.h +++ b/src/gallium/drivers/nv40/nv40_screen.h @@ -34,4 +34,7 @@ nv40_screen(struct pipe_screen *screen) return (struct nv40_screen *)screen; } +void +nv40_screen_init_transfer_functions(struct pipe_screen *pscreen); + #endif diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nv40/nv40_state.h index 9c55903ae3..8a9d8c8fdf 100644 --- a/src/gallium/drivers/nv40/nv40_state.h +++ b/src/gallium/drivers/nv40/nv40_state.h @@ -79,9 +79,6 @@ struct nv40_miptree { struct pipe_buffer *buffer; uint total_size; - struct pipe_texture *shadow_tex; - struct pipe_surface *shadow_surface; - struct { uint pitch; uint *image_offset; diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c index 454abad31f..5ebd3a1a56 100644 --- a/src/gallium/drivers/nv40/nv40_state_fb.c +++ b/src/gallium/drivers/nv40/nv40_state_fb.c @@ -12,7 +12,7 @@ static boolean nv40_state_framebuffer_validate(struct nv40_context *nv40) { struct pipe_framebuffer_state *fb = &nv40->framebuffer; - struct pipe_surface *rt[4], *zeta; + struct nv04_surface *rt[4], *zeta; uint32_t rt_enable, rt_format; int i, colour_format = 0, zeta_format = 0; struct nouveau_stateobj *so = so_new(64, 10); @@ -27,7 +27,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) } else { colour_format = fb->cbufs[i]->format; rt_enable |= (NV40TCL_RT_ENABLE_COLOR0 << i); - rt[i] = fb->cbufs[i]; + rt[i] = (struct nv04_surface *)fb->cbufs[i]; } } @@ -37,13 +37,13 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) if (fb->zsbuf) { zeta_format = fb->zsbuf->format; - zeta = fb->zsbuf; + zeta = (struct nv04_surface *)fb->zsbuf; } - if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { + 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]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)); + assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)); rt_format = NV40TCL_RT_FORMAT_TYPE_SWIZZLED | log2i(fb->width) << NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT | @@ -78,60 +78,60 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) if (rt_enable & NV40TCL_RT_ENABLE_COLOR0) { so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR0, 1); - so_reloc (so, nv40_surface_buffer(rt[0]), 0, rt_flags | NOUVEAU_BO_OR, + so_reloc (so, nv40_surface_buffer(&rt[0]->base), 0, rt_flags | NOUVEAU_BO_OR, nv40->nvws->channel->vram->handle, nv40->nvws->channel->gart->handle); so_method(so, nv40->screen->curie, NV40TCL_COLOR0_PITCH, 2); - so_data (so, rt[0]->stride); - so_reloc (so, nv40_surface_buffer(rt[0]), rt[0]->offset, rt_flags | + so_data (so, rt[0]->pitch); + so_reloc (so, nv40_surface_buffer(&rt[0]->base), rt[0]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); } if (rt_enable & NV40TCL_RT_ENABLE_COLOR1) { so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR1, 1); - so_reloc (so, nv40_surface_buffer(rt[1]), 0, rt_flags | NOUVEAU_BO_OR, + so_reloc (so, nv40_surface_buffer(&rt[1]->base), 0, rt_flags | NOUVEAU_BO_OR, nv40->nvws->channel->vram->handle, nv40->nvws->channel->gart->handle); so_method(so, nv40->screen->curie, NV40TCL_COLOR1_OFFSET, 2); - so_reloc (so, nv40_surface_buffer(rt[1]), rt[1]->offset, rt_flags | + so_reloc (so, nv40_surface_buffer(&rt[1]->base), rt[1]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); - so_data (so, rt[1]->stride); + so_data (so, rt[1]->pitch); } if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) { so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR2, 1); - so_reloc (so, nv40_surface_buffer(rt[2]), 0, rt_flags | NOUVEAU_BO_OR, + so_reloc (so, nv40_surface_buffer(&rt[2]->base), 0, rt_flags | NOUVEAU_BO_OR, nv40->nvws->channel->vram->handle, nv40->nvws->channel->gart->handle); so_method(so, nv40->screen->curie, NV40TCL_COLOR2_OFFSET, 1); - so_reloc (so, nv40_surface_buffer(rt[2]), rt[2]->offset, rt_flags | + so_reloc (so, nv40_surface_buffer(&rt[2]->base), rt[2]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); so_method(so, nv40->screen->curie, NV40TCL_COLOR2_PITCH, 1); - so_data (so, rt[2]->stride); + so_data (so, rt[2]->pitch); } if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) { so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR3, 1); - so_reloc (so, nv40_surface_buffer(rt[3]), 0, rt_flags | NOUVEAU_BO_OR, + so_reloc (so, nv40_surface_buffer(&rt[3]->base), 0, rt_flags | NOUVEAU_BO_OR, nv40->nvws->channel->vram->handle, nv40->nvws->channel->gart->handle); so_method(so, nv40->screen->curie, NV40TCL_COLOR3_OFFSET, 1); - so_reloc (so, nv40_surface_buffer(rt[3]), rt[3]->offset, rt_flags | + so_reloc (so, nv40_surface_buffer(&rt[3]->base), rt[3]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); so_method(so, nv40->screen->curie, NV40TCL_COLOR3_PITCH, 1); - so_data (so, rt[3]->stride); + so_data (so, rt[3]->pitch); } if (zeta_format) { so_method(so, nv40->screen->curie, NV40TCL_DMA_ZETA, 1); - so_reloc (so, nv40_surface_buffer(zeta), 0, rt_flags | NOUVEAU_BO_OR, + so_reloc (so, nv40_surface_buffer(&zeta->base), 0, rt_flags | NOUVEAU_BO_OR, nv40->nvws->channel->vram->handle, nv40->nvws->channel->gart->handle); so_method(so, nv40->screen->curie, NV40TCL_ZETA_OFFSET, 1); - so_reloc (so, nv40_surface_buffer(zeta), zeta->offset, rt_flags | + so_reloc (so, nv40_surface_buffer(&zeta->base), zeta->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); so_method(so, nv40->screen->curie, NV40TCL_ZETA_PITCH, 1); - so_data (so, zeta->stride); + so_data (so, zeta->pitch); } so_method(so, nv40->screen->curie, NV40TCL_RT_ENABLE, 1); diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c new file mode 100644 index 0000000000..b090f2238e --- /dev/null +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -0,0 +1,201 @@ +#include +#include +#include +#include +#include +#include "nv40_context.h" +#include "nv40_screen.h" +#include "nv40_state.h" + +struct nv40_transfer { + struct pipe_transfer base; + struct pipe_surface *surface; + 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) +{ + 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->block = pt->block; + template->nblocksx[0] = pt->nblocksx[level]; + template->nblocksy[0] = pt->nblocksx[level]; + template->last_level = 0; + template->compressed = pt->compressed; + template->nr_samples = pt->nr_samples; + + template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | + NOUVEAU_TEXTURE_USAGE_LINEAR; +} + +static struct pipe_transfer * +nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + struct nv40_miptree *mt = (struct nv40_miptree *)pt; + struct nv40_transfer *tx; + struct pipe_texture tx_tex_template, *tx_tex; + + tx = CALLOC_STRUCT(nv40_transfer); + if (!tx) + return NULL; + + tx->base.refcount = 1; + 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; + tx->base.level = level; + tx->base.zslice = zslice; + + /* Direct access to texture */ + if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || + debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) && + pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) + { + tx->direct = true; + tx->surface = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + nv40_usage_tx_to_buf(usage)); + return &tx->base; + } + + tx->direct = false; + + nv40_compatible_transfer_tex(pt, level, &tx_tex_template); + + tx_tex = pscreen->texture_create(pscreen, &tx_tex_template); + if (!tx_tex) + { + FREE(tx); + return NULL; + } + + tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, + face, level, zslice, + nv40_usage_tx_to_buf(usage)); + + pipe_texture_reference(&tx_tex, NULL); + + if (!tx->surface) + { + pipe_surface_reference(&tx->surface, NULL); + FREE(tx); + return NULL; + } + + if (usage != PIPE_TRANSFER_WRITE) { + struct nv40_screen *nvscreen = nv40_screen(pscreen); + struct pipe_surface *src; + + src = pscreen->get_tex_surface(pscreen, pt, + face, level, zslice, + PIPE_BUFFER_USAGE_GPU_READ); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + /* TODO: Check if SIFM can un-swizzle */ + nvscreen->eng2d->copy(nvscreen->eng2d, + tx->surface, 0, 0, + src, 0, 0, + src->width, src->height); + + pipe_surface_reference(&src, NULL); + } + + return &tx->base; +} + +static void +nv40_transfer_del(struct pipe_screen *pscreen, struct pipe_transfer **pptx) +{ + struct pipe_transfer *ptx = *pptx; + struct nv40_transfer *tx = (struct nv40_transfer *)ptx; + + if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + struct nv40_screen *nvscreen = nv40_screen(pscreen); + struct pipe_surface *dst; + + dst = pscreen->get_tex_surface(pscreen, ptx->texture, + ptx->face, ptx->level, ptx->zslice, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */ + nvscreen->eng2d->copy(nvscreen->eng2d, + dst, 0, 0, + tx->surface, 0, 0, + dst->width, dst->height); + + pipe_surface_reference(&dst, NULL); + } + + *pptx = NULL; + if (--ptx->refcount) + return; + + pipe_surface_reference(&tx->surface, NULL); + pipe_texture_reference(&ptx->texture, NULL); + FREE(ptx); +} + +static void * +nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv40_transfer *tx = (struct nv40_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)); + + return map + ns->base.offset + + ptx->y * ns->pitch + ptx->x * ptx->block.size; +} + +static void +nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) +{ + struct nv40_transfer *tx = (struct nv40_transfer *)ptx; + struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture; + + pipe_buffer_unmap(pscreen, mt->buffer); +} + +void +nv40_screen_init_transfer_functions(struct pipe_screen *pscreen) +{ + pscreen->get_tex_transfer = nv40_transfer_new; + pscreen->tex_transfer_release = nv40_transfer_del; + pscreen->transfer_map = nv40_transfer_map; + pscreen->transfer_unmap = nv40_transfer_unmap; +} -- cgit v1.2.3 From 69f080cefced8b3395cdf179c107303a1013d196 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 25 Feb 2009 17:30:56 -0500 Subject: R300: Add support for RS600 chips --- src/mesa/drivers/dri/radeon/radeon_chipset.h | 4 ++++ src/mesa/drivers/dri/radeon/radeon_screen.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h index 55a73eab20..f6bd1eb83f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_chipset.h +++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h @@ -247,6 +247,9 @@ #define PCI_CHIP_RS350_7835 0x7835 #define PCI_CHIP_RS690_791E 0x791E #define PCI_CHIP_RS690_791F 0x791F +#define PCI_CHIP_RS600_793F 0x793F +#define PCI_CHIP_RS600_7941 0x7941 +#define PCI_CHIP_RS600_7942 0x7942 #define PCI_CHIP_RS740_796C 0x796C #define PCI_CHIP_RS740_796D 0x796D #define PCI_CHIP_RS740_796E 0x796E @@ -270,6 +273,7 @@ enum { CHIP_FAMILY_R420, CHIP_FAMILY_RV410, CHIP_FAMILY_RS400, + CHIP_FAMILY_RS600, CHIP_FAMILY_RS690, CHIP_FAMILY_RS740, CHIP_FAMILY_RV515, diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 56c22faafa..f7cba5016b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -685,6 +685,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->chip_family = CHIP_FAMILY_RS400; break; + case PCI_CHIP_RS600_793F: + case PCI_CHIP_RS600_7941: + case PCI_CHIP_RS600_7942: + screen->chip_family = CHIP_FAMILY_RS600; + break; + case PCI_CHIP_RS690_791E: case PCI_CHIP_RS690_791F: screen->chip_family = CHIP_FAMILY_RS690; @@ -843,7 +849,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) ret = radeonGetParam( sPriv->fd, RADEON_PARAM_FB_LOCATION, &temp); if (ret) { - if (screen->chip_family < CHIP_FAMILY_RS690) + if (screen->chip_family < CHIP_FAMILY_RS600) screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff) << 16; else { FREE( screen ); @@ -854,7 +860,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->fbLocation = (temp & 0xffff) << 16; } - if (screen->chip_family >= CHIP_FAMILY_RV515) { + if (screen->chip_family >= CHIP_FAMILY_R300) { ret = radeonGetParam( sPriv->fd, RADEON_PARAM_NUM_GB_PIPES, &temp); if (ret) { -- cgit v1.2.3 From d0415a5a01c1a8c2c2a389d977401a7f6cee031b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Feb 2009 12:41:25 -0800 Subject: i965: Rename CMD_CONST_BUFFER_STATE to the CS_URB_STATE used in the docs. --- src/mesa/drivers/dri/i965/brw_context.h | 4 +++- src/mesa/drivers/dri/i965/brw_curbe.c | 16 ++++++++-------- src/mesa/drivers/dri/i965/brw_defines.h | 2 +- src/mesa/drivers/dri/i965/brw_misc_state.c | 2 +- src/mesa/drivers/dri/i965/brw_state.h | 1 - src/mesa/drivers/dri/i965/brw_structs.h | 2 +- 6 files changed, 14 insertions(+), 13 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 9106b748ad..cb12a2b773 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -670,7 +670,9 @@ void brwInitFragProgFuncs( struct dd_function_table *functions ); */ void brw_upload_urb_fence(struct brw_context *brw); -void brw_upload_constant_buffer_state(struct brw_context *brw); +/* brw_curbe.c + */ +void brw_upload_cs_urb_state(struct brw_context *brw); /*====================================================================== diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 4eaaa5f871..4ec0cfb816 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -138,24 +138,24 @@ const struct brw_tracked_state brw_curbe_offsets = { * 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) +void brw_upload_cs_urb_state(struct brw_context *brw) { - struct brw_constant_buffer_state cbs; - memset(&cbs, 0, sizeof(cbs)); + struct brw_cs_urb_state cs_urb; + memset(&cs_urb, 0, sizeof(cs_urb)); /* 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; + cs_urb.header.opcode = CMD_CS_URB_STATE; + cs_urb.header.length = sizeof(cs_urb)/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; + cs_urb.bits0.nr_urb_entries = brw->urb.nr_cs_entries; + cs_urb.bits0.urb_entry_size = brw->urb.csize - 1; assert(brw->urb.nr_cs_entries); - BRW_CACHED_BATCH_STRUCT(brw, &cbs); + BRW_CACHED_BATCH_STRUCT(brw, &cs_urb); } static GLfloat fixed_plane[6][4] = { diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 39c32255f8..590b064c7e 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -734,7 +734,7 @@ #define CMD_URB_FENCE 0x6000 -#define CMD_CONST_BUFFER_STATE 0x6001 +#define CMD_CS_URB_STATE 0x6001 #define CMD_CONST_BUFFER 0x6002 #define CMD_STATE_BASE_ADDRESS 0x6101 diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 9dcdad7b4e..40cb7a341d 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -178,7 +178,7 @@ 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); + brw_upload_cs_urb_state(brw); } const struct brw_tracked_state brw_psp_urb_cbs = { diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index df839c5b30..81b0a45998 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -52,7 +52,6 @@ const struct brw_tracked_state brw_cc_vp; const struct brw_tracked_state brw_check_fallback; 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; diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h index d97ff27f0a..89e2981203 100644 --- a/src/mesa/drivers/dri/i965/brw_structs.h +++ b/src/mesa/drivers/dri/i965/brw_structs.h @@ -439,7 +439,7 @@ struct brw_urb_fence } bits1; }; -struct brw_constant_buffer_state /* previously brw_command_streamer */ +struct brw_cs_urb_state { struct header header; -- cgit v1.2.3 From 119f34e2a52d7e074ea51d49acf6c11d83142ccc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Feb 2009 22:54:51 -0800 Subject: intel: Fix up x8r8g8b8 renderbuffer format so that alpha=1 spans code happens. I was lured into a false sense of security by the fact that the spans code was already there, and a bunch of tests didn't catch the problem. oglconform's mask.c did, though. Bug #19970. --- src/mesa/drivers/dri/intel/intel_fbo.c | 9 +++++++++ src/mesa/drivers/dri/intel/intel_screen.c | 9 ++++++++- 2 files changed, 17 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 c9fb90f3b2..739a85232e 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -323,6 +323,15 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 5; irb->Base.DataType = GL_UNSIGNED_BYTE; break; + case GL_RGB8: + irb->Base._ActualFormat = GL_RGB8; + 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; + break; case GL_RGBA8: irb->Base._ActualFormat = GL_RGBA8; irb->Base._BaseFormat = GL_RGBA; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index d6110b8163..df404695bc 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -323,7 +323,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, else { GLboolean swStencil = (mesaVis->stencilBits > 0 && mesaVis->depthBits != 24); - GLenum rgbFormat = (mesaVis->redBits == 5 ? GL_RGB5 : GL_RGBA8); + GLenum rgbFormat; struct intel_framebuffer *intel_fb = CALLOC_STRUCT(intel_framebuffer); @@ -332,6 +332,13 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, _mesa_initialize_framebuffer(&intel_fb->Base, mesaVis); + if (mesaVis->redBits == 5) + rgbFormat = GL_RGB5; + else if (mesaVis->alphaBits == 0) + rgbFormat = GL_RGB8; + else + rgbFormat = GL_RGBA8; + /* setup the hardware-based renderbuffers */ intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT, -- cgit v1.2.3 From 43a45439465eff483486e7f86620e1d09978497f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Feb 2009 23:54:40 -0800 Subject: intel: make template wrappers for the spans templates. This is insanity, but so is copying the same blocks containing the actual interesting code in the file three times each for the different tile formats. --- src/mesa/drivers/dri/intel/intel_depthtmp.h | 54 ++++++ src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 4 +- src/mesa/drivers/dri/intel/intel_span.c | 235 +++++------------------- src/mesa/drivers/dri/intel/intel_spantmp.h | 61 ++++++ 4 files changed, 165 insertions(+), 189 deletions(-) create mode 100644 src/mesa/drivers/dri/intel/intel_depthtmp.h create mode 100644 src/mesa/drivers/dri/intel/intel_spantmp.h (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_depthtmp.h b/src/mesa/drivers/dri/intel/intel_depthtmp.h new file mode 100644 index 0000000000..16d7708453 --- /dev/null +++ b/src/mesa/drivers/dri/intel/intel_depthtmp.h @@ -0,0 +1,54 @@ +/* + * 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 + * + */ + +/** + * Wrapper around the depthtmp.h macrofest to generate spans code for + * all the tiling styles. + */ + +#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)) +#define TAG(x) INTEL_TAG(intel##x) +#include "depthtmp.h" + +#define VALUE_TYPE INTEL_VALUE_TYPE +#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(X_TILE(_x, _y), d) +#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(X_TILE(_x, _y)) +#define TAG(x) INTEL_TAG(intel_XTile_##x) +#include "depthtmp.h" + +#define VALUE_TYPE INTEL_VALUE_TYPE +#define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(Y_TILE(_x, _y), d) +#define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(Y_TILE(_x, _y)) +#define TAG(x) INTEL_TAG(intel_YTile_##x) +#include "depthtmp.h" + +#undef INTEL_VALUE_TYPE +#undef INTEL_WRITE_DEPTH +#undef INTEL_READ_DEPTH +#undef INTEL_TAG diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 1db7f5594e..eb898a18cf 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -541,7 +541,7 @@ intelBitmap(GLcontext * ctx, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * pixels) -{ +{/* if (do_blit_bitmap(ctx, x, y, width, height, unpack, pixels)) return; @@ -549,7 +549,7 @@ intelBitmap(GLcontext * ctx, if (intel_texture_bitmap(ctx, x, y, width, height, unpack, pixels)) return; - + */ if (INTEL_DEBUG & DEBUG_PIXEL) _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index bdd2fd9e85..b397fbebce 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -131,6 +131,18 @@ 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) { @@ -293,101 +305,29 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off) #define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off) -/* 16 bit, RGB565 color spanline and pixel functions - */ -#define SPANTMP_PIXEL_FMT GL_RGB -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5 - -#define TAG(x) intel##x##_RGB565 -#define TAG2(x,y) intel##x##_RGB565##y -#define GET_VALUE(X, Y) pread_16(irb, NO_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_16(irb, NO_TILE(X, Y), V) -#include "spantmp2.h" - -/* 32 bit, ARGB8888 color spanline and pixel functions - */ -#define SPANTMP_PIXEL_FMT GL_BGRA -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV - -#define TAG(x) intel##x##_ARGB8888 -#define TAG2(x,y) intel##x##_ARGB8888##y -#define GET_VALUE(X, Y) pread_32(irb, NO_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_32(irb, NO_TILE(X, Y), V) -#include "spantmp2.h" - -/* 32 bit, xRGB8888 color spanline and pixel functions - */ -#define SPANTMP_PIXEL_FMT GL_BGRA -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV - -#define TAG(x) intel##x##_xRGB8888 -#define TAG2(x,y) intel##x##_xRGB8888##y -#define GET_VALUE(X, Y) pread_xrgb8888(irb, NO_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, NO_TILE(X, Y), V) -#include "spantmp2.h" - -/* 16 bit RGB565 color tile spanline and pixel functions - */ - -#define SPANTMP_PIXEL_FMT GL_RGB -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5 - -#define TAG(x) intel_XTile_##x##_RGB565 -#define TAG2(x,y) intel_XTile_##x##_RGB565##y -#define GET_VALUE(X, Y) pread_16(irb, X_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_16(irb, X_TILE(X, Y), V) -#include "spantmp2.h" - -#define SPANTMP_PIXEL_FMT GL_RGB -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5 - -#define TAG(x) intel_YTile_##x##_RGB565 -#define TAG2(x,y) intel_YTile_##x##_RGB565##y -#define GET_VALUE(X, Y) pread_16(irb, Y_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_16(irb, Y_TILE(X, Y), V) -#include "spantmp2.h" - -/* 32 bit ARGB888 color tile spanline and pixel functions - */ - -#define SPANTMP_PIXEL_FMT GL_BGRA -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV - -#define TAG(x) intel_XTile_##x##_ARGB8888 -#define TAG2(x,y) intel_XTile_##x##_ARGB8888##y -#define GET_VALUE(X, Y) pread_32(irb, X_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_32(irb, X_TILE(X, Y), V) -#include "spantmp2.h" - -#define SPANTMP_PIXEL_FMT GL_BGRA -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV - -#define TAG(x) intel_YTile_##x##_ARGB8888 -#define TAG2(x,y) intel_YTile_##x##_ARGB8888##y -#define GET_VALUE(X, Y) pread_32(irb, Y_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_32(irb, Y_TILE(X, Y), V) -#include "spantmp2.h" - -/* 32 bit xRGB888 color tile spanline and pixel functions - */ - -#define SPANTMP_PIXEL_FMT GL_BGRA -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV - -#define TAG(x) intel_XTile_##x##_xRGB8888 -#define TAG2(x,y) intel_XTile_##x##_xRGB8888##y -#define GET_VALUE(X, Y) pread_xrgb8888(irb, X_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, X_TILE(X, Y), V) -#include "spantmp2.h" - -#define SPANTMP_PIXEL_FMT GL_BGRA -#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV - -#define TAG(x) intel_YTile_##x##_xRGB8888 -#define TAG2(x,y) intel_YTile_##x##_xRGB8888##y -#define GET_VALUE(X, Y) pread_xrgb8888(irb, Y_TILE(X, Y)) -#define PUT_VALUE(X, Y, V) pwrite_xrgb8888(irb, Y_TILE(X, Y), V) -#include "spantmp2.h" +/* r5g6b5 color span and pixel functions */ +#define INTEL_PIXEL_FMT GL_RGB +#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5 +#define INTEL_READ_VALUE(offset) pread_16(irb, offset) +#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v) +#define INTEL_TAG(x) x##_RGB565 +#include "intel_spantmp.h" + +/* a8r8g8b8 color span and pixel functions */ +#define INTEL_PIXEL_FMT GL_BGRA +#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV +#define INTEL_READ_VALUE(offset) pread_32(irb, offset) +#define INTEL_WRITE_VALUE(offset, v) pwrite_32(irb, offset, v) +#define INTEL_TAG(x) x##_ARGB8888 +#include "intel_spantmp.h" + +/* x8r8g8b8 color span and pixel functions */ +#define INTEL_PIXEL_FMT GL_BGRA +#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) +#define INTEL_TAG(x) x##_xRGB8888 +#include "intel_spantmp.h" #define LOCAL_DEPTH_VARS \ struct intel_context *intel = intel_context(ctx); \ @@ -402,98 +342,19 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS -/** - ** 16-bit depthbuffer functions. - **/ -#define VALUE_TYPE GLushort -#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, NO_TILE(_x, _y), d) -#define READ_DEPTH(d, _x, _y) d = pread_16(irb, NO_TILE(_x, _y)) -#define TAG(x) intel##x##_z16 -#include "depthtmp.h" - - -/** - ** 16-bit x tile depthbuffer functions. - **/ -#define VALUE_TYPE GLushort -#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, X_TILE(_x, _y), d) -#define READ_DEPTH(d, _x, _y) d = pread_16(irb, X_TILE(_x, _y)) -#define TAG(x) intel_XTile_##x##_z16 -#include "depthtmp.h" - -/** - ** 16-bit y tile depthbuffer functions. - **/ -#define VALUE_TYPE GLushort -#define WRITE_DEPTH(_x, _y, d) pwrite_16(irb, Y_TILE(_x, _y), d) -#define READ_DEPTH(d, _x, _y) d = pread_16(irb, Y_TILE(_x, _y)) -#define TAG(x) intel_YTile_##x##_z16 -#include "depthtmp.h" - - -/** - ** 24/8-bit interleaved depth/stencil functions - ** Note: we're actually reading back combined depth+stencil values. - ** The wrappers in main/depthstencil.c are used to extract the depth - ** and stencil values. - **/ -#define VALUE_TYPE GLuint - -/* Change ZZZS -> SZZZ */ -#define WRITE_DEPTH(_x, _y, d) \ - pwrite_32(irb, NO_TILE(_x, _y), ((d) >> 8) | ((d) << 24)) - -/* Change SZZZ -> ZZZS */ -#define READ_DEPTH( d, _x, _y ) { \ - GLuint tmp = pread_32(irb, NO_TILE(_x, _y)); \ - d = (tmp << 8) | (tmp >> 24); \ -} - -#define TAG(x) intel##x##_z24_s8 -#include "depthtmp.h" - - -/** - ** 24/8-bit x-tile interleaved depth/stencil functions - ** Note: we're actually reading back combined depth+stencil values. - ** The wrappers in main/depthstencil.c are used to extract the depth - ** and stencil values. - **/ -#define VALUE_TYPE GLuint - -/* Change ZZZS -> SZZZ */ -#define WRITE_DEPTH(_x, _y, d) \ - pwrite_32(irb, X_TILE(_x, _y), ((d) >> 8) | ((d) << 24)) - -/* Change SZZZ -> ZZZS */ -#define READ_DEPTH( d, _x, _y ) { \ - GLuint tmp = pread_32(irb, X_TILE(_x, _y)); \ - d = (tmp << 8) | (tmp >> 24); \ -} - -#define TAG(x) intel_XTile_##x##_z24_s8 -#include "depthtmp.h" - -/** - ** 24/8-bit y-tile interleaved depth/stencil functions - ** Note: we're actually reading back combined depth+stencil values. - ** The wrappers in main/depthstencil.c are used to extract the depth - ** and stencil values. - **/ -#define VALUE_TYPE GLuint - -/* Change ZZZS -> SZZZ */ -#define WRITE_DEPTH(_x, _y, d) \ - pwrite_32(irb, Y_TILE(_x, _y), ((d) >> 8) | ((d) << 24)) - -/* Change SZZZ -> ZZZS */ -#define READ_DEPTH( d, _x, _y ) { \ - GLuint tmp = pread_32(irb, Y_TILE(_x, _y)); \ - d = (tmp << 8) | (tmp >> 24); \ -} - -#define TAG(x) intel_YTile_##x##_z24_s8 -#include "depthtmp.h" +/* z16 depthbuffer functions. */ +#define INTEL_VALUE_TYPE GLushort +#define INTEL_WRITE_DEPTH(offset, d) pwrite_16(irb, offset, d) +#define INTEL_READ_DEPTH(offset) pread_16(irb, offset) +#define INTEL_TAG(name) name##_z16 +#include "intel_depthtmp.h" + +/* 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_TAG(name) name##_z24_s8 +#include "intel_depthtmp.h" /** diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h new file mode 100644 index 0000000000..ead0b1c168 --- /dev/null +++ b/src/mesa/drivers/dri/intel/intel_spantmp.h @@ -0,0 +1,61 @@ +/* + * 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 + * + */ + +/** + * Wrapper around the spantmp.h macrofest to generate spans code for + * all the tiling styles. + */ + +#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) +#define GET_VALUE(_x, _y) INTEL_READ_VALUE(NO_TILE(_x, _y)) +#define TAG(x) INTEL_TAG(intel##x) +#define TAG2(x, y) INTEL_TAG(intel##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(X_TILE(_x, _y), v) +#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y)) +#define TAG(x) INTEL_TAG(intel_XTile_##x) +#define TAG2(x, y) INTEL_TAG(intel_XTile_##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(X_TILE(_x, _y), v) +#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y)) +#define TAG(x) INTEL_TAG(intel_YTile_##x) +#define TAG2(x, y) INTEL_TAG(intel_YTile_##x)##y +#include "spantmp2.h" + +#undef INTEL_PIXEL_FMT +#undef INTEL_PIXEL_TYPE +#undef INTEL_WRITE_VALUE +#undef INTEL_READ_VALUE +#undef INTEL_TAG -- cgit v1.2.3 From 2b34275a784501225f605f11db801b5f2d7cdc64 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 25 Feb 2009 23:58:38 -0800 Subject: intel: Add span code for z24 without stencil. It seems that in this case the Mesa code is handing us x8z24 values instead of z24s8 values, so we need to not do the rotation. Fixes half of OGLconform depthrange.c. Bug #19447. --- src/mesa/drivers/dri/intel/intel_span.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 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 b397fbebce..c3a873f1ab 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -349,6 +349,13 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #define INTEL_TAG(name) name##_z16 #include "intel_depthtmp.h" +/* z24 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, z24s8_to_s8z24(d)) @@ -613,8 +620,21 @@ intel_set_span_functions(struct intel_context *intel, break; } } - else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24 || /* XXX FBO remove */ - rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) { + else 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) { switch (tiling) { case I915_TILING_NONE: default: -- cgit v1.2.3 From 160c3617fc8867edc445b1ba62fc996c4630cc35 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Feb 2009 00:18:46 -0800 Subject: intel: Disable creating DRI2 FBconfigs with depth size != color size. While it's a nice idea to be able to allow clients to choose a smaller (or bigger for 16bpp screens!) depth size, right now DRI2 hands back a buffer with a size that matches the drawable, rather than being based off of the visual. This led to problems in readback as parts of the driver disagreed on what format the depth buffer was really in. Fixes the remainder of bug #19447. --- src/mesa/drivers/dri/intel/intel_screen.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index df404695bc..09eba13aab 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -765,13 +765,34 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) fb_format[2] = GL_BGRA; fb_type[2] = GL_UNSIGNED_INT_8_8_8_8_REV; + depth_bits[0] = 0; + stencil_bits[0] = 0; + for (color = 0; color < ARRAY_SIZE(fb_format); color++) { __DRIconfig **new_configs; + int depth_factor; + + /* With DRI2 right now, GetBuffers always returns a depth/stencil buffer + * with the same cpp as the drawable. So we can't support depth cpp != + * color cpp currently. + */ + if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) { + depth_bits[1] = 16; + stencil_bits[1] = 0; + + depth_factor = 2; + } else { + depth_bits[1] = 24; + stencil_bits[1] = 0; + depth_bits[2] = 24; + stencil_bits[2] = 8; + depth_factor = 3; + } new_configs = driCreateConfigs(fb_format[color], fb_type[color], depth_bits, stencil_bits, - ARRAY_SIZE(depth_bits), + depth_factor, back_buffer_modes, ARRAY_SIZE(back_buffer_modes), msaa_samples_array, -- cgit v1.2.3 From 68915fd6fac44dd000080298e3afb0669e8754aa Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 26 Feb 2009 17:31:01 +0800 Subject: i965: fix for RHW workaround It is possible that an object whose vertices all are outside of a view plane is passed to clip thread due to the RHW workaround. This object should be rejected by clip thread. Fix bug #19879 --- src/mesa/drivers/dri/i965/brw_clip_line.c | 66 +++++++++++++++++---------- src/mesa/drivers/dri/i965/brw_clip_tri.c | 76 +++++++++++++++++++++++-------- 2 files changed, 99 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c index c45d48dff8..d830e49e50 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_line.c +++ b/src/mesa/drivers/dri/i965/brw_clip_line.c @@ -181,34 +181,54 @@ static void clip_and_emit_line( struct brw_clip_compile *c ) brw_DP4(p, vec4(c->reg.dp1), deref_4f(vtx1, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); 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); + /* + * Both can be negative on GM965/G965 due to RHW workaround + * if so, this object should be rejected. + */ + if (!BRW_IS_G4X(p->brw)) { + brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_LE, c->reg.dp0, brw_imm_f(0.0)); + is_neg2 = brw_IF(p, BRW_EXECUTE_1); + { + brw_clip_kill_thread(c); + } + brw_ENDIF(p, is_neg2); + } + + 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. - */ + /* 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 */ + /* Only on GM965/G965 */ + if (!BRW_IS_G4X(p->brw)) { + brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0)); + is_neg2 = brw_IF(p, BRW_EXECUTE_1); + } - /* 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_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); + } + + if (!BRW_IS_G4X(p->brw)) { + brw_ENDIF(p, is_neg2); + } + } brw_ENDIF(p, is_negative); } brw_ENDIF(p, plane_active); diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c index 1dbba37fe7..7fd37bd05f 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_tri.c +++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c @@ -455,6 +455,8 @@ static void brw_clip_test( struct brw_clip_compile *c ) struct brw_indirect vt2 = brw_indirect(2, 0); struct brw_compile *p = &c->func; + struct brw_instruction *is_outside; + struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */ 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])); @@ -462,53 +464,87 @@ static void brw_clip_test( struct brw_clip_compile *c ) 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])); + brw_AND(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(~0x3f)); /* test nearz, xmin, ymin plane */ - brw_CMP(p, t1, BRW_CONDITIONAL_LE, negate(v0), get_element(v0, 3)); + /* clip.xyz < -clip.w */ + brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, negate(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_CMP(p, t2, BRW_CONDITIONAL_L, v1, negate(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_CMP(p, t3, BRW_CONDITIONAL_L, v2, negate(get_element(v2, 3))); brw_set_predicate_control(p, BRW_PREDICATE_NONE); + + /* All vertices are outside of a plane, rejected */ + brw_AND(p, t, t1, t2); + brw_AND(p, t, t, t3); + brw_OR(p, tmp0, get_element(t, 0), get_element(t, 1)); + brw_OR(p, tmp0, tmp0, get_element(t, 2)); + brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); + brw_AND(p, brw_null_reg(), tmp0, brw_imm_ud(0x1)); + is_outside = brw_IF(p, BRW_EXECUTE_1); + { + brw_clip_kill_thread(c); + } + brw_ENDIF(p, is_outside); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + + /* some vertices are inside a plane, some are outside,need to clip */ 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_AND(p, t, t, brw_imm_ud(0x1)); + 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_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_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)); + /* clip.xyz > clip.w */ + brw_CMP(p, t1, BRW_CONDITIONAL_G, 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_CMP(p, t2, BRW_CONDITIONAL_G, 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_CMP(p, t3, BRW_CONDITIONAL_G, v2, get_element(v2, 3)); brw_set_predicate_control(p, BRW_PREDICATE_NONE); + /* All vertices are outside of a plane, rejected */ + brw_AND(p, t, t1, t2); + brw_AND(p, t, t, t3); + brw_OR(p, tmp0, get_element(t, 0), get_element(t, 1)); + brw_OR(p, tmp0, tmp0, get_element(t, 2)); + brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); + brw_AND(p, brw_null_reg(), tmp0, brw_imm_ud(0x1)); + is_outside = brw_IF(p, BRW_EXECUTE_1); + { + brw_clip_kill_thread(c); + } + brw_ENDIF(p, is_outside); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + + /* some vertices are inside a plane, some are outside,need to clip */ 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_AND(p, t, t, brw_imm_ud(0x1)); + 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_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_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); -- cgit v1.2.3 From 5add2c88bdcf0f892b65d6074986672fe4c1bdfe Mon Sep 17 00:00:00 2001 From: Tomas Carnecky Date: Thu, 26 Feb 2009 07:31:35 +0100 Subject: Fix "cast to pointer from integer of different size" The script generates code like: pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); which causes the above mentioned warning. Add parenthesis around the whole expression to fix it. Signed-off-by: Tomas Carnecky --- src/mesa/glapi/glX_proto_recv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/glapi/glX_proto_recv.py b/src/mesa/glapi/glX_proto_recv.py index 923c1958f0..f423c6db08 100644 --- a/src/mesa/glapi/glX_proto_recv.py +++ b/src/mesa/glapi/glX_proto_recv.py @@ -277,7 +277,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): if param.is_image(): offset = f.offset_of( param.name ) - print '%s %s const %s = (%s) %s(pc + %s);' % (indent, type_string, param.name, type_string, cond, offset) + print '%s %s const %s = (%s) (%s(pc + %s));' % (indent, type_string, param.name, type_string, cond, offset) if param.depth: print '%s __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent) -- cgit v1.2.3 From b12dc74f86c611483465c08504dc8a564f927b15 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Feb 2009 11:45:07 -0800 Subject: intel: Revert disable of accelerated Bitmap, which slipped in with spans stuff. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 eb898a18cf..1db7f5594e 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -541,7 +541,7 @@ intelBitmap(GLcontext * ctx, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte * pixels) -{/* +{ if (do_blit_bitmap(ctx, x, y, width, height, unpack, pixels)) return; @@ -549,7 +549,7 @@ intelBitmap(GLcontext * ctx, if (intel_texture_bitmap(ctx, x, y, width, height, unpack, pixels)) return; - */ + if (INTEL_DEBUG & DEBUG_PIXEL) _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); -- cgit v1.2.3 From 857ac1e817808f4b6bf985679162d0e3d709e5b5 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 26 Feb 2009 05:35:15 -0800 Subject: mesa: Resurrect SPARC asm code. This rewrites the sparc GLAPI code so that it's PIC friendly and works with all of the TLS/PTHREADS/64-bit/32-bit combinations properly. As a result we can turn SPARC asm back on. Currently it's only enabled on Linux, as that's the only place where I can test this stuff out. For the moment the cliptest SPARC asm routines are disabled as they are non-working. The problem is that they use register %g7 as a temporary which is where the threading libraries store the thread pointer on SPARC. I will fix that code up in a future change as it's a pretty important routine to optimize. Like x86 we do the runtime patch as a pthread once-invoked initializer in init_glapi_relocs(). Unlike x86, however, our GLAPI stubs on SPARC are just two instruction sequences that branch to a trampoline and put the GLAPI offset into a register. The trampoline is what we run-time patch. The stubs thus all look like: glFoo: ba __glapi_sparc_foo_stub sethi GLAPI_OFFSET(glFOO) * PTR_SIZE, %g3 This actually makes generate_entrypoint() a lot simpler on SPARC. For this case in generate_entrypoint() we generate stubs using a 'call' instead of the 'ba' above to make sure it can reach. In order to get a proper tail call going here, in the unpatched case, we do several tricks. To get the current PC, for example, we save the return address register into a temporary, do a call, save the return address register written by the call to another temporary, then restore the original return address register value. This is to avoid having to allocate a stack frame. This is necessary for PIC address formation. This new GLAPI scheme lets us get rid of the ugly SPARC GLAPI hacks in __glXInitialize() and one_time_init(). Signed-off-by: David S. Miller --- src/glx/x11/glxext.c | 86 --- src/mesa/glapi/gl_SPARC_asm.py | 228 ++++-- src/mesa/glapi/glapi.c | 131 ++++ src/mesa/glapi/glapi_getproc.c | 78 +- src/mesa/main/context.c | 3 - src/mesa/sparc/glapi_sparc.S | 1645 +++++++++++++--------------------------- src/mesa/sparc/sparc.c | 38 +- src/mesa/sparc/sparc.h | 1 - 8 files changed, 878 insertions(+), 1332 deletions(-) (limited to 'src') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index be6edf9b19..b296b7c651 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -56,19 +56,6 @@ void __glXDumpDrawBuffer(__GLXcontext * ctx); #endif -#ifdef USE_SPARC_ASM -static void _glx_mesa_init_sparc_glapi_relocs(void); -static int _mesa_sparc_needs_init = 1; -#define INIT_MESA_SPARC do { \ - if (_mesa_sparc_needs_init) { \ - _glx_mesa_init_sparc_glapi_relocs(); \ - _mesa_sparc_needs_init = 0; \ - } \ - } while(0) -#else -#define INIT_MESA_SPARC do { } while(0) -#endif - /* ** You can set this cell to 1 to force the gl drawing stuff to be ** one command per packet @@ -670,7 +657,6 @@ __glXInitialize(Display * dpy) } #endif - INIT_MESA_SPARC; /* The one and only long long lock */ __glXLock(); @@ -785,7 +771,6 @@ __glXSetupForCommand(Display * dpy) if (gc->currentDpy == dpy) { /* Use opcode from gc because its right */ - INIT_MESA_SPARC; return gc->majorOpcode; } else { @@ -979,74 +964,3 @@ __glXDumpDrawBuffer(__GLXcontext * ctx) } } #endif - -#ifdef USE_SPARC_ASM -/* - * This is where our dispatch table's bounds are. - * And the static mesa_init is taken directly from - * Mesa's 'sparc.c' initializer. - * - * We need something like this here, because this version - * of openGL/glx never initializes a Mesa context, and so - * the address of the dispatch table pointer never gets stuffed - * into the dispatch jump table otherwise. - * - * It matters only on SPARC, and only if you are using assembler - * code instead of C-code indirect dispatch. - * - * -- FEM, 04.xii.03 - */ -extern unsigned int _mesa_sparc_glapi_begin; -extern unsigned int _mesa_sparc_glapi_end; -extern void __glapi_sparc_icache_flush(unsigned int *); - -static void -_glx_mesa_init_sparc_glapi_relocs(void) -{ - unsigned int *insn_ptr, *end_ptr; - unsigned long disp_addr; - - insn_ptr = &_mesa_sparc_glapi_begin; - end_ptr = &_mesa_sparc_glapi_end; - disp_addr = (unsigned long) &_glapi_Dispatch; - - /* - * Verbatim from Mesa sparc.c. It's needed because there doesn't - * seem to be a better way to do this: - * - * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset ) - * - * This code is patching in the ADDRESS of the pointer to the - * dispatch table. Hence, it must be called exactly once, because - * that address is not going to change. - * - * What it points to can change, but Mesa (and hence, we) assume - * that there is only one pointer. - * - */ - while (insn_ptr < end_ptr) { -#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) ) -/* - This code patches for 64-bit addresses. This had better - not happen for Sparc/Linux, no matter what architecture we - are building for. So, don't do this. - - The 'defined(__linux_64__)' is used here as a placeholder for - when we do do 64-bit usermode on sparc linux. - */ - insn_ptr[0] |= (disp_addr >> (32 + 10)); - insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10); - __glapi_sparc_icache_flush(&insn_ptr[0]); - insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1)); - insn_ptr[3] |= (disp_addr & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&insn_ptr[2]); - insn_ptr += 11; -#else - insn_ptr[0] |= (disp_addr >> 10); - insn_ptr[1] |= (disp_addr & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&insn_ptr[0]); - insn_ptr += 5; -#endif - } -} -#endif /* sparc ASM in use */ diff --git a/src/mesa/glapi/gl_SPARC_asm.py b/src/mesa/glapi/gl_SPARC_asm.py index 178c00a227..33e752df38 100644 --- a/src/mesa/glapi/gl_SPARC_asm.py +++ b/src/mesa/glapi/gl_SPARC_asm.py @@ -39,80 +39,202 @@ class PrintGenericStubs(gl_XML.gl_print_base): def printRealHeader(self): - print '#include "glapioffsets.h"' + print '#include "glapi/glapioffsets.h"' print '' print '#ifdef __arch64__' - print '# define GL_STUB(fn,off)\t\t\t\t\\' - print 'fn:\t\t\t\t\t\\' - print '\tsethi\t%hi(0xDEADBEEF), %g4 ;\t\t\t\\' - print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\' - print '\tor\t%g4, %lo(0xDEADBEEF), %g4 ;\t\t\\' - print '\tor\t%g1, %lo(0xDEADBEEF), %g1 ;\t\t\\' - print '\tsllx\t%g4, 32, %g4 ;\t\t\t\t\\' - print '\tldx\t[%g1 + %g4], %g1 ;\t\t\t\\' - print '\tsethi\t%hi(8 * off), %g4 ;\t\t\t\\' - print '\tor\t%g4, %lo(8 * off), %g4 ;\t\t\\' - print '\tldx\t[%g1 + %g4], %g5 ;\t\t\t\\' - print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\' - print '\tnop' + print '#define GL_OFF(N)\t((N) * 8)' + print '#define GL_LL\t\tldx' + print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)' + print '#define GL_STACK_SIZE\t128' print '#else' - print '# define GL_STUB(fn,off)\t\t\t\t\\' - print 'fn:\t\t\t\t\t\\' - print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\' - print '\tld\t[%g1 + %lo(0xDEADBEEF)], %g1 ;\t\t\\' - print '\tld\t[%g1 + (4 * off)], %g5 ;\t\t\\' - print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\' - print '\tnop' + print '#define GL_OFF(N)\t((N) * 4)' + print '#define GL_LL\t\tld' + print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)' + print '#define GL_STACK_SIZE\t64' print '#endif' print '' - print '#define GL_STUB_ALIAS(fn,alias) fn = alias' + print '#define GLOBL_FN(x) .globl x ; .type x, @function' + print '#define HIDDEN(x) .hidden x' print '' - print '.text' - print '.align 32' - print '\t\t.globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function' + print '\t.register %g2, #scratch' + print '\t.register %g3, #scratch' + print '' + print '\t.text' + print '' + print '\tGLOBL_FN(__glapi_sparc_icache_flush)' + print '\tHIDDEN(__glapi_sparc_icache_flush)' + print '\t.type\t__glapi_sparc_icache_flush, @function' print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */' print '\tflush\t%o0' print '\tretl' - print '\tnop' + print '\t nop' + print '' + print '\t.align\t32' + print '' + print '\t.type\t__glapi_sparc_get_pc, @function' + print '__glapi_sparc_get_pc:' + print '\tretl' + print '\t add\t%o7, %g2, %g2' + print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc' + print '' + print '#ifdef GLX_USE_TLS' + print '' + print '\tGLOBL_FN(__glapi_sparc_get_dispatch)' + print '\tHIDDEN(__glapi_sparc_get_dispatch)' + print '__glapi_sparc_get_dispatch:' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1' + print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1' + print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)' + print '\tretl' + print '\t mov\t%g2, %o0' + print '' + print '\t.data' + print '\t.align\t32' + print '' + print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */' + print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */' + print '\tGLOBL_FN(__glapi_sparc_tls_stub)' + print '\tHIDDEN(__glapi_sparc_tls_stub)' + print '__glapi_sparc_tls_stub: /* Call offset in %g3 */' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsrl\t%g3, 10, %g3' + print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1' + print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1' + print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)' + print '\tGL_LL\t[%g7+%g2], %g1' + print '\tGL_LL\t[%g1 + %g3], %g1' + print '\tjmp\t%g1' + print '\t nop' + print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub' + print '' + print '#define GL_STUB(fn, off)\t\t\t\t\\' + print '\tGLOBL_FN(fn);\t\t\t\t\t\\' + print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\' + print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\' + print '\t.size\tfn,.-fn;' + print '' + print '#elif defined(PTHREADS)' + print '' + print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */' + print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */' + print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */' + print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */' + print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */' + print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */' + print '' + print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */' + print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */' + print '' + print '\t.data' + print '\t.align\t32' + print '' + print '\tGLOBL_FN(__glapi_sparc_pthread_stub)' + print '\tHIDDEN(__glapi_sparc_pthread_stub)' + print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsethi\t%hi(_glapi_Dispatch), %g1' + print '\tor\t%g1, %lo(_glapi_Dispatch), %g1' + print '\tsrl\t%g3, 10, %g3' + print '\tGL_LL\t[%g2+%g1], %g2' + print '\tGL_LL\t[%g2], %g1' + print '\tcmp\t%g1, 0' + print '\tbe\t2f' + print '\t nop' + print '1:\tGL_LL\t[%g1 + %g3], %g1' + print '\tjmp\t%g1' + print '\t nop' + print '2:\tsave\t%sp, GL_STACK_SIZE, %sp' + print '\tmov\t%g3, %l0' + print '\tcall\t_glapi_get_dispatch' + print '\t nop' + print '\tmov\t%o0, %g1' + print '\tmov\t%l0, %g3' + print '\tba\t1b' + print '\t restore %g0, %g0, %g0' + print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub' + print '' + print '#define GL_STUB(fn, off)\t\t\t\\' + print '\tGLOBL_FN(fn);\t\t\t\t\\' + print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\' + print '\t sethi\tGL_OFF(off), %g3;\t\t\\' + print '\t.size\tfn,.-fn;' + print '' + print '#else /* Non-threaded version. */' print '' - print '.data' - print '.align 64' + print '\t.type __glapi_sparc_nothread_stub, @function' + print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */' + print '\tmov\t%o7, %g1' + print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2' + print '\tcall\t__glapi_sparc_get_pc' + print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2' + print '\tmov\t%g1, %o7' + print '\tsrl\t%g3, 10, %g3' + print '\tsethi\t%hi(_glapi_Dispatch), %g1' + print '\tor\t%g1, %lo(_glapi_Dispatch), %g1' + print '\tGL_LL\t[%g2+%g1], %g2' + print '\tGL_LL\t[%g2], %g1' + print '\tGL_LL\t[%g1 + %g3], %g1' + print '\tjmp\t%g1' + print '\t nop' + print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub' + print '' + print '#define GL_STUB(fn, off)\t\t\t\\' + print '\tGLOBL_FN(fn);\t\t\t\t\\' + print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\' + print '\t sethi\tGL_OFF(off), %g3;\t\t\\' + print '\t.size\tfn,.-fn;' + print '' + print '#endif' + print '' + print '#define GL_STUB_ALIAS(fn, alias) \\' + print ' .globl fn; \\' + print ' .set fn, alias' + print '' + print '\t.text' + print '\t.align\t32' + print '' + print '\t.globl\tgl_dispatch_functions_start' + print '\tHIDDEN(gl_dispatch_functions_start)' + print 'gl_dispatch_functions_start:' print '' return + def printRealFooter(self): + print '' + print '\t.globl\tgl_dispatch_functions_end' + print '\tHIDDEN(gl_dispatch_functions_end)' + print 'gl_dispatch_functions_end:' + return def printBody(self, api): for f in api.functionIterateByOffset(): - if f.is_static_entry_point(f.name): - name = f.name - else: - name = "_dispatch_stub_%u" % (f.offset) + name = f.dispatch_name() - print '\t\t.globl gl%s ; .type gl%s,#function' % (name, name) + print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, f.name) - print '\t\t.globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function' - print '_mesa_sparc_glapi_begin:' - print '' + if not f.is_static_entry_point(f.name): + print '\tHIDDEN(gl%s)' % (name) for f in api.functionIterateByOffset(): - if f.is_static_entry_point(f.name): - name = f.name - else: - name = "_dispatch_stub_%u" % (f.offset) - - print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, name) + name = f.dispatch_name() - print '' - print '\t\t.globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function' - print '_mesa_sparc_glapi_end:' - print '' - - - for f in api.functionIterateByOffset(): - for n in f.entry_points: - if n != f.name: - if f.is_static_entry_point(n): - text = '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name) + if f.is_static_entry_point(f.name): + for n in f.entry_points: + if n != f.name: + text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name) if f.has_different_protocol(n): print '#ifndef GLX_INDIRECT_RENDERING' diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index e20618abc1..2b105d0f17 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -318,6 +318,14 @@ extern const GLubyte gl_dispatch_functions_start[]; # endif #endif +#ifdef USE_SPARC_ASM +#ifdef GLX_USE_TLS +extern unsigned int __glapi_sparc_tls_stub; +#else +extern unsigned int __glapi_sparc_pthread_stub; +#endif +#endif + #if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer) # define NEED_FUNCTION_POINTER #endif @@ -344,6 +352,129 @@ init_glapi_relocs( void ) curr_func += DISPATCH_FUNCTION_SIZE; } #endif +#ifdef USE_SPARC_ASM + extern void __glapi_sparc_icache_flush(unsigned int *); + static const unsigned int template[] = { +#ifdef GLX_USE_TLS + 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */ + 0x8730e00a, /* srl %g3, 10, %g3 */ + 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */ +#ifdef __arch64__ + 0xc259c002, /* ldx [%g7 + %g2], %g1 */ + 0xc2584003, /* ldx [%g1 + %g3], %g1 */ +#else + 0xc201c002, /* ld [%g7 + %g2], %g1 */ + 0xc2004003, /* ld [%g1 + %g3], %g1 */ +#endif + 0x81c04000, /* jmp %g1 */ + 0x01000000, /* nop */ +#else +#ifdef __arch64__ + 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */ + 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */ + 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */ + 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */ + 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */ + 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */ + 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */ +#else + 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */ + 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */ + 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ +#endif + 0x80a06000, /* --> cmp %g1, 0 */ + 0x02800005, /* --> be +4*5 */ + 0x01000000, /* --> nop */ +#ifdef __arch64__ + 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */ +#else + 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */ +#endif + 0x81c04000, /* --> jmp %g1 */ + 0x01000000, /* --> nop */ +#ifdef __arch64__ + 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */ +#else + 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */ +#endif + 0xa0100003, /* --> mov %g3, %l0 */ + 0x40000000, /* --> call _glapi_get_dispatch */ + 0x01000000, /* --> nop */ + 0x82100008, /* --> mov %o0, %g1 */ + 0x86100010, /* --> mov %l0, %g3 */ + 0x10bffff7, /* --> ba -4*9 */ + 0x81e80000, /* --> restore */ +#endif + }; +#ifdef GLX_USE_TLS + extern unsigned long __glapi_sparc_get_dispatch(void); + unsigned int *code = &__glapi_sparc_tls_stub; + unsigned long dispatch = __glapi_sparc_get_dispatch(); +#else + unsigned int *code = &__glapi_sparc_pthread_stub; + unsigned long dispatch = (unsigned long) &_glapi_Dispatch; + unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch; + int idx; +#endif + +#if defined(GLX_USE_TLS) + code[0] = template[0] | (dispatch >> 10); + code[1] = template[1]; + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | (dispatch & 0x3ff); + code[3] = template[3]; + __glapi_sparc_icache_flush(&code[2]); + code[4] = template[4]; + code[5] = template[5]; + __glapi_sparc_icache_flush(&code[4]); + code[6] = template[6]; + __glapi_sparc_icache_flush(&code[6]); +#else +#if defined(__arch64__) + code[0] = template[0] | (dispatch >> (32 + 10)); + code[1] = template[1] | ((dispatch & 0xffffffff) >> 10); + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | ((dispatch >> 32) & 0x3ff); + code[3] = template[3]; + __glapi_sparc_icache_flush(&code[2]); + code[4] = template[4]; + code[5] = template[5]; + __glapi_sparc_icache_flush(&code[4]); + code[6] = template[6] | (dispatch & 0x3ff); + idx = 7; +#else + code[0] = template[0] | (dispatch >> 10); + code[1] = template[1]; + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | (dispatch & 0x3ff); + idx = 3; +#endif + code[idx + 0] = template[idx + 0]; + __glapi_sparc_icache_flush(&code[idx - 1]); + code[idx + 1] = template[idx + 1]; + code[idx + 2] = template[idx + 2]; + __glapi_sparc_icache_flush(&code[idx + 1]); + code[idx + 3] = template[idx + 3]; + code[idx + 4] = template[idx + 4]; + __glapi_sparc_icache_flush(&code[idx + 3]); + code[idx + 5] = template[idx + 5]; + code[idx + 6] = template[idx + 6]; + __glapi_sparc_icache_flush(&code[idx + 5]); + code[idx + 7] = template[idx + 7]; + code[idx + 8] = template[idx + 8] | + (((call_dest - ((unsigned long) &code[idx + 8])) + >> 2) & 0x3fffffff); + __glapi_sparc_icache_flush(&code[idx + 7]); + code[idx + 9] = template[idx + 9]; + code[idx + 10] = template[idx + 10]; + __glapi_sparc_icache_flush(&code[idx + 9]); + code[idx + 11] = template[idx + 11]; + code[idx + 12] = template[idx + 12]; + __glapi_sparc_icache_flush(&code[idx + 11]); + code[idx + 13] = template[idx + 13]; + __glapi_sparc_icache_flush(&code[idx + 13]); +#endif +#endif } #endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */ diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index 4adc1aece0..764e2ef98e 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -259,53 +259,30 @@ generate_entrypoint(GLuint functionOffset) } return (_glapi_proc) code; -#elif defined(USE_SPARC_ASM) - -#ifdef __arch64__ - static const unsigned int insn_template[] = { - 0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */ - 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ - 0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */ - 0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */ - 0x8528b020, /* sllx %g2, 32, %g2 */ - 0xc2584002, /* ldx [%g1 + %g2], %g1 */ - 0x05000000, /* sethi %hi(8 * glapioffset), %g2 */ - 0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */ - 0xc6584002, /* ldx [%g1 + %g2], %g3 */ - 0x81c0c000, /* jmpl %g3, %g0 */ - 0x01000000 /* nop */ +#elif defined(USE_SPARC_ASM) && (defined(PTHREADS) || defined(GLX_USE_TLS)) + static const unsigned int template[] = { + 0x07000000, /* sethi %hi(0), %g3 */ + 0x8210000f, /* mov %o7, %g1 */ + 0x40000000, /* call */ + 0x9e100001, /* mov %g1, %o7 */ }; +#ifdef GLX_USE_TLS + extern unsigned int __glapi_sparc_tls_stub; + unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub; #else - static const unsigned int insn_template[] = { - 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ - 0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ - 0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */ - 0x81c0c000, /* jmpl %g3, %g0 */ - 0x01000000 /* nop */ - }; -#endif /* __arch64__ */ - unsigned int *code = (unsigned int *) malloc(sizeof(insn_template)); - unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch; + extern unsigned int __glapi_sparc_pthread_stub; + unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub; +#endif + unsigned int *code = (unsigned int *) malloc(sizeof(template)); if (code) { - memcpy(code, insn_template, sizeof(insn_template)); - -#ifdef __arch64__ - code[0] |= (glapi_addr >> (32 + 10)); - code[1] |= ((glapi_addr & 0xffffffff) >> 10); + code[0] = template[0] | (functionOffset & 0x3fffff); + code[1] = template[1]; __glapi_sparc_icache_flush(&code[0]); - code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1)); - code[3] |= (glapi_addr & ((1 << 10) - 1)); + code[2] = template[2] | + (((call_dest - ((unsigned long) &code[2])) + >> 2) & 0x3fffffff); + code[3] = template[3]; __glapi_sparc_icache_flush(&code[2]); - code[6] |= ((functionOffset * 8) >> 10); - code[7] |= ((functionOffset * 8) & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&code[6]); -#else - code[0] |= (glapi_addr >> 10); - code[1] |= (glapi_addr & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&code[0]); - code[2] |= (functionOffset * 4); - __glapi_sparc_icache_flush(&code[2]); -#endif /* __arch64__ */ } return (_glapi_proc) code; #else @@ -337,21 +314,10 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset) #endif #elif defined(USE_SPARC_ASM) - - /* XXX this hasn't been tested! */ unsigned int *code = (unsigned int *) entrypoint; -#ifdef __arch64__ - code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */ - code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */ - code[6] |= ((offset * 8) >> 10); - code[7] |= ((offset * 8) & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&code[6]); -#else /* __arch64__ */ - code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */ - code[2] |= (offset * 4); - __glapi_sparc_icache_flush(&code[2]); -#endif /* __arch64__ */ - + code[0] &= ~0x3fffff; + code[0] |= (offset * sizeof(void *)) & 0x3fffff; + __glapi_sparc_icache_flush(&code[0]); #else /* an unimplemented architecture */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index a94bbf3fdf..fb43054cdd 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -390,9 +390,6 @@ one_time_init( GLcontext *ctx ) _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; } -#ifdef USE_SPARC_ASM - _mesa_init_sparc_glapi_relocs(); -#endif if (_mesa_getenv("MESA_DEBUG")) { _glapi_noop_enable_warnings(GL_TRUE); _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 7d215939b4..bf70fceef5 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -26,818 +26,176 @@ * SOFTWARE. */ -#include "glapioffsets.h" +#include "glapi/glapioffsets.h" #ifdef __arch64__ -# define GL_STUB(fn,off) \ -fn: \ - sethi %hi(0xDEADBEEF), %g4 ; \ - sethi %hi(0xDEADBEEF), %g1 ; \ - or %g4, %lo(0xDEADBEEF), %g4 ; \ - or %g1, %lo(0xDEADBEEF), %g1 ; \ - sllx %g4, 32, %g4 ; \ - ldx [%g1 + %g4], %g1 ; \ - sethi %hi(8 * off), %g4 ; \ - or %g4, %lo(8 * off), %g4 ; \ - ldx [%g1 + %g4], %g5 ; \ - jmpl %g5, %g0 ; \ - nop +#define GL_OFF(N) ((N) * 8) +#define GL_LL ldx +#define GL_TIE_LD(SYM) %tie_ldx(SYM) +#define GL_STACK_SIZE 128 #else -# define GL_STUB(fn,off) \ -fn: \ - sethi %hi(0xDEADBEEF), %g1 ; \ - ld [%g1 + %lo(0xDEADBEEF)], %g1 ; \ - ld [%g1 + (4 * off)], %g5 ; \ - jmpl %g5, %g0 ; \ - nop +#define GL_OFF(N) ((N) * 4) +#define GL_LL ld +#define GL_TIE_LD(SYM) %tie_ld(SYM) +#define GL_STACK_SIZE 64 #endif -#define GL_STUB_ALIAS(fn,alias) fn = alias +#define GLOBL_FN(x) .globl x ; .type x, @function +#define HIDDEN(x) .hidden x -.text -.align 32 - .globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function + .register %g2, #scratch + .register %g3, #scratch + + .text + + GLOBL_FN(__glapi_sparc_icache_flush) + HIDDEN(__glapi_sparc_icache_flush) + .type __glapi_sparc_icache_flush, @function __glapi_sparc_icache_flush: /* %o0 = insn_addr */ flush %o0 retl - nop + nop + + .align 32 + + .type __glapi_sparc_get_pc, @function +__glapi_sparc_get_pc: + retl + add %o7, %g2, %g2 + .size __glapi_sparc_get_pc, .-__glapi_sparc_get_pc + +#ifdef GLX_USE_TLS + + GLOBL_FN(__glapi_sparc_get_dispatch) + HIDDEN(__glapi_sparc_get_dispatch) +__glapi_sparc_get_dispatch: + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + sethi %tie_hi22(_glapi_tls_Dispatch), %g1 + add %g1, %tie_lo10(_glapi_tls_Dispatch), %g1 + GL_LL [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch) + retl + mov %g2, %o0 + + .data + .align 32 + + /* --> sethi %hi(_glapi_tls_Dispatch), %g1 */ + /* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */ + GLOBL_FN(__glapi_sparc_tls_stub) + HIDDEN(__glapi_sparc_tls_stub) +__glapi_sparc_tls_stub: /* Call offset in %g3 */ + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + srl %g3, 10, %g3 + sethi %tie_hi22(_glapi_tls_Dispatch), %g1 + add %g1, %tie_lo10(_glapi_tls_Dispatch), %g1 + GL_LL [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch) + GL_LL [%g7+%g2], %g1 + GL_LL [%g1 + %g3], %g1 + jmp %g1 + nop + .size __glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub + +#define GL_STUB(fn, off) \ + GLOBL_FN(fn); \ +fn: ba __glapi_sparc_tls_stub; \ + sethi GL_OFF(off), %g3; \ + .size fn,.-fn; + +#elif defined(PTHREADS) + + /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */ + /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */ + /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */ + /* 64-bit 0x0c --> sllx %g1, 32, %g1 */ + /* 64-bit 0x10 --> add %g1, %g2, %g1 */ + /* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */ -.data -.align 64 + /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */ + /* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ - .globl glNewList ; .type glNewList,#function - .globl glEndList ; .type glEndList,#function - .globl glCallList ; .type glCallList,#function - .globl glCallLists ; .type glCallLists,#function - .globl glDeleteLists ; .type glDeleteLists,#function - .globl glGenLists ; .type glGenLists,#function - .globl glListBase ; .type glListBase,#function - .globl glBegin ; .type glBegin,#function - .globl glBitmap ; .type glBitmap,#function - .globl glColor3b ; .type glColor3b,#function - .globl glColor3bv ; .type glColor3bv,#function - .globl glColor3d ; .type glColor3d,#function - .globl glColor3dv ; .type glColor3dv,#function - .globl glColor3f ; .type glColor3f,#function - .globl glColor3fv ; .type glColor3fv,#function - .globl glColor3i ; .type glColor3i,#function - .globl glColor3iv ; .type glColor3iv,#function - .globl glColor3s ; .type glColor3s,#function - .globl glColor3sv ; .type glColor3sv,#function - .globl glColor3ub ; .type glColor3ub,#function - .globl glColor3ubv ; .type glColor3ubv,#function - .globl glColor3ui ; .type glColor3ui,#function - .globl glColor3uiv ; .type glColor3uiv,#function - .globl glColor3us ; .type glColor3us,#function - .globl glColor3usv ; .type glColor3usv,#function - .globl glColor4b ; .type glColor4b,#function - .globl glColor4bv ; .type glColor4bv,#function - .globl glColor4d ; .type glColor4d,#function - .globl glColor4dv ; .type glColor4dv,#function - .globl glColor4f ; .type glColor4f,#function - .globl glColor4fv ; .type glColor4fv,#function - .globl glColor4i ; .type glColor4i,#function - .globl glColor4iv ; .type glColor4iv,#function - .globl glColor4s ; .type glColor4s,#function - .globl glColor4sv ; .type glColor4sv,#function - .globl glColor4ub ; .type glColor4ub,#function - .globl glColor4ubv ; .type glColor4ubv,#function - .globl glColor4ui ; .type glColor4ui,#function - .globl glColor4uiv ; .type glColor4uiv,#function - .globl glColor4us ; .type glColor4us,#function - .globl glColor4usv ; .type glColor4usv,#function - .globl glEdgeFlag ; .type glEdgeFlag,#function - .globl glEdgeFlagv ; .type glEdgeFlagv,#function - .globl glEnd ; .type glEnd,#function - .globl glIndexd ; .type glIndexd,#function - .globl glIndexdv ; .type glIndexdv,#function - .globl glIndexf ; .type glIndexf,#function - .globl glIndexfv ; .type glIndexfv,#function - .globl glIndexi ; .type glIndexi,#function - .globl glIndexiv ; .type glIndexiv,#function - .globl glIndexs ; .type glIndexs,#function - .globl glIndexsv ; .type glIndexsv,#function - .globl glNormal3b ; .type glNormal3b,#function - .globl glNormal3bv ; .type glNormal3bv,#function - .globl glNormal3d ; .type glNormal3d,#function - .globl glNormal3dv ; .type glNormal3dv,#function - .globl glNormal3f ; .type glNormal3f,#function - .globl glNormal3fv ; .type glNormal3fv,#function - .globl glNormal3i ; .type glNormal3i,#function - .globl glNormal3iv ; .type glNormal3iv,#function - .globl glNormal3s ; .type glNormal3s,#function - .globl glNormal3sv ; .type glNormal3sv,#function - .globl glRasterPos2d ; .type glRasterPos2d,#function - .globl glRasterPos2dv ; .type glRasterPos2dv,#function - .globl glRasterPos2f ; .type glRasterPos2f,#function - .globl glRasterPos2fv ; .type glRasterPos2fv,#function - .globl glRasterPos2i ; .type glRasterPos2i,#function - .globl glRasterPos2iv ; .type glRasterPos2iv,#function - .globl glRasterPos2s ; .type glRasterPos2s,#function - .globl glRasterPos2sv ; .type glRasterPos2sv,#function - .globl glRasterPos3d ; .type glRasterPos3d,#function - .globl glRasterPos3dv ; .type glRasterPos3dv,#function - .globl glRasterPos3f ; .type glRasterPos3f,#function - .globl glRasterPos3fv ; .type glRasterPos3fv,#function - .globl glRasterPos3i ; .type glRasterPos3i,#function - .globl glRasterPos3iv ; .type glRasterPos3iv,#function - .globl glRasterPos3s ; .type glRasterPos3s,#function - .globl glRasterPos3sv ; .type glRasterPos3sv,#function - .globl glRasterPos4d ; .type glRasterPos4d,#function - .globl glRasterPos4dv ; .type glRasterPos4dv,#function - .globl glRasterPos4f ; .type glRasterPos4f,#function - .globl glRasterPos4fv ; .type glRasterPos4fv,#function - .globl glRasterPos4i ; .type glRasterPos4i,#function - .globl glRasterPos4iv ; .type glRasterPos4iv,#function - .globl glRasterPos4s ; .type glRasterPos4s,#function - .globl glRasterPos4sv ; .type glRasterPos4sv,#function - .globl glRectd ; .type glRectd,#function - .globl glRectdv ; .type glRectdv,#function - .globl glRectf ; .type glRectf,#function - .globl glRectfv ; .type glRectfv,#function - .globl glRecti ; .type glRecti,#function - .globl glRectiv ; .type glRectiv,#function - .globl glRects ; .type glRects,#function - .globl glRectsv ; .type glRectsv,#function - .globl glTexCoord1d ; .type glTexCoord1d,#function - .globl glTexCoord1dv ; .type glTexCoord1dv,#function - .globl glTexCoord1f ; .type glTexCoord1f,#function - .globl glTexCoord1fv ; .type glTexCoord1fv,#function - .globl glTexCoord1i ; .type glTexCoord1i,#function - .globl glTexCoord1iv ; .type glTexCoord1iv,#function - .globl glTexCoord1s ; .type glTexCoord1s,#function - .globl glTexCoord1sv ; .type glTexCoord1sv,#function - .globl glTexCoord2d ; .type glTexCoord2d,#function - .globl glTexCoord2dv ; .type glTexCoord2dv,#function - .globl glTexCoord2f ; .type glTexCoord2f,#function - .globl glTexCoord2fv ; .type glTexCoord2fv,#function - .globl glTexCoord2i ; .type glTexCoord2i,#function - .globl glTexCoord2iv ; .type glTexCoord2iv,#function - .globl glTexCoord2s ; .type glTexCoord2s,#function - .globl glTexCoord2sv ; .type glTexCoord2sv,#function - .globl glTexCoord3d ; .type glTexCoord3d,#function - .globl glTexCoord3dv ; .type glTexCoord3dv,#function - .globl glTexCoord3f ; .type glTexCoord3f,#function - .globl glTexCoord3fv ; .type glTexCoord3fv,#function - .globl glTexCoord3i ; .type glTexCoord3i,#function - .globl glTexCoord3iv ; .type glTexCoord3iv,#function - .globl glTexCoord3s ; .type glTexCoord3s,#function - .globl glTexCoord3sv ; .type glTexCoord3sv,#function - .globl glTexCoord4d ; .type glTexCoord4d,#function - .globl glTexCoord4dv ; .type glTexCoord4dv,#function - .globl glTexCoord4f ; .type glTexCoord4f,#function - .globl glTexCoord4fv ; .type glTexCoord4fv,#function - .globl glTexCoord4i ; .type glTexCoord4i,#function - .globl glTexCoord4iv ; .type glTexCoord4iv,#function - .globl glTexCoord4s ; .type glTexCoord4s,#function - .globl glTexCoord4sv ; .type glTexCoord4sv,#function - .globl glVertex2d ; .type glVertex2d,#function - .globl glVertex2dv ; .type glVertex2dv,#function - .globl glVertex2f ; .type glVertex2f,#function - .globl glVertex2fv ; .type glVertex2fv,#function - .globl glVertex2i ; .type glVertex2i,#function - .globl glVertex2iv ; .type glVertex2iv,#function - .globl glVertex2s ; .type glVertex2s,#function - .globl glVertex2sv ; .type glVertex2sv,#function - .globl glVertex3d ; .type glVertex3d,#function - .globl glVertex3dv ; .type glVertex3dv,#function - .globl glVertex3f ; .type glVertex3f,#function - .globl glVertex3fv ; .type glVertex3fv,#function - .globl glVertex3i ; .type glVertex3i,#function - .globl glVertex3iv ; .type glVertex3iv,#function - .globl glVertex3s ; .type glVertex3s,#function - .globl glVertex3sv ; .type glVertex3sv,#function - .globl glVertex4d ; .type glVertex4d,#function - .globl glVertex4dv ; .type glVertex4dv,#function - .globl glVertex4f ; .type glVertex4f,#function - .globl glVertex4fv ; .type glVertex4fv,#function - .globl glVertex4i ; .type glVertex4i,#function - .globl glVertex4iv ; .type glVertex4iv,#function - .globl glVertex4s ; .type glVertex4s,#function - .globl glVertex4sv ; .type glVertex4sv,#function - .globl glClipPlane ; .type glClipPlane,#function - .globl glColorMaterial ; .type glColorMaterial,#function - .globl glCullFace ; .type glCullFace,#function - .globl glFogf ; .type glFogf,#function - .globl glFogfv ; .type glFogfv,#function - .globl glFogi ; .type glFogi,#function - .globl glFogiv ; .type glFogiv,#function - .globl glFrontFace ; .type glFrontFace,#function - .globl glHint ; .type glHint,#function - .globl glLightf ; .type glLightf,#function - .globl glLightfv ; .type glLightfv,#function - .globl glLighti ; .type glLighti,#function - .globl glLightiv ; .type glLightiv,#function - .globl glLightModelf ; .type glLightModelf,#function - .globl glLightModelfv ; .type glLightModelfv,#function - .globl glLightModeli ; .type glLightModeli,#function - .globl glLightModeliv ; .type glLightModeliv,#function - .globl glLineStipple ; .type glLineStipple,#function - .globl glLineWidth ; .type glLineWidth,#function - .globl glMaterialf ; .type glMaterialf,#function - .globl glMaterialfv ; .type glMaterialfv,#function - .globl glMateriali ; .type glMateriali,#function - .globl glMaterialiv ; .type glMaterialiv,#function - .globl glPointSize ; .type glPointSize,#function - .globl glPolygonMode ; .type glPolygonMode,#function - .globl glPolygonStipple ; .type glPolygonStipple,#function - .globl glScissor ; .type glScissor,#function - .globl glShadeModel ; .type glShadeModel,#function - .globl glTexParameterf ; .type glTexParameterf,#function - .globl glTexParameterfv ; .type glTexParameterfv,#function - .globl glTexParameteri ; .type glTexParameteri,#function - .globl glTexParameteriv ; .type glTexParameteriv,#function - .globl glTexImage1D ; .type glTexImage1D,#function - .globl glTexImage2D ; .type glTexImage2D,#function - .globl glTexEnvf ; .type glTexEnvf,#function - .globl glTexEnvfv ; .type glTexEnvfv,#function - .globl glTexEnvi ; .type glTexEnvi,#function - .globl glTexEnviv ; .type glTexEnviv,#function - .globl glTexGend ; .type glTexGend,#function - .globl glTexGendv ; .type glTexGendv,#function - .globl glTexGenf ; .type glTexGenf,#function - .globl glTexGenfv ; .type glTexGenfv,#function - .globl glTexGeni ; .type glTexGeni,#function - .globl glTexGeniv ; .type glTexGeniv,#function - .globl glFeedbackBuffer ; .type glFeedbackBuffer,#function - .globl glSelectBuffer ; .type glSelectBuffer,#function - .globl glRenderMode ; .type glRenderMode,#function - .globl glInitNames ; .type glInitNames,#function - .globl glLoadName ; .type glLoadName,#function - .globl glPassThrough ; .type glPassThrough,#function - .globl glPopName ; .type glPopName,#function - .globl glPushName ; .type glPushName,#function - .globl glDrawBuffer ; .type glDrawBuffer,#function - .globl glClear ; .type glClear,#function - .globl glClearAccum ; .type glClearAccum,#function - .globl glClearIndex ; .type glClearIndex,#function - .globl glClearColor ; .type glClearColor,#function - .globl glClearStencil ; .type glClearStencil,#function - .globl glClearDepth ; .type glClearDepth,#function - .globl glStencilMask ; .type glStencilMask,#function - .globl glColorMask ; .type glColorMask,#function - .globl glDepthMask ; .type glDepthMask,#function - .globl glIndexMask ; .type glIndexMask,#function - .globl glAccum ; .type glAccum,#function - .globl glDisable ; .type glDisable,#function - .globl glEnable ; .type glEnable,#function - .globl glFinish ; .type glFinish,#function - .globl glFlush ; .type glFlush,#function - .globl glPopAttrib ; .type glPopAttrib,#function - .globl glPushAttrib ; .type glPushAttrib,#function - .globl glMap1d ; .type glMap1d,#function - .globl glMap1f ; .type glMap1f,#function - .globl glMap2d ; .type glMap2d,#function - .globl glMap2f ; .type glMap2f,#function - .globl glMapGrid1d ; .type glMapGrid1d,#function - .globl glMapGrid1f ; .type glMapGrid1f,#function - .globl glMapGrid2d ; .type glMapGrid2d,#function - .globl glMapGrid2f ; .type glMapGrid2f,#function - .globl glEvalCoord1d ; .type glEvalCoord1d,#function - .globl glEvalCoord1dv ; .type glEvalCoord1dv,#function - .globl glEvalCoord1f ; .type glEvalCoord1f,#function - .globl glEvalCoord1fv ; .type glEvalCoord1fv,#function - .globl glEvalCoord2d ; .type glEvalCoord2d,#function - .globl glEvalCoord2dv ; .type glEvalCoord2dv,#function - .globl glEvalCoord2f ; .type glEvalCoord2f,#function - .globl glEvalCoord2fv ; .type glEvalCoord2fv,#function - .globl glEvalMesh1 ; .type glEvalMesh1,#function - .globl glEvalPoint1 ; .type glEvalPoint1,#function - .globl glEvalMesh2 ; .type glEvalMesh2,#function - .globl glEvalPoint2 ; .type glEvalPoint2,#function - .globl glAlphaFunc ; .type glAlphaFunc,#function - .globl glBlendFunc ; .type glBlendFunc,#function - .globl glLogicOp ; .type glLogicOp,#function - .globl glStencilFunc ; .type glStencilFunc,#function - .globl glStencilOp ; .type glStencilOp,#function - .globl glDepthFunc ; .type glDepthFunc,#function - .globl glPixelZoom ; .type glPixelZoom,#function - .globl glPixelTransferf ; .type glPixelTransferf,#function - .globl glPixelTransferi ; .type glPixelTransferi,#function - .globl glPixelStoref ; .type glPixelStoref,#function - .globl glPixelStorei ; .type glPixelStorei,#function - .globl glPixelMapfv ; .type glPixelMapfv,#function - .globl glPixelMapuiv ; .type glPixelMapuiv,#function - .globl glPixelMapusv ; .type glPixelMapusv,#function - .globl glReadBuffer ; .type glReadBuffer,#function - .globl glCopyPixels ; .type glCopyPixels,#function - .globl glReadPixels ; .type glReadPixels,#function - .globl glDrawPixels ; .type glDrawPixels,#function - .globl glGetBooleanv ; .type glGetBooleanv,#function - .globl glGetClipPlane ; .type glGetClipPlane,#function - .globl glGetDoublev ; .type glGetDoublev,#function - .globl glGetError ; .type glGetError,#function - .globl glGetFloatv ; .type glGetFloatv,#function - .globl glGetIntegerv ; .type glGetIntegerv,#function - .globl glGetLightfv ; .type glGetLightfv,#function - .globl glGetLightiv ; .type glGetLightiv,#function - .globl glGetMapdv ; .type glGetMapdv,#function - .globl glGetMapfv ; .type glGetMapfv,#function - .globl glGetMapiv ; .type glGetMapiv,#function - .globl glGetMaterialfv ; .type glGetMaterialfv,#function - .globl glGetMaterialiv ; .type glGetMaterialiv,#function - .globl glGetPixelMapfv ; .type glGetPixelMapfv,#function - .globl glGetPixelMapuiv ; .type glGetPixelMapuiv,#function - .globl glGetPixelMapusv ; .type glGetPixelMapusv,#function - .globl glGetPolygonStipple ; .type glGetPolygonStipple,#function - .globl glGetString ; .type glGetString,#function - .globl glGetTexEnvfv ; .type glGetTexEnvfv,#function - .globl glGetTexEnviv ; .type glGetTexEnviv,#function - .globl glGetTexGendv ; .type glGetTexGendv,#function - .globl glGetTexGenfv ; .type glGetTexGenfv,#function - .globl glGetTexGeniv ; .type glGetTexGeniv,#function - .globl glGetTexImage ; .type glGetTexImage,#function - .globl glGetTexParameterfv ; .type glGetTexParameterfv,#function - .globl glGetTexParameteriv ; .type glGetTexParameteriv,#function - .globl glGetTexLevelParameterfv ; .type glGetTexLevelParameterfv,#function - .globl glGetTexLevelParameteriv ; .type glGetTexLevelParameteriv,#function - .globl glIsEnabled ; .type glIsEnabled,#function - .globl glIsList ; .type glIsList,#function - .globl glDepthRange ; .type glDepthRange,#function - .globl glFrustum ; .type glFrustum,#function - .globl glLoadIdentity ; .type glLoadIdentity,#function - .globl glLoadMatrixf ; .type glLoadMatrixf,#function - .globl glLoadMatrixd ; .type glLoadMatrixd,#function - .globl glMatrixMode ; .type glMatrixMode,#function - .globl glMultMatrixf ; .type glMultMatrixf,#function - .globl glMultMatrixd ; .type glMultMatrixd,#function - .globl glOrtho ; .type glOrtho,#function - .globl glPopMatrix ; .type glPopMatrix,#function - .globl glPushMatrix ; .type glPushMatrix,#function - .globl glRotated ; .type glRotated,#function - .globl glRotatef ; .type glRotatef,#function - .globl glScaled ; .type glScaled,#function - .globl glScalef ; .type glScalef,#function - .globl glTranslated ; .type glTranslated,#function - .globl glTranslatef ; .type glTranslatef,#function - .globl glViewport ; .type glViewport,#function - .globl glArrayElement ; .type glArrayElement,#function - .globl glBindTexture ; .type glBindTexture,#function - .globl glColorPointer ; .type glColorPointer,#function - .globl glDisableClientState ; .type glDisableClientState,#function - .globl glDrawArrays ; .type glDrawArrays,#function - .globl glDrawElements ; .type glDrawElements,#function - .globl glEdgeFlagPointer ; .type glEdgeFlagPointer,#function - .globl glEnableClientState ; .type glEnableClientState,#function - .globl glIndexPointer ; .type glIndexPointer,#function - .globl glIndexub ; .type glIndexub,#function - .globl glIndexubv ; .type glIndexubv,#function - .globl glInterleavedArrays ; .type glInterleavedArrays,#function - .globl glNormalPointer ; .type glNormalPointer,#function - .globl glPolygonOffset ; .type glPolygonOffset,#function - .globl glTexCoordPointer ; .type glTexCoordPointer,#function - .globl glVertexPointer ; .type glVertexPointer,#function - .globl glAreTexturesResident ; .type glAreTexturesResident,#function - .globl glCopyTexImage1D ; .type glCopyTexImage1D,#function - .globl glCopyTexImage2D ; .type glCopyTexImage2D,#function - .globl glCopyTexSubImage1D ; .type glCopyTexSubImage1D,#function - .globl glCopyTexSubImage2D ; .type glCopyTexSubImage2D,#function - .globl glDeleteTextures ; .type glDeleteTextures,#function - .globl glGenTextures ; .type glGenTextures,#function - .globl glGetPointerv ; .type glGetPointerv,#function - .globl glIsTexture ; .type glIsTexture,#function - .globl glPrioritizeTextures ; .type glPrioritizeTextures,#function - .globl glTexSubImage1D ; .type glTexSubImage1D,#function - .globl glTexSubImage2D ; .type glTexSubImage2D,#function - .globl glPopClientAttrib ; .type glPopClientAttrib,#function - .globl glPushClientAttrib ; .type glPushClientAttrib,#function - .globl glBlendColor ; .type glBlendColor,#function - .globl glBlendEquation ; .type glBlendEquation,#function - .globl glDrawRangeElements ; .type glDrawRangeElements,#function - .globl glColorTable ; .type glColorTable,#function - .globl glColorTableParameterfv ; .type glColorTableParameterfv,#function - .globl glColorTableParameteriv ; .type glColorTableParameteriv,#function - .globl glCopyColorTable ; .type glCopyColorTable,#function - .globl glGetColorTable ; .type glGetColorTable,#function - .globl glGetColorTableParameterfv ; .type glGetColorTableParameterfv,#function - .globl glGetColorTableParameteriv ; .type glGetColorTableParameteriv,#function - .globl glColorSubTable ; .type glColorSubTable,#function - .globl glCopyColorSubTable ; .type glCopyColorSubTable,#function - .globl glConvolutionFilter1D ; .type glConvolutionFilter1D,#function - .globl glConvolutionFilter2D ; .type glConvolutionFilter2D,#function - .globl glConvolutionParameterf ; .type glConvolutionParameterf,#function - .globl glConvolutionParameterfv ; .type glConvolutionParameterfv,#function - .globl glConvolutionParameteri ; .type glConvolutionParameteri,#function - .globl glConvolutionParameteriv ; .type glConvolutionParameteriv,#function - .globl glCopyConvolutionFilter1D ; .type glCopyConvolutionFilter1D,#function - .globl glCopyConvolutionFilter2D ; .type glCopyConvolutionFilter2D,#function - .globl glGetConvolutionFilter ; .type glGetConvolutionFilter,#function - .globl glGetConvolutionParameterfv ; .type glGetConvolutionParameterfv,#function - .globl glGetConvolutionParameteriv ; .type glGetConvolutionParameteriv,#function - .globl glGetSeparableFilter ; .type glGetSeparableFilter,#function - .globl glSeparableFilter2D ; .type glSeparableFilter2D,#function - .globl glGetHistogram ; .type glGetHistogram,#function - .globl glGetHistogramParameterfv ; .type glGetHistogramParameterfv,#function - .globl glGetHistogramParameteriv ; .type glGetHistogramParameteriv,#function - .globl glGetMinmax ; .type glGetMinmax,#function - .globl glGetMinmaxParameterfv ; .type glGetMinmaxParameterfv,#function - .globl glGetMinmaxParameteriv ; .type glGetMinmaxParameteriv,#function - .globl glHistogram ; .type glHistogram,#function - .globl glMinmax ; .type glMinmax,#function - .globl glResetHistogram ; .type glResetHistogram,#function - .globl glResetMinmax ; .type glResetMinmax,#function - .globl glTexImage3D ; .type glTexImage3D,#function - .globl glTexSubImage3D ; .type glTexSubImage3D,#function - .globl glCopyTexSubImage3D ; .type glCopyTexSubImage3D,#function - .globl glActiveTextureARB ; .type glActiveTextureARB,#function - .globl glClientActiveTextureARB ; .type glClientActiveTextureARB,#function - .globl glMultiTexCoord1dARB ; .type glMultiTexCoord1dARB,#function - .globl glMultiTexCoord1dvARB ; .type glMultiTexCoord1dvARB,#function - .globl glMultiTexCoord1fARB ; .type glMultiTexCoord1fARB,#function - .globl glMultiTexCoord1fvARB ; .type glMultiTexCoord1fvARB,#function - .globl glMultiTexCoord1iARB ; .type glMultiTexCoord1iARB,#function - .globl glMultiTexCoord1ivARB ; .type glMultiTexCoord1ivARB,#function - .globl glMultiTexCoord1sARB ; .type glMultiTexCoord1sARB,#function - .globl glMultiTexCoord1svARB ; .type glMultiTexCoord1svARB,#function - .globl glMultiTexCoord2dARB ; .type glMultiTexCoord2dARB,#function - .globl glMultiTexCoord2dvARB ; .type glMultiTexCoord2dvARB,#function - .globl glMultiTexCoord2fARB ; .type glMultiTexCoord2fARB,#function - .globl glMultiTexCoord2fvARB ; .type glMultiTexCoord2fvARB,#function - .globl glMultiTexCoord2iARB ; .type glMultiTexCoord2iARB,#function - .globl glMultiTexCoord2ivARB ; .type glMultiTexCoord2ivARB,#function - .globl glMultiTexCoord2sARB ; .type glMultiTexCoord2sARB,#function - .globl glMultiTexCoord2svARB ; .type glMultiTexCoord2svARB,#function - .globl glMultiTexCoord3dARB ; .type glMultiTexCoord3dARB,#function - .globl glMultiTexCoord3dvARB ; .type glMultiTexCoord3dvARB,#function - .globl glMultiTexCoord3fARB ; .type glMultiTexCoord3fARB,#function - .globl glMultiTexCoord3fvARB ; .type glMultiTexCoord3fvARB,#function - .globl glMultiTexCoord3iARB ; .type glMultiTexCoord3iARB,#function - .globl glMultiTexCoord3ivARB ; .type glMultiTexCoord3ivARB,#function - .globl glMultiTexCoord3sARB ; .type glMultiTexCoord3sARB,#function - .globl glMultiTexCoord3svARB ; .type glMultiTexCoord3svARB,#function - .globl glMultiTexCoord4dARB ; .type glMultiTexCoord4dARB,#function - .globl glMultiTexCoord4dvARB ; .type glMultiTexCoord4dvARB,#function - .globl glMultiTexCoord4fARB ; .type glMultiTexCoord4fARB,#function - .globl glMultiTexCoord4fvARB ; .type glMultiTexCoord4fvARB,#function - .globl glMultiTexCoord4iARB ; .type glMultiTexCoord4iARB,#function - .globl glMultiTexCoord4ivARB ; .type glMultiTexCoord4ivARB,#function - .globl glMultiTexCoord4sARB ; .type glMultiTexCoord4sARB,#function - .globl glMultiTexCoord4svARB ; .type glMultiTexCoord4svARB,#function - .globl glAttachShader ; .type glAttachShader,#function - .globl glCreateProgram ; .type glCreateProgram,#function - .globl glCreateShader ; .type glCreateShader,#function - .globl glDeleteProgram ; .type glDeleteProgram,#function - .globl glDeleteShader ; .type glDeleteShader,#function - .globl glDetachShader ; .type glDetachShader,#function - .globl glGetAttachedShaders ; .type glGetAttachedShaders,#function - .globl glGetProgramInfoLog ; .type glGetProgramInfoLog,#function - .globl glGetProgramiv ; .type glGetProgramiv,#function - .globl glGetShaderInfoLog ; .type glGetShaderInfoLog,#function - .globl glGetShaderiv ; .type glGetShaderiv,#function - .globl glIsProgram ; .type glIsProgram,#function - .globl glIsShader ; .type glIsShader,#function - .globl glStencilFuncSeparate ; .type glStencilFuncSeparate,#function - .globl glStencilMaskSeparate ; .type glStencilMaskSeparate,#function - .globl glStencilOpSeparate ; .type glStencilOpSeparate,#function - .globl glUniformMatrix2x3fv ; .type glUniformMatrix2x3fv,#function - .globl glUniformMatrix2x4fv ; .type glUniformMatrix2x4fv,#function - .globl glUniformMatrix3x2fv ; .type glUniformMatrix3x2fv,#function - .globl glUniformMatrix3x4fv ; .type glUniformMatrix3x4fv,#function - .globl glUniformMatrix4x2fv ; .type glUniformMatrix4x2fv,#function - .globl glUniformMatrix4x3fv ; .type glUniformMatrix4x3fv,#function - .globl glLoadTransposeMatrixdARB ; .type glLoadTransposeMatrixdARB,#function - .globl glLoadTransposeMatrixfARB ; .type glLoadTransposeMatrixfARB,#function - .globl glMultTransposeMatrixdARB ; .type glMultTransposeMatrixdARB,#function - .globl glMultTransposeMatrixfARB ; .type glMultTransposeMatrixfARB,#function - .globl glSampleCoverageARB ; .type glSampleCoverageARB,#function - .globl glCompressedTexImage1DARB ; .type glCompressedTexImage1DARB,#function - .globl glCompressedTexImage2DARB ; .type glCompressedTexImage2DARB,#function - .globl glCompressedTexImage3DARB ; .type glCompressedTexImage3DARB,#function - .globl glCompressedTexSubImage1DARB ; .type glCompressedTexSubImage1DARB,#function - .globl glCompressedTexSubImage2DARB ; .type glCompressedTexSubImage2DARB,#function - .globl glCompressedTexSubImage3DARB ; .type glCompressedTexSubImage3DARB,#function - .globl glGetCompressedTexImageARB ; .type glGetCompressedTexImageARB,#function - .globl glDisableVertexAttribArrayARB ; .type glDisableVertexAttribArrayARB,#function - .globl glEnableVertexAttribArrayARB ; .type glEnableVertexAttribArrayARB,#function - .globl glGetProgramEnvParameterdvARB ; .type glGetProgramEnvParameterdvARB,#function - .globl glGetProgramEnvParameterfvARB ; .type glGetProgramEnvParameterfvARB,#function - .globl glGetProgramLocalParameterdvARB ; .type glGetProgramLocalParameterdvARB,#function - .globl glGetProgramLocalParameterfvARB ; .type glGetProgramLocalParameterfvARB,#function - .globl glGetProgramStringARB ; .type glGetProgramStringARB,#function - .globl glGetProgramivARB ; .type glGetProgramivARB,#function - .globl glGetVertexAttribdvARB ; .type glGetVertexAttribdvARB,#function - .globl glGetVertexAttribfvARB ; .type glGetVertexAttribfvARB,#function - .globl glGetVertexAttribivARB ; .type glGetVertexAttribivARB,#function - .globl glProgramEnvParameter4dARB ; .type glProgramEnvParameter4dARB,#function - .globl glProgramEnvParameter4dvARB ; .type glProgramEnvParameter4dvARB,#function - .globl glProgramEnvParameter4fARB ; .type glProgramEnvParameter4fARB,#function - .globl glProgramEnvParameter4fvARB ; .type glProgramEnvParameter4fvARB,#function - .globl glProgramLocalParameter4dARB ; .type glProgramLocalParameter4dARB,#function - .globl glProgramLocalParameter4dvARB ; .type glProgramLocalParameter4dvARB,#function - .globl glProgramLocalParameter4fARB ; .type glProgramLocalParameter4fARB,#function - .globl glProgramLocalParameter4fvARB ; .type glProgramLocalParameter4fvARB,#function - .globl glProgramStringARB ; .type glProgramStringARB,#function - .globl glVertexAttrib1dARB ; .type glVertexAttrib1dARB,#function - .globl glVertexAttrib1dvARB ; .type glVertexAttrib1dvARB,#function - .globl glVertexAttrib1fARB ; .type glVertexAttrib1fARB,#function - .globl glVertexAttrib1fvARB ; .type glVertexAttrib1fvARB,#function - .globl glVertexAttrib1sARB ; .type glVertexAttrib1sARB,#function - .globl glVertexAttrib1svARB ; .type glVertexAttrib1svARB,#function - .globl glVertexAttrib2dARB ; .type glVertexAttrib2dARB,#function - .globl glVertexAttrib2dvARB ; .type glVertexAttrib2dvARB,#function - .globl glVertexAttrib2fARB ; .type glVertexAttrib2fARB,#function - .globl glVertexAttrib2fvARB ; .type glVertexAttrib2fvARB,#function - .globl glVertexAttrib2sARB ; .type glVertexAttrib2sARB,#function - .globl glVertexAttrib2svARB ; .type glVertexAttrib2svARB,#function - .globl glVertexAttrib3dARB ; .type glVertexAttrib3dARB,#function - .globl glVertexAttrib3dvARB ; .type glVertexAttrib3dvARB,#function - .globl glVertexAttrib3fARB ; .type glVertexAttrib3fARB,#function - .globl glVertexAttrib3fvARB ; .type glVertexAttrib3fvARB,#function - .globl glVertexAttrib3sARB ; .type glVertexAttrib3sARB,#function - .globl glVertexAttrib3svARB ; .type glVertexAttrib3svARB,#function - .globl glVertexAttrib4NbvARB ; .type glVertexAttrib4NbvARB,#function - .globl glVertexAttrib4NivARB ; .type glVertexAttrib4NivARB,#function - .globl glVertexAttrib4NsvARB ; .type glVertexAttrib4NsvARB,#function - .globl glVertexAttrib4NubARB ; .type glVertexAttrib4NubARB,#function - .globl glVertexAttrib4NubvARB ; .type glVertexAttrib4NubvARB,#function - .globl glVertexAttrib4NuivARB ; .type glVertexAttrib4NuivARB,#function - .globl glVertexAttrib4NusvARB ; .type glVertexAttrib4NusvARB,#function - .globl glVertexAttrib4bvARB ; .type glVertexAttrib4bvARB,#function - .globl glVertexAttrib4dARB ; .type glVertexAttrib4dARB,#function - .globl glVertexAttrib4dvARB ; .type glVertexAttrib4dvARB,#function - .globl glVertexAttrib4fARB ; .type glVertexAttrib4fARB,#function - .globl glVertexAttrib4fvARB ; .type glVertexAttrib4fvARB,#function - .globl glVertexAttrib4ivARB ; .type glVertexAttrib4ivARB,#function - .globl glVertexAttrib4sARB ; .type glVertexAttrib4sARB,#function - .globl glVertexAttrib4svARB ; .type glVertexAttrib4svARB,#function - .globl glVertexAttrib4ubvARB ; .type glVertexAttrib4ubvARB,#function - .globl glVertexAttrib4uivARB ; .type glVertexAttrib4uivARB,#function - .globl glVertexAttrib4usvARB ; .type glVertexAttrib4usvARB,#function - .globl glVertexAttribPointerARB ; .type glVertexAttribPointerARB,#function - .globl glBindBufferARB ; .type glBindBufferARB,#function - .globl glBufferDataARB ; .type glBufferDataARB,#function - .globl glBufferSubDataARB ; .type glBufferSubDataARB,#function - .globl glDeleteBuffersARB ; .type glDeleteBuffersARB,#function - .globl glGenBuffersARB ; .type glGenBuffersARB,#function - .globl glGetBufferParameterivARB ; .type glGetBufferParameterivARB,#function - .globl glGetBufferPointervARB ; .type glGetBufferPointervARB,#function - .globl glGetBufferSubDataARB ; .type glGetBufferSubDataARB,#function - .globl glIsBufferARB ; .type glIsBufferARB,#function - .globl glMapBufferARB ; .type glMapBufferARB,#function - .globl glUnmapBufferARB ; .type glUnmapBufferARB,#function - .globl glBeginQueryARB ; .type glBeginQueryARB,#function - .globl glDeleteQueriesARB ; .type glDeleteQueriesARB,#function - .globl glEndQueryARB ; .type glEndQueryARB,#function - .globl glGenQueriesARB ; .type glGenQueriesARB,#function - .globl glGetQueryObjectivARB ; .type glGetQueryObjectivARB,#function - .globl glGetQueryObjectuivARB ; .type glGetQueryObjectuivARB,#function - .globl glGetQueryivARB ; .type glGetQueryivARB,#function - .globl glIsQueryARB ; .type glIsQueryARB,#function - .globl glAttachObjectARB ; .type glAttachObjectARB,#function - .globl glCompileShaderARB ; .type glCompileShaderARB,#function - .globl glCreateProgramObjectARB ; .type glCreateProgramObjectARB,#function - .globl glCreateShaderObjectARB ; .type glCreateShaderObjectARB,#function - .globl glDeleteObjectARB ; .type glDeleteObjectARB,#function - .globl glDetachObjectARB ; .type glDetachObjectARB,#function - .globl glGetActiveUniformARB ; .type glGetActiveUniformARB,#function - .globl glGetAttachedObjectsARB ; .type glGetAttachedObjectsARB,#function - .globl glGetHandleARB ; .type glGetHandleARB,#function - .globl glGetInfoLogARB ; .type glGetInfoLogARB,#function - .globl glGetObjectParameterfvARB ; .type glGetObjectParameterfvARB,#function - .globl glGetObjectParameterivARB ; .type glGetObjectParameterivARB,#function - .globl glGetShaderSourceARB ; .type glGetShaderSourceARB,#function - .globl glGetUniformLocationARB ; .type glGetUniformLocationARB,#function - .globl glGetUniformfvARB ; .type glGetUniformfvARB,#function - .globl glGetUniformivARB ; .type glGetUniformivARB,#function - .globl glLinkProgramARB ; .type glLinkProgramARB,#function - .globl glShaderSourceARB ; .type glShaderSourceARB,#function - .globl glUniform1fARB ; .type glUniform1fARB,#function - .globl glUniform1fvARB ; .type glUniform1fvARB,#function - .globl glUniform1iARB ; .type glUniform1iARB,#function - .globl glUniform1ivARB ; .type glUniform1ivARB,#function - .globl glUniform2fARB ; .type glUniform2fARB,#function - .globl glUniform2fvARB ; .type glUniform2fvARB,#function - .globl glUniform2iARB ; .type glUniform2iARB,#function - .globl glUniform2ivARB ; .type glUniform2ivARB,#function - .globl glUniform3fARB ; .type glUniform3fARB,#function - .globl glUniform3fvARB ; .type glUniform3fvARB,#function - .globl glUniform3iARB ; .type glUniform3iARB,#function - .globl glUniform3ivARB ; .type glUniform3ivARB,#function - .globl glUniform4fARB ; .type glUniform4fARB,#function - .globl glUniform4fvARB ; .type glUniform4fvARB,#function - .globl glUniform4iARB ; .type glUniform4iARB,#function - .globl glUniform4ivARB ; .type glUniform4ivARB,#function - .globl glUniformMatrix2fvARB ; .type glUniformMatrix2fvARB,#function - .globl glUniformMatrix3fvARB ; .type glUniformMatrix3fvARB,#function - .globl glUniformMatrix4fvARB ; .type glUniformMatrix4fvARB,#function - .globl glUseProgramObjectARB ; .type glUseProgramObjectARB,#function - .globl glValidateProgramARB ; .type glValidateProgramARB,#function - .globl glBindAttribLocationARB ; .type glBindAttribLocationARB,#function - .globl glGetActiveAttribARB ; .type glGetActiveAttribARB,#function - .globl glGetAttribLocationARB ; .type glGetAttribLocationARB,#function - .globl glDrawBuffersARB ; .type glDrawBuffersARB,#function - .globl glRenderbufferStorageMultisample ; .type glRenderbufferStorageMultisample,#function - .globl glPolygonOffsetEXT ; .type glPolygonOffsetEXT,#function - .globl gl_dispatch_stub_563 ; .type gl_dispatch_stub_563,#function - .globl gl_dispatch_stub_564 ; .type gl_dispatch_stub_564,#function - .globl gl_dispatch_stub_565 ; .type gl_dispatch_stub_565,#function - .globl gl_dispatch_stub_566 ; .type gl_dispatch_stub_566,#function - .globl gl_dispatch_stub_567 ; .type gl_dispatch_stub_567,#function - .globl gl_dispatch_stub_568 ; .type gl_dispatch_stub_568,#function - .globl gl_dispatch_stub_569 ; .type gl_dispatch_stub_569,#function - .globl gl_dispatch_stub_570 ; .type gl_dispatch_stub_570,#function - .globl glColorPointerEXT ; .type glColorPointerEXT,#function - .globl glEdgeFlagPointerEXT ; .type glEdgeFlagPointerEXT,#function - .globl glIndexPointerEXT ; .type glIndexPointerEXT,#function - .globl glNormalPointerEXT ; .type glNormalPointerEXT,#function - .globl glTexCoordPointerEXT ; .type glTexCoordPointerEXT,#function - .globl glVertexPointerEXT ; .type glVertexPointerEXT,#function - .globl glPointParameterfEXT ; .type glPointParameterfEXT,#function - .globl glPointParameterfvEXT ; .type glPointParameterfvEXT,#function - .globl glLockArraysEXT ; .type glLockArraysEXT,#function - .globl glUnlockArraysEXT ; .type glUnlockArraysEXT,#function - .globl gl_dispatch_stub_581 ; .type gl_dispatch_stub_581,#function - .globl gl_dispatch_stub_582 ; .type gl_dispatch_stub_582,#function - .globl glSecondaryColor3bEXT ; .type glSecondaryColor3bEXT,#function - .globl glSecondaryColor3bvEXT ; .type glSecondaryColor3bvEXT,#function - .globl glSecondaryColor3dEXT ; .type glSecondaryColor3dEXT,#function - .globl glSecondaryColor3dvEXT ; .type glSecondaryColor3dvEXT,#function - .globl glSecondaryColor3fEXT ; .type glSecondaryColor3fEXT,#function - .globl glSecondaryColor3fvEXT ; .type glSecondaryColor3fvEXT,#function - .globl glSecondaryColor3iEXT ; .type glSecondaryColor3iEXT,#function - .globl glSecondaryColor3ivEXT ; .type glSecondaryColor3ivEXT,#function - .globl glSecondaryColor3sEXT ; .type glSecondaryColor3sEXT,#function - .globl glSecondaryColor3svEXT ; .type glSecondaryColor3svEXT,#function - .globl glSecondaryColor3ubEXT ; .type glSecondaryColor3ubEXT,#function - .globl glSecondaryColor3ubvEXT ; .type glSecondaryColor3ubvEXT,#function - .globl glSecondaryColor3uiEXT ; .type glSecondaryColor3uiEXT,#function - .globl glSecondaryColor3uivEXT ; .type glSecondaryColor3uivEXT,#function - .globl glSecondaryColor3usEXT ; .type glSecondaryColor3usEXT,#function - .globl glSecondaryColor3usvEXT ; .type glSecondaryColor3usvEXT,#function - .globl glSecondaryColorPointerEXT ; .type glSecondaryColorPointerEXT,#function - .globl glMultiDrawArraysEXT ; .type glMultiDrawArraysEXT,#function - .globl glMultiDrawElementsEXT ; .type glMultiDrawElementsEXT,#function - .globl glFogCoordPointerEXT ; .type glFogCoordPointerEXT,#function - .globl glFogCoorddEXT ; .type glFogCoorddEXT,#function - .globl glFogCoorddvEXT ; .type glFogCoorddvEXT,#function - .globl glFogCoordfEXT ; .type glFogCoordfEXT,#function - .globl glFogCoordfvEXT ; .type glFogCoordfvEXT,#function - .globl gl_dispatch_stub_607 ; .type gl_dispatch_stub_607,#function - .globl glBlendFuncSeparateEXT ; .type glBlendFuncSeparateEXT,#function - .globl glFlushVertexArrayRangeNV ; .type glFlushVertexArrayRangeNV,#function - .globl glVertexArrayRangeNV ; .type glVertexArrayRangeNV,#function - .globl glCombinerInputNV ; .type glCombinerInputNV,#function - .globl glCombinerOutputNV ; .type glCombinerOutputNV,#function - .globl glCombinerParameterfNV ; .type glCombinerParameterfNV,#function - .globl glCombinerParameterfvNV ; .type glCombinerParameterfvNV,#function - .globl glCombinerParameteriNV ; .type glCombinerParameteriNV,#function - .globl glCombinerParameterivNV ; .type glCombinerParameterivNV,#function - .globl glFinalCombinerInputNV ; .type glFinalCombinerInputNV,#function - .globl glGetCombinerInputParameterfvNV ; .type glGetCombinerInputParameterfvNV,#function - .globl glGetCombinerInputParameterivNV ; .type glGetCombinerInputParameterivNV,#function - .globl glGetCombinerOutputParameterfvNV ; .type glGetCombinerOutputParameterfvNV,#function - .globl glGetCombinerOutputParameterivNV ; .type glGetCombinerOutputParameterivNV,#function - .globl glGetFinalCombinerInputParameterfvNV ; .type glGetFinalCombinerInputParameterfvNV,#function - .globl glGetFinalCombinerInputParameterivNV ; .type glGetFinalCombinerInputParameterivNV,#function - .globl glResizeBuffersMESA ; .type glResizeBuffersMESA,#function - .globl glWindowPos2dMESA ; .type glWindowPos2dMESA,#function - .globl glWindowPos2dvMESA ; .type glWindowPos2dvMESA,#function - .globl glWindowPos2fMESA ; .type glWindowPos2fMESA,#function - .globl glWindowPos2fvMESA ; .type glWindowPos2fvMESA,#function - .globl glWindowPos2iMESA ; .type glWindowPos2iMESA,#function - .globl glWindowPos2ivMESA ; .type glWindowPos2ivMESA,#function - .globl glWindowPos2sMESA ; .type glWindowPos2sMESA,#function - .globl glWindowPos2svMESA ; .type glWindowPos2svMESA,#function - .globl glWindowPos3dMESA ; .type glWindowPos3dMESA,#function - .globl glWindowPos3dvMESA ; .type glWindowPos3dvMESA,#function - .globl glWindowPos3fMESA ; .type glWindowPos3fMESA,#function - .globl glWindowPos3fvMESA ; .type glWindowPos3fvMESA,#function - .globl glWindowPos3iMESA ; .type glWindowPos3iMESA,#function - .globl glWindowPos3ivMESA ; .type glWindowPos3ivMESA,#function - .globl glWindowPos3sMESA ; .type glWindowPos3sMESA,#function - .globl glWindowPos3svMESA ; .type glWindowPos3svMESA,#function - .globl glWindowPos4dMESA ; .type glWindowPos4dMESA,#function - .globl glWindowPos4dvMESA ; .type glWindowPos4dvMESA,#function - .globl glWindowPos4fMESA ; .type glWindowPos4fMESA,#function - .globl glWindowPos4fvMESA ; .type glWindowPos4fvMESA,#function - .globl glWindowPos4iMESA ; .type glWindowPos4iMESA,#function - .globl glWindowPos4ivMESA ; .type glWindowPos4ivMESA,#function - .globl glWindowPos4sMESA ; .type glWindowPos4sMESA,#function - .globl glWindowPos4svMESA ; .type glWindowPos4svMESA,#function - .globl gl_dispatch_stub_649 ; .type gl_dispatch_stub_649,#function - .globl gl_dispatch_stub_650 ; .type gl_dispatch_stub_650,#function - .globl gl_dispatch_stub_651 ; .type gl_dispatch_stub_651,#function - .globl gl_dispatch_stub_652 ; .type gl_dispatch_stub_652,#function - .globl gl_dispatch_stub_653 ; .type gl_dispatch_stub_653,#function - .globl gl_dispatch_stub_654 ; .type gl_dispatch_stub_654,#function - .globl gl_dispatch_stub_655 ; .type gl_dispatch_stub_655,#function - .globl gl_dispatch_stub_656 ; .type gl_dispatch_stub_656,#function - .globl gl_dispatch_stub_657 ; .type gl_dispatch_stub_657,#function - .globl glAreProgramsResidentNV ; .type glAreProgramsResidentNV,#function - .globl glBindProgramNV ; .type glBindProgramNV,#function - .globl glDeleteProgramsNV ; .type glDeleteProgramsNV,#function - .globl glExecuteProgramNV ; .type glExecuteProgramNV,#function - .globl glGenProgramsNV ; .type glGenProgramsNV,#function - .globl glGetProgramParameterdvNV ; .type glGetProgramParameterdvNV,#function - .globl glGetProgramParameterfvNV ; .type glGetProgramParameterfvNV,#function - .globl glGetProgramStringNV ; .type glGetProgramStringNV,#function - .globl glGetProgramivNV ; .type glGetProgramivNV,#function - .globl glGetTrackMatrixivNV ; .type glGetTrackMatrixivNV,#function - .globl glGetVertexAttribPointervNV ; .type glGetVertexAttribPointervNV,#function - .globl glGetVertexAttribdvNV ; .type glGetVertexAttribdvNV,#function - .globl glGetVertexAttribfvNV ; .type glGetVertexAttribfvNV,#function - .globl glGetVertexAttribivNV ; .type glGetVertexAttribivNV,#function - .globl glIsProgramNV ; .type glIsProgramNV,#function - .globl glLoadProgramNV ; .type glLoadProgramNV,#function - .globl glProgramParameters4dvNV ; .type glProgramParameters4dvNV,#function - .globl glProgramParameters4fvNV ; .type glProgramParameters4fvNV,#function - .globl glRequestResidentProgramsNV ; .type glRequestResidentProgramsNV,#function - .globl glTrackMatrixNV ; .type glTrackMatrixNV,#function - .globl glVertexAttrib1dNV ; .type glVertexAttrib1dNV,#function - .globl glVertexAttrib1dvNV ; .type glVertexAttrib1dvNV,#function - .globl glVertexAttrib1fNV ; .type glVertexAttrib1fNV,#function - .globl glVertexAttrib1fvNV ; .type glVertexAttrib1fvNV,#function - .globl glVertexAttrib1sNV ; .type glVertexAttrib1sNV,#function - .globl glVertexAttrib1svNV ; .type glVertexAttrib1svNV,#function - .globl glVertexAttrib2dNV ; .type glVertexAttrib2dNV,#function - .globl glVertexAttrib2dvNV ; .type glVertexAttrib2dvNV,#function - .globl glVertexAttrib2fNV ; .type glVertexAttrib2fNV,#function - .globl glVertexAttrib2fvNV ; .type glVertexAttrib2fvNV,#function - .globl glVertexAttrib2sNV ; .type glVertexAttrib2sNV,#function - .globl glVertexAttrib2svNV ; .type glVertexAttrib2svNV,#function - .globl glVertexAttrib3dNV ; .type glVertexAttrib3dNV,#function - .globl glVertexAttrib3dvNV ; .type glVertexAttrib3dvNV,#function - .globl glVertexAttrib3fNV ; .type glVertexAttrib3fNV,#function - .globl glVertexAttrib3fvNV ; .type glVertexAttrib3fvNV,#function - .globl glVertexAttrib3sNV ; .type glVertexAttrib3sNV,#function - .globl glVertexAttrib3svNV ; .type glVertexAttrib3svNV,#function - .globl glVertexAttrib4dNV ; .type glVertexAttrib4dNV,#function - .globl glVertexAttrib4dvNV ; .type glVertexAttrib4dvNV,#function - .globl glVertexAttrib4fNV ; .type glVertexAttrib4fNV,#function - .globl glVertexAttrib4fvNV ; .type glVertexAttrib4fvNV,#function - .globl glVertexAttrib4sNV ; .type glVertexAttrib4sNV,#function - .globl glVertexAttrib4svNV ; .type glVertexAttrib4svNV,#function - .globl glVertexAttrib4ubNV ; .type glVertexAttrib4ubNV,#function - .globl glVertexAttrib4ubvNV ; .type glVertexAttrib4ubvNV,#function - .globl glVertexAttribPointerNV ; .type glVertexAttribPointerNV,#function - .globl glVertexAttribs1dvNV ; .type glVertexAttribs1dvNV,#function - .globl glVertexAttribs1fvNV ; .type glVertexAttribs1fvNV,#function - .globl glVertexAttribs1svNV ; .type glVertexAttribs1svNV,#function - .globl glVertexAttribs2dvNV ; .type glVertexAttribs2dvNV,#function - .globl glVertexAttribs2fvNV ; .type glVertexAttribs2fvNV,#function - .globl glVertexAttribs2svNV ; .type glVertexAttribs2svNV,#function - .globl glVertexAttribs3dvNV ; .type glVertexAttribs3dvNV,#function - .globl glVertexAttribs3fvNV ; .type glVertexAttribs3fvNV,#function - .globl glVertexAttribs3svNV ; .type glVertexAttribs3svNV,#function - .globl glVertexAttribs4dvNV ; .type glVertexAttribs4dvNV,#function - .globl glVertexAttribs4fvNV ; .type glVertexAttribs4fvNV,#function - .globl glVertexAttribs4svNV ; .type glVertexAttribs4svNV,#function - .globl glVertexAttribs4ubvNV ; .type glVertexAttribs4ubvNV,#function - .globl glAlphaFragmentOp1ATI ; .type glAlphaFragmentOp1ATI,#function - .globl glAlphaFragmentOp2ATI ; .type glAlphaFragmentOp2ATI,#function - .globl glAlphaFragmentOp3ATI ; .type glAlphaFragmentOp3ATI,#function - .globl glBeginFragmentShaderATI ; .type glBeginFragmentShaderATI,#function - .globl glBindFragmentShaderATI ; .type glBindFragmentShaderATI,#function - .globl glColorFragmentOp1ATI ; .type glColorFragmentOp1ATI,#function - .globl glColorFragmentOp2ATI ; .type glColorFragmentOp2ATI,#function - .globl glColorFragmentOp3ATI ; .type glColorFragmentOp3ATI,#function - .globl glDeleteFragmentShaderATI ; .type glDeleteFragmentShaderATI,#function - .globl glEndFragmentShaderATI ; .type glEndFragmentShaderATI,#function - .globl glGenFragmentShadersATI ; .type glGenFragmentShadersATI,#function - .globl glPassTexCoordATI ; .type glPassTexCoordATI,#function - .globl glSampleMapATI ; .type glSampleMapATI,#function - .globl glSetFragmentShaderConstantATI ; .type glSetFragmentShaderConstantATI,#function - .globl glPointParameteriNV ; .type glPointParameteriNV,#function - .globl glPointParameterivNV ; .type glPointParameterivNV,#function - .globl gl_dispatch_stub_734 ; .type gl_dispatch_stub_734,#function - .globl gl_dispatch_stub_735 ; .type gl_dispatch_stub_735,#function - .globl gl_dispatch_stub_736 ; .type gl_dispatch_stub_736,#function - .globl gl_dispatch_stub_737 ; .type gl_dispatch_stub_737,#function - .globl gl_dispatch_stub_738 ; .type gl_dispatch_stub_738,#function - .globl glGetProgramNamedParameterdvNV ; .type glGetProgramNamedParameterdvNV,#function - .globl glGetProgramNamedParameterfvNV ; .type glGetProgramNamedParameterfvNV,#function - .globl glProgramNamedParameter4dNV ; .type glProgramNamedParameter4dNV,#function - .globl glProgramNamedParameter4dvNV ; .type glProgramNamedParameter4dvNV,#function - .globl glProgramNamedParameter4fNV ; .type glProgramNamedParameter4fNV,#function - .globl glProgramNamedParameter4fvNV ; .type glProgramNamedParameter4fvNV,#function - .globl gl_dispatch_stub_745 ; .type gl_dispatch_stub_745,#function - .globl gl_dispatch_stub_746 ; .type gl_dispatch_stub_746,#function - .globl glBindFramebufferEXT ; .type glBindFramebufferEXT,#function - .globl glBindRenderbufferEXT ; .type glBindRenderbufferEXT,#function - .globl glCheckFramebufferStatusEXT ; .type glCheckFramebufferStatusEXT,#function - .globl glDeleteFramebuffersEXT ; .type glDeleteFramebuffersEXT,#function - .globl glDeleteRenderbuffersEXT ; .type glDeleteRenderbuffersEXT,#function - .globl glFramebufferRenderbufferEXT ; .type glFramebufferRenderbufferEXT,#function - .globl glFramebufferTexture1DEXT ; .type glFramebufferTexture1DEXT,#function - .globl glFramebufferTexture2DEXT ; .type glFramebufferTexture2DEXT,#function - .globl glFramebufferTexture3DEXT ; .type glFramebufferTexture3DEXT,#function - .globl glGenFramebuffersEXT ; .type glGenFramebuffersEXT,#function - .globl glGenRenderbuffersEXT ; .type glGenRenderbuffersEXT,#function - .globl glGenerateMipmapEXT ; .type glGenerateMipmapEXT,#function - .globl glGetFramebufferAttachmentParameterivEXT ; .type glGetFramebufferAttachmentParameterivEXT,#function - .globl glGetRenderbufferParameterivEXT ; .type glGetRenderbufferParameterivEXT,#function - .globl glIsFramebufferEXT ; .type glIsFramebufferEXT,#function - .globl glIsRenderbufferEXT ; .type glIsRenderbufferEXT,#function - .globl glRenderbufferStorageEXT ; .type glRenderbufferStorageEXT,#function - .globl gl_dispatch_stub_764 ; .type gl_dispatch_stub_764,#function - .globl glFramebufferTextureLayerEXT ; .type glFramebufferTextureLayerEXT,#function - .globl gl_dispatch_stub_766 ; .type gl_dispatch_stub_766,#function - .globl gl_dispatch_stub_767 ; .type gl_dispatch_stub_767,#function - .globl gl_dispatch_stub_768 ; .type gl_dispatch_stub_768,#function - .globl gl_dispatch_stub_769 ; .type gl_dispatch_stub_769,#function - .globl gl_dispatch_stub_770 ; .type gl_dispatch_stub_770,#function - .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function -_mesa_sparc_glapi_begin: + .data + .align 32 + + GLOBL_FN(__glapi_sparc_pthread_stub) + HIDDEN(__glapi_sparc_pthread_stub) +__glapi_sparc_pthread_stub: /* Call offset in %g3 */ + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + sethi %hi(_glapi_Dispatch), %g1 + or %g1, %lo(_glapi_Dispatch), %g1 + srl %g3, 10, %g3 + GL_LL [%g2+%g1], %g2 + GL_LL [%g2], %g1 + cmp %g1, 0 + be 2f + nop +1: GL_LL [%g1 + %g3], %g1 + jmp %g1 + nop +2: save %sp, GL_STACK_SIZE, %sp + mov %g3, %l0 + call _glapi_get_dispatch + nop + mov %o0, %g1 + mov %l0, %g3 + ba 1b + restore %g0, %g0, %g0 + .size __glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub + +#define GL_STUB(fn, off) \ + GLOBL_FN(fn); \ +fn: ba __glapi_sparc_pthread_stub; \ + sethi GL_OFF(off), %g3; \ + .size fn,.-fn; + +#else /* Non-threaded version. */ + + .type __glapi_sparc_nothread_stub, @function +__glapi_sparc_nothread_stub: /* Call offset in %g3 */ + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + srl %g3, 10, %g3 + sethi %hi(_glapi_Dispatch), %g1 + or %g1, %lo(_glapi_Dispatch), %g1 + GL_LL [%g2+%g1], %g2 + GL_LL [%g2], %g1 + GL_LL [%g1 + %g3], %g1 + jmp %g1 + nop + .size __glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub + +#define GL_STUB(fn, off) \ + GLOBL_FN(fn); \ +fn: ba __glapi_sparc_nothread_stub; \ + sethi GL_OFF(off), %g3; \ + .size fn,.-fn; + +#endif + +#define GL_STUB_ALIAS(fn, alias) \ + .globl fn; \ + .set fn, alias + + .text + .align 32 + + .globl gl_dispatch_functions_start + HIDDEN(gl_dispatch_functions_start) +gl_dispatch_functions_start: GL_STUB(glNewList, _gloffset_NewList) GL_STUB(glEndList, _gloffset_EndList) @@ -1402,14 +760,22 @@ _mesa_sparc_glapi_begin: GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB) GL_STUB(glRenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample) GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT) - GL_STUB(gl_dispatch_stub_563, _gloffset__dispatch_stub_563) - GL_STUB(gl_dispatch_stub_564, _gloffset__dispatch_stub_564) - GL_STUB(gl_dispatch_stub_565, _gloffset__dispatch_stub_565) - GL_STUB(gl_dispatch_stub_566, _gloffset__dispatch_stub_566) - GL_STUB(gl_dispatch_stub_567, _gloffset__dispatch_stub_567) - GL_STUB(gl_dispatch_stub_568, _gloffset__dispatch_stub_568) - GL_STUB(gl_dispatch_stub_569, _gloffset__dispatch_stub_569) - GL_STUB(gl_dispatch_stub_570, _gloffset__dispatch_stub_570) + GL_STUB(gl_dispatch_stub_563, _gloffset_GetPixelTexGenParameterfvSGIS) + HIDDEN(gl_dispatch_stub_563) + GL_STUB(gl_dispatch_stub_564, _gloffset_GetPixelTexGenParameterivSGIS) + HIDDEN(gl_dispatch_stub_564) + GL_STUB(gl_dispatch_stub_565, _gloffset_PixelTexGenParameterfSGIS) + HIDDEN(gl_dispatch_stub_565) + GL_STUB(gl_dispatch_stub_566, _gloffset_PixelTexGenParameterfvSGIS) + HIDDEN(gl_dispatch_stub_566) + GL_STUB(gl_dispatch_stub_567, _gloffset_PixelTexGenParameteriSGIS) + HIDDEN(gl_dispatch_stub_567) + GL_STUB(gl_dispatch_stub_568, _gloffset_PixelTexGenParameterivSGIS) + HIDDEN(gl_dispatch_stub_568) + GL_STUB(gl_dispatch_stub_569, _gloffset_SampleMaskSGIS) + HIDDEN(gl_dispatch_stub_569) + GL_STUB(gl_dispatch_stub_570, _gloffset_SamplePatternSGIS) + HIDDEN(gl_dispatch_stub_570) GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT) GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT) GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT) @@ -1420,8 +786,10 @@ _mesa_sparc_glapi_begin: GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT) GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT) GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT) - GL_STUB(gl_dispatch_stub_581, _gloffset__dispatch_stub_581) - GL_STUB(gl_dispatch_stub_582, _gloffset__dispatch_stub_582) + GL_STUB(gl_dispatch_stub_581, _gloffset_CullParameterdvEXT) + HIDDEN(gl_dispatch_stub_581) + GL_STUB(gl_dispatch_stub_582, _gloffset_CullParameterfvEXT) + HIDDEN(gl_dispatch_stub_582) GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT) GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT) GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT) @@ -1446,7 +814,8 @@ _mesa_sparc_glapi_begin: GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT) GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT) GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT) - GL_STUB(gl_dispatch_stub_607, _gloffset__dispatch_stub_607) + GL_STUB(gl_dispatch_stub_607, _gloffset_PixelTexGenSGIX) + HIDDEN(gl_dispatch_stub_607) GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT) GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV) GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV) @@ -1488,15 +857,24 @@ _mesa_sparc_glapi_begin: GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA) GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA) GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA) - GL_STUB(gl_dispatch_stub_649, _gloffset__dispatch_stub_649) - GL_STUB(gl_dispatch_stub_650, _gloffset__dispatch_stub_650) - GL_STUB(gl_dispatch_stub_651, _gloffset__dispatch_stub_651) - GL_STUB(gl_dispatch_stub_652, _gloffset__dispatch_stub_652) - GL_STUB(gl_dispatch_stub_653, _gloffset__dispatch_stub_653) - GL_STUB(gl_dispatch_stub_654, _gloffset__dispatch_stub_654) - GL_STUB(gl_dispatch_stub_655, _gloffset__dispatch_stub_655) - GL_STUB(gl_dispatch_stub_656, _gloffset__dispatch_stub_656) - GL_STUB(gl_dispatch_stub_657, _gloffset__dispatch_stub_657) + GL_STUB(gl_dispatch_stub_649, _gloffset_MultiModeDrawArraysIBM) + HIDDEN(gl_dispatch_stub_649) + GL_STUB(gl_dispatch_stub_650, _gloffset_MultiModeDrawElementsIBM) + HIDDEN(gl_dispatch_stub_650) + GL_STUB(gl_dispatch_stub_651, _gloffset_DeleteFencesNV) + HIDDEN(gl_dispatch_stub_651) + GL_STUB(gl_dispatch_stub_652, _gloffset_FinishFenceNV) + HIDDEN(gl_dispatch_stub_652) + GL_STUB(gl_dispatch_stub_653, _gloffset_GenFencesNV) + HIDDEN(gl_dispatch_stub_653) + GL_STUB(gl_dispatch_stub_654, _gloffset_GetFenceivNV) + HIDDEN(gl_dispatch_stub_654) + GL_STUB(gl_dispatch_stub_655, _gloffset_IsFenceNV) + HIDDEN(gl_dispatch_stub_655) + GL_STUB(gl_dispatch_stub_656, _gloffset_SetFenceNV) + HIDDEN(gl_dispatch_stub_656) + GL_STUB(gl_dispatch_stub_657, _gloffset_TestFenceNV) + HIDDEN(gl_dispatch_stub_657) GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV) GL_STUB(glBindProgramNV, _gloffset_BindProgramNV) GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV) @@ -1573,19 +951,26 @@ _mesa_sparc_glapi_begin: GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI) GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV) GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV) - GL_STUB(gl_dispatch_stub_734, _gloffset__dispatch_stub_734) - GL_STUB(gl_dispatch_stub_735, _gloffset__dispatch_stub_735) - GL_STUB(gl_dispatch_stub_736, _gloffset__dispatch_stub_736) - GL_STUB(gl_dispatch_stub_737, _gloffset__dispatch_stub_737) - GL_STUB(gl_dispatch_stub_738, _gloffset__dispatch_stub_738) + GL_STUB(gl_dispatch_stub_734, _gloffset_ActiveStencilFaceEXT) + HIDDEN(gl_dispatch_stub_734) + GL_STUB(gl_dispatch_stub_735, _gloffset_BindVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_735) + GL_STUB(gl_dispatch_stub_736, _gloffset_DeleteVertexArraysAPPLE) + HIDDEN(gl_dispatch_stub_736) + GL_STUB(gl_dispatch_stub_737, _gloffset_GenVertexArraysAPPLE) + HIDDEN(gl_dispatch_stub_737) + GL_STUB(gl_dispatch_stub_738, _gloffset_IsVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_738) GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV) GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV) GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV) GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV) GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV) GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV) - GL_STUB(gl_dispatch_stub_745, _gloffset__dispatch_stub_745) - GL_STUB(gl_dispatch_stub_746, _gloffset__dispatch_stub_746) + GL_STUB(gl_dispatch_stub_745, _gloffset_DepthBoundsEXT) + HIDDEN(gl_dispatch_stub_745) + GL_STUB(gl_dispatch_stub_746, _gloffset_BlendEquationSeparateEXT) + HIDDEN(gl_dispatch_stub_746) GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT) GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT) GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT) @@ -1603,287 +988,353 @@ _mesa_sparc_glapi_begin: GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT) GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT) GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT) - GL_STUB(gl_dispatch_stub_764, _gloffset__dispatch_stub_764) + GL_STUB(gl_dispatch_stub_764, _gloffset_BlitFramebufferEXT) + HIDDEN(gl_dispatch_stub_764) GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT) - GL_STUB(gl_dispatch_stub_766, _gloffset__dispatch_stub_766) - GL_STUB(gl_dispatch_stub_767, _gloffset__dispatch_stub_767) - GL_STUB(gl_dispatch_stub_768, _gloffset__dispatch_stub_768) - GL_STUB(gl_dispatch_stub_769, _gloffset__dispatch_stub_769) - GL_STUB(gl_dispatch_stub_770, _gloffset__dispatch_stub_770) - - .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function -_mesa_sparc_glapi_end: - - .globl glArrayElementEXT ; .type glArrayElementEXT,#function ; glArrayElementEXT = glArrayElement - .globl glBindTextureEXT ; .type glBindTextureEXT,#function ; glBindTextureEXT = glBindTexture - .globl glDrawArraysEXT ; .type glDrawArraysEXT,#function ; glDrawArraysEXT = glDrawArrays + GL_STUB(gl_dispatch_stub_766, _gloffset_StencilFuncSeparateATI) + HIDDEN(gl_dispatch_stub_766) + GL_STUB(gl_dispatch_stub_767, _gloffset_ProgramEnvParameters4fvEXT) + HIDDEN(gl_dispatch_stub_767) + GL_STUB(gl_dispatch_stub_768, _gloffset_ProgramLocalParameters4fvEXT) + HIDDEN(gl_dispatch_stub_768) + GL_STUB(gl_dispatch_stub_769, _gloffset_GetQueryObjecti64vEXT) + HIDDEN(gl_dispatch_stub_769) + GL_STUB(gl_dispatch_stub_770, _gloffset_GetQueryObjectui64vEXT) + HIDDEN(gl_dispatch_stub_770) + GL_STUB_ALIAS(glArrayElementEXT, glArrayElement) + GL_STUB_ALIAS(glBindTextureEXT, glBindTexture) + GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glAreTexturesResidentEXT, glAreTexturesResident) +#endif + GL_STUB_ALIAS(glCopyTexImage1DEXT, glCopyTexImage1D) + GL_STUB_ALIAS(glCopyTexImage2DEXT, glCopyTexImage2D) + GL_STUB_ALIAS(glCopyTexSubImage1DEXT, glCopyTexSubImage1D) + GL_STUB_ALIAS(glCopyTexSubImage2DEXT, glCopyTexSubImage2D) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glDeleteTexturesEXT, glDeleteTextures) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGenTexturesEXT, glGenTextures) +#endif + GL_STUB_ALIAS(glGetPointervEXT, glGetPointerv) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glIsTextureEXT, glIsTexture) +#endif + GL_STUB_ALIAS(glPrioritizeTexturesEXT, glPrioritizeTextures) + GL_STUB_ALIAS(glTexSubImage1DEXT, glTexSubImage1D) + GL_STUB_ALIAS(glTexSubImage2DEXT, glTexSubImage2D) + GL_STUB_ALIAS(glBlendColorEXT, glBlendColor) + GL_STUB_ALIAS(glBlendEquationEXT, glBlendEquation) + GL_STUB_ALIAS(glDrawRangeElementsEXT, glDrawRangeElements) + GL_STUB_ALIAS(glColorTableSGI, glColorTable) + GL_STUB_ALIAS(glColorTableEXT, glColorTable) + GL_STUB_ALIAS(glColorTableParameterfvSGI, glColorTableParameterfv) + GL_STUB_ALIAS(glColorTableParameterivSGI, glColorTableParameteriv) + GL_STUB_ALIAS(glCopyColorTableSGI, glCopyColorTable) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableSGI, glGetColorTable) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableEXT, glGetColorTable) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableParameterfvSGI, glGetColorTableParameterfv) +#endif #ifndef GLX_INDIRECT_RENDERING - .globl glAreTexturesResidentEXT ; .type glAreTexturesResidentEXT,#function ; glAreTexturesResidentEXT = glAreTexturesResident + GL_STUB_ALIAS(glGetColorTableParameterfvEXT, glGetColorTableParameterfv) #endif - .globl glCopyTexImage1DEXT ; .type glCopyTexImage1DEXT,#function ; glCopyTexImage1DEXT = glCopyTexImage1D - .globl glCopyTexImage2DEXT ; .type glCopyTexImage2DEXT,#function ; glCopyTexImage2DEXT = glCopyTexImage2D - .globl glCopyTexSubImage1DEXT ; .type glCopyTexSubImage1DEXT,#function ; glCopyTexSubImage1DEXT = glCopyTexSubImage1D - .globl glCopyTexSubImage2DEXT ; .type glCopyTexSubImage2DEXT,#function ; glCopyTexSubImage2DEXT = glCopyTexSubImage2D #ifndef GLX_INDIRECT_RENDERING - .globl glDeleteTexturesEXT ; .type glDeleteTexturesEXT,#function ; glDeleteTexturesEXT = glDeleteTextures + GL_STUB_ALIAS(glGetColorTableParameterivSGI, glGetColorTableParameteriv) #endif #ifndef GLX_INDIRECT_RENDERING - .globl glGenTexturesEXT ; .type glGenTexturesEXT,#function ; glGenTexturesEXT = glGenTextures + GL_STUB_ALIAS(glGetColorTableParameterivEXT, glGetColorTableParameteriv) #endif - .globl glGetPointervEXT ; .type glGetPointervEXT,#function ; glGetPointervEXT = glGetPointerv + GL_STUB_ALIAS(glColorSubTableEXT, glColorSubTable) + GL_STUB_ALIAS(glCopyColorSubTableEXT, glCopyColorSubTable) + GL_STUB_ALIAS(glConvolutionFilter1DEXT, glConvolutionFilter1D) + GL_STUB_ALIAS(glConvolutionFilter2DEXT, glConvolutionFilter2D) + GL_STUB_ALIAS(glConvolutionParameterfEXT, glConvolutionParameterf) + GL_STUB_ALIAS(glConvolutionParameterfvEXT, glConvolutionParameterfv) + GL_STUB_ALIAS(glConvolutionParameteriEXT, glConvolutionParameteri) + GL_STUB_ALIAS(glConvolutionParameterivEXT, glConvolutionParameteriv) + GL_STUB_ALIAS(glCopyConvolutionFilter1DEXT, glCopyConvolutionFilter1D) + GL_STUB_ALIAS(glCopyConvolutionFilter2DEXT, glCopyConvolutionFilter2D) #ifndef GLX_INDIRECT_RENDERING - .globl glIsTextureEXT ; .type glIsTextureEXT,#function ; glIsTextureEXT = glIsTexture + GL_STUB_ALIAS(glGetConvolutionFilterEXT, glGetConvolutionFilter) #endif - .globl glPrioritizeTexturesEXT ; .type glPrioritizeTexturesEXT,#function ; glPrioritizeTexturesEXT = glPrioritizeTextures - .globl glTexSubImage1DEXT ; .type glTexSubImage1DEXT,#function ; glTexSubImage1DEXT = glTexSubImage1D - .globl glTexSubImage2DEXT ; .type glTexSubImage2DEXT,#function ; glTexSubImage2DEXT = glTexSubImage2D - .globl glBlendColorEXT ; .type glBlendColorEXT,#function ; glBlendColorEXT = glBlendColor - .globl glBlendEquationEXT ; .type glBlendEquationEXT,#function ; glBlendEquationEXT = glBlendEquation - .globl glDrawRangeElementsEXT ; .type glDrawRangeElementsEXT,#function ; glDrawRangeElementsEXT = glDrawRangeElements - .globl glColorTableEXT ; .type glColorTableEXT,#function ; glColorTableEXT = glColorTable #ifndef GLX_INDIRECT_RENDERING - .globl glGetColorTableEXT ; .type glGetColorTableEXT,#function ; glGetColorTableEXT = glGetColorTable + GL_STUB_ALIAS(glGetConvolutionParameterfvEXT, glGetConvolutionParameterfv) #endif #ifndef GLX_INDIRECT_RENDERING - .globl glGetColorTableParameterfvEXT ; .type glGetColorTableParameterfvEXT,#function ; glGetColorTableParameterfvEXT = glGetColorTableParameterfv + GL_STUB_ALIAS(glGetConvolutionParameterivEXT, glGetConvolutionParameteriv) #endif #ifndef GLX_INDIRECT_RENDERING - .globl glGetColorTableParameterivEXT ; .type glGetColorTableParameterivEXT,#function ; glGetColorTableParameterivEXT = glGetColorTableParameteriv + GL_STUB_ALIAS(glGetSeparableFilterEXT, glGetSeparableFilter) #endif - .globl glTexImage3DEXT ; .type glTexImage3DEXT,#function ; glTexImage3DEXT = glTexImage3D - .globl glTexSubImage3DEXT ; .type glTexSubImage3DEXT,#function ; glTexSubImage3DEXT = glTexSubImage3D - .globl glCopyTexSubImage3DEXT ; .type glCopyTexSubImage3DEXT,#function ; glCopyTexSubImage3DEXT = glCopyTexSubImage3D - .globl glActiveTexture ; .type glActiveTexture,#function ; glActiveTexture = glActiveTextureARB - .globl glClientActiveTexture ; .type glClientActiveTexture,#function ; glClientActiveTexture = glClientActiveTextureARB - .globl glMultiTexCoord1d ; .type glMultiTexCoord1d,#function ; glMultiTexCoord1d = glMultiTexCoord1dARB - .globl glMultiTexCoord1dv ; .type glMultiTexCoord1dv,#function ; glMultiTexCoord1dv = glMultiTexCoord1dvARB - .globl glMultiTexCoord1f ; .type glMultiTexCoord1f,#function ; glMultiTexCoord1f = glMultiTexCoord1fARB - .globl glMultiTexCoord1fv ; .type glMultiTexCoord1fv,#function ; glMultiTexCoord1fv = glMultiTexCoord1fvARB - .globl glMultiTexCoord1i ; .type glMultiTexCoord1i,#function ; glMultiTexCoord1i = glMultiTexCoord1iARB - .globl glMultiTexCoord1iv ; .type glMultiTexCoord1iv,#function ; glMultiTexCoord1iv = glMultiTexCoord1ivARB - .globl glMultiTexCoord1s ; .type glMultiTexCoord1s,#function ; glMultiTexCoord1s = glMultiTexCoord1sARB - .globl glMultiTexCoord1sv ; .type glMultiTexCoord1sv,#function ; glMultiTexCoord1sv = glMultiTexCoord1svARB - .globl glMultiTexCoord2d ; .type glMultiTexCoord2d,#function ; glMultiTexCoord2d = glMultiTexCoord2dARB - .globl glMultiTexCoord2dv ; .type glMultiTexCoord2dv,#function ; glMultiTexCoord2dv = glMultiTexCoord2dvARB - .globl glMultiTexCoord2f ; .type glMultiTexCoord2f,#function ; glMultiTexCoord2f = glMultiTexCoord2fARB - .globl glMultiTexCoord2fv ; .type glMultiTexCoord2fv,#function ; glMultiTexCoord2fv = glMultiTexCoord2fvARB - .globl glMultiTexCoord2i ; .type glMultiTexCoord2i,#function ; glMultiTexCoord2i = glMultiTexCoord2iARB - .globl glMultiTexCoord2iv ; .type glMultiTexCoord2iv,#function ; glMultiTexCoord2iv = glMultiTexCoord2ivARB - .globl glMultiTexCoord2s ; .type glMultiTexCoord2s,#function ; glMultiTexCoord2s = glMultiTexCoord2sARB - .globl glMultiTexCoord2sv ; .type glMultiTexCoord2sv,#function ; glMultiTexCoord2sv = glMultiTexCoord2svARB - .globl glMultiTexCoord3d ; .type glMultiTexCoord3d,#function ; glMultiTexCoord3d = glMultiTexCoord3dARB - .globl glMultiTexCoord3dv ; .type glMultiTexCoord3dv,#function ; glMultiTexCoord3dv = glMultiTexCoord3dvARB - .globl glMultiTexCoord3f ; .type glMultiTexCoord3f,#function ; glMultiTexCoord3f = glMultiTexCoord3fARB - .globl glMultiTexCoord3fv ; .type glMultiTexCoord3fv,#function ; glMultiTexCoord3fv = glMultiTexCoord3fvARB - .globl glMultiTexCoord3i ; .type glMultiTexCoord3i,#function ; glMultiTexCoord3i = glMultiTexCoord3iARB - .globl glMultiTexCoord3iv ; .type glMultiTexCoord3iv,#function ; glMultiTexCoord3iv = glMultiTexCoord3ivARB - .globl glMultiTexCoord3s ; .type glMultiTexCoord3s,#function ; glMultiTexCoord3s = glMultiTexCoord3sARB - .globl glMultiTexCoord3sv ; .type glMultiTexCoord3sv,#function ; glMultiTexCoord3sv = glMultiTexCoord3svARB - .globl glMultiTexCoord4d ; .type glMultiTexCoord4d,#function ; glMultiTexCoord4d = glMultiTexCoord4dARB - .globl glMultiTexCoord4dv ; .type glMultiTexCoord4dv,#function ; glMultiTexCoord4dv = glMultiTexCoord4dvARB - .globl glMultiTexCoord4f ; .type glMultiTexCoord4f,#function ; glMultiTexCoord4f = glMultiTexCoord4fARB - .globl glMultiTexCoord4fv ; .type glMultiTexCoord4fv,#function ; glMultiTexCoord4fv = glMultiTexCoord4fvARB - .globl glMultiTexCoord4i ; .type glMultiTexCoord4i,#function ; glMultiTexCoord4i = glMultiTexCoord4iARB - .globl glMultiTexCoord4iv ; .type glMultiTexCoord4iv,#function ; glMultiTexCoord4iv = glMultiTexCoord4ivARB - .globl glMultiTexCoord4s ; .type glMultiTexCoord4s,#function ; glMultiTexCoord4s = glMultiTexCoord4sARB - .globl glMultiTexCoord4sv ; .type glMultiTexCoord4sv,#function ; glMultiTexCoord4sv = glMultiTexCoord4svARB - .globl glLoadTransposeMatrixd ; .type glLoadTransposeMatrixd,#function ; glLoadTransposeMatrixd = glLoadTransposeMatrixdARB - .globl glLoadTransposeMatrixf ; .type glLoadTransposeMatrixf,#function ; glLoadTransposeMatrixf = glLoadTransposeMatrixfARB - .globl glMultTransposeMatrixd ; .type glMultTransposeMatrixd,#function ; glMultTransposeMatrixd = glMultTransposeMatrixdARB - .globl glMultTransposeMatrixf ; .type glMultTransposeMatrixf,#function ; glMultTransposeMatrixf = glMultTransposeMatrixfARB - .globl glSampleCoverage ; .type glSampleCoverage,#function ; glSampleCoverage = glSampleCoverageARB - .globl glCompressedTexImage1D ; .type glCompressedTexImage1D,#function ; glCompressedTexImage1D = glCompressedTexImage1DARB - .globl glCompressedTexImage2D ; .type glCompressedTexImage2D,#function ; glCompressedTexImage2D = glCompressedTexImage2DARB - .globl glCompressedTexImage3D ; .type glCompressedTexImage3D,#function ; glCompressedTexImage3D = glCompressedTexImage3DARB - .globl glCompressedTexSubImage1D ; .type glCompressedTexSubImage1D,#function ; glCompressedTexSubImage1D = glCompressedTexSubImage1DARB - .globl glCompressedTexSubImage2D ; .type glCompressedTexSubImage2D,#function ; glCompressedTexSubImage2D = glCompressedTexSubImage2DARB - .globl glCompressedTexSubImage3D ; .type glCompressedTexSubImage3D,#function ; glCompressedTexSubImage3D = glCompressedTexSubImage3DARB - .globl glGetCompressedTexImage ; .type glGetCompressedTexImage,#function ; glGetCompressedTexImage = glGetCompressedTexImageARB - .globl glDisableVertexAttribArray ; .type glDisableVertexAttribArray,#function ; glDisableVertexAttribArray = glDisableVertexAttribArrayARB - .globl glEnableVertexAttribArray ; .type glEnableVertexAttribArray,#function ; glEnableVertexAttribArray = glEnableVertexAttribArrayARB - .globl glGetVertexAttribdv ; .type glGetVertexAttribdv,#function ; glGetVertexAttribdv = glGetVertexAttribdvARB - .globl glGetVertexAttribfv ; .type glGetVertexAttribfv,#function ; glGetVertexAttribfv = glGetVertexAttribfvARB - .globl glGetVertexAttribiv ; .type glGetVertexAttribiv,#function ; glGetVertexAttribiv = glGetVertexAttribivARB - .globl glProgramParameter4dNV ; .type glProgramParameter4dNV,#function ; glProgramParameter4dNV = glProgramEnvParameter4dARB - .globl glProgramParameter4dvNV ; .type glProgramParameter4dvNV,#function ; glProgramParameter4dvNV = glProgramEnvParameter4dvARB - .globl glProgramParameter4fNV ; .type glProgramParameter4fNV,#function ; glProgramParameter4fNV = glProgramEnvParameter4fARB - .globl glProgramParameter4fvNV ; .type glProgramParameter4fvNV,#function ; glProgramParameter4fvNV = glProgramEnvParameter4fvARB - .globl glVertexAttrib1d ; .type glVertexAttrib1d,#function ; glVertexAttrib1d = glVertexAttrib1dARB - .globl glVertexAttrib1dv ; .type glVertexAttrib1dv,#function ; glVertexAttrib1dv = glVertexAttrib1dvARB - .globl glVertexAttrib1f ; .type glVertexAttrib1f,#function ; glVertexAttrib1f = glVertexAttrib1fARB - .globl glVertexAttrib1fv ; .type glVertexAttrib1fv,#function ; glVertexAttrib1fv = glVertexAttrib1fvARB - .globl glVertexAttrib1s ; .type glVertexAttrib1s,#function ; glVertexAttrib1s = glVertexAttrib1sARB - .globl glVertexAttrib1sv ; .type glVertexAttrib1sv,#function ; glVertexAttrib1sv = glVertexAttrib1svARB - .globl glVertexAttrib2d ; .type glVertexAttrib2d,#function ; glVertexAttrib2d = glVertexAttrib2dARB - .globl glVertexAttrib2dv ; .type glVertexAttrib2dv,#function ; glVertexAttrib2dv = glVertexAttrib2dvARB - .globl glVertexAttrib2f ; .type glVertexAttrib2f,#function ; glVertexAttrib2f = glVertexAttrib2fARB - .globl glVertexAttrib2fv ; .type glVertexAttrib2fv,#function ; glVertexAttrib2fv = glVertexAttrib2fvARB - .globl glVertexAttrib2s ; .type glVertexAttrib2s,#function ; glVertexAttrib2s = glVertexAttrib2sARB - .globl glVertexAttrib2sv ; .type glVertexAttrib2sv,#function ; glVertexAttrib2sv = glVertexAttrib2svARB - .globl glVertexAttrib3d ; .type glVertexAttrib3d,#function ; glVertexAttrib3d = glVertexAttrib3dARB - .globl glVertexAttrib3dv ; .type glVertexAttrib3dv,#function ; glVertexAttrib3dv = glVertexAttrib3dvARB - .globl glVertexAttrib3f ; .type glVertexAttrib3f,#function ; glVertexAttrib3f = glVertexAttrib3fARB - .globl glVertexAttrib3fv ; .type glVertexAttrib3fv,#function ; glVertexAttrib3fv = glVertexAttrib3fvARB - .globl glVertexAttrib3s ; .type glVertexAttrib3s,#function ; glVertexAttrib3s = glVertexAttrib3sARB - .globl glVertexAttrib3sv ; .type glVertexAttrib3sv,#function ; glVertexAttrib3sv = glVertexAttrib3svARB - .globl glVertexAttrib4Nbv ; .type glVertexAttrib4Nbv,#function ; glVertexAttrib4Nbv = glVertexAttrib4NbvARB - .globl glVertexAttrib4Niv ; .type glVertexAttrib4Niv,#function ; glVertexAttrib4Niv = glVertexAttrib4NivARB - .globl glVertexAttrib4Nsv ; .type glVertexAttrib4Nsv,#function ; glVertexAttrib4Nsv = glVertexAttrib4NsvARB - .globl glVertexAttrib4Nub ; .type glVertexAttrib4Nub,#function ; glVertexAttrib4Nub = glVertexAttrib4NubARB - .globl glVertexAttrib4Nubv ; .type glVertexAttrib4Nubv,#function ; glVertexAttrib4Nubv = glVertexAttrib4NubvARB - .globl glVertexAttrib4Nuiv ; .type glVertexAttrib4Nuiv,#function ; glVertexAttrib4Nuiv = glVertexAttrib4NuivARB - .globl glVertexAttrib4Nusv ; .type glVertexAttrib4Nusv,#function ; glVertexAttrib4Nusv = glVertexAttrib4NusvARB - .globl glVertexAttrib4bv ; .type glVertexAttrib4bv,#function ; glVertexAttrib4bv = glVertexAttrib4bvARB - .globl glVertexAttrib4d ; .type glVertexAttrib4d,#function ; glVertexAttrib4d = glVertexAttrib4dARB - .globl glVertexAttrib4dv ; .type glVertexAttrib4dv,#function ; glVertexAttrib4dv = glVertexAttrib4dvARB - .globl glVertexAttrib4f ; .type glVertexAttrib4f,#function ; glVertexAttrib4f = glVertexAttrib4fARB - .globl glVertexAttrib4fv ; .type glVertexAttrib4fv,#function ; glVertexAttrib4fv = glVertexAttrib4fvARB - .globl glVertexAttrib4iv ; .type glVertexAttrib4iv,#function ; glVertexAttrib4iv = glVertexAttrib4ivARB - .globl glVertexAttrib4s ; .type glVertexAttrib4s,#function ; glVertexAttrib4s = glVertexAttrib4sARB - .globl glVertexAttrib4sv ; .type glVertexAttrib4sv,#function ; glVertexAttrib4sv = glVertexAttrib4svARB - .globl glVertexAttrib4ubv ; .type glVertexAttrib4ubv,#function ; glVertexAttrib4ubv = glVertexAttrib4ubvARB - .globl glVertexAttrib4uiv ; .type glVertexAttrib4uiv,#function ; glVertexAttrib4uiv = glVertexAttrib4uivARB - .globl glVertexAttrib4usv ; .type glVertexAttrib4usv,#function ; glVertexAttrib4usv = glVertexAttrib4usvARB - .globl glVertexAttribPointer ; .type glVertexAttribPointer,#function ; glVertexAttribPointer = glVertexAttribPointerARB - .globl glBindBuffer ; .type glBindBuffer,#function ; glBindBuffer = glBindBufferARB - .globl glBufferData ; .type glBufferData,#function ; glBufferData = glBufferDataARB - .globl glBufferSubData ; .type glBufferSubData,#function ; glBufferSubData = glBufferSubDataARB - .globl glDeleteBuffers ; .type glDeleteBuffers,#function ; glDeleteBuffers = glDeleteBuffersARB - .globl glGenBuffers ; .type glGenBuffers,#function ; glGenBuffers = glGenBuffersARB - .globl glGetBufferParameteriv ; .type glGetBufferParameteriv,#function ; glGetBufferParameteriv = glGetBufferParameterivARB - .globl glGetBufferPointerv ; .type glGetBufferPointerv,#function ; glGetBufferPointerv = glGetBufferPointervARB - .globl glGetBufferSubData ; .type glGetBufferSubData,#function ; glGetBufferSubData = glGetBufferSubDataARB - .globl glIsBuffer ; .type glIsBuffer,#function ; glIsBuffer = glIsBufferARB - .globl glMapBuffer ; .type glMapBuffer,#function ; glMapBuffer = glMapBufferARB - .globl glUnmapBuffer ; .type glUnmapBuffer,#function ; glUnmapBuffer = glUnmapBufferARB - .globl glBeginQuery ; .type glBeginQuery,#function ; glBeginQuery = glBeginQueryARB - .globl glDeleteQueries ; .type glDeleteQueries,#function ; glDeleteQueries = glDeleteQueriesARB - .globl glEndQuery ; .type glEndQuery,#function ; glEndQuery = glEndQueryARB - .globl glGenQueries ; .type glGenQueries,#function ; glGenQueries = glGenQueriesARB - .globl glGetQueryObjectiv ; .type glGetQueryObjectiv,#function ; glGetQueryObjectiv = glGetQueryObjectivARB - .globl glGetQueryObjectuiv ; .type glGetQueryObjectuiv,#function ; glGetQueryObjectuiv = glGetQueryObjectuivARB - .globl glGetQueryiv ; .type glGetQueryiv,#function ; glGetQueryiv = glGetQueryivARB - .globl glIsQuery ; .type glIsQuery,#function ; glIsQuery = glIsQueryARB - .globl glCompileShader ; .type glCompileShader,#function ; glCompileShader = glCompileShaderARB - .globl glGetActiveUniform ; .type glGetActiveUniform,#function ; glGetActiveUniform = glGetActiveUniformARB - .globl glGetShaderSource ; .type glGetShaderSource,#function ; glGetShaderSource = glGetShaderSourceARB - .globl glGetUniformLocation ; .type glGetUniformLocation,#function ; glGetUniformLocation = glGetUniformLocationARB - .globl glGetUniformfv ; .type glGetUniformfv,#function ; glGetUniformfv = glGetUniformfvARB - .globl glGetUniformiv ; .type glGetUniformiv,#function ; glGetUniformiv = glGetUniformivARB - .globl glLinkProgram ; .type glLinkProgram,#function ; glLinkProgram = glLinkProgramARB - .globl glShaderSource ; .type glShaderSource,#function ; glShaderSource = glShaderSourceARB - .globl glUniform1f ; .type glUniform1f,#function ; glUniform1f = glUniform1fARB - .globl glUniform1fv ; .type glUniform1fv,#function ; glUniform1fv = glUniform1fvARB - .globl glUniform1i ; .type glUniform1i,#function ; glUniform1i = glUniform1iARB - .globl glUniform1iv ; .type glUniform1iv,#function ; glUniform1iv = glUniform1ivARB - .globl glUniform2f ; .type glUniform2f,#function ; glUniform2f = glUniform2fARB - .globl glUniform2fv ; .type glUniform2fv,#function ; glUniform2fv = glUniform2fvARB - .globl glUniform2i ; .type glUniform2i,#function ; glUniform2i = glUniform2iARB - .globl glUniform2iv ; .type glUniform2iv,#function ; glUniform2iv = glUniform2ivARB - .globl glUniform3f ; .type glUniform3f,#function ; glUniform3f = glUniform3fARB - .globl glUniform3fv ; .type glUniform3fv,#function ; glUniform3fv = glUniform3fvARB - .globl glUniform3i ; .type glUniform3i,#function ; glUniform3i = glUniform3iARB - .globl glUniform3iv ; .type glUniform3iv,#function ; glUniform3iv = glUniform3ivARB - .globl glUniform4f ; .type glUniform4f,#function ; glUniform4f = glUniform4fARB - .globl glUniform4fv ; .type glUniform4fv,#function ; glUniform4fv = glUniform4fvARB - .globl glUniform4i ; .type glUniform4i,#function ; glUniform4i = glUniform4iARB - .globl glUniform4iv ; .type glUniform4iv,#function ; glUniform4iv = glUniform4ivARB - .globl glUniformMatrix2fv ; .type glUniformMatrix2fv,#function ; glUniformMatrix2fv = glUniformMatrix2fvARB - .globl glUniformMatrix3fv ; .type glUniformMatrix3fv,#function ; glUniformMatrix3fv = glUniformMatrix3fvARB - .globl glUniformMatrix4fv ; .type glUniformMatrix4fv,#function ; glUniformMatrix4fv = glUniformMatrix4fvARB - .globl glUseProgram ; .type glUseProgram,#function ; glUseProgram = glUseProgramObjectARB - .globl glValidateProgram ; .type glValidateProgram,#function ; glValidateProgram = glValidateProgramARB - .globl glBindAttribLocation ; .type glBindAttribLocation,#function ; glBindAttribLocation = glBindAttribLocationARB - .globl glGetActiveAttrib ; .type glGetActiveAttrib,#function ; glGetActiveAttrib = glGetActiveAttribARB - .globl glGetAttribLocation ; .type glGetAttribLocation,#function ; glGetAttribLocation = glGetAttribLocationARB - .globl glDrawBuffers ; .type glDrawBuffers,#function ; glDrawBuffers = glDrawBuffersARB - .globl glDrawBuffersATI ; .type glDrawBuffersATI,#function ; glDrawBuffersATI = glDrawBuffersARB - .globl glPointParameterf ; .type glPointParameterf,#function ; glPointParameterf = glPointParameterfEXT - .globl glPointParameterfARB ; .type glPointParameterfARB,#function ; glPointParameterfARB = glPointParameterfEXT - .globl glPointParameterfv ; .type glPointParameterfv,#function ; glPointParameterfv = glPointParameterfvEXT - .globl glPointParameterfvARB ; .type glPointParameterfvARB,#function ; glPointParameterfvARB = glPointParameterfvEXT - .globl glSecondaryColor3b ; .type glSecondaryColor3b,#function ; glSecondaryColor3b = glSecondaryColor3bEXT - .globl glSecondaryColor3bv ; .type glSecondaryColor3bv,#function ; glSecondaryColor3bv = glSecondaryColor3bvEXT - .globl glSecondaryColor3d ; .type glSecondaryColor3d,#function ; glSecondaryColor3d = glSecondaryColor3dEXT - .globl glSecondaryColor3dv ; .type glSecondaryColor3dv,#function ; glSecondaryColor3dv = glSecondaryColor3dvEXT - .globl glSecondaryColor3f ; .type glSecondaryColor3f,#function ; glSecondaryColor3f = glSecondaryColor3fEXT - .globl glSecondaryColor3fv ; .type glSecondaryColor3fv,#function ; glSecondaryColor3fv = glSecondaryColor3fvEXT - .globl glSecondaryColor3i ; .type glSecondaryColor3i,#function ; glSecondaryColor3i = glSecondaryColor3iEXT - .globl glSecondaryColor3iv ; .type glSecondaryColor3iv,#function ; glSecondaryColor3iv = glSecondaryColor3ivEXT - .globl glSecondaryColor3s ; .type glSecondaryColor3s,#function ; glSecondaryColor3s = glSecondaryColor3sEXT - .globl glSecondaryColor3sv ; .type glSecondaryColor3sv,#function ; glSecondaryColor3sv = glSecondaryColor3svEXT - .globl glSecondaryColor3ub ; .type glSecondaryColor3ub,#function ; glSecondaryColor3ub = glSecondaryColor3ubEXT - .globl glSecondaryColor3ubv ; .type glSecondaryColor3ubv,#function ; glSecondaryColor3ubv = glSecondaryColor3ubvEXT - .globl glSecondaryColor3ui ; .type glSecondaryColor3ui,#function ; glSecondaryColor3ui = glSecondaryColor3uiEXT - .globl glSecondaryColor3uiv ; .type glSecondaryColor3uiv,#function ; glSecondaryColor3uiv = glSecondaryColor3uivEXT - .globl glSecondaryColor3us ; .type glSecondaryColor3us,#function ; glSecondaryColor3us = glSecondaryColor3usEXT - .globl glSecondaryColor3usv ; .type glSecondaryColor3usv,#function ; glSecondaryColor3usv = glSecondaryColor3usvEXT - .globl glSecondaryColorPointer ; .type glSecondaryColorPointer,#function ; glSecondaryColorPointer = glSecondaryColorPointerEXT - .globl glMultiDrawArrays ; .type glMultiDrawArrays,#function ; glMultiDrawArrays = glMultiDrawArraysEXT - .globl glMultiDrawElements ; .type glMultiDrawElements,#function ; glMultiDrawElements = glMultiDrawElementsEXT - .globl glFogCoordPointer ; .type glFogCoordPointer,#function ; glFogCoordPointer = glFogCoordPointerEXT - .globl glFogCoordd ; .type glFogCoordd,#function ; glFogCoordd = glFogCoorddEXT - .globl glFogCoorddv ; .type glFogCoorddv,#function ; glFogCoorddv = glFogCoorddvEXT - .globl glFogCoordf ; .type glFogCoordf,#function ; glFogCoordf = glFogCoordfEXT - .globl glFogCoordfv ; .type glFogCoordfv,#function ; glFogCoordfv = glFogCoordfvEXT - .globl glBlendFuncSeparate ; .type glBlendFuncSeparate,#function ; glBlendFuncSeparate = glBlendFuncSeparateEXT - .globl glWindowPos2d ; .type glWindowPos2d,#function ; glWindowPos2d = glWindowPos2dMESA - .globl glWindowPos2dARB ; .type glWindowPos2dARB,#function ; glWindowPos2dARB = glWindowPos2dMESA - .globl glWindowPos2dv ; .type glWindowPos2dv,#function ; glWindowPos2dv = glWindowPos2dvMESA - .globl glWindowPos2dvARB ; .type glWindowPos2dvARB,#function ; glWindowPos2dvARB = glWindowPos2dvMESA - .globl glWindowPos2f ; .type glWindowPos2f,#function ; glWindowPos2f = glWindowPos2fMESA - .globl glWindowPos2fARB ; .type glWindowPos2fARB,#function ; glWindowPos2fARB = glWindowPos2fMESA - .globl glWindowPos2fv ; .type glWindowPos2fv,#function ; glWindowPos2fv = glWindowPos2fvMESA - .globl glWindowPos2fvARB ; .type glWindowPos2fvARB,#function ; glWindowPos2fvARB = glWindowPos2fvMESA - .globl glWindowPos2i ; .type glWindowPos2i,#function ; glWindowPos2i = glWindowPos2iMESA - .globl glWindowPos2iARB ; .type glWindowPos2iARB,#function ; glWindowPos2iARB = glWindowPos2iMESA - .globl glWindowPos2iv ; .type glWindowPos2iv,#function ; glWindowPos2iv = glWindowPos2ivMESA - .globl glWindowPos2ivARB ; .type glWindowPos2ivARB,#function ; glWindowPos2ivARB = glWindowPos2ivMESA - .globl glWindowPos2s ; .type glWindowPos2s,#function ; glWindowPos2s = glWindowPos2sMESA - .globl glWindowPos2sARB ; .type glWindowPos2sARB,#function ; glWindowPos2sARB = glWindowPos2sMESA - .globl glWindowPos2sv ; .type glWindowPos2sv,#function ; glWindowPos2sv = glWindowPos2svMESA - .globl glWindowPos2svARB ; .type glWindowPos2svARB,#function ; glWindowPos2svARB = glWindowPos2svMESA - .globl glWindowPos3d ; .type glWindowPos3d,#function ; glWindowPos3d = glWindowPos3dMESA - .globl glWindowPos3dARB ; .type glWindowPos3dARB,#function ; glWindowPos3dARB = glWindowPos3dMESA - .globl glWindowPos3dv ; .type glWindowPos3dv,#function ; glWindowPos3dv = glWindowPos3dvMESA - .globl glWindowPos3dvARB ; .type glWindowPos3dvARB,#function ; glWindowPos3dvARB = glWindowPos3dvMESA - .globl glWindowPos3f ; .type glWindowPos3f,#function ; glWindowPos3f = glWindowPos3fMESA - .globl glWindowPos3fARB ; .type glWindowPos3fARB,#function ; glWindowPos3fARB = glWindowPos3fMESA - .globl glWindowPos3fv ; .type glWindowPos3fv,#function ; glWindowPos3fv = glWindowPos3fvMESA - .globl glWindowPos3fvARB ; .type glWindowPos3fvARB,#function ; glWindowPos3fvARB = glWindowPos3fvMESA - .globl glWindowPos3i ; .type glWindowPos3i,#function ; glWindowPos3i = glWindowPos3iMESA - .globl glWindowPos3iARB ; .type glWindowPos3iARB,#function ; glWindowPos3iARB = glWindowPos3iMESA - .globl glWindowPos3iv ; .type glWindowPos3iv,#function ; glWindowPos3iv = glWindowPos3ivMESA - .globl glWindowPos3ivARB ; .type glWindowPos3ivARB,#function ; glWindowPos3ivARB = glWindowPos3ivMESA - .globl glWindowPos3s ; .type glWindowPos3s,#function ; glWindowPos3s = glWindowPos3sMESA - .globl glWindowPos3sARB ; .type glWindowPos3sARB,#function ; glWindowPos3sARB = glWindowPos3sMESA - .globl glWindowPos3sv ; .type glWindowPos3sv,#function ; glWindowPos3sv = glWindowPos3svMESA - .globl glWindowPos3svARB ; .type glWindowPos3svARB,#function ; glWindowPos3svARB = glWindowPos3svMESA - .globl glBindProgramARB ; .type glBindProgramARB,#function ; glBindProgramARB = glBindProgramNV - .globl glDeleteProgramsARB ; .type glDeleteProgramsARB,#function ; glDeleteProgramsARB = glDeleteProgramsNV - .globl glGenProgramsARB ; .type glGenProgramsARB,#function ; glGenProgramsARB = glGenProgramsNV - .globl glGetVertexAttribPointerv ; .type glGetVertexAttribPointerv,#function ; glGetVertexAttribPointerv = glGetVertexAttribPointervNV - .globl glGetVertexAttribPointervARB ; .type glGetVertexAttribPointervARB,#function ; glGetVertexAttribPointervARB = glGetVertexAttribPointervNV - .globl glIsProgramARB ; .type glIsProgramARB,#function ; glIsProgramARB = glIsProgramNV - .globl glPointParameteri ; .type glPointParameteri,#function ; glPointParameteri = glPointParameteriNV - .globl glPointParameteriv ; .type glPointParameteriv,#function ; glPointParameteriv = glPointParameterivNV - .globl glBlendEquationSeparate ; .type glBlendEquationSeparate,#function ; glBlendEquationSeparate = glBlendEquationSeparateEXT - .globl glBindFramebuffer ; .type glBindFramebuffer,#function ; glBindFramebuffer = glBindFramebufferEXT - .globl glBindRenderbuffer ; .type glBindRenderbuffer,#function ; glBindRenderbuffer = glBindRenderbufferEXT - .globl glCheckFramebufferStatus ; .type glCheckFramebufferStatus,#function ; glCheckFramebufferStatus = glCheckFramebufferStatusEXT - .globl glDeleteFramebuffers ; .type glDeleteFramebuffers,#function ; glDeleteFramebuffers = glDeleteFramebuffersEXT - .globl glDeleteRenderbuffers ; .type glDeleteRenderbuffers,#function ; glDeleteRenderbuffers = glDeleteRenderbuffersEXT - .globl glFramebufferRenderbuffer ; .type glFramebufferRenderbuffer,#function ; glFramebufferRenderbuffer = glFramebufferRenderbufferEXT - .globl glFramebufferTexture1D ; .type glFramebufferTexture1D,#function ; glFramebufferTexture1D = glFramebufferTexture1DEXT - .globl glFramebufferTexture2D ; .type glFramebufferTexture2D,#function ; glFramebufferTexture2D = glFramebufferTexture2DEXT - .globl glFramebufferTexture3D ; .type glFramebufferTexture3D,#function ; glFramebufferTexture3D = glFramebufferTexture3DEXT - .globl glGenFramebuffers ; .type glGenFramebuffers,#function ; glGenFramebuffers = glGenFramebuffersEXT - .globl glGenRenderbuffers ; .type glGenRenderbuffers,#function ; glGenRenderbuffers = glGenRenderbuffersEXT - .globl glGenerateMipmap ; .type glGenerateMipmap,#function ; glGenerateMipmap = glGenerateMipmapEXT - .globl glGetFramebufferAttachmentParameteriv ; .type glGetFramebufferAttachmentParameteriv,#function ; glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT - .globl glGetRenderbufferParameteriv ; .type glGetRenderbufferParameteriv,#function ; glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT - .globl glIsFramebuffer ; .type glIsFramebuffer,#function ; glIsFramebuffer = glIsFramebufferEXT - .globl glIsRenderbuffer ; .type glIsRenderbuffer,#function ; glIsRenderbuffer = glIsRenderbufferEXT - .globl glRenderbufferStorage ; .type glRenderbufferStorage,#function ; glRenderbufferStorage = glRenderbufferStorageEXT - .globl glBlitFramebuffer ; .type glBlitFramebuffer,#function ; glBlitFramebuffer = glBlitFramebufferEXT - .globl glFramebufferTextureLayer ; .type glFramebufferTextureLayer,#function ; glFramebufferTextureLayer = glFramebufferTextureLayerEXT + GL_STUB_ALIAS(glSeparableFilter2DEXT, glSeparableFilter2D) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetHistogramEXT, glGetHistogram) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetHistogramParameterfvEXT, glGetHistogramParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetHistogramParameterivEXT, glGetHistogramParameteriv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetMinmaxEXT, glGetMinmax) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetMinmaxParameterfvEXT, glGetMinmaxParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetMinmaxParameterivEXT, glGetMinmaxParameteriv) +#endif + GL_STUB_ALIAS(glHistogramEXT, glHistogram) + GL_STUB_ALIAS(glMinmaxEXT, glMinmax) + GL_STUB_ALIAS(glResetHistogramEXT, glResetHistogram) + GL_STUB_ALIAS(glResetMinmaxEXT, glResetMinmax) + GL_STUB_ALIAS(glTexImage3DEXT, glTexImage3D) + GL_STUB_ALIAS(glTexSubImage3DEXT, glTexSubImage3D) + GL_STUB_ALIAS(glCopyTexSubImage3DEXT, glCopyTexSubImage3D) + GL_STUB_ALIAS(glActiveTexture, glActiveTextureARB) + GL_STUB_ALIAS(glClientActiveTexture, glClientActiveTextureARB) + GL_STUB_ALIAS(glMultiTexCoord1d, glMultiTexCoord1dARB) + GL_STUB_ALIAS(glMultiTexCoord1dv, glMultiTexCoord1dvARB) + GL_STUB_ALIAS(glMultiTexCoord1f, glMultiTexCoord1fARB) + GL_STUB_ALIAS(glMultiTexCoord1fv, glMultiTexCoord1fvARB) + GL_STUB_ALIAS(glMultiTexCoord1i, glMultiTexCoord1iARB) + GL_STUB_ALIAS(glMultiTexCoord1iv, glMultiTexCoord1ivARB) + GL_STUB_ALIAS(glMultiTexCoord1s, glMultiTexCoord1sARB) + GL_STUB_ALIAS(glMultiTexCoord1sv, glMultiTexCoord1svARB) + GL_STUB_ALIAS(glMultiTexCoord2d, glMultiTexCoord2dARB) + GL_STUB_ALIAS(glMultiTexCoord2dv, glMultiTexCoord2dvARB) + GL_STUB_ALIAS(glMultiTexCoord2f, glMultiTexCoord2fARB) + GL_STUB_ALIAS(glMultiTexCoord2fv, glMultiTexCoord2fvARB) + GL_STUB_ALIAS(glMultiTexCoord2i, glMultiTexCoord2iARB) + GL_STUB_ALIAS(glMultiTexCoord2iv, glMultiTexCoord2ivARB) + GL_STUB_ALIAS(glMultiTexCoord2s, glMultiTexCoord2sARB) + GL_STUB_ALIAS(glMultiTexCoord2sv, glMultiTexCoord2svARB) + GL_STUB_ALIAS(glMultiTexCoord3d, glMultiTexCoord3dARB) + GL_STUB_ALIAS(glMultiTexCoord3dv, glMultiTexCoord3dvARB) + GL_STUB_ALIAS(glMultiTexCoord3f, glMultiTexCoord3fARB) + GL_STUB_ALIAS(glMultiTexCoord3fv, glMultiTexCoord3fvARB) + GL_STUB_ALIAS(glMultiTexCoord3i, glMultiTexCoord3iARB) + GL_STUB_ALIAS(glMultiTexCoord3iv, glMultiTexCoord3ivARB) + GL_STUB_ALIAS(glMultiTexCoord3s, glMultiTexCoord3sARB) + GL_STUB_ALIAS(glMultiTexCoord3sv, glMultiTexCoord3svARB) + GL_STUB_ALIAS(glMultiTexCoord4d, glMultiTexCoord4dARB) + GL_STUB_ALIAS(glMultiTexCoord4dv, glMultiTexCoord4dvARB) + GL_STUB_ALIAS(glMultiTexCoord4f, glMultiTexCoord4fARB) + GL_STUB_ALIAS(glMultiTexCoord4fv, glMultiTexCoord4fvARB) + GL_STUB_ALIAS(glMultiTexCoord4i, glMultiTexCoord4iARB) + GL_STUB_ALIAS(glMultiTexCoord4iv, glMultiTexCoord4ivARB) + GL_STUB_ALIAS(glMultiTexCoord4s, glMultiTexCoord4sARB) + GL_STUB_ALIAS(glMultiTexCoord4sv, glMultiTexCoord4svARB) + GL_STUB_ALIAS(glStencilOpSeparateATI, glStencilOpSeparate) + GL_STUB_ALIAS(glLoadTransposeMatrixd, glLoadTransposeMatrixdARB) + GL_STUB_ALIAS(glLoadTransposeMatrixf, glLoadTransposeMatrixfARB) + GL_STUB_ALIAS(glMultTransposeMatrixd, glMultTransposeMatrixdARB) + GL_STUB_ALIAS(glMultTransposeMatrixf, glMultTransposeMatrixfARB) + GL_STUB_ALIAS(glSampleCoverage, glSampleCoverageARB) + GL_STUB_ALIAS(glCompressedTexImage1D, glCompressedTexImage1DARB) + GL_STUB_ALIAS(glCompressedTexImage2D, glCompressedTexImage2DARB) + GL_STUB_ALIAS(glCompressedTexImage3D, glCompressedTexImage3DARB) + GL_STUB_ALIAS(glCompressedTexSubImage1D, glCompressedTexSubImage1DARB) + GL_STUB_ALIAS(glCompressedTexSubImage2D, glCompressedTexSubImage2DARB) + GL_STUB_ALIAS(glCompressedTexSubImage3D, glCompressedTexSubImage3DARB) + GL_STUB_ALIAS(glGetCompressedTexImage, glGetCompressedTexImageARB) + GL_STUB_ALIAS(glDisableVertexAttribArray, glDisableVertexAttribArrayARB) + GL_STUB_ALIAS(glEnableVertexAttribArray, glEnableVertexAttribArrayARB) + GL_STUB_ALIAS(glGetVertexAttribdv, glGetVertexAttribdvARB) + GL_STUB_ALIAS(glGetVertexAttribfv, glGetVertexAttribfvARB) + GL_STUB_ALIAS(glGetVertexAttribiv, glGetVertexAttribivARB) + GL_STUB_ALIAS(glProgramParameter4dNV, glProgramEnvParameter4dARB) + GL_STUB_ALIAS(glProgramParameter4dvNV, glProgramEnvParameter4dvARB) + GL_STUB_ALIAS(glProgramParameter4fNV, glProgramEnvParameter4fARB) + GL_STUB_ALIAS(glProgramParameter4fvNV, glProgramEnvParameter4fvARB) + GL_STUB_ALIAS(glVertexAttrib1d, glVertexAttrib1dARB) + GL_STUB_ALIAS(glVertexAttrib1dv, glVertexAttrib1dvARB) + GL_STUB_ALIAS(glVertexAttrib1f, glVertexAttrib1fARB) + GL_STUB_ALIAS(glVertexAttrib1fv, glVertexAttrib1fvARB) + GL_STUB_ALIAS(glVertexAttrib1s, glVertexAttrib1sARB) + GL_STUB_ALIAS(glVertexAttrib1sv, glVertexAttrib1svARB) + GL_STUB_ALIAS(glVertexAttrib2d, glVertexAttrib2dARB) + GL_STUB_ALIAS(glVertexAttrib2dv, glVertexAttrib2dvARB) + GL_STUB_ALIAS(glVertexAttrib2f, glVertexAttrib2fARB) + GL_STUB_ALIAS(glVertexAttrib2fv, glVertexAttrib2fvARB) + GL_STUB_ALIAS(glVertexAttrib2s, glVertexAttrib2sARB) + GL_STUB_ALIAS(glVertexAttrib2sv, glVertexAttrib2svARB) + GL_STUB_ALIAS(glVertexAttrib3d, glVertexAttrib3dARB) + GL_STUB_ALIAS(glVertexAttrib3dv, glVertexAttrib3dvARB) + GL_STUB_ALIAS(glVertexAttrib3f, glVertexAttrib3fARB) + GL_STUB_ALIAS(glVertexAttrib3fv, glVertexAttrib3fvARB) + GL_STUB_ALIAS(glVertexAttrib3s, glVertexAttrib3sARB) + GL_STUB_ALIAS(glVertexAttrib3sv, glVertexAttrib3svARB) + GL_STUB_ALIAS(glVertexAttrib4Nbv, glVertexAttrib4NbvARB) + GL_STUB_ALIAS(glVertexAttrib4Niv, glVertexAttrib4NivARB) + GL_STUB_ALIAS(glVertexAttrib4Nsv, glVertexAttrib4NsvARB) + GL_STUB_ALIAS(glVertexAttrib4Nub, glVertexAttrib4NubARB) + GL_STUB_ALIAS(glVertexAttrib4Nubv, glVertexAttrib4NubvARB) + GL_STUB_ALIAS(glVertexAttrib4Nuiv, glVertexAttrib4NuivARB) + GL_STUB_ALIAS(glVertexAttrib4Nusv, glVertexAttrib4NusvARB) + GL_STUB_ALIAS(glVertexAttrib4bv, glVertexAttrib4bvARB) + GL_STUB_ALIAS(glVertexAttrib4d, glVertexAttrib4dARB) + GL_STUB_ALIAS(glVertexAttrib4dv, glVertexAttrib4dvARB) + GL_STUB_ALIAS(glVertexAttrib4f, glVertexAttrib4fARB) + GL_STUB_ALIAS(glVertexAttrib4fv, glVertexAttrib4fvARB) + GL_STUB_ALIAS(glVertexAttrib4iv, glVertexAttrib4ivARB) + GL_STUB_ALIAS(glVertexAttrib4s, glVertexAttrib4sARB) + GL_STUB_ALIAS(glVertexAttrib4sv, glVertexAttrib4svARB) + GL_STUB_ALIAS(glVertexAttrib4ubv, glVertexAttrib4ubvARB) + GL_STUB_ALIAS(glVertexAttrib4uiv, glVertexAttrib4uivARB) + GL_STUB_ALIAS(glVertexAttrib4usv, glVertexAttrib4usvARB) + GL_STUB_ALIAS(glVertexAttribPointer, glVertexAttribPointerARB) + GL_STUB_ALIAS(glBindBuffer, glBindBufferARB) + GL_STUB_ALIAS(glBufferData, glBufferDataARB) + GL_STUB_ALIAS(glBufferSubData, glBufferSubDataARB) + GL_STUB_ALIAS(glDeleteBuffers, glDeleteBuffersARB) + GL_STUB_ALIAS(glGenBuffers, glGenBuffersARB) + GL_STUB_ALIAS(glGetBufferParameteriv, glGetBufferParameterivARB) + GL_STUB_ALIAS(glGetBufferPointerv, glGetBufferPointervARB) + GL_STUB_ALIAS(glGetBufferSubData, glGetBufferSubDataARB) + GL_STUB_ALIAS(glIsBuffer, glIsBufferARB) + GL_STUB_ALIAS(glMapBuffer, glMapBufferARB) + GL_STUB_ALIAS(glUnmapBuffer, glUnmapBufferARB) + GL_STUB_ALIAS(glBeginQuery, glBeginQueryARB) + GL_STUB_ALIAS(glDeleteQueries, glDeleteQueriesARB) + GL_STUB_ALIAS(glEndQuery, glEndQueryARB) + GL_STUB_ALIAS(glGenQueries, glGenQueriesARB) + GL_STUB_ALIAS(glGetQueryObjectiv, glGetQueryObjectivARB) + GL_STUB_ALIAS(glGetQueryObjectuiv, glGetQueryObjectuivARB) + GL_STUB_ALIAS(glGetQueryiv, glGetQueryivARB) + GL_STUB_ALIAS(glIsQuery, glIsQueryARB) + GL_STUB_ALIAS(glCompileShader, glCompileShaderARB) + GL_STUB_ALIAS(glGetActiveUniform, glGetActiveUniformARB) + GL_STUB_ALIAS(glGetShaderSource, glGetShaderSourceARB) + GL_STUB_ALIAS(glGetUniformLocation, glGetUniformLocationARB) + GL_STUB_ALIAS(glGetUniformfv, glGetUniformfvARB) + GL_STUB_ALIAS(glGetUniformiv, glGetUniformivARB) + GL_STUB_ALIAS(glLinkProgram, glLinkProgramARB) + GL_STUB_ALIAS(glShaderSource, glShaderSourceARB) + GL_STUB_ALIAS(glUniform1f, glUniform1fARB) + GL_STUB_ALIAS(glUniform1fv, glUniform1fvARB) + GL_STUB_ALIAS(glUniform1i, glUniform1iARB) + GL_STUB_ALIAS(glUniform1iv, glUniform1ivARB) + GL_STUB_ALIAS(glUniform2f, glUniform2fARB) + GL_STUB_ALIAS(glUniform2fv, glUniform2fvARB) + GL_STUB_ALIAS(glUniform2i, glUniform2iARB) + GL_STUB_ALIAS(glUniform2iv, glUniform2ivARB) + GL_STUB_ALIAS(glUniform3f, glUniform3fARB) + GL_STUB_ALIAS(glUniform3fv, glUniform3fvARB) + GL_STUB_ALIAS(glUniform3i, glUniform3iARB) + GL_STUB_ALIAS(glUniform3iv, glUniform3ivARB) + GL_STUB_ALIAS(glUniform4f, glUniform4fARB) + GL_STUB_ALIAS(glUniform4fv, glUniform4fvARB) + GL_STUB_ALIAS(glUniform4i, glUniform4iARB) + GL_STUB_ALIAS(glUniform4iv, glUniform4ivARB) + GL_STUB_ALIAS(glUniformMatrix2fv, glUniformMatrix2fvARB) + GL_STUB_ALIAS(glUniformMatrix3fv, glUniformMatrix3fvARB) + GL_STUB_ALIAS(glUniformMatrix4fv, glUniformMatrix4fvARB) + GL_STUB_ALIAS(glUseProgram, glUseProgramObjectARB) + GL_STUB_ALIAS(glValidateProgram, glValidateProgramARB) + GL_STUB_ALIAS(glBindAttribLocation, glBindAttribLocationARB) + GL_STUB_ALIAS(glGetActiveAttrib, glGetActiveAttribARB) + GL_STUB_ALIAS(glGetAttribLocation, glGetAttribLocationARB) + GL_STUB_ALIAS(glDrawBuffers, glDrawBuffersARB) + GL_STUB_ALIAS(glDrawBuffersATI, glDrawBuffersARB) + GL_STUB_ALIAS(glPointParameterf, glPointParameterfEXT) + GL_STUB_ALIAS(glPointParameterfARB, glPointParameterfEXT) + GL_STUB_ALIAS(glPointParameterfSGIS, glPointParameterfEXT) + GL_STUB_ALIAS(glPointParameterfv, glPointParameterfvEXT) + GL_STUB_ALIAS(glPointParameterfvARB, glPointParameterfvEXT) + GL_STUB_ALIAS(glPointParameterfvSGIS, glPointParameterfvEXT) + GL_STUB_ALIAS(glSecondaryColor3b, glSecondaryColor3bEXT) + GL_STUB_ALIAS(glSecondaryColor3bv, glSecondaryColor3bvEXT) + GL_STUB_ALIAS(glSecondaryColor3d, glSecondaryColor3dEXT) + GL_STUB_ALIAS(glSecondaryColor3dv, glSecondaryColor3dvEXT) + GL_STUB_ALIAS(glSecondaryColor3f, glSecondaryColor3fEXT) + GL_STUB_ALIAS(glSecondaryColor3fv, glSecondaryColor3fvEXT) + GL_STUB_ALIAS(glSecondaryColor3i, glSecondaryColor3iEXT) + GL_STUB_ALIAS(glSecondaryColor3iv, glSecondaryColor3ivEXT) + GL_STUB_ALIAS(glSecondaryColor3s, glSecondaryColor3sEXT) + GL_STUB_ALIAS(glSecondaryColor3sv, glSecondaryColor3svEXT) + GL_STUB_ALIAS(glSecondaryColor3ub, glSecondaryColor3ubEXT) + GL_STUB_ALIAS(glSecondaryColor3ubv, glSecondaryColor3ubvEXT) + GL_STUB_ALIAS(glSecondaryColor3ui, glSecondaryColor3uiEXT) + GL_STUB_ALIAS(glSecondaryColor3uiv, glSecondaryColor3uivEXT) + GL_STUB_ALIAS(glSecondaryColor3us, glSecondaryColor3usEXT) + GL_STUB_ALIAS(glSecondaryColor3usv, glSecondaryColor3usvEXT) + GL_STUB_ALIAS(glSecondaryColorPointer, glSecondaryColorPointerEXT) + GL_STUB_ALIAS(glMultiDrawArrays, glMultiDrawArraysEXT) + GL_STUB_ALIAS(glMultiDrawElements, glMultiDrawElementsEXT) + GL_STUB_ALIAS(glFogCoordPointer, glFogCoordPointerEXT) + GL_STUB_ALIAS(glFogCoordd, glFogCoorddEXT) + GL_STUB_ALIAS(glFogCoorddv, glFogCoorddvEXT) + GL_STUB_ALIAS(glFogCoordf, glFogCoordfEXT) + GL_STUB_ALIAS(glFogCoordfv, glFogCoordfvEXT) + GL_STUB_ALIAS(glBlendFuncSeparate, glBlendFuncSeparateEXT) + GL_STUB_ALIAS(glBlendFuncSeparateINGR, glBlendFuncSeparateEXT) + GL_STUB_ALIAS(glWindowPos2d, glWindowPos2dMESA) + GL_STUB_ALIAS(glWindowPos2dARB, glWindowPos2dMESA) + GL_STUB_ALIAS(glWindowPos2dv, glWindowPos2dvMESA) + GL_STUB_ALIAS(glWindowPos2dvARB, glWindowPos2dvMESA) + GL_STUB_ALIAS(glWindowPos2f, glWindowPos2fMESA) + GL_STUB_ALIAS(glWindowPos2fARB, glWindowPos2fMESA) + GL_STUB_ALIAS(glWindowPos2fv, glWindowPos2fvMESA) + GL_STUB_ALIAS(glWindowPos2fvARB, glWindowPos2fvMESA) + GL_STUB_ALIAS(glWindowPos2i, glWindowPos2iMESA) + GL_STUB_ALIAS(glWindowPos2iARB, glWindowPos2iMESA) + GL_STUB_ALIAS(glWindowPos2iv, glWindowPos2ivMESA) + GL_STUB_ALIAS(glWindowPos2ivARB, glWindowPos2ivMESA) + GL_STUB_ALIAS(glWindowPos2s, glWindowPos2sMESA) + GL_STUB_ALIAS(glWindowPos2sARB, glWindowPos2sMESA) + GL_STUB_ALIAS(glWindowPos2sv, glWindowPos2svMESA) + GL_STUB_ALIAS(glWindowPos2svARB, glWindowPos2svMESA) + GL_STUB_ALIAS(glWindowPos3d, glWindowPos3dMESA) + GL_STUB_ALIAS(glWindowPos3dARB, glWindowPos3dMESA) + GL_STUB_ALIAS(glWindowPos3dv, glWindowPos3dvMESA) + GL_STUB_ALIAS(glWindowPos3dvARB, glWindowPos3dvMESA) + GL_STUB_ALIAS(glWindowPos3f, glWindowPos3fMESA) + GL_STUB_ALIAS(glWindowPos3fARB, glWindowPos3fMESA) + GL_STUB_ALIAS(glWindowPos3fv, glWindowPos3fvMESA) + GL_STUB_ALIAS(glWindowPos3fvARB, glWindowPos3fvMESA) + GL_STUB_ALIAS(glWindowPos3i, glWindowPos3iMESA) + GL_STUB_ALIAS(glWindowPos3iARB, glWindowPos3iMESA) + GL_STUB_ALIAS(glWindowPos3iv, glWindowPos3ivMESA) + GL_STUB_ALIAS(glWindowPos3ivARB, glWindowPos3ivMESA) + GL_STUB_ALIAS(glWindowPos3s, glWindowPos3sMESA) + GL_STUB_ALIAS(glWindowPos3sARB, glWindowPos3sMESA) + GL_STUB_ALIAS(glWindowPos3sv, glWindowPos3svMESA) + GL_STUB_ALIAS(glWindowPos3svARB, glWindowPos3svMESA) + GL_STUB_ALIAS(glBindProgramARB, glBindProgramNV) + GL_STUB_ALIAS(glDeleteProgramsARB, glDeleteProgramsNV) + GL_STUB_ALIAS(glGenProgramsARB, glGenProgramsNV) + GL_STUB_ALIAS(glGetVertexAttribPointerv, glGetVertexAttribPointervNV) + GL_STUB_ALIAS(glGetVertexAttribPointervARB, glGetVertexAttribPointervNV) + GL_STUB_ALIAS(glIsProgramARB, glIsProgramNV) + GL_STUB_ALIAS(glPointParameteri, glPointParameteriNV) + GL_STUB_ALIAS(glPointParameteriv, glPointParameterivNV) + GL_STUB_ALIAS(glBindFramebuffer, glBindFramebufferEXT) + GL_STUB_ALIAS(glBindRenderbuffer, glBindRenderbufferEXT) + GL_STUB_ALIAS(glCheckFramebufferStatus, glCheckFramebufferStatusEXT) + GL_STUB_ALIAS(glDeleteFramebuffers, glDeleteFramebuffersEXT) + GL_STUB_ALIAS(glDeleteRenderbuffers, glDeleteRenderbuffersEXT) + GL_STUB_ALIAS(glFramebufferRenderbuffer, glFramebufferRenderbufferEXT) + GL_STUB_ALIAS(glFramebufferTexture1D, glFramebufferTexture1DEXT) + GL_STUB_ALIAS(glFramebufferTexture2D, glFramebufferTexture2DEXT) + GL_STUB_ALIAS(glFramebufferTexture3D, glFramebufferTexture3DEXT) + GL_STUB_ALIAS(glGenFramebuffers, glGenFramebuffersEXT) + GL_STUB_ALIAS(glGenRenderbuffers, glGenRenderbuffersEXT) + GL_STUB_ALIAS(glGenerateMipmap, glGenerateMipmapEXT) + GL_STUB_ALIAS(glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT) + GL_STUB_ALIAS(glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT) + GL_STUB_ALIAS(glIsFramebuffer, glIsFramebufferEXT) + GL_STUB_ALIAS(glIsRenderbuffer, glIsRenderbufferEXT) + GL_STUB_ALIAS(glRenderbufferStorage, glRenderbufferStorageEXT) + GL_STUB_ALIAS(glFramebufferTextureLayer, glFramebufferTextureLayerEXT) + + .globl gl_dispatch_functions_end + HIDDEN(gl_dispatch_functions_end) +gl_dispatch_functions_end: diff --git a/src/mesa/sparc/sparc.c b/src/mesa/sparc/sparc.c index 84e8ac6723..3bde98e34b 100644 --- a/src/mesa/sparc/sparc.c +++ b/src/mesa/sparc/sparc.c @@ -109,10 +109,10 @@ void _mesa_init_all_sparc_transform_asm(void) ASSIGN_XFORM_GROUP(sparc, 2) ASSIGN_XFORM_GROUP(sparc, 3) ASSIGN_XFORM_GROUP(sparc, 4) - +#if 0 _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4; _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np; - +#endif #if 0 /* disable these too. See bug 673938 */ _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = @@ -140,38 +140,4 @@ void _mesa_init_all_sparc_transform_asm(void) #endif } -extern unsigned int _mesa_sparc_glapi_begin; -extern unsigned int _mesa_sparc_glapi_end; -extern void __glapi_sparc_icache_flush(unsigned int *); - -#endif /* USE_SPARC_ASM */ - - -void _mesa_init_sparc_glapi_relocs(void) -{ -#ifdef USE_SPARC_ASM - unsigned int *insn_ptr, *end_ptr; - unsigned long disp_addr; - - insn_ptr = &_mesa_sparc_glapi_begin; - end_ptr = &_mesa_sparc_glapi_end; - disp_addr = (unsigned long) &_glapi_Dispatch; - - while (insn_ptr < end_ptr) { -#ifdef __arch64__ - insn_ptr[0] |= (disp_addr >> (32 + 10)); - insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10); - __glapi_sparc_icache_flush(&insn_ptr[0]); - insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1)); - insn_ptr[3] |= (disp_addr & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&insn_ptr[2]); - insn_ptr += 11; -#else - insn_ptr[0] |= (disp_addr >> 10); - insn_ptr[1] |= (disp_addr & ((1 << 10) - 1)); - __glapi_sparc_icache_flush(&insn_ptr[0]); - insn_ptr += 5; -#endif - } #endif /* USE_SPARC_ASM */ -} diff --git a/src/mesa/sparc/sparc.h b/src/mesa/sparc/sparc.h index a98e4d0e40..b9ea336856 100644 --- a/src/mesa/sparc/sparc.h +++ b/src/mesa/sparc/sparc.h @@ -32,6 +32,5 @@ #define SPARC_H extern void _mesa_init_all_sparc_transform_asm(void); -extern void _mesa_init_sparc_glapi_relocs(void); #endif /* !(SPARC_H) */ -- cgit v1.2.3 From 9b78d9f65178648b1888f98153a2f738a281cb84 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Feb 2009 16:39:22 -0700 Subject: i965: whitespace/indentation fixes --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 52 ++++++++++++++++------------------- 1 file changed, 24 insertions(+), 28 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 37766b7c3a..b2d67bd867 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -289,8 +289,7 @@ static struct prog_src_register get_pixel_w( struct brw_wm_compile *c ) struct prog_dst_register pixel_w = get_temp(c); struct prog_src_register deltas = get_delta_xy(c); struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS); - - + /* deltas.xyw = DELTAS2 deltas.xy, payload.interp_wpos.x */ emit_op(c, @@ -510,7 +509,6 @@ static void precalc_dst( struct brw_wm_compile *c, src_undef()); } - if (dst.WriteMask & WRITEMASK_XZ) { struct prog_instruction *swz; GLuint z = GET_SWZ(src0.Swizzle, Z); @@ -563,7 +561,6 @@ static void precalc_lit( struct brw_wm_compile *c, swz->SrcReg[0].NegateBase = 0; } - if (dst.WriteMask & WRITEMASK_YZ) { emit_op(c, OPCODE_LIT, @@ -876,20 +873,20 @@ static void emit_fb_write( struct brw_wm_compile *c ) use it for fb write target and eot */ if (brw->state.nr_draw_regions > 1) { - for (i = 0 ; i < brw->state.nr_draw_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); - inst->Sampler = (i<<1); - if (c->fp_fragcolor_emitted) { - outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); - last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), - 0, outcolor, payload_r0_depth, outdepth); - inst->Sampler = (i<<1); - } - } - last_inst->Sampler |= 1; //eot + for (i = 0 ; i < brw->state.nr_draw_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); + inst->Sampler = (i<<1); + if (c->fp_fragcolor_emitted) { + outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), + 0, outcolor, payload_r0_depth, outdepth); + inst->Sampler = (i<<1); + } + } + last_inst->Sampler |= 1; //eot } else { /* if gl_FragData[0] is written, use it, else use gl_FragColor */ @@ -898,9 +895,9 @@ static void emit_fb_write( struct brw_wm_compile *c ) else outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); - inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), - 0, outcolor, payload_r0_depth, outdepth); - inst->Sampler = 1|(0<<1); + inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), + 0, outcolor, payload_r0_depth, outdepth); + inst->Sampler = 1|(0<<1); } } @@ -931,9 +928,9 @@ static void validate_dst_regs( struct brw_wm_compile *c, const struct prog_instruction *inst ) { if (inst->DstReg.File == PROGRAM_OUTPUT) { - GLuint idx = inst->DstReg.Index; - if (idx == FRAG_RESULT_COLR) - c->fp_fragcolor_emitted = 1; + GLuint idx = inst->DstReg.Index; + if (idx == FRAG_RESULT_COLR) + c->fp_fragcolor_emitted = 1; } } @@ -954,7 +951,6 @@ static void print_insns( const struct prog_instruction *insn, } else _mesa_printf("UNKNOWN\n"); - } } @@ -1079,9 +1075,9 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) } if (INTEL_DEBUG & DEBUG_WM) { - _mesa_printf("pass_fp:\n"); - print_insns( c->prog_instructions, c->nr_fp_insns ); - _mesa_printf("\n"); + _mesa_printf("pass_fp:\n"); + print_insns( c->prog_instructions, c->nr_fp_insns ); + _mesa_printf("\n"); } } -- cgit v1.2.3 From 8ae7e7749b708fc5a46180d3de2503ba7e2ab1f3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Feb 2009 17:50:55 -0700 Subject: mesa: replace old prog_instruction::Sampler field with Aux field The i965 driver needs an extra instruction field for color output information. It was using the Sampler field for this. Use the Aux field instead. This will probaby be revisited at some point... --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 11 +++++------ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 ++-- src/mesa/drivers/dri/i965/brw_wm_pass0.c | 4 ++-- src/mesa/shader/prog_instruction.h | 11 +++-------- 4 files changed, 12 insertions(+), 18 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 b2d67bd867..fcd833b9bc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -869,8 +869,7 @@ static void emit_fb_write( struct brw_wm_compile *c ) struct prog_instruction *inst, *last_inst; struct brw_context *brw = c->func.brw; - /* inst->Sampler is not used by backend, - use it for fb write target and eot */ + /* The inst->Aux field is used for FB write target and the EOT marker */ if (brw->state.nr_draw_regions > 1) { for (i = 0 ; i < brw->state.nr_draw_regions; i++) { @@ -878,15 +877,15 @@ static void emit_fb_write( struct brw_wm_compile *c ) last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, outcolor, payload_r0_depth, outdepth); - inst->Sampler = (i<<1); + inst->Aux = (i<<1); if (c->fp_fragcolor_emitted) { outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, outcolor, payload_r0_depth, outdepth); - inst->Sampler = (i<<1); + inst->Aux = (i<<1); } } - last_inst->Sampler |= 1; //eot + last_inst->Aux |= 1; //eot } else { /* if gl_FragData[0] is written, use it, else use gl_FragColor */ @@ -897,7 +896,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->Sampler = 1|(0<<1); + inst->Aux = 1|(0<<1); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 121cdc040e..8e404bcdc3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -426,8 +426,8 @@ static void emit_fb_write(struct brw_wm_compile *c, nr += 2; } - target = inst->Sampler >> 1; - eot = inst->Sampler & 1; + target = inst->Aux >> 1; + eot = inst->Aux & 1; 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 783545de56..2debd0678a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -350,8 +350,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->Sampler & 1; - out->target = inst->Sampler>>1; + out->eot = inst->Aux & 1; + out->target = inst->Aux >> 1; /* Args: */ diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index e3bb7ac01d..3808644550 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -410,20 +410,15 @@ struct prog_instruction */ GLint BranchTarget; -#if 01 /* XXX just use this for i965 driver for now! */ - /** - * For TEX instructions in shaders, the sampler to use for the - * texture lookup. - */ - GLint Sampler; -#endif - /** for debugging purposes */ const char *Comment; /** Arbitrary data. Used for OPCODE_PRINT and some drivers */ void *Data; + /** for driver use (try to remove someday) */ + GLint Aux; + /* XXX obsolete - remove someday */ #if FEATURE_MESA_program_debug GLshort StringPos; -- cgit v1.2.3 From ecdf3ce436c004365c4d3c468bf1f9ef9138853e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Feb 2009 14:02:52 -0700 Subject: i965: add missing init for region->width This doesn't seem to really effect anything but seeing width=0 in drawing regions was confusing. --- src/mesa/drivers/dri/intel/intel_regions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 749920502a..0aa5b8c02c 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -466,7 +466,8 @@ intel_recreate_static(struct intel_context *intel, else region->cpp = intel->ctx.Visual.rgbBits / 8; region->pitch = intelScreen->pitch; - region->height = intelScreen->height; /* needed? */ + region->width = intelScreen->width; + region->height = intelScreen->height; if (region->buffer != NULL) { dri_bo_unreference(region->buffer); -- cgit v1.2.3 From 16144632354cb310f090c8713a11d3c65696969e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Feb 2009 14:49:24 -0700 Subject: mesa: avoid extraneous calls to ctx->Driver.BindFramebuffer() Only call this driver function when we really need to bind different buffers. --- src/mesa/main/fbobject.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 23b3fb68fb..151e29053a 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1229,19 +1229,26 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) ASSERT(newFb != &DummyFramebuffer); /* - * XXX check if re-binding same buffer and skip some of this code. + * OK, now bind the new Draw/Read framebuffers, if they're changing. */ if (bindReadBuf) { - _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); + if (ctx->ReadBuffer == newFbread) + bindReadBuf = GL_FALSE; /* no change */ + else + _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); } if (bindDrawBuf) { /* check if old FB had any texture attachments */ - check_end_texture_render(ctx, ctx->DrawBuffer); + if (ctx->DrawBuffer->Name != 0) { + check_end_texture_render(ctx, ctx->DrawBuffer); + } - /* check if time to delete this framebuffer */ - _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); + if (ctx->DrawBuffer == newFb) + bindDrawBuf = GL_FALSE; /* no change */ + else + _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); if (newFb->Name != 0) { /* check if newly bound framebuffer has any texture attachments */ @@ -1249,7 +1256,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } } - if (ctx->Driver.BindFramebuffer) { + if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) { ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread); } } -- cgit v1.2.3 From cdc63901df6af3b370935bd4997e3c9c4eb4b933 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Feb 2009 15:04:20 -0700 Subject: i965: rename draw_regions -> color_regions Be a little more specific about what these are. --- src/mesa/drivers/dri/i965/brw_context.h | 4 ++-- src/mesa/drivers/dri/i965/brw_vtbl.c | 22 +++++++++++----------- src/mesa/drivers/dri/i965/brw_wm_fp.c | 4 ++-- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 +++++----- 4 files changed, 20 insertions(+), 20 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 cb12a2b773..a43fc40ac9 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -418,8 +418,8 @@ struct brw_context struct brw_tracked_state **atoms; GLuint nr_atoms; - GLuint nr_draw_regions; - struct intel_region *draw_regions[MAX_DRAW_BUFFERS]; + GLuint nr_color_regions; + struct intel_region *color_regions[MAX_DRAW_BUFFERS]; struct intel_region *depth_region; /** diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 15ceac6ba1..fc9f6cc80c 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -71,9 +71,9 @@ static void brw_destroy_context( struct intel_context *intel ) brw_FrameBufferTexDestroy( brw ); - for (i = 0; i < brw->state.nr_draw_regions; i++) - intel_region_release(&brw->state.draw_regions[i]); - brw->state.nr_draw_regions = 0; + for (i = 0; i < brw->state.nr_color_regions; i++) + intel_region_release(&brw->state.color_regions[i]); + brw->state.nr_color_regions = 0; intel_region_release(&brw->state.depth_region); dri_bo_release(&brw->curbe.curbe_bo); @@ -105,25 +105,25 @@ static void brw_destroy_context( struct intel_context *intel ) * called from intelDrawBuffer() */ static void brw_set_draw_region( struct intel_context *intel, - struct intel_region *draw_regions[], + struct intel_region *color_regions[], struct intel_region *depth_region, - GLuint num_regions) + GLuint num_color_regions) { struct brw_context *brw = brw_context(&intel->ctx); - int i; + GLuint i; /* release old color/depth regions */ if (brw->state.depth_region != depth_region) brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER; - for (i = 0; i < brw->state.nr_draw_regions; i++) - intel_region_release(&brw->state.draw_regions[i]); + for (i = 0; i < brw->state.nr_color_regions; i++) + intel_region_release(&brw->state.color_regions[i]); intel_region_release(&brw->state.depth_region); /* reference new color/depth regions */ - for (i = 0; i < num_regions; i++) - intel_region_reference(&brw->state.draw_regions[i], draw_regions[i]); + for (i = 0; i < num_color_regions; i++) + intel_region_reference(&brw->state.color_regions[i], color_regions[i]); intel_region_reference(&brw->state.depth_region, depth_region); - brw->state.nr_draw_regions = num_regions; + brw->state.nr_color_regions = num_color_regions; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index fcd833b9bc..977b9dd089 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -871,8 +871,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_draw_regions > 1) { - for (i = 0 ; i < brw->state.nr_draw_regions; i++) { + 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, 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 654adcd131..e402fdf0ee 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -454,13 +454,13 @@ static void prepare_wm_surfaces(struct brw_context *brw ) GLuint i; int old_nr_surfaces; - if (brw->state.nr_draw_regions > 1) { - for (i = 0; i < brw->state.nr_draw_regions; i++) { - brw_update_region_surface(brw, brw->state.draw_regions[i], i, + if (brw->state.nr_color_regions > 1) { + for (i = 0; i < brw->state.nr_color_regions; i++) { + brw_update_region_surface(brw, brw->state.color_regions[i], i, GL_FALSE); } - }else { - brw_update_region_surface(brw, brw->state.draw_regions[0], 0, GL_TRUE); + } else { + brw_update_region_surface(brw, brw->state.color_regions[0], 0, GL_TRUE); } old_nr_surfaces = brw->wm.nr_surfaces; -- cgit v1.2.3 From 645f220710923f72e80281fa75e577e133b5a53c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Feb 2009 16:44:42 -0700 Subject: intel: updated comment, some debug code (disabled) --- src/mesa/drivers/dri/intel/intel_tex_format.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 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 2715a540d0..2d57c67848 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -3,11 +3,15 @@ #include "main/texformat.h" #include "main/enums.h" -/* It works out that this function is fine for all the supported + +/** + * Choose hardware texture format given the user's glTexImage parameters. + * + * It works out that this function is fine for all the supported * hardware. However, there is still a need to map the formats onto * hardware descriptors. - */ -/* Note that the i915 can actually support many more formats than + * + * Note that the i915 can actually support many more formats than * these if we take the step of simply swizzling the colors * immediately after sampling... */ @@ -18,6 +22,11 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, struct intel_context *intel = intel_context(ctx); const GLboolean do32bpt = (intel->ctx.Visual.rgbBits >= 24); +#if 0 + printf("%s intFmt=0x%x format=0x%x type=0x%x\n", + __FUNCTION__, internalFormat, format, type); +#endif + switch (internalFormat) { case 4: case GL_RGBA: -- cgit v1.2.3 From f77b720cde981d441e482bbbd68115634b3041ce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Feb 2009 16:51:50 -0700 Subject: intel: check texture formats in intel_validate_framebuffer() We can't render into any texture format; only certain formats. Check that render-to-texture's format is renderable in the intel_validate_framebuffer() There seems to be a bug somewhere that causes rendering to rgb565 textures to be corrupted so disallow that for now. This will be revisted. --- src/mesa/drivers/dri/intel/intel_fbo.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 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 739a85232e..53075378bc 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -634,6 +634,7 @@ intel_finish_render_texture(GLcontext * ctx, static void intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) { + struct intel_context *intel = intel_context(ctx); const struct intel_renderbuffer *depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH); const struct intel_renderbuffer *stencilRb = @@ -645,6 +646,34 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) */ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; } + + /* check that texture color buffers are a format we can render into */ + { + const struct gl_texture_format *supportedFormat; + GLuint i; + + /* The texture format we can render into seems to depend on the + * screen depth. There currently seems to be a problem when + * rendering into a rgb565 texture when the screen is abgr8888. + */ + if (intel->front_region->cpp == 4) + supportedFormat = &_mesa_texformat_argb8888; + else + supportedFormat = &_mesa_texformat_rgb565; + + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + const struct gl_texture_object *texObj = + fb->Attachment[BUFFER_COLOR0 + i].Texture; + if (texObj) { + const struct gl_texture_image *texImg = + texObj->Image[0][texObj->BaseLevel]; + if (texImg && texImg->TexFormat != supportedFormat) { + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; + break; + } + } + } + } } -- cgit v1.2.3 From 4f8ed56d168e9175e76bc42d8b924c7bcaa59dea Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 26 Feb 2009 18:42:00 -0700 Subject: intel: no-op the intel_finish_render_texture() function It doesn't have to do anything. See comments for more details. --- src/mesa/drivers/dri/intel/intel_fbo.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 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 53075378bc..787c290022 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -612,19 +612,16 @@ static void intel_finish_render_texture(GLcontext * ctx, struct gl_renderbuffer_attachment *att) { - struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer); - - DBG("End render texture (tid %x) tex %u\n", _glthread_GetID(), att->Texture->Name); - - if (irb) { - /* just release the region */ - intel_region_release(&irb->region); - } - else if (att->Renderbuffer) { - /* software fallback */ - _mesa_finish_render_texture(ctx, att); - /* XXX FBO: Need to unmap the buffer (or in intelSpanRenderStart???) */ - } + /* 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". + */ } -- cgit v1.2.3 From 18e01393b83b2a1b78a0c0cee7fd3713cb3bc373 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 26 Feb 2009 18:59:04 -0700 Subject: mesa: Fix DEBUG_MATH build on sparc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Need to use '__asm__' instead of plain 'asm'. math/m_debug_clip.c: In function ‘test_cliptest_function’: math/m_debug_clip.c:253: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asm’ math/m_debug_clip.c:253: warning: implicit declaration of function ‘asm’ Signed-off-by: David S. Miller --- src/mesa/math/m_debug_util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h index 7abe6f2565..2e67db8e55 100644 --- a/src/mesa/math/m_debug_util.h +++ b/src/mesa/math/m_debug_util.h @@ -231,8 +231,8 @@ extern char *mesa_profile; #define BEGIN_RACE(x) \ x = LONG_MAX; \ for (cycle_i = 0; cycle_i <10; cycle_i++) { \ - register long cycle_tmp1 asm("l0"); \ - register long cycle_tmp2 asm("l1"); \ + register long cycle_tmp1 __asm__("l0"); \ + register long cycle_tmp2 __asm__("l1"); \ /* rd %tick, %l0 */ \ __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */ -- cgit v1.2.3 From 24a94d13c98f8b02a32213689acbd9665694318c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 27 Feb 2009 03:25:08 +0100 Subject: st/drm: Seperate get handle for global buffer ids --- src/gallium/include/state_tracker/drm_api.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 588fa3a312..cfed8d7b24 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -22,9 +22,18 @@ struct drm_api * Special buffer functions */ /*@{*/ - boolean (*buffer_from_texture)(struct pipe_texture *texture, struct pipe_buffer **buffer, unsigned *stride); - struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, const char *name, unsigned handle); - unsigned (*handle_from_buffer)(struct pipe_screen *screen, struct pipe_buffer *buffer); + boolean (*buffer_from_texture)(struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride); + struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen, + const char *name, + unsigned handle); + boolean (*handle_from_buffer)(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); + boolean (*global_handle_from_buffer)(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); /*@}*/ }; -- cgit v1.2.3 From 6a72a2d3f4ea50996593bfa55ae671eee9836d76 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 27 Feb 2009 03:25:48 +0100 Subject: egl: Fix for minor api change --- src/gallium/state_trackers/egl/egl_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 281dff9f8a..aa3c32d41c 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -132,7 +132,7 @@ drm_create_texture(_EGLDriver *drv, scrn->front.width = w; scrn->front.height = h; scrn->front.pitch = pitch; - scrn->front.handle = drm_api_hocks.handle_from_buffer(dev->winsys, scrn->buffer); + drm_api_hocks.handle_from_buffer(dev->winsys, scrn->buffer, &scrn->front.handle); if (0) goto err_handle; -- cgit v1.2.3 From e1d276f9351a6524f4a48d9606ae531cc04ccad4 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 27 Feb 2009 03:27:31 +0100 Subject: intel: Use flink for global buffer ids Also fix minor drm api change --- src/gallium/winsys/drm/intel/gem/intel_be_api.c | 1 + src/gallium/winsys/drm/intel/gem/intel_be_device.c | 35 +++++++++++++++++++--- src/gallium/winsys/drm/intel/gem/intel_be_device.h | 17 +++++++++-- 3 files changed, 47 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c index e79ff0c6a3..3f71c25441 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c @@ -11,4 +11,5 @@ struct drm_api drm_api_hocks = .buffer_from_texture = i915_get_texture_buffer, .buffer_from_handle = intel_be_buffer_from_handle, .handle_from_buffer = intel_be_handle_from_buffer, + .global_handle_from_buffer = intel_be_global_handle_from_buffer, }; diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index c0ba834006..595de44726 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -70,6 +70,8 @@ intel_be_buffer_create(struct pipe_winsys *winsys, buffer->base.alignment = alignment; buffer->base.usage = usage; buffer->base.size = size; + buffer->flinked = FALSE; + buffer->flink = 0; if (usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_CONSTANT)) { /* Local buffer */ @@ -162,14 +164,39 @@ err: return NULL; } -unsigned +boolean intel_be_handle_from_buffer(struct pipe_screen *screen, - struct pipe_buffer *buf) + struct pipe_buffer *buffer, + unsigned *handle) { - drm_intel_bo *bo = intel_bo(buf); - return bo->handle; + drm_intel_bo *bo; + + if (!buffer) + return FALSE; + + *handle = intel_bo(buffer)->handle; + return TRUE; } +boolean +intel_be_global_handle_from_buffer(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle) +{ + struct intel_be_buffer *buf = intel_be_buffer(buffer); + + if (!buffer) + return FALSE; + + if (!buf->flinked) { + if (drm_intel_bo_flink(intel_bo(buffer), &buf->flink)) + return FALSE; + buf->flinked = TRUE; + } + + *handle = buf->flink; + return TRUE; +} /* * Fence */ diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h index 5bf7d3fc4f..47d2176cb4 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h @@ -44,6 +44,8 @@ intel_be_init_device(struct intel_be_device *device, int fd, unsigned id); struct intel_be_buffer { struct pipe_buffer base; drm_intel_bo *bo; + boolean flinked; + unsigned flink; }; /** @@ -60,9 +62,20 @@ intel_be_buffer_from_handle(struct pipe_screen *screen, * * If buffer is destroyed handle may become invalid. */ -unsigned +boolean intel_be_handle_from_buffer(struct pipe_screen *screen, - struct pipe_buffer *buffer); + struct pipe_buffer *buffer, + unsigned *handle); + +/** + * Gets the global handle from a buffer. + * + * If buffer is destroyed handle may become invalid. + */ +boolean +intel_be_global_handle_from_buffer(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); static INLINE struct intel_be_buffer * intel_be_buffer(struct pipe_buffer *buf) -- cgit v1.2.3 From bde27b0d94dc2b3d0d4656e2c85ecbbd1245b3ac Mon Sep 17 00:00:00 2001 From: David Miller Date: Fri, 27 Feb 2009 02:38:37 -0800 Subject: mesa: Fix Sparc cliptest asm code and re-enable. Stop using register %g7 since that is used by the "system" (ie. the pthread implementation makes use of it). Also, the projection vector can be NULL and we shouldn't try to access it at all in _mesa_sparc_cliptest_points4_np(). ioquake3 would crash due to this bug. Finally, unconditionally emit the register directives and re-enable in _mesa_init_all_sparc_transform_asm(). Signed-off-by: David S. Miller --- src/mesa/sparc/clip.S | 29 +++++++++-------------------- src/mesa/sparc/sparc.c | 4 ++-- 2 files changed, 11 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/sparc/clip.S b/src/mesa/sparc/clip.S index 58c228ed15..208843c606 100644 --- a/src/mesa/sparc/clip.S +++ b/src/mesa/sparc/clip.S @@ -25,12 +25,8 @@ #define VEC_SIZE_3 7 #define VEC_SIZE_4 15 -#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) - /* Solaris requires this for 64-bit. */ .register %g2, #scratch .register %g3, #scratch - .register %g7, #scratch -#endif .text .align 64 @@ -78,7 +74,7 @@ _mesa_sparc_cliptest_points4: add %g1, 0x4, %g1 ld [%i0 + V4F_STRIDE], %l1 - ld [%i0 + V4F_COUNT], %g7 + ld [%i0 + V4F_COUNT], %l3 LDPTR [%i0 + V4F_START], %i0 LDPTR [%i1 + V4F_START], %i5 ldub [%i3], %g2 @@ -91,12 +87,12 @@ _mesa_sparc_cliptest_points4: st %g3, [%i1 + V4F_FLAGS] mov 3, %g3 st %g3, [%i1 + V4F_SIZE] - st %g7, [%i1 + V4F_COUNT] + st %l3, [%i1 + V4F_COUNT] clr %l2 clr %l0 /* l0: i - * g7: count + * l3: count * l1: stride * l2: c * g2: (tmpAndMask << 8) | tmpOrMask @@ -153,12 +149,12 @@ _mesa_sparc_cliptest_points4: 3: add %i5, 0x10, %i5 ! IEU1 add %l0, 1, %l0 ! IEU0 Group add %i2, 1, %i2 ! IEU0 Group - cmp %l0, %g7 ! IEU1 Group + cmp %l0, %l3 ! IEU1 Group bne 1b ! CTI add %i0, %l1, %i0 ! IEU0 Group stb %g2, [%i3] ! LSU srl %g2, 8, %g3 ! IEU0 Group - cmp %l2, %g7 ! IEU1 Group + cmp %l2, %l3 ! IEU1 Group bl,a 1f ! CTI clr %g3 ! IEU0 1: stb %g3, [%i4] ! LSU Group @@ -174,25 +170,18 @@ _mesa_sparc_cliptest_points4_np: add %g1, 0x4, %g1 ld [%i0 + V4F_STRIDE], %l1 - ld [%i0 + V4F_COUNT], %g7 + ld [%i0 + V4F_COUNT], %l3 LDPTR [%i0 + V4F_START], %i0 - LDPTR [%i1 + V4F_START], %i5 ldub [%i3], %g2 ldub [%i4], %g3 sll %g3, 8, %g3 or %g2, %g3, %g2 - ld [%i1 + V4F_FLAGS], %g3 - or %g3, VEC_SIZE_4, %g3 - st %g3, [%i1 + V4F_FLAGS] - mov 3, %g3 - st %g3, [%i1 + V4F_SIZE] - st %g7, [%i1 + V4F_COUNT] clr %l2 clr %l0 /* l0: i - * g7: count + * l3: count * l1: stride * l2: c * g2: (tmpAndMask << 8) | tmpOrMask @@ -230,12 +219,12 @@ _mesa_sparc_cliptest_points4_np: and %g2, %g4, %g2 ! IEU0 Group 2: add %l0, 1, %l0 ! IEU0 Group add %i2, 1, %i2 ! IEU0 Group - cmp %l0, %g7 ! IEU1 Group + cmp %l0, %l3 ! IEU1 Group bne 1b ! CTI add %i0, %l1, %i0 ! IEU0 Group stb %g2, [%i3] ! LSU srl %g2, 8, %g3 ! IEU0 Group - cmp %l2, %g7 ! IEU1 Group + cmp %l2, %l3 ! IEU1 Group bl,a 1f ! CTI clr %g3 ! IEU0 1: stb %g3, [%i4] ! LSU Group diff --git a/src/mesa/sparc/sparc.c b/src/mesa/sparc/sparc.c index 3bde98e34b..fafb49b81c 100644 --- a/src/mesa/sparc/sparc.c +++ b/src/mesa/sparc/sparc.c @@ -109,10 +109,10 @@ void _mesa_init_all_sparc_transform_asm(void) ASSIGN_XFORM_GROUP(sparc, 2) ASSIGN_XFORM_GROUP(sparc, 3) ASSIGN_XFORM_GROUP(sparc, 4) -#if 0 + _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4; _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np; -#endif + #if 0 /* disable these too. See bug 673938 */ _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = -- cgit v1.2.3 From cf89f063634ff89cbd732bf67950debc94897ed9 Mon Sep 17 00:00:00 2001 From: David Miller Date: Fri, 27 Feb 2009 02:38:40 -0800 Subject: mesa: Fix and re-enable sparc normal asm. Fix a bug reported in 2003 :-) The output vector has 4 entries, not 3. Unconditionally emit .register directives. Signed-off-by: David S. Miller --- src/mesa/sparc/norm.S | 25 +++++++++++-------------- src/mesa/sparc/sparc.c | 3 --- 2 files changed, 11 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/sparc/norm.S b/src/mesa/sparc/norm.S index 44950a10a5..117d36fa22 100644 --- a/src/mesa/sparc/norm.S +++ b/src/mesa/sparc/norm.S @@ -1,11 +1,8 @@ #include "sparc_matrix.h" -#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) - /* Solaris requires this for 64-bit. */ .register %g2, #scratch .register %g3, #scratch -#endif .text @@ -98,7 +95,7 @@ _mesa_sparc_transform_normalize_normals: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer ba 7f nop @@ -154,7 +151,7 @@ _mesa_sparc_transform_normalize_normals: cmp %o4, %g1 ! continue if (i < count) bl 5b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -225,7 +222,7 @@ _mesa_sparc_transform_normalize_normals_no_rot: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer ba 7f nop @@ -263,7 +260,7 @@ _mesa_sparc_transform_normalize_normals_no_rot: cmp %o4, %g1 ! continue if (i < count) bl 5b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -314,7 +311,7 @@ _mesa_sparc_transform_rescale_normals_no_rot: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -379,7 +376,7 @@ _mesa_sparc_transform_rescale_normals: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -421,7 +418,7 @@ _mesa_sparc_transform_normals_no_rot: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -471,7 +468,7 @@ _mesa_sparc_transform_normals: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -529,7 +526,7 @@ _mesa_sparc_normalize_normals: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer ba 7f nop @@ -557,7 +554,7 @@ _mesa_sparc_normalize_normals: cmp %o4, %g1 ! continue if (i < count) bl 5b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop @@ -602,7 +599,7 @@ _mesa_sparc_rescale_normals: cmp %o4, %g1 ! continue if (i < count) bl 1b - add %g3, 0x0c, %g3 ! advance out vector pointer + add %g3, 0x10, %g3 ! advance out vector pointer 7: retl nop diff --git a/src/mesa/sparc/sparc.c b/src/mesa/sparc/sparc.c index fafb49b81c..d2286a2c83 100644 --- a/src/mesa/sparc/sparc.c +++ b/src/mesa/sparc/sparc.c @@ -113,8 +113,6 @@ void _mesa_init_all_sparc_transform_asm(void) _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4; _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np; -#if 0 - /* disable these too. See bug 673938 */ _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = _mesa_sparc_transform_normalize_normals; _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = @@ -131,7 +129,6 @@ void _mesa_init_all_sparc_transform_asm(void) _mesa_sparc_normalize_normals; _mesa_normal_tab[NORM_RESCALE] = _mesa_sparc_rescale_normals; -#endif #ifdef DEBUG_MATH _math_test_all_transform_functions("sparc"); -- cgit v1.2.3 From a321b8ed6ea583f43f8d5ab5d1b918a96df44f1d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 19 Feb 2009 14:46:23 +0000 Subject: softpipe: add dumping of post-tranfsormed vertices (disabled) --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index d56eed80a4..eef6e5806c 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -60,6 +60,7 @@ struct softpipe_vbuf_render struct softpipe_context *softpipe; uint prim; uint vertex_size; + uint nr_vertices; uint vertex_buffer_size; void *vertex_buffer; }; @@ -95,12 +96,44 @@ sp_vbuf_allocate_vertices(struct vbuf_render *vbr, } cvbr->vertex_size = vertex_size; + cvbr->nr_vertices = nr_vertices; + return cvbr->vertex_buffer != NULL; } 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 */ } -- cgit v1.2.3 From b747e1dec4a2999412ee25371994a07a4bed900e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Feb 2009 15:10:11 +0000 Subject: util: set vbuf.max_index in draw_vertex_buffer() (cherry picked from commit 1350f2efba5eeceebe0e711db6152c29e9889ce7) --- src/gallium/auxiliary/util/u_draw_quad.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c index f282f3d289..f0bcd75899 100644 --- a/src/gallium/auxiliary/util/u_draw_quad.c +++ b/src/gallium/auxiliary/util/u_draw_quad.c @@ -51,9 +51,11 @@ util_draw_vertex_buffer(struct pipe_context *pipe, assert(num_attribs <= PIPE_MAX_ATTRIBS); /* tell pipe about the vertex buffer */ + memset(&vbuffer, 0, sizeof(vbuffer)); vbuffer.buffer = vbuf; vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */ vbuffer.buffer_offset = offset; + vbuffer.max_index = num_verts - 1; pipe->set_vertex_buffers(pipe, 1, &vbuffer); /* tell pipe about the vertex attributes */ -- cgit v1.2.3 From 5fc74734d92f7e7ff3df693254986ba5d2b5e653 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 09:43:58 -0700 Subject: gallium: add st_validate_framebuffer() driver function Gallium only supports combined depth/stencil buffers, not separate ones. If the user tries to create create a FBO with separate depth/stencil renderbuffers mark the FBO as unsupported. --- src/mesa/state_tracker/st_cb_fbo.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 5cc6960c06..15bd6fee05 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -439,6 +439,25 @@ st_finish_render_texture(GLcontext *ctx, } +/** + * Check that the framebuffer configuration is valid in terms of what + * the driver can support. + * + * For Gallium we only supports combined Z+stencil, not separate buffers. + */ +static void +st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +{ + const struct gl_renderbuffer *depthRb = + fb->Attachment[BUFFER_DEPTH].Renderbuffer; + const struct gl_renderbuffer *stencilRb = + fb->Attachment[BUFFER_STENCIL].Renderbuffer; + + if (stencilRb && depthRb && stencilRb != depthRb) { + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; + } +} + void st_init_fbo_functions(struct dd_function_table *functions) { @@ -448,6 +467,7 @@ void st_init_fbo_functions(struct dd_function_table *functions) functions->FramebufferRenderbuffer = st_framebuffer_renderbuffer; functions->RenderTexture = st_render_texture; functions->FinishRenderTexture = st_finish_render_texture; + functions->ValidateFramebuffer = st_validate_framebuffer; /* no longer needed by core Mesa, drivers handle resizes... functions->ResizeBuffers = st_resize_buffers; */ -- cgit v1.2.3 From 026465b9b1aebab98b6d519b75fe96d0ca9f4f51 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 09:45:41 -0700 Subject: gallium: fix state tracker's stencil buffer test Need to check ctx->DrawBuffer->Visual.stencilBits not ctx->Visual.stencilBits because the later only applies to the window system buffers, not user-created FBOs. This, plus the previous commit, fixes progs/tests/fbotexture.c --- src/mesa/state_tracker/st_atom_depth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index a6156df7ae..4ea62dda18 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -106,7 +106,7 @@ update_depth_stencil_alpha(struct st_context *st) ctx->Query.CurrentOcclusionObject->Active) dsa->depth.occlusion_count = 1; - if (ctx->Stencil.Enabled && ctx->Visual.stencilBits > 0) { + 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]); dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[0]); -- cgit v1.2.3 From 17c7852bf93c4d4edf0c2cf0bdc553d399e2f51a Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Fri, 27 Feb 2009 00:21:07 -0700 Subject: i965: texture fixes: bordered textures, fallback rendering i965 doesn't natively support GL_CLAMP; it treats it like GL_CLAMP_TO_EDGE, which fails conformance tests. This fix adds a clause to the check_fallbacks() test to check whether GL_CLAMP is in use on any enabled 2D texture. If so, and if strict conformance is required (via INTEL_STRICT_CONFORMANCE), a software fallback is mandated. In addition, validate textures *before* checking for fallbacks, rather than after; otherwise, the texture state is never validated and can't be trusted. (In particular, if texturing is enabled and the sampler would access any level beyond level 0 of a texture, the sampler will segfault, because texture validation sets the firstLevel and lastLevel fields of a texture object so that the valid levels will be mapped and accessed correctly. If texture validation doesn't occur, only level 0 is accessed correctly, and that only because firstLevel and lastLevel happen to be set to 0.) --- src/mesa/drivers/dri/i965/brw_draw.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 3ca953da37..7ab1ece263 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -194,6 +194,9 @@ static GLboolean check_fallbacks( struct brw_context *brw, GLcontext *ctx = &brw->intel.ctx; GLuint i; + /* If we don't require strict OpenGL conformance, never + * use fallbacks. + */ if (!brw->intel.strict_conformance) return GL_FALSE; @@ -230,13 +233,31 @@ static GLboolean check_fallbacks( struct brw_context *brw, } } - if (ctx->Point.SmoothFlag) { for (i = 0; i < nr_prims; i++) if (prim[i].mode == GL_POINTS) return GL_TRUE; } + + /* BRW hardware doesn't handle GL_CLAMP texturing correctly; + * brw_wm_sampler_state:translate_wrap_mode() treats GL_CLAMP + * as GL_CLAMP_TO_EDGE instead. If we're using GL_CLAMP, and + * we want strict conformance, force the fallback. + * Right now, we only do this for 2D textures. + */ + { + int u; + for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { + if (ctx->Texture.Unit[u].Enabled) { + if (ctx->Texture.Unit[u].CurrentTex[TEXTURE_2D_INDEX]->WrapS == GL_CLAMP || + ctx->Texture.Unit[u].CurrentTex[TEXTURE_2D_INDEX]->WrapT == GL_CLAMP) { + return GL_TRUE; + } + } + } + } + /* Nothing stopping us from the fast path now */ return GL_FALSE; } @@ -261,11 +282,18 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx, if (ctx->NewState) _mesa_update_state( ctx ); + /* We have to validate the textures *before* checking for fallbacks; + * otherwise, the software fallback won't be able to rely on the + * texture state, the firstLevel and lastLevel fields won't be + * set in the intel texture object (they'll both be 0), and the + * software fallback will segfault if it attempts to access any + * texture level other than level 0. + */ + brw_validate_textures( brw ); + if (check_fallbacks(brw, prim, nr_prims)) return GL_FALSE; - brw_validate_textures( brw ); - /* Bind all inputs, derive varying and size information: */ brw_merge_inputs( brw, arrays ); -- cgit v1.2.3 From 65021162a494cfffd6b0d50d3e93fb1082e90332 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 26 Feb 2009 21:25:06 -0800 Subject: r300-gallium: A handful of tiny vfmt fixups. Using a tab of inputs should work, but I keep getting bad results. If only Rawhide's GDB wasn't broken... --- src/gallium/drivers/r300/r300_state_derived.c | 29 +++++++++++++++++---------- src/gallium/drivers/r300/r300_swtcl_emit.c | 8 ++++++-- 2 files changed, 24 insertions(+), 13 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 a51904096f..4284a955ab 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -57,34 +57,39 @@ static uint32_t translate_vertex_data_type(int type) { /* XXX this function should be able to handle vert shaders as well as draw */ static void r300_update_vertex_layout(struct r300_context* r300) { + struct r300_vertex_format vformat; struct vertex_info vinfo; boolean pos = false, psize = false, fog = false; int i, texs = 0, cols = 0; + int tab[16]; struct tgsi_shader_info* info = &r300->fs->info; + memset(&vinfo, 0, sizeof(vinfo)); + for (i = 0; i < 16; i++) { + tab[i] = -1; + } assert(info->num_inputs <= 16); - /* This is rather lame. Since draw_find_vs_output doesn't return an error - * when it can't find an output, we have to pre-iterate and count each - * output ourselves. */ 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: - cols++; + tab[i] = 2 + cols++; break; case TGSI_SEMANTIC_FOG: fog = true; break; case TGSI_SEMANTIC_PSIZE: psize = true; + tab[i] = 1; break; case TGSI_SEMANTIC_GENERIC: - texs++; + tab[i] = 6 + texs++; break; default: debug_printf("r300: Unknown vertex input %d\n", @@ -105,6 +110,7 @@ static void r300_update_vertex_layout(struct r300_context* r300) if (!pos) { debug_printf("r300: Forcing vertex position attribute emit...\n"); + tab[0] = 0; } draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_POS, @@ -152,18 +158,19 @@ static void r300_update_vertex_layout(struct r300_context* r300) (0xf << R300_WRITE_ENA_SHIFT)) for (i = 0; i < vinfo.num_attribs; i++) { + /* Make sure we have a proper destination for our attribute */ + //assert(tab[i] != -1); + temp = translate_vertex_data_type(vinfo.attrib[i].emit) | - R300_SIGNED; + (tab[i] << R300_DST_VEC_LOC_SHIFT) | R300_SIGNED; if (i & 1) { r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff0000; r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= - (translate_vertex_data_type(vinfo.attrib[i].emit) | - R300_SIGNED) << 16; + temp << 16; } else { r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff; r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= - translate_vertex_data_type(vinfo.attrib[i].emit) | - R300_SIGNED; + temp; } r300->vertex_info.vap_prog_stream_cntl_ext[i >> 1] |= @@ -180,7 +187,7 @@ static void r300_update_vertex_layout(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. */ -void r300_update_rs_block(struct r300_context* r300) +static void r300_update_rs_block(struct r300_context* r300) { } diff --git a/src/gallium/drivers/r300/r300_swtcl_emit.c b/src/gallium/drivers/r300/r300_swtcl_emit.c index 5b028aaf7b..cdd44240ad 100644 --- a/src/gallium/drivers/r300/r300_swtcl_emit.c +++ b/src/gallium/drivers/r300/r300_swtcl_emit.c @@ -27,6 +27,7 @@ #include "r300_cs.h" #include "r300_context.h" #include "r300_reg.h" +#include "r300_state_derived.h" /* r300_swtcl_emit: Vertex and index buffer primitive emission. No HW TCL. */ @@ -191,12 +192,15 @@ static void prepare_render(struct r300_swtcl_render* render) * PACKET3 [3D_LOAD_VBPNTR] * COUNT [1] * FORMAT [size | stride << 8] + * OFFSET [0] * VBPNTR [relocated BO] */ BEGIN_CS(5); OUT_CS(CP_PACKET3(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(render->vbo_offset); OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); END_CS; } @@ -218,7 +222,7 @@ static void r300_swtcl_render_draw_arrays(struct vbuf_render* render, BEGIN_CS(2); OUT_CS(CP_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0)); OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) | - r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); + r300render->hwprim); END_CS; } -- cgit v1.2.3 From 4ef8c047ea4cdbf9bc31920d58205620b857fe3c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 08:23:01 -0800 Subject: r300-gallium: Add RS600 chipsets. --- src/gallium/drivers/r300/r300_chipset.c | 7 +++++++ src/gallium/drivers/r300/r300_chipset.h | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + 3 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 196537a432..9577fd706f 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -204,6 +204,13 @@ void r300_parse_chipset(struct r300_capabilities* caps) caps->has_tcl = FALSE; break; + case 0x793F: + case 0x7941: + case 0x7942: + caps->family = CHIP_FAMILY_RS600; + caps->has_tcl = FALSE; + break; + case 0x796C: case 0x796D: case 0x796E: diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index a9cd372ec5..21eebeae60 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -64,6 +64,7 @@ enum { CHIP_FAMILY_RC410, CHIP_FAMILY_RS480, CHIP_FAMILY_RS482, + CHIP_FAMILY_RS600, CHIP_FAMILY_RS690, CHIP_FAMILY_RS740, CHIP_FAMILY_RV515, diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 5ff9015a7b..470e1e2acb 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -50,6 +50,7 @@ static const char* chip_families[] = { "RC410", "RS480", "RS482", + "RS600", "RS690", "RS740", "RV515", -- cgit v1.2.3 From c28298855bf5d5ef790d28bac2e77700625fa69a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 10:15:42 -0800 Subject: r300-gallium: Add RS block setup. This is still icky, and only compile-tested. --- src/gallium/drivers/r300/r300_context.h | 22 ++++++++---- src/gallium/drivers/r300/r300_emit.c | 33 ++++++++++++++++++ src/gallium/drivers/r300/r300_reg.h | 2 ++ src/gallium/drivers/r300/r300_state_derived.c | 48 +++++++++++++++++++++++++-- 4 files changed, 97 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index aaab1dd2bc..5247901be5 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -75,6 +75,13 @@ struct r300_rs_state { uint32_t line_stipple_value; /* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */ }; +struct r300_rs_block { + uint32_t ip[8]; /* R300_RS_IP_[0-7], R500_RS_IP_[0-7] */ + uint32_t count; /* R300_RS_COUNT */ + uint32_t inst_count; /* R300_RS_INST_COUNT */ + uint32_t inst[8]; /* R300_RS_INST_[0-7] */ +}; + struct r300_sampler_state { uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */ uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */ @@ -96,12 +103,13 @@ struct r300_texture_state { #define R300_NEW_FRAMEBUFFERS 0x0000010 #define R300_NEW_FRAGMENT_SHADER 0x0000020 #define R300_NEW_RASTERIZER 0x0000040 -#define R300_NEW_SAMPLER 0x0000080 -#define R300_NEW_SCISSOR 0x0008000 -#define R300_NEW_TEXTURE 0x0010000 -#define R300_NEW_VERTEX_FORMAT 0x1000000 -#define R300_NEW_VERTEX_SHADER 0x2000000 -#define R300_NEW_KITCHEN_SINK 0x3ffffff +#define R300_NEW_RS_BLOCK 0x0000080 +#define R300_NEW_SAMPLER 0x0000100 +#define R300_NEW_SCISSOR 0x0010000 +#define R300_NEW_TEXTURE 0x0020000 +#define R300_NEW_VERTEX_FORMAT 0x2000000 +#define R300_NEW_VERTEX_SHADER 0x4000000 +#define R300_NEW_KITCHEN_SINK 0x7ffffff /* The next several objects are not pure Radeon state; they inherit from * various Gallium classes. */ @@ -224,6 +232,8 @@ struct r300_context { struct pipe_framebuffer_state framebuffer_state; /* Rasterizer state. */ struct r300_rs_state* rs_state; + /* RS block state. */ + struct r300_rs_block* rs_block; /* Sampler states. */ struct r300_sampler_state* sampler_states[8]; int sampler_count; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 960f45f651..86fa46df42 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -208,6 +208,39 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs) END_CS; } +void r300_emit_rs_block_state(struct r300_context* r300, + struct r300_rs_block* rs) +{ + struct r300_screen* r300screen = + (struct r300_screen*)r300->context.screen; + CS_LOCALS(r300); + int i; + + BEGIN_CS(0); + if (r300screen->caps->is_r500) { + OUT_CS_REG_SEQ(R500_RS_IP_0, 8); + } else { + OUT_CS_REG_SEQ(R300_RS_IP_0, 8); + } + for (i = 0; i < 8; i++) { + OUT_CS(rs->ip[i]); + } + + OUT_CS_REG_SEQ(R300_RS_COUNT, 2); + OUT_CS(rs->count); + OUT_CS(rs->inst_count); + + if (r300screen->caps->is_r500) { + OUT_CS_REG_SEQ(R500_RS_INST_0, 8); + } else { + OUT_CS_REG_SEQ(R300_RS_INST_0, 8); + } + for (i = 0; i < 8; i++) { + OUT_CS(rs->inst[i]); + } + END_CS; +} + void r300_emit_scissor_state(struct r300_context* r300, struct r300_scissor_state* scissor) { diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 8888b39a2f..8f31bd5d6e 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1240,9 +1240,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_RS_INST_7 0x434C # define R300_RS_INST_TEX_ID(x) ((x) << 0) # define R300_RS_INST_TEX_CN_WRITE (1 << 3) +# define R300_RS_INST_TEX_ADDR(x) ((x) << 6) # define R300_RS_INST_TEX_ADDR_SHIFT 6 # define R300_RS_INST_COL_ID(x) ((x) << 11) # define R300_RS_INST_COL_CN_WRITE (1 << 14) +# define R300_RS_INST_COL_ADDR(x) ((x) << 17) # define R300_RS_INST_COL_ADDR_SHIFT 17 # define R300_RS_INST_TEX_ADJ (1 << 22) # define R300_RS_COL_BIAS_UNUSED_SHIFT 23 diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 4284a955ab..c4f56627c3 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -139,7 +139,7 @@ static void r300_update_vertex_layout(struct r300_context* r300) } for (i = 0; i < texs; i++) { - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, + 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)); @@ -159,7 +159,9 @@ static void r300_update_vertex_layout(struct r300_context* r300) for (i = 0; i < vinfo.num_attribs; i++) { /* Make sure we have a proper destination for our attribute */ - //assert(tab[i] != -1); + if (tab[i] != -1) { + assert(0); + } temp = translate_vertex_data_type(vinfo.attrib[i].emit) | (tab[i] << R300_DST_VEC_LOC_SHIFT) | R300_SIGNED; @@ -189,6 +191,48 @@ static void r300_update_vertex_layout(struct r300_context* r300) * 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 = r300->rs_block; + struct vertex_info* vinfo = &r300->vertex_info.vinfo; + int col_count = 0, fp_offset = 0, i, tex_count = 0; + + memset(rs, 0, sizeof(struct r300_rs_block)); + + for (i = 0; i < vinfo->num_attribs; i++) { + switch (vinfo->attrib[i].interp_mode) { + case INTERP_LINEAR: + rs->ip[col_count] |= + R300_RS_COL_PTR(vinfo->attrib[i].src_index) | + R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); + col_count++; + break; + case INTERP_PERSPECTIVE: + rs->ip[tex_count] |= + R300_RS_TEX_PTR(vinfo->attrib[i].src_index) | + 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 += 4; + break; + } + } + + 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); + 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 = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) | + R300_HIRES_EN; + + rs->inst_count = MAX2(col_count, tex_count); } void r300_update_derived_state(struct r300_context* r300) -- cgit v1.2.3 From 43714e92e3b512307851349fd8c706638030854e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Feb 2009 19:33:17 +0000 Subject: tgsi: don't dump interpolation info except for fragment shader inputs Don't print the meaningless and confusing CONSTANT interpolation attribute after everything else. --- src/gallium/auxiliary/tgsi/tgsi_dump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index d57cb9139f..a784b7cc3c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -245,8 +245,12 @@ iter_declaration( } } - TXT( ", " ); - ENM( decl->Declaration.Interpolate, interpolate_names ); + if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT && + decl->Declaration.File == TGSI_FILE_INPUT) + { + TXT( ", " ); + ENM( decl->Declaration.Interpolate, interpolate_names ); + } if (decl->Declaration.Centroid) { TXT( ", CENTROID" ); -- cgit v1.2.3 From 40290745ea645b52d30f866abfe25ac5d58a755c Mon Sep 17 00:00:00 2001 From: Shaohua Li Date: Mon, 23 Feb 2009 15:19:21 +0800 Subject: i915: Add support for a new G33-like chipset. Signed-off-by: Shaohua Li Signed-off-by: Eric Anholt --- src/mesa/drivers/dri/intel/intel_chipset.h | 11 +++++++++-- src/mesa/drivers/dri/intel/intel_context.c | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index d1b4941601..4593d90df3 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -46,6 +46,13 @@ #define PCI_CHIP_G33_G 0x29C2 #define PCI_CHIP_Q33_G 0x29D2 +#define PCI_CHIP_IGD_GM 0xA011 +#define PCI_CHIP_IGD_G 0xA001 + +#define IS_IGDGM(devid) (devid == PCI_CHIP_IGD_GM) +#define IS_IGDG(devid) (devid == PCI_CHIP_IGD_G) +#define IS_IGD(devid) (IS_IGDG(devid) || IS_IGDGM(devid)) + #define PCI_CHIP_I965_G 0x29A2 #define PCI_CHIP_I965_Q 0x2992 #define PCI_CHIP_I965_G_1 0x2982 @@ -66,7 +73,7 @@ devid == PCI_CHIP_I945_GME || \ devid == PCI_CHIP_I965_GM || \ devid == PCI_CHIP_I965_GME || \ - devid == PCI_CHIP_GM45_GM) + devid == PCI_CHIP_GM45_GM || IS_IGD(devid)) #define IS_G45(devid) (devid == PCI_CHIP_IGD_E_G || \ devid == PCI_CHIP_Q45_G || \ @@ -84,7 +91,7 @@ devid == PCI_CHIP_I945_GME || \ devid == PCI_CHIP_G33_G || \ devid == PCI_CHIP_Q33_G || \ - devid == PCI_CHIP_Q35_G) + devid == PCI_CHIP_Q35_G || IS_IGD(devid)) #define IS_965(devid) (devid == PCI_CHIP_I965_G || \ devid == PCI_CHIP_I965_Q || \ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 1aa173db18..b3f6fc02df 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -123,6 +123,10 @@ intelGetString(GLcontext * ctx, GLenum name) case PCI_CHIP_Q33_G: chipset = "Intel(R) Q33"; break; + case PCI_CHIP_IGD_GM: + case PCI_CHIP_IGD_G: + chipset = "Intel(R) IGD"; + break; case PCI_CHIP_I965_Q: chipset = "Intel(R) 965Q"; break; -- cgit v1.2.3 From 75e3ccf6a5b639834bcda0ff6f9035b148fca8f1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 12:30:21 -0700 Subject: mesa: fix incorrect error handling in glBufferDataARB() If glBufferDataARB() is called while a buffer object is currently mapped we're supposed to unmap the current buffer, then replace it. Don't generate an error. --- src/mesa/main/bufferobj.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 016543da01..e4bdc6f1e7 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -951,8 +951,10 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, } if (bufObj->Pointer) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" ); - return; + /* Unmap the existing buffer. We'll replace it now. Not an error. */ + ctx->Driver.UnmapBuffer(ctx, target, bufObj); + bufObj->Access = DEFAULT_ACCESS; + bufObj->Pointer = NULL; } ASSERT(ctx->Driver.BufferData); -- cgit v1.2.3 From 395bcad8c095e78621e7aca18af1dab71fe69813 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 12:41:11 -0700 Subject: mesa: updated comments --- src/mesa/main/bufferobj.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index e4bdc6f1e7..1f41565fe2 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.2 + * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 1999-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"), @@ -25,7 +26,7 @@ /** * \file bufferobj.c - * \brief Functions for the GL_ARB_vertex_buffer_object extension. + * \brief Functions for the GL_ARB_vertex/pixel_buffer_object extensions. * \author Brian Paul, Ian Romanick */ @@ -144,8 +145,7 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, /** * Allocate and initialize a new buffer object. * - * This function is intended to be called via - * \c dd_function_table::NewBufferObject. + * Default callback for the \c dd_function_table::NewBufferObject() hook. */ struct gl_buffer_object * _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) @@ -163,8 +163,7 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) /** * Delete a buffer object. * - * This function is intended to be called via - * \c dd_function_table::DeleteBuffer. + * Default callback for the \c dd_function_table::DeleteBuffer() hook. */ void _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) @@ -271,9 +270,8 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, * previously stored in the buffer object is lost. If \c data is \c NULL, * memory will be allocated, but no copy will occur. * - * This function is intended to be called via - * \c dd_function_table::BufferData. This function need not set GL error - * codes. The input parameters will have been tested before calling. + * This is the default callback for \c dd_function_table::BufferData() + * Note that all GL error checking will have been done already. * * \param ctx GL context. * \param target Buffer object target on which to operate. @@ -312,9 +310,8 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, * specified by \c size + \c offset extends beyond the end of the buffer or * if \c data is \c NULL, no copy is performed. * - * This function is intended to be called by - * \c dd_function_table::BufferSubData. This function need not set GL error - * codes. The input parameters will have been tested before calling. + * This is the default callback for \c dd_function_table::BufferSubData() + * Note that all GL error checking will have been done already. * * \param ctx GL context. * \param target Buffer object target on which to operate. @@ -346,15 +343,14 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, * specified by \c size + \c offset extends beyond the end of the buffer or * if \c data is \c NULL, no copy is performed. * - * This function is intended to be called by - * \c dd_function_table::BufferGetSubData. This function need not set GL error - * codes. The input parameters will have been tested before calling. + * This is the default callback for \c dd_function_table::GetBufferSubData() + * Note that all GL error checking will have been done already. * * \param ctx GL context. * \param target Buffer object target on which to operate. - * \param offset Offset of the first byte to be modified. + * \param offset Offset of the first byte to be fetched. * \param size Size, in bytes, of the data range. - * \param data Pointer to the data to store in the buffer object. + * \param data Destination for data * \param bufObj Object to be used. * * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData. @@ -373,9 +369,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, /** - * Fallback function called via ctx->Driver.MapBuffer(). - * Hardware drivers that really implement buffer objects should never use - * this function. + * Default callback for \c dd_function_tabel::MapBuffer(). * * The function parameters will have been already tested for errors. * @@ -407,9 +401,7 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, /** - * Fallback function called via ctx->Driver.MapBuffer(). - * Hardware drivers that really implement buffer objects should never use - * function. + * Default callback for \c dd_function_table::MapBuffer(). * * The input parameters will have been already tested for errors. * @@ -446,6 +438,7 @@ _mesa_init_buffer_objects( GLcontext *ctx ) ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj; } + /** * Bind the specified target to buffer for the specified context. */ @@ -796,11 +789,11 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) for (i = 0; i < n; i++) { struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]); if (bufObj) { - /* unbind any vertex pointers bound to this buffer */ GLuint j; ASSERT(bufObj->Name == ids[i]); + /* unbind any vertex pointers bound to this buffer */ unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj); unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj); unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj); @@ -822,6 +815,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); } + /* unbind any pixel pack/unpack pointers bound to this buffer */ if (ctx->Pack.BufferObj == bufObj) { _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 ); } -- cgit v1.2.3 From a7f434b486187129ae8d5507170c42a9ce750258 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 13:04:38 -0700 Subject: mesa: if a buffer object is mapped when glDeleteBuffers() is called, unmap it --- src/mesa/main/bufferobj.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 1f41565fe2..8df0a5b1a1 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -793,6 +793,11 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) ASSERT(bufObj->Name == ids[i]); + if (bufObj->Pointer) { + /* if mapped, unmap it now */ + ctx->Driver.UnmapBuffer(ctx, 0, bufObj); + } + /* unbind any vertex pointers bound to this buffer */ unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj); unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj); -- cgit v1.2.3 From 67025f789324163a69771436e852975d3acbcd86 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 13:10:45 -0700 Subject: mesa: set bufObj->Pointer = NULL after unmapping Also, ctx->Driver.UnmapBuffer can never be null, so remove conditional. --- src/mesa/main/bufferobj.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 8df0a5b1a1..c8d160baa9 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -796,6 +796,8 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) if (bufObj->Pointer) { /* if mapped, unmap it now */ ctx->Driver.UnmapBuffer(ctx, 0, bufObj); + bufObj->Access = DEFAULT_ACCESS; + bufObj->Pointer = NULL; } /* unbind any vertex pointers bound to this buffer */ @@ -1069,10 +1071,7 @@ _mesa_UnmapBufferARB(GLenum target) return GL_FALSE; } - if (ctx->Driver.UnmapBuffer) { - status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); - } - + status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); bufObj->Access = DEFAULT_ACCESS; bufObj->Pointer = NULL; -- cgit v1.2.3 From fd5411fe362a398ab0506c2becdd5953711476d5 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 10:46:14 -0800 Subject: r300-gallium: Turn true and false into TRUE and FALSE. Match the rest of Gallium. --- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_state.c | 2 +- src/gallium/drivers/r300/r300_state_derived.c | 8 ++++---- src/gallium/drivers/r300/r300_swtcl_emit.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 15a8751549..81ac6ffc0d 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -73,7 +73,7 @@ static boolean r300_draw_range_elements(struct pipe_context* pipe, start + count - 1, NULL); } - return true; + return TRUE; } static boolean r300_draw_elements(struct pipe_context* pipe, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index da99a3be6b..59a7565393 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -457,7 +457,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) } } - fs->translated = true; + fs->translated = TRUE; r300->fs = fs; r300->dirty_state |= R300_NEW_FRAGMENT_SHADER; diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index c4f56627c3..dcf0990934 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -59,7 +59,7 @@ static void r300_update_vertex_layout(struct r300_context* r300) { struct r300_vertex_format vformat; struct vertex_info vinfo; - boolean pos = false, psize = false, fog = false; + boolean pos = FALSE, psize = FALSE, fog = FALSE; int i, texs = 0, cols = 0; int tab[16]; @@ -75,17 +75,17 @@ static void r300_update_vertex_layout(struct r300_context* r300) for (i = 0; i < info->num_inputs; i++) { switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: - pos = true; + pos = TRUE; tab[i] = 0; break; case TGSI_SEMANTIC_COLOR: tab[i] = 2 + cols++; break; case TGSI_SEMANTIC_FOG: - fog = true; + fog = TRUE; break; case TGSI_SEMANTIC_PSIZE: - psize = true; + psize = TRUE; tab[i] = 1; break; case TGSI_SEMANTIC_GENERIC: diff --git a/src/gallium/drivers/r300/r300_swtcl_emit.c b/src/gallium/drivers/r300/r300_swtcl_emit.c index cdd44240ad..f9baaade1e 100644 --- a/src/gallium/drivers/r300/r300_swtcl_emit.c +++ b/src/gallium/drivers/r300/r300_swtcl_emit.c @@ -92,9 +92,9 @@ static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render, r300render->vertex_size = vertex_size; if (r300render->vbo) { - return true; + return TRUE; } else { - return false; + return FALSE; } } @@ -168,11 +168,11 @@ static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render, r300render->hwprim = R300_VAP_VF_CNTL__PRIM_POLYGON; break; default: - return false; + return FALSE; break; } - return true; + return TRUE; } static void prepare_render(struct r300_swtcl_render* render) -- cgit v1.2.3 From 7a10fcb7b6263b991714778c7bbacedb2246f474 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 10:52:09 -0800 Subject: Include p_compiler.h in drm_api.h for boolean typedef. --- src/gallium/include/state_tracker/drm_api.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index cfed8d7b24..91a727be66 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -2,6 +2,8 @@ #ifndef _DRM_API_H_ #define _DRM_API_H_ +#include "pipe/p_compiler.h" + struct pipe_screen; struct pipe_winsys; struct pipe_buffer; -- cgit v1.2.3 From 991c945e726311c9db6bea72a63e2a5cfb7ab37b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 10:52:49 -0800 Subject: radeon: Add DRM stubs. Nothing really of note, unfortunately. --- src/gallium/winsys/drm/radeon/Makefile | 1 + src/gallium/winsys/drm/radeon/radeon_drm.c | 30 +++++++++++++++++++++++++ src/gallium/winsys/drm/radeon/radeon_drm.h | 35 ++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 src/gallium/winsys/drm/radeon/radeon_drm.c create mode 100644 src/gallium/winsys/drm/radeon/radeon_drm.h (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/Makefile b/src/gallium/winsys/drm/radeon/Makefile index dca1e3233a..784686ffb6 100644 --- a/src/gallium/winsys/drm/radeon/Makefile +++ b/src/gallium/winsys/drm/radeon/Makefile @@ -13,6 +13,7 @@ PIPE_DRIVERS = \ DRIVER_SOURCES = \ radeon_buffer.c \ radeon_context.c \ + radeon_drm.c \ radeon_r300.c \ radeon_screen.c \ radeon_winsys_softpipe.c diff --git a/src/gallium/winsys/drm/radeon/radeon_drm.c b/src/gallium/winsys/drm/radeon/radeon_drm.c new file mode 100644 index 0000000000..839b0bf0bd --- /dev/null +++ b/src/gallium/winsys/drm/radeon/radeon_drm.c @@ -0,0 +1,30 @@ +/* + * 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 + */ +#include "radeon_drm.h" diff --git a/src/gallium/winsys/drm/radeon/radeon_drm.h b/src/gallium/winsys/drm/radeon/radeon_drm.h new file mode 100644 index 0000000000..8ccbc81895 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/radeon_drm.h @@ -0,0 +1,35 @@ +/* + * 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_DRM_H +#define RADEON_DRM_H + +#include "state_tracker/drm_api.h" + +#endif -- cgit v1.2.3 From 49de8ec2eac7da8520c73d1a0f132b26e2fd1b9f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 12:23:16 -0800 Subject: r300-gallium: Properly split up RS into r300 and r500 variants. --- src/gallium/drivers/r300/r300_emit.c | 3 +- src/gallium/drivers/r300/r300_reg.h | 4 ++ src/gallium/drivers/r300/r300_state_derived.c | 90 +++++++++++++++++++-------- 3 files changed, 69 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 86fa46df42..2f9ec2c3be 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -216,7 +216,7 @@ void r300_emit_rs_block_state(struct r300_context* r300, CS_LOCALS(r300); int i; - BEGIN_CS(0); + BEGIN_CS(21); if (r300screen->caps->is_r500) { OUT_CS_REG_SEQ(R500_RS_IP_0, 8); } else { @@ -238,6 +238,7 @@ void r300_emit_rs_block_state(struct r300_context* r300, for (i = 0; i < 8; i++) { OUT_CS(rs->inst[i]); } + END_CS; } diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 8f31bd5d6e..b3b8f49499 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -732,6 +732,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_RS_IP_TEX_PTR_Q_SHIFT 18 #define R500_RS_IP_COL_PTR_SHIFT 24 #define R500_RS_IP_COL_FMT_SHIFT 27 +# define R500_RS_SEL_S(x) ((x) << 0) +# define R500_RS_SEL_T(x) ((x) << 6) +# define R500_RS_SEL_R(x) ((x) << 12) +# define R500_RS_SEL_Q(x) ((x) << 18) # define R500_RS_COL_PTR(x) ((x) << 24) # define R500_RS_COL_FMT(x) ((x) << 27) /* gap */ diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index dcf0990934..d17050e0d7 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -197,36 +197,72 @@ static void r300_update_rs_block(struct r300_context* r300) memset(rs, 0, sizeof(struct r300_rs_block)); - for (i = 0; i < vinfo->num_attribs; i++) { - switch (vinfo->attrib[i].interp_mode) { - case INTERP_LINEAR: - rs->ip[col_count] |= - R300_RS_COL_PTR(vinfo->attrib[i].src_index) | - R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); - col_count++; - break; - case INTERP_PERSPECTIVE: - rs->ip[tex_count] |= - R300_RS_TEX_PTR(vinfo->attrib[i].src_index) | - 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 += 4; - break; + if (r300_screen(r300->context.screen)->caps->is_r500) { + for (i = 0; i < vinfo->num_attribs; i++) { + switch (vinfo->attrib[i].interp_mode) { + case INTERP_LINEAR: + rs->ip[col_count] |= + R500_RS_COL_PTR(vinfo->attrib[i].src_index) | + R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); + col_count++; + break; + case INTERP_PERSPECTIVE: + rs->ip[tex_count] |= + R500_RS_TEX_PTR(vinfo->attrib[i].src_index) | + R500_RS_SEL_S(tex_count) | + R500_RS_SEL_T(tex_count + 1) | + R500_RS_SEL_R(tex_count + 2) | + R500_RS_SEL_Q(tex_count + 3); + tex_count++; + break; + } } - } - 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); - 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++; + } + + rs->inst_count = MAX2(col_count, tex_count); + } else { + for (i = 0; i < vinfo->num_attribs; i++) { + switch (vinfo->attrib[i].interp_mode) { + case INTERP_LINEAR: + rs->ip[col_count] |= + R300_RS_COL_PTR(vinfo->attrib[i].src_index) | + R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); + col_count++; + break; + case INTERP_PERSPECTIVE: + rs->ip[tex_count] |= + R300_RS_TEX_PTR(vinfo->attrib[i].src_index) | + 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 += 4; + break; + } + } - 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++) { + rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE | + R300_RS_INST_TEX_ADDR(fp_offset); + fp_offset++; + } + + for (i = 0; i < col_count; i++) { + rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE | + R300_RS_INST_COL_ADDR(fp_offset); + fp_offset++; + } } rs->count = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) | -- cgit v1.2.3 From a070937c00828ef0c0d618df7cc4845b0a21bbf3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 13:44:42 -0700 Subject: mesa: update fragResults array in arb_output_attrib_string() Plus add some comments. --- src/mesa/shader/prog_print.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 80be51c3c5..2747480834 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -86,6 +86,9 @@ file_string(enum register_file f, gl_prog_print_mode mode) static const char * arb_input_attrib_string(GLint index, GLenum progType) { + /* + * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. + */ const char *vertAttribs[] = { "vertex.position", "vertex.weight", @@ -160,6 +163,9 @@ arb_input_attrib_string(GLint index, GLenum progType) static const char * arb_output_attrib_string(GLint index, GLenum progType) { + /* + * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens. + */ const char *vertResults[] = { "result.position", "result.color.primary", @@ -184,7 +190,12 @@ arb_output_attrib_string(GLint index, GLenum progType) }; const char *fragResults[] = { "result.color", - "result.depth" + "result.color(half)", + "result.depth", + "result.color[0]", + "result.color[1]", + "result.color[2]", + "result.color[3]" }; if (progType == GL_VERTEX_PROGRAM_ARB) { -- cgit v1.2.3 From c6bde8873fbda6d8467600b7491d8543c75b0509 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 13:13:52 -0700 Subject: intel: remove some unneeded buffer unmap calls Core mesa now unmaps the buffers if needed in these cases. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 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 60d7bb3770..b7c7eeb368 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -35,9 +35,6 @@ #include "intel_batchbuffer.h" #include "intel_regions.h" -static GLboolean intel_bufferobj_unmap(GLcontext * ctx, - GLenum target, - struct gl_buffer_object *obj); /** Allocates a new dri_bo to store the data for the buffer object. */ static void @@ -103,12 +100,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) struct intel_buffer_object *intel_obj = intel_buffer_object(obj); assert(intel_obj); - - /* Buffer objects are automatically unmapped when deleting according - * to the spec. - */ - if (obj->Pointer) - intel_bufferobj_unmap(ctx, 0, obj); + assert(!obj->Pointer); /* Mesa should have unmapped it */ if (intel_obj->region) { intel_bufferobj_release_region(intel, intel_obj); @@ -141,11 +133,7 @@ intel_bufferobj_data(GLcontext * ctx, intel_obj->Base.Size = size; intel_obj->Base.Usage = usage; - /* Buffer objects are automatically unmapped when creating new data buffers - * according to the spec. - */ - if (obj->Pointer) - intel_bufferobj_unmap(ctx, 0, obj); + assert(!obj->Pointer); /* Mesa should have unmapped it */ if (intel_obj->region) intel_bufferobj_release_region(intel, intel_obj); -- cgit v1.2.3 From ba91e79dad6a3666ae31b13c0c4b3b174f10b747 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Sat, 28 Feb 2009 15:09:43 +0100 Subject: tgsi: More descriptive sanity diagnostic messages. --- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 76e773da91..6f1f5c2b4b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -30,18 +30,19 @@ #include "tgsi_info.h" #include "tgsi_iterate.h" -#define MAX_REGISTERS 256 - typedef uint reg_flag; #define BITS_IN_REG_FLAG (sizeof( reg_flag ) * 8) +#define MAX_REGISTERS 256 +#define MAX_REG_FLAGS ((MAX_REGISTERS + BITS_IN_REG_FLAG - 1) / BITS_IN_REG_FLAG) + struct sanity_check_ctx { struct tgsi_iterate_context iter; - reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG]; - reg_flag regs_used[TGSI_FILE_COUNT][MAX_REGISTERS / BITS_IN_REG_FLAG]; + reg_flag regs_decl[TGSI_FILE_COUNT][MAX_REG_FLAGS]; + reg_flag regs_used[TGSI_FILE_COUNT][MAX_REG_FLAGS]; boolean regs_ind_used[TGSI_FILE_COUNT]; uint num_imms; uint num_instructions; @@ -89,7 +90,7 @@ check_file_name( uint file ) { if (file <= TGSI_FILE_NULL || file >= TGSI_FILE_COUNT) { - report_error( ctx, "Invalid register file name" ); + report_error( ctx, "(%u): Invalid register file name", file ); return FALSE; } return TRUE; @@ -113,7 +114,7 @@ is_any_register_declared( { uint i; - for (i = 0; i < MAX_REGISTERS / BITS_IN_REG_FLAG; i++) + for (i = 0; i < MAX_REG_FLAGS; i++) if (ctx->regs_decl[file][i]) return TRUE; return FALSE; @@ -162,9 +163,8 @@ check_register_usage( ctx->regs_ind_used[file] = TRUE; } else { - if (index < 0 || index > MAX_REGISTERS) { - report_error( ctx, "%s[%i]: Invalid index %s", - file_names[file], index, name ); + if (index < 0 || index >= MAX_REGISTERS) { + report_error( ctx, "%s[%d]: Invalid %s index", file_names[file], index, name ); return FALSE; } @@ -193,15 +193,15 @@ iter_instruction( info = tgsi_get_opcode_info( inst->Instruction.Opcode ); if (info == NULL) { - report_error( ctx, "Invalid instruction opcode" ); + report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode ); return TRUE; } if (info->num_dst != inst->Instruction.NumDstRegs) { - report_error( ctx, "Invalid number of destination operands" ); + report_error( ctx, "Invalid number of destination operands, should be %u", info->num_dst ); } if (info->num_src != inst->Instruction.NumSrcRegs) { - report_error( ctx, "Invalid number of source operands" ); + report_error( ctx, "Invalid number of source operands, should be %u", info->num_src ); } /* Check destination and source registers' validity. @@ -266,7 +266,7 @@ iter_declaration( return TRUE; for (i = decl->DeclarationRange.First; i <= decl->DeclarationRange.Last; i++) { if (is_register_declared( ctx, file, i )) - report_error( ctx, "The same register declared twice" ); + 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)); } @@ -295,7 +295,7 @@ iter_immediate( /* Check data type validity. */ if (imm->Immediate.DataType != TGSI_IMM_FLOAT32) { - report_error( ctx, "Invalid immediate data type" ); + report_error( ctx, "(%u): Invalid immediate data type", imm->Immediate.DataType ); return TRUE; } @@ -322,7 +322,7 @@ epilog( for (i = 0; i < MAX_REGISTERS; i++) { if (is_register_declared( ctx, file, i ) && !is_register_used( ctx, file, i ) && !ctx->regs_ind_used[file]) { - report_warning( ctx, "Register never used" ); + report_warning( ctx, "%s[%u]: Register never used", file_names[file], i ); } } } -- cgit v1.2.3 From b210c3fb3f1367525ab690ddb7cf9f0dcc1e7c99 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 27 Feb 2009 23:40:18 -0800 Subject: r300-gallium: Fix RS. I should just stop using "git stash" altogether. --- src/gallium/drivers/r300/r300_reg.h | 4 ++++ src/gallium/drivers/r300/r300_state_derived.c | 9 ++++----- 2 files changed, 8 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 b3b8f49499..e0da9d361e 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1220,14 +1220,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_RS_INST_14 0x4358 #define R500_RS_INST_15 0x435c #define R500_RS_INST_TEX_ID_SHIFT 0 +# 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_COL_ID_SHIFT 12 +# define R500_RS_INST_COL_ID(x) ((x) << 12) #define R500_RS_INST_COL_CN_NO_WRITE (0 << 16) #define R500_RS_INST_COL_CN_WRITE (1 << 16) #define R500_RS_INST_COL_CN_WRITE_FBUFFER (2 << 16) #define R500_RS_INST_COL_CN_WRITE_BACKFACE (3 << 16) #define R500_RS_INST_COL_ADDR_SHIFT 18 +# define R500_RS_INST_COL_ADDR(x) ((x) << 18) #define R500_RS_INST_TEX_ADJ (1 << 25) #define R500_RS_INST_W_CN (1 << 26) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index d17050e0d7..5bf4f24b7a 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -208,11 +208,10 @@ static void r300_update_rs_block(struct r300_context* r300) break; case INTERP_PERSPECTIVE: rs->ip[tex_count] |= - R500_RS_TEX_PTR(vinfo->attrib[i].src_index) | - R500_RS_SEL_S(tex_count) | - R500_RS_SEL_T(tex_count + 1) | - R500_RS_SEL_R(tex_count + 2) | - R500_RS_SEL_Q(tex_count + 3); + R500_RS_SEL_S(vinfo->attrib[i].src_index) | + R500_RS_SEL_T(vinfo->attrib[i].src_index + 1) | + R500_RS_SEL_R(vinfo->attrib[i].src_index + 2) | + R500_RS_SEL_Q(vinfo->attrib[i].src_index + 3); tex_count++; break; } -- cgit v1.2.3 From 2b5770e652f0e6620b52971755bd7eb31c16ad7d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 00:01:41 -0800 Subject: r300-gallium: Fix C99 error. --- src/gallium/drivers/r300/r300_texture.c | 3 ++- 1 file changed, 2 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 edd4370663..8251a597ea 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -31,8 +31,9 @@ static void r300_setup_miptree(struct r300_texture* tex) { struct pipe_texture* base = &tex->tex; int stride, size, offset; + int i; - for (int i = 0; i <= base->last_level; 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]); -- cgit v1.2.3 From 3e131d7d74bfc2c34a772a627b8cf8743d074f27 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 08:13:31 -0800 Subject: r300-gallium: A handful of fixups. --- src/gallium/drivers/r300/r300_context.c | 2 ++ src/gallium/drivers/r300/r300_state_derived.c | 29 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 81ac6ffc0d..a981150143 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -97,6 +97,7 @@ static void r300_destroy_context(struct pipe_context* context) { draw_destroy(r300->draw); FREE(r300->blend_color_state); + FREE(r300->rs_block); FREE(r300->scissor_state); FREE(r300); } @@ -126,6 +127,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300)); 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_init_flush_functions(r300); diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5bf4f24b7a..548a840f25 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -83,6 +83,7 @@ static void r300_update_vertex_layout(struct r300_context* r300) break; case TGSI_SEMANTIC_FOG: fog = TRUE; + tab[i] = 6 + texs++; break; case TGSI_SEMANTIC_PSIZE: psize = TRUE; @@ -110,6 +111,11 @@ static void r300_update_vertex_layout(struct r300_context* r300) if (!pos) { debug_printf("r300: Forcing vertex position attribute emit...\n"); + /* Make room for the position attribute + * at the beginning of the tab. */ + for (i = 1; i < 16; i++) { + tab[i] = tab[i-1]; + } tab[0] = 0; } @@ -131,16 +137,17 @@ static void r300_update_vertex_layout(struct r300_context* r300) vinfo.hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); } - if (fog) { + for (i = 0; i < texs; i++) { draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); - vinfo.hwfmt[2] |= - (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << cols); + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); + vinfo.hwfmt[3] |= (4 << (3 * i)); } - for (i = 0; i < texs; i++) { + if (fog) { + i++; draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); vinfo.hwfmt[3] |= (4 << (3 * i)); } @@ -159,7 +166,15 @@ static void r300_update_vertex_layout(struct r300_context* r300) for (i = 0; i < vinfo.num_attribs; i++) { /* Make sure we have a proper destination for our attribute */ - if (tab[i] != -1) { + if (tab[i] == -1) { + debug_printf("attrib count: %d, fp input count: %d\n", + vinfo.num_attribs, info->num_inputs); + for (i = 0; i < vinfo.num_attribs; i++) { + debug_printf("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]); + } assert(0); } -- cgit v1.2.3 From bedd20743b80b5a6d7d9954e4479a44a76c7ea02 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 21:39:04 -0700 Subject: mesa: lots of updated comments, formatting clean-ups --- src/mesa/main/mtypes.h | 189 +++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e80d3db043..ee49e5d178 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -623,9 +623,7 @@ struct gl_current_attrib * \note Index and Edgeflag current values are stored as floats in the * SIX and SEVEN attribute slots. */ - /*@{*/ GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */ - /*@}*/ /** * \name Current raster position attributes (always valid). @@ -822,11 +820,11 @@ struct gl_hint_attrib */ struct gl_histogram_attrib { - GLuint Width; /**< number of table entries */ - GLint Format; /**< GL_ALPHA, GL_RGB, etc */ - GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */ - GLboolean Sink; /**< terminate image transfer? */ - GLubyte RedSize; /**< Bits per counter */ + GLuint Width; /**< number of table entries */ + GLint Format; /**< GL_ALPHA, GL_RGB, etc */ + GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */ + GLboolean Sink; /**< terminate image transfer? */ + GLubyte RedSize; /**< Bits per counter */ GLubyte GreenSize; GLubyte BlueSize; GLubyte AlphaSize; @@ -1005,13 +1003,15 @@ struct gl_pixel_attrib /*--- Begin Pixel Transfer State ---*/ /* Fields are in the order in which they're applied... */ - /* Scale & Bias (index shift, offset) */ + /** Scale & Bias (index shift, offset) */ + /*@{*/ GLfloat RedBias, RedScale; GLfloat GreenBias, GreenScale; GLfloat BlueBias, BlueScale; GLfloat AlphaBias, AlphaScale; GLfloat DepthBias, DepthScale; GLint IndexShift, IndexOffset; + /*@}*/ /* Pixel Maps */ /* Note: actual pixel maps are not part of this attrib group */ @@ -1027,7 +1027,7 @@ struct gl_pixel_attrib GLboolean Convolution1DEnabled; GLboolean Convolution2DEnabled; GLboolean Separable2DEnabled; - GLfloat ConvolutionBorderColor[3][4]; + GLfloat ConvolutionBorderColor[3][4]; /**< RGBA */ GLenum ConvolutionBorderMode[3]; GLfloat ConvolutionFilterScale[3][4]; /**< RGBA */ GLfloat ConvolutionFilterBias[3][4]; /**< RGBA */ @@ -1538,24 +1538,12 @@ struct gl_texture_unit }; - /** * Texture attribute group (GL_TEXTURE_BIT). */ struct gl_texture_attrib { - /** - * name multitexture - */ - /**@{*/ - GLuint CurrentUnit; /**< Active texture unit [0, MaxTextureImageUnits-1] */ - GLbitfield _EnabledUnits; /**< one bit set for each really-enabled unit */ - GLbitfield _EnabledCoordUnits; /**< one bit per enabled coordinate unit */ - GLbitfield _GenFlags; /**< for texgen */ - GLbitfield _TexGenEnabled; /**< Mask of ENABLE_TEXGEN flags */ - GLbitfield _TexMatEnabled; /**< Mask of ENABLE_TEXMAT flags */ - /**@}*/ - + GLuint CurrentUnit; /**< GL_ACTIVE_TEXTURE */ struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS]; @@ -1563,6 +1551,15 @@ struct gl_texture_attrib /** GL_EXT_shared_texture_palette */ GLboolean SharedPalette; struct gl_color_table Palette; + + /** Per-unit flags */ + /*@{*/ + GLbitfield _EnabledUnits; /**< one bit set for each really-enabled unit */ + GLbitfield _EnabledCoordUnits; /**< one bit per enabled coordinate unit */ + GLbitfield _GenFlags; /**< for texgen */ + GLbitfield _TexGenEnabled; /**< Mask of ENABLE_TEXGEN flags */ + GLbitfield _TexMatEnabled; /**< Mask of ENABLE_TEXMAT flags */ + /*@}*/ }; @@ -1624,7 +1621,6 @@ struct gl_buffer_object }; - /** * Client pixel packing/unpacking attributes */ @@ -1634,8 +1630,8 @@ struct gl_pixelstore_attrib GLint RowLength; GLint SkipPixels; GLint SkipRows; - GLint ImageHeight; /**< for GL_EXT_texture3D */ - GLint SkipImages; /**< for GL_EXT_texture3D */ + GLint ImageHeight; + GLint SkipImages; GLboolean SwapBytes; GLboolean LsbFirst; GLboolean ClientStorage; /**< GL_APPLE_client_storage */ @@ -1644,7 +1640,6 @@ struct gl_pixelstore_attrib }; - /** * Client vertex array attributes */ @@ -1724,7 +1719,7 @@ struct gl_array_attrib struct gl_feedback { GLenum Type; - GLbitfield _Mask; /* FB_* bits */ + GLbitfield _Mask; /**< FB_* bits */ GLfloat *Buffer; GLuint BufferSize; GLuint Count; @@ -1948,14 +1943,14 @@ struct gl_program_state */ struct gl_vertex_program_state { - GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */ - GLboolean _Enabled; /**< Enabled and _valid_ user program? */ - GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */ - GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */ + GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */ + GLboolean _Enabled; /**< Enabled and _valid_ user program? */ + GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */ + GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */ struct gl_vertex_program *Current; /**< User-bound vertex program */ - /** Currently enabled and valid vertex program (including internal programs, - * user-defined vertex programs and GLSL vertex shaders). + /** Currently enabled and valid vertex program (including internal + * programs, user-defined vertex programs and GLSL vertex shaders). * This is the program we must use when rendering. */ struct gl_vertex_program *_Current; @@ -1995,8 +1990,8 @@ struct gl_fragment_program_state GLboolean _Enabled; /**< Enabled and _valid_ user program? */ struct gl_fragment_program *Current; /**< User-bound fragment program */ - /** Currently enabled and valid fragment program (including internal programs, - * user-defined fragment programs and GLSL fragment shaders). + /** Currently enabled and valid fragment program (including internal + * programs, user-defined fragment programs and GLSL fragment shaders). * This is the program we must use when rendering. */ struct gl_fragment_program *_Current; @@ -2339,9 +2334,8 @@ struct gl_renderbuffer /** - * A renderbuffer attachment point points to either a texture object - * (and specifies a mipmap level, cube face or 3D texture slice) or - * points to a renderbuffer. + * A renderbuffer attachment points to either a texture object (and specifies + * a mipmap level, cube face or 3D texture slice) or points to a renderbuffer. */ struct gl_renderbuffer_attachment { @@ -2373,14 +2367,16 @@ struct gl_renderbuffer_attachment */ struct gl_framebuffer { - _glthread_Mutex Mutex; /**< for thread safety */ - GLuint Name; /* if zero, this is a window system framebuffer */ + _glthread_Mutex Mutex; /**< for thread safety */ + GLuint Name; /**< if zero, this is a window system framebuffer */ GLint RefCount; GLboolean DeletePending; - GLvisual Visual; /**< The framebuffer's visual. - Immutable if this is a window system buffer. - Computed from attachments if user-made FBO. */ + /** + * The framebuffer's visual. Immutable if this is a window system buffer. + * Computed from attachments if user-made FBO. + */ + GLvisual Visual; GLboolean Initialized; @@ -2399,9 +2395,10 @@ struct gl_framebuffer GLfloat _MRD; /**< minimum resolvable difference in Z values */ /*@}*/ - GLenum _Status; /* One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */ + /** One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */ + GLenum _Status; - /* Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */ + /** Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */ struct gl_renderbuffer_attachment Attachment[BUFFER_COUNT]; /* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER @@ -2463,52 +2460,58 @@ struct gl_program_constants */ struct gl_constants { - GLint MaxTextureLevels; /**< Maximum number of allowed mipmap levels. */ - GLint Max3DTextureLevels; /**< Maximum number of allowed mipmap levels for 3D texture targets. */ - GLint MaxCubeTextureLevels; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */ - GLint MaxArrayTextureLayers; /**< Maximum number of layers in an array texture. */ - GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */ + GLint MaxTextureLevels; /**< Max mipmap levels. */ + GLint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */ + GLint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */ + GLint MaxArrayTextureLayers; /**< Max layers in array textures */ + GLint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */ GLuint MaxTextureCoordUnits; GLuint MaxTextureImageUnits; - GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */ - GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ - GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ + GLuint MaxVertexTextureImageUnits; + GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */ + GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ + GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ + GLuint MaxArrayLockSize; + GLint SubPixelBits; - GLfloat MinPointSize, MaxPointSize; /* aliased */ - GLfloat MinPointSizeAA, MaxPointSizeAA; /* antialiased */ + + GLfloat MinPointSize, MaxPointSize; /**< aliased */ + GLfloat MinPointSizeAA, MaxPointSizeAA; /**< antialiased */ GLfloat PointSizeGranularity; - GLfloat MinLineWidth, MaxLineWidth; /* aliased */ - GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */ + GLfloat MinLineWidth, MaxLineWidth; /**< aliased */ + GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */ GLfloat LineWidthGranularity; + GLuint MaxColorTableSize; GLuint MaxConvolutionWidth; GLuint MaxConvolutionHeight; + GLuint MaxClipPlanes; GLuint MaxLights; - GLfloat MaxShininess; /* GL_NV_light_max_exponent */ - GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */ + GLfloat MaxShininess; /**< GL_NV_light_max_exponent */ + GLfloat MaxSpotExponent; /**< GL_NV_light_max_exponent */ + GLuint MaxViewportWidth, MaxViewportHeight; - struct gl_program_constants VertexProgram; /* GL_ARB_vertex_program */ - struct gl_program_constants FragmentProgram; /* GL_ARB_fragment_program */ - /* shared by vertex and fragment program: */ + + struct gl_program_constants VertexProgram; /**< GL_ARB_vertex_program */ + struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */ GLuint MaxProgramMatrices; GLuint MaxProgramMatrixStackDepth; - /* vertex array / buffer object bounds checking */ + + /** vertex array / buffer object bounds checking */ GLboolean CheckArrayBounds; - /* GL_ARB_draw_buffers */ - GLuint MaxDrawBuffers; - /* GL_OES_read_format */ - GLenum ColorReadFormat; - GLenum ColorReadType; - /* GL_EXT_framebuffer_object */ - GLuint MaxColorAttachments; - GLuint MaxRenderbufferSize; - /* GL_ARB_vertex_shader */ - GLuint MaxVertexTextureImageUnits; - GLuint MaxVarying; /**< Number of float[4] vectors */ - /* GL_ARB_framebuffer_object */ - GLuint MaxSamples; + + 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 */ + + GLuint MaxVarying; /**< Number of float[4] varying parameters */ }; @@ -2518,12 +2521,6 @@ struct gl_constants */ struct gl_extensions { - /** - * \name Flags to quickly test if certain extensions are available. - * - * Not every extension needs to have such a flag, but it's encouraged. - */ - /*@{*/ GLboolean dummy; /* don't remove this! */ GLboolean ARB_depth_texture; GLboolean ARB_draw_buffers; @@ -2641,8 +2638,7 @@ struct gl_extensions GLboolean SGIS_texture_lod; GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; - /*@}*/ - /* The extension string */ + /** The extension string */ const GLubyte *String; }; @@ -2662,7 +2658,6 @@ struct gl_matrix_stack /** * \name Bits for image transfer operations - * * \sa __GLcontextRec::ImageTransferState. */ /*@{*/ @@ -2677,7 +2672,7 @@ struct gl_matrix_stack #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100 #define IMAGE_HISTOGRAM_BIT 0x200 #define IMAGE_MIN_MAX_BIT 0x400 -#define IMAGE_CLAMP_BIT 0x800 /* extra */ +#define IMAGE_CLAMP_BIT 0x800 /** Pixel Transfer ops up to convolution */ @@ -3040,21 +3035,15 @@ struct __GLcontextRec struct gl_color_table ColorTable[COLORTABLE_MAX]; struct gl_color_table ProxyColorTable[COLORTABLE_MAX]; -#if 0 - struct gl_color_table PostConvolutionColorTable; - struct gl_color_table ProxyPostConvolutionColorTable; - struct gl_color_table PostColorMatrixColorTable; - struct gl_color_table ProxyPostColorMatrixColorTable; -#endif - - struct gl_program_state Program; /**< for vertex or fragment progs */ - struct gl_vertex_program_state VertexProgram; /**< GL_ARB/NV_vertex_program */ - struct gl_fragment_program_state FragmentProgram; /**< GL_ARB/NV_vertex_program */ - struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */ - struct gl_query_state Query; /**< GL_ARB_occlusion_query */ + struct gl_program_state Program; /**< general program state */ + struct gl_vertex_program_state VertexProgram; + struct gl_fragment_program_state FragmentProgram; + struct gl_ati_fragment_shader_state ATIFragmentShader; struct gl_shader_state Shader; /**< GLSL shader object state */ + + struct gl_query_state Query; /**< occlusion, timer queries */ /*@}*/ #if FEATURE_EXT_framebuffer_object @@ -3078,9 +3067,9 @@ struct __GLcontextRec GLfloat _ModelViewInvScale; GLboolean _NeedEyeCoords; GLboolean _ForceEyeCoords; - GLenum _CurrentProgram; /* currently executing program */ + GLenum _CurrentProgram; /**< currently executing program */ - GLuint TextureStateTimestamp; /* detect changes to shared state */ + GLuint TextureStateTimestamp; /**< detect changes to shared state */ struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */ struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */ -- cgit v1.2.3 From 55399c29511a47bd52c39862a246f29e6f35c3cf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 21:41:26 -0700 Subject: mesa: move gl_enable_attrib struct to attrib.c, the only place it's used --- src/mesa/main/attrib.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/mtypes.h | 78 ---------------------------------------------- 2 files changed, 84 insertions(+), 78 deletions(-) (limited to 'src') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 996033a2d8..baad214263 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -58,6 +58,90 @@ #include "mtypes.h" +/** + * glEnable()/glDisable() attribute group (GL_ENABLE_BIT). + */ +struct gl_enable_attrib +{ + GLboolean AlphaTest; + GLboolean AutoNormal; + GLboolean Blend; + GLbitfield ClipPlanes; + GLboolean ColorMaterial; + GLboolean ColorTable[COLORTABLE_MAX]; + GLboolean Convolution1D; + GLboolean Convolution2D; + GLboolean Separable2D; + GLboolean CullFace; + GLboolean DepthTest; + GLboolean Dither; + GLboolean Fog; + GLboolean Histogram; + GLboolean Light[MAX_LIGHTS]; + GLboolean Lighting; + GLboolean LineSmooth; + GLboolean LineStipple; + GLboolean IndexLogicOp; + GLboolean ColorLogicOp; + + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ + + GLboolean MinMax; + GLboolean Normalize; + GLboolean PixelTexture; + GLboolean PointSmooth; + GLboolean PolygonOffsetPoint; + GLboolean PolygonOffsetLine; + GLboolean PolygonOffsetFill; + GLboolean PolygonSmooth; + GLboolean PolygonStipple; + GLboolean RescaleNormals; + GLboolean Scissor; + GLboolean Stencil; + GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */ + GLboolean MultisampleEnabled; /* GL_ARB_multisample */ + GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ + GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ + GLboolean SampleCoverage; /* GL_ARB_multisample */ + GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ + GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ + + GLbitfield Texture[MAX_TEXTURE_UNITS]; + GLbitfield TexGen[MAX_TEXTURE_UNITS]; + + /* SGI_texture_color_table */ + GLboolean TextureColorTable[MAX_TEXTURE_UNITS]; + + /* GL_ARB_vertex_program / GL_NV_vertex_program */ + GLboolean VertexProgram; + GLboolean VertexProgramPointSize; + GLboolean VertexProgramTwoSide; + + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + GLboolean PointSprite; + GLboolean FragmentShaderATI; +}; + + /** * Special struct for saving/restoring texture state (GL_TEXTURE_BIT) */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ee49e5d178..a758c12d6f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -655,84 +655,6 @@ struct gl_depthbuffer_attrib }; -/** - * glEnable()/glDisable() attribute group (GL_ENABLE_BIT). - */ -struct gl_enable_attrib -{ - GLboolean AlphaTest; - GLboolean AutoNormal; - GLboolean Blend; - GLbitfield ClipPlanes; - GLboolean ColorMaterial; - GLboolean ColorTable[COLORTABLE_MAX]; - GLboolean Convolution1D; - GLboolean Convolution2D; - GLboolean Separable2D; - GLboolean CullFace; - GLboolean DepthTest; - GLboolean Dither; - GLboolean Fog; - GLboolean Histogram; - GLboolean Light[MAX_LIGHTS]; - GLboolean Lighting; - GLboolean LineSmooth; - GLboolean LineStipple; - GLboolean IndexLogicOp; - GLboolean ColorLogicOp; - GLboolean Map1Color4; - GLboolean Map1Index; - GLboolean Map1Normal; - GLboolean Map1TextureCoord1; - GLboolean Map1TextureCoord2; - GLboolean Map1TextureCoord3; - GLboolean Map1TextureCoord4; - GLboolean Map1Vertex3; - GLboolean Map1Vertex4; - GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ - GLboolean Map2Color4; - GLboolean Map2Index; - GLboolean Map2Normal; - GLboolean Map2TextureCoord1; - GLboolean Map2TextureCoord2; - GLboolean Map2TextureCoord3; - GLboolean Map2TextureCoord4; - GLboolean Map2Vertex3; - GLboolean Map2Vertex4; - GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ - GLboolean MinMax; - GLboolean Normalize; - GLboolean PixelTexture; - GLboolean PointSmooth; - GLboolean PolygonOffsetPoint; - GLboolean PolygonOffsetLine; - GLboolean PolygonOffsetFill; - GLboolean PolygonSmooth; - GLboolean PolygonStipple; - GLboolean RescaleNormals; - GLboolean Scissor; - GLboolean Stencil; - GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */ - GLboolean MultisampleEnabled; /* GL_ARB_multisample */ - GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ - GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ - GLboolean SampleCoverage; /* GL_ARB_multisample */ - GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ - GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ - GLuint Texture[MAX_TEXTURE_UNITS]; - GLuint TexGen[MAX_TEXTURE_UNITS]; - /* SGI_texture_color_table */ - GLboolean TextureColorTable[MAX_TEXTURE_UNITS]; - /* GL_ARB_vertex_program / GL_NV_vertex_program */ - GLboolean VertexProgram; - GLboolean VertexProgramPointSize; - GLboolean VertexProgramTwoSide; - /* GL_ARB_point_sprite / GL_NV_point_sprite */ - GLboolean PointSprite; - GLboolean FragmentShaderATI; -}; - - /** * Evaluator attribute group (GL_EVAL_BIT). */ -- cgit v1.2.3 From 7f25d9ebb4856273c46ea4bbba4152b85f610a91 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:01:40 -0700 Subject: mesa: move gl_attrib_node struct to attrib.c too --- src/mesa/main/attrib.c | 12 ++++++++++++ src/mesa/main/mtypes.h | 12 +----------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index baad214263..de27917709 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -142,6 +142,18 @@ struct gl_enable_attrib }; +/** + * Node for the attribute stack. + */ +struct gl_attrib_node +{ + GLbitfield kind; + void *data; + struct gl_attrib_node *next; +}; + + + /** * Special struct for saving/restoring texture state (GL_TEXTURE_BIT) */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a758c12d6f..315295b5b3 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -115,6 +115,7 @@ typedef int GLfixed; */ /*@{*/ struct _mesa_HashTable; +struct gl_attrib_node; struct gl_pixelstore_attrib; struct gl_program_cache; struct gl_texture_format; @@ -1516,17 +1517,6 @@ struct gl_viewport_attrib }; -/** - * Node for the attribute stack. - */ -struct gl_attrib_node -{ - GLbitfield kind; - void *data; - struct gl_attrib_node *next; -}; - - /** * GL_ARB_vertex/pixel_buffer_object buffer object */ -- cgit v1.2.3 From f6021ab3c631345d013437d53a7bc1a4e2359ad4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:04:58 -0700 Subject: mesa: remove dead code --- src/mesa/main/feedback.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 48c2ccbff3..69b235a3e5 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -126,20 +126,8 @@ void _mesa_feedback_vertex( GLcontext *ctx, GLfloat index, const GLfloat texcoord[4] ) { -#if 0 - { - /* snap window x, y to fractional pixel position */ - const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); - GLfixed x, y; - x = FloatToFixed(win[0]) & snapMask; - y = FloatToFixed(win[1]) & snapMask; - FEEDBACK_TOKEN(ctx, FixedToFloat(x)); - FEEDBACK_TOKEN(ctx, FixedToFloat(y) ); - } -#else FEEDBACK_TOKEN( ctx, win[0] ); FEEDBACK_TOKEN( ctx, win[1] ); -#endif if (ctx->Feedback._Mask & FB_3D) { FEEDBACK_TOKEN( ctx, win[2] ); } -- cgit v1.2.3 From 559aec47015b741e045d57362f7732b3a04f9450 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:12:31 -0700 Subject: mesa: comments, whitespace, reformatting --- src/mesa/main/feedback.c | 37 ++++++++++++++++++++----------------- src/mesa/main/feedback.h | 28 +++++++++++++--------------- 2 files changed, 33 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 69b235a3e5..9a62db0be3 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,13 +1,9 @@ -/** - * \file feedback.c - * Selection and feedback modes functions. - */ - /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 7.5 * - * Copyright (C) 1999-2003 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"), @@ -27,6 +23,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * \file feedback.c + * Selection and feedback modes functions. + */ + #include "glheader.h" #include "colormac.h" @@ -116,15 +117,15 @@ _mesa_PassThrough( GLfloat token ) } - -/* +/** * Put a vertex into the feedback buffer. */ -void _mesa_feedback_vertex( GLcontext *ctx, - const GLfloat win[4], - const GLfloat color[4], - GLfloat index, - const GLfloat texcoord[4] ) +void +_mesa_feedback_vertex(GLcontext *ctx, + const GLfloat win[4], + const GLfloat color[4], + GLfloat index, + const GLfloat texcoord[4]) { FEEDBACK_TOKEN( ctx, win[0] ); FEEDBACK_TOKEN( ctx, win[1] ); @@ -151,7 +152,7 @@ void _mesa_feedback_vertex( GLcontext *ctx, } } -#endif +#endif /* _HAVE_FULL_GL */ /**********************************************************************/ @@ -217,7 +218,8 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) * Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and * gl_selection::HitMaxZ. */ -void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ) +void +_mesa_update_hitflag(GLcontext *ctx, GLfloat z) { ctx->Select.HitFlag = GL_TRUE; if (z < ctx->Select.HitMinZ) { @@ -240,7 +242,8 @@ void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ) * * \sa gl_selection. */ -static void write_hit_record( GLcontext *ctx ) +static void +write_hit_record(GLcontext *ctx) { GLuint i; GLuint zmin, zmax, zscale = (~0u); diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index 6c448ad631..c6478b02e1 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -1,13 +1,9 @@ -/** - * \file feedback.h - * Selection and feedback modes functions. - */ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 7.5 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,7 +23,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #ifndef FEEDBACK_H #define FEEDBACK_H @@ -42,16 +37,19 @@ CTX->Feedback.Count++; -extern void _mesa_init_feedback( GLcontext * ctx ); +extern void +_mesa_init_feedback( GLcontext *ctx ); -extern void _mesa_feedback_vertex( GLcontext *ctx, - const GLfloat win[4], - const GLfloat color[4], - GLfloat index, - const GLfloat texcoord[4] ); +extern void +_mesa_feedback_vertex( GLcontext *ctx, + const GLfloat win[4], + const GLfloat color[4], + GLfloat index, + const GLfloat texcoord[4] ); -extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); +extern void +_mesa_update_hitflag( GLcontext *ctx, GLfloat z ); extern void GLAPIENTRY -- cgit v1.2.3 From bf8a187f71bd667a0dc0f70164a897d8e62361a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:18:33 -0700 Subject: mesa: replace FEEDBACK_TOKEN macro with _mesa_feedback_token() inline function --- src/mesa/main/drawpix.c | 8 ++++---- src/mesa/main/feedback.c | 31 ++++++++++++++++--------------- src/mesa/main/feedback.h | 17 ++++++++++------- src/mesa/swrast/s_feedback.c | 8 ++++---- 4 files changed, 34 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 13cfa0e756..e9de0c097a 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -103,7 +103,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, @@ -166,7 +166,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, } else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, @@ -243,7 +243,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT(ctx, 0); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, @@ -311,7 +311,7 @@ _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 9a62db0be3..5073ccbef5 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -111,8 +111,8 @@ _mesa_PassThrough( GLfloat token ) if (ctx->RenderMode==GL_FEEDBACK) { FLUSH_VERTICES(ctx, 0); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); - FEEDBACK_TOKEN( ctx, token ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); + _mesa_feedback_token( ctx, token ); } } @@ -127,31 +127,32 @@ _mesa_feedback_vertex(GLcontext *ctx, GLfloat index, const GLfloat texcoord[4]) { - FEEDBACK_TOKEN( ctx, win[0] ); - FEEDBACK_TOKEN( ctx, win[1] ); + _mesa_feedback_token( ctx, win[0] ); + _mesa_feedback_token( ctx, win[1] ); if (ctx->Feedback._Mask & FB_3D) { - FEEDBACK_TOKEN( ctx, win[2] ); + _mesa_feedback_token( ctx, win[2] ); } if (ctx->Feedback._Mask & FB_4D) { - FEEDBACK_TOKEN( ctx, win[3] ); + _mesa_feedback_token( ctx, win[3] ); } if (ctx->Feedback._Mask & FB_INDEX) { - FEEDBACK_TOKEN( ctx, (GLfloat) index ); + _mesa_feedback_token( ctx, (GLfloat) index ); } if (ctx->Feedback._Mask & FB_COLOR) { - FEEDBACK_TOKEN( ctx, color[0] ); - FEEDBACK_TOKEN( ctx, color[1] ); - FEEDBACK_TOKEN( ctx, color[2] ); - FEEDBACK_TOKEN( ctx, color[3] ); + _mesa_feedback_token( ctx, color[0] ); + _mesa_feedback_token( ctx, color[1] ); + _mesa_feedback_token( ctx, color[2] ); + _mesa_feedback_token( ctx, color[3] ); } if (ctx->Feedback._Mask & FB_TEXTURE) { - FEEDBACK_TOKEN( ctx, texcoord[0] ); - FEEDBACK_TOKEN( ctx, texcoord[1] ); - FEEDBACK_TOKEN( ctx, texcoord[2] ); - FEEDBACK_TOKEN( ctx, texcoord[3] ); + _mesa_feedback_token( ctx, texcoord[0] ); + _mesa_feedback_token( ctx, texcoord[1] ); + _mesa_feedback_token( ctx, texcoord[2] ); + _mesa_feedback_token( ctx, texcoord[3] ); } } + #endif /* _HAVE_FULL_GL */ diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index c6478b02e1..72c2acd5ed 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -30,13 +30,6 @@ #include "mtypes.h" -#define FEEDBACK_TOKEN( CTX, T ) \ - if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \ - CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \ - } \ - CTX->Feedback.Count++; - - extern void _mesa_init_feedback( GLcontext *ctx ); @@ -48,6 +41,16 @@ _mesa_feedback_vertex( GLcontext *ctx, const GLfloat texcoord[4] ); +static INLINE void +_mesa_feedback_token( GLcontext *ctx, GLfloat token ) +{ + if (ctx->Feedback.Count < ctx->Feedback.BufferSize) { + ctx->Feedback.Buffer[ctx->Feedback.Count] = token; + } + ctx->Feedback.Count++; +} + + extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index aa79531277..7bb914b658 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -59,8 +59,8 @@ _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (_swrast_culltriangle(ctx, v0, v1, v2)) { - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); - FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */ + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */ if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); @@ -86,7 +86,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, if (swrast->StippleCounter == 0) token = GL_LINE_RESET_TOKEN; - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token); + _mesa_feedback_token(ctx, (GLfloat) (GLint) token); if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); @@ -104,7 +104,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, void _swrast_feedback_point(GLcontext *ctx, const SWvertex *v) { - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); feedback_vertex(ctx, v, v); } -- cgit v1.2.3 From 8bf25a17d2f8f888e8e8a4f7a2c6d68c6c06f6e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:21:42 -0700 Subject: mesa: convert macro to inline function --- src/mesa/main/feedback.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 5073ccbef5..beab535b15 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -203,11 +203,14 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) * Verifies there is free space in the buffer to write the value and * increments the pointer. */ -#define WRITE_RECORD( CTX, V ) \ - if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \ - CTX->Select.Buffer[CTX->Select.BufferCount] = (V); \ - } \ - CTX->Select.BufferCount++; +static INLINE void +write_record(GLcontext *ctx, GLuint value) +{ + if (ctx->Select.BufferCount < ctx->Select.BufferSize) { + ctx->Select.Buffer[ctx->Select.BufferCount] = value; + } + ctx->Select.BufferCount++; +} /** @@ -256,11 +259,11 @@ write_hit_record(GLcontext *ctx) zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ); zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ); - WRITE_RECORD( ctx, ctx->Select.NameStackDepth ); - WRITE_RECORD( ctx, zmin ); - WRITE_RECORD( ctx, zmax ); + write_record( ctx, ctx->Select.NameStackDepth ); + write_record( ctx, zmin ); + write_record( ctx, zmax ); for (i = 0; i < ctx->Select.NameStackDepth; i++) { - WRITE_RECORD( ctx, ctx->Select.NameStack[i] ); + write_record( ctx, ctx->Select.NameStack[i] ); } ctx->Select.Hits++; -- cgit v1.2.3 From 389d50baff8234fdf4d7bcddeb09658d7d17012d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:26:18 -0700 Subject: mesa: move GLfixed type and related macros to swrast module Fixed point is only used in swrast and sw-based drivers. --- src/mesa/main/mtypes.h | 32 -------------------------------- src/mesa/swrast/s_context.h | 28 ++++++++++++++++++++++++++++ src/mesa/swrast/swrast.h | 6 ++++++ 3 files changed, 34 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 315295b5b3..2801f61948 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -78,38 +78,6 @@ #endif -/** - * Fixed point data type. - */ -typedef int GLfixed; -/* - * Fixed point arithmetic macros - */ -#ifndef FIXED_FRAC_BITS -#define FIXED_FRAC_BITS 11 -#endif - -#define FIXED_SHIFT FIXED_FRAC_BITS -#define FIXED_ONE (1 << FIXED_SHIFT) -#define FIXED_HALF (1 << (FIXED_SHIFT-1)) -#define FIXED_FRAC_MASK (FIXED_ONE - 1) -#define FIXED_INT_MASK (~FIXED_FRAC_MASK) -#define FIXED_EPSILON 1 -#define FIXED_SCALE ((float) FIXED_ONE) -#define FIXED_DBL_SCALE ((double) FIXED_ONE) -#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) -#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE)) -#define IntToFixed(I) ((I) << FIXED_SHIFT) -#define FixedToInt(X) ((X) >> FIXED_SHIFT) -#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT) -#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK) -#define FixedFloor(X) ((X) & FIXED_INT_MASK) -#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE)) -#define PosFloatToFixed(X) FloatToFixed(X) -#define SignedFloatToFixed(X) FloatToFixed(X) - - - /** * \name Some forward type declarations */ diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index cdd6fa5048..6e8d080704 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -288,6 +288,34 @@ swrast_render_finish(GLcontext *ctx) +/* + * Fixed point arithmetic macros + */ +#ifndef FIXED_FRAC_BITS +#define FIXED_FRAC_BITS 11 +#endif + +#define FIXED_SHIFT FIXED_FRAC_BITS +#define FIXED_ONE (1 << FIXED_SHIFT) +#define FIXED_HALF (1 << (FIXED_SHIFT-1)) +#define FIXED_FRAC_MASK (FIXED_ONE - 1) +#define FIXED_INT_MASK (~FIXED_FRAC_MASK) +#define FIXED_EPSILON 1 +#define FIXED_SCALE ((float) FIXED_ONE) +#define FIXED_DBL_SCALE ((double) FIXED_ONE) +#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) +#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE)) +#define IntToFixed(I) ((I) << FIXED_SHIFT) +#define FixedToInt(X) ((X) >> FIXED_SHIFT) +#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT) +#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK) +#define FixedFloor(X) ((X) & FIXED_INT_MASK) +#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE)) +#define PosFloatToFixed(X) FloatToFixed(X) +#define SignedFloatToFixed(X) FloatToFixed(X) + + + /* * XXX these macros are just bandages for now in order to make * CHAN_BITS==32 compile cleanly. diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 047f7991e6..015f8a05c3 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -75,6 +75,12 @@ typedef struct { } SWvertex; +/** + * Fixed point data type. + */ +typedef int GLfixed; + + #define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0 -- cgit v1.2.3 From ae5c06b9ce1191afaa95dd784d7315f25ec729ff Mon Sep 17 00:00:00 2001 From: David Miller Date: Fri, 27 Feb 2009 23:34:41 -0800 Subject: mesa: Sparc's IROUND() optimization is invalid. We can't use the "fstoi" instruction like this. Unlike other floating point instructions, "fstoi" always rounds towards zero no matter what rounding mode the FPU has been set to. This was validated using the following test program: -------------------- static inline int iround(float f) { int r; __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f)); return r; } #define IROUND(x) iround(x) #define IROUND_REF(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F))) int main(void) { float f = -2.0; while (f < 3.0f) { int sparc_val = IROUND(f); int ref_val = IROUND_REF(f); if (sparc_val != ref_val) printf("DIFFERENT[%f]: REF==%d SPARC==%d\n", f, ref_val, sparc_val); f += 0.1f; } return 0; } -------------------- which prints out things like: -------------------- DIFFERENT[-1.900000]: REF==-2 SPARC==-1 DIFFERENT[-1.800000]: REF==-2 SPARC==-1 DIFFERENT[-1.700000]: REF==-2 SPARC==-1 DIFFERENT[-1.600000]: REF==-2 SPARC==-1 DIFFERENT[-1.000000]: REF==-1 SPARC==0 DIFFERENT[-0.900000]: REF==-1 SPARC==0 DIFFERENT[-0.800000]: REF==-1 SPARC==0 DIFFERENT[-0.700000]: REF==-1 SPARC==0 DIFFERENT[-0.600000]: REF==-1 SPARC==0 DIFFERENT[0.500000]: REF==1 SPARC==0 DIFFERENT[0.600000]: REF==1 SPARC==0 ... -------------------- So we have to remove Sparc's IROUND() definition, it's wrong. Signed-off-by: David S. Miller --- src/mesa/main/imports.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 4192f037c0..7b61e22e93 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -256,15 +256,7 @@ static INLINE int GET_FLOAT_BITS( float x ) /*** *** IROUND: return (as an integer) float rounded to nearest integer ***/ -#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__) -static INLINE int iround(float f) -{ - int r; - __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f)); - return r; -} -#define IROUND(x) iround(x) -#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \ +#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \ (!(defined(__BEOS__) || defined(__HAIKU__)) || \ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))) static INLINE int iround(float f) -- cgit v1.2.3 From 079554a480f62674b27cea5ff8bb655589e06166 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 10:06:55 -0700 Subject: mesa: add a prototype to silence warnings --- src/mesa/tnl_dd/t_dd_vb.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c index 3cedd90119..b3937c29a0 100644 --- a/src/mesa/tnl_dd/t_dd_vb.c +++ b/src/mesa/tnl_dd/t_dd_vb.c @@ -188,6 +188,9 @@ void TAG(translate_vertex)(GLcontext *ctx, } +/* prototype to silence warning */ +void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ); + void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) { -- cgit v1.2.3 From b7ebc270a4b464eb2136e9c45fdfeed798c007c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 10:08:22 -0700 Subject: mesa: move #include "bitset.h" out of mtypes.h - not needed in core Mesa --- src/mesa/main/mtypes.h | 1 - src/mesa/tnl/t_context.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2801f61948..f608ac42a8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -38,7 +38,6 @@ #include "main/config.h" #include "main/compiler.h" #include "main/mfeatures.h" -#include "main/bitset.h" #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 0a6ce04614..c19eb3df3c 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -50,6 +50,7 @@ #define _T_CONTEXT_H #include "main/glheader.h" +#include "main/bitset.h" #include "main/mtypes.h" #include "math/m_matrix.h" -- cgit v1.2.3 From 3673fc35d68edf55d0b1dc0fb4c3628f228eb9d6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 08:58:05 -0800 Subject: r300-gallium: Move all state translators to r300_state_inlines. Tryin' to do some cleanup. --- src/gallium/drivers/r300/r300_state.c | 282 +++-------------------- src/gallium/drivers/r300/r300_state_inlines.h | 310 ++++++++++++++++++++++---- 2 files changed, 304 insertions(+), 288 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 59a7565393..f5635591b6 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -28,6 +28,7 @@ #include "r300_context.h" #include "r300_reg.h" +#include "r300_state_inlines.h" #include "r300_state_shader.h" /* r300_state: Functions used to intialize state context by translating @@ -47,71 +48,6 @@ static uint32_t pack_float_32(float f) return u.u; } -static uint32_t translate_blend_function(int blend_func) { - switch (blend_func) { - case PIPE_BLEND_ADD: - return R300_COMB_FCN_ADD_CLAMP; - case PIPE_BLEND_SUBTRACT: - return R300_COMB_FCN_SUB_CLAMP; - case PIPE_BLEND_REVERSE_SUBTRACT: - return R300_COMB_FCN_RSUB_CLAMP; - case PIPE_BLEND_MIN: - return R300_COMB_FCN_MIN; - case PIPE_BLEND_MAX: - return R300_COMB_FCN_MAX; - default: - debug_printf("r300: Unknown blend function %d\n", blend_func); - break; - } - return 0; -} - -/* XXX we can also offer the D3D versions of some of these... */ -static uint32_t translate_blend_factor(int blend_fact) { - switch (blend_fact) { - case PIPE_BLENDFACTOR_ONE: - return R300_BLEND_GL_ONE; - case PIPE_BLENDFACTOR_SRC_COLOR: - return R300_BLEND_GL_SRC_COLOR; - case PIPE_BLENDFACTOR_SRC_ALPHA: - return R300_BLEND_GL_SRC_ALPHA; - case PIPE_BLENDFACTOR_DST_ALPHA: - return R300_BLEND_GL_DST_ALPHA; - case PIPE_BLENDFACTOR_DST_COLOR: - return R300_BLEND_GL_DST_COLOR; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - return R300_BLEND_GL_SRC_ALPHA_SATURATE; - case PIPE_BLENDFACTOR_CONST_COLOR: - return R300_BLEND_GL_CONST_COLOR; - case PIPE_BLENDFACTOR_CONST_ALPHA: - return R300_BLEND_GL_CONST_ALPHA; - /* XXX WTF are these? - case PIPE_BLENDFACTOR_SRC1_COLOR: - case PIPE_BLENDFACTOR_SRC1_ALPHA: */ - case PIPE_BLENDFACTOR_ZERO: - return R300_BLEND_GL_ZERO; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - return R300_BLEND_GL_ONE_MINUS_SRC_COLOR; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - return R300_BLEND_GL_ONE_MINUS_DST_ALPHA; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - return R300_BLEND_GL_ONE_MINUS_DST_COLOR; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - return R300_BLEND_GL_ONE_MINUS_CONST_COLOR; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA; - /* XXX see above - case PIPE_BLENDFACTOR_INV_SRC1_COLOR: - case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */ - default: - debug_printf("r300: Unknown blend factor %d\n", blend_fact); - break; - } - return 0; -} - /* Create a new blend state based on the CSO blend state. * * This encompasses alpha blending, logic/raster ops, and blend dithering. */ @@ -126,16 +62,16 @@ static void* r300_create_blend_state(struct pipe_context* pipe, blend->blend_control = R300_ALPHA_BLEND_ENABLE | R300_SEPARATE_ALPHA_ENABLE | R300_READ_ENABLE | - translate_blend_function(state->rgb_func) | - (translate_blend_factor(state->rgb_src_factor) << + r300_translate_blend_function(state->rgb_func) | + (r300_translate_blend_factor(state->rgb_src_factor) << R300_SRC_BLEND_SHIFT) | - (translate_blend_factor(state->rgb_dst_factor) << + (r300_translate_blend_factor(state->rgb_dst_factor) << R300_DST_BLEND_SHIFT); blend->alpha_blend_control = - translate_blend_function(state->alpha_func) | - (translate_blend_factor(state->alpha_src_factor) << + r300_translate_blend_function(state->alpha_func) | + (r300_translate_blend_factor(state->alpha_src_factor) << R300_SRC_BLEND_SHIFT) | - (translate_blend_factor(state->alpha_dst_factor) << + (r300_translate_blend_factor(state->alpha_dst_factor) << R300_DST_BLEND_SHIFT); } @@ -233,82 +169,6 @@ static void r300->dirty_state |= R300_NEW_CONSTANTS; } -static uint32_t translate_depth_stencil_function(int zs_func) { - switch (zs_func) { - case PIPE_FUNC_NEVER: - return R300_ZS_NEVER; - case PIPE_FUNC_LESS: - return R300_ZS_LESS; - case PIPE_FUNC_EQUAL: - return R300_ZS_EQUAL; - case PIPE_FUNC_LEQUAL: - return R300_ZS_LEQUAL; - case PIPE_FUNC_GREATER: - return R300_ZS_GREATER; - case PIPE_FUNC_NOTEQUAL: - return R300_ZS_NOTEQUAL; - case PIPE_FUNC_GEQUAL: - return R300_ZS_GEQUAL; - case PIPE_FUNC_ALWAYS: - return R300_ZS_ALWAYS; - default: - debug_printf("r300: Unknown depth/stencil function %d\n", - zs_func); - break; - } - return 0; -} - -static uint32_t translate_stencil_op(int s_op) { - switch (s_op) { - case PIPE_STENCIL_OP_KEEP: - return R300_ZS_KEEP; - case PIPE_STENCIL_OP_ZERO: - return R300_ZS_ZERO; - case PIPE_STENCIL_OP_REPLACE: - return R300_ZS_REPLACE; - case PIPE_STENCIL_OP_INCR: - return R300_ZS_INCR; - case PIPE_STENCIL_OP_DECR: - return R300_ZS_DECR; - case PIPE_STENCIL_OP_INCR_WRAP: - return R300_ZS_INCR_WRAP; - case PIPE_STENCIL_OP_DECR_WRAP: - return R300_ZS_DECR_WRAP; - case PIPE_STENCIL_OP_INVERT: - return R300_ZS_INVERT; - default: - debug_printf("r300: Unknown stencil op %d", s_op); - break; - } - return 0; -} - -static uint32_t translate_alpha_function(int alpha_func) { - switch (alpha_func) { - case PIPE_FUNC_NEVER: - return R300_FG_ALPHA_FUNC_NEVER; - case PIPE_FUNC_LESS: - return R300_FG_ALPHA_FUNC_LESS; - case PIPE_FUNC_EQUAL: - return R300_FG_ALPHA_FUNC_EQUAL; - case PIPE_FUNC_LEQUAL: - return R300_FG_ALPHA_FUNC_LE; - case PIPE_FUNC_GREATER: - return R300_FG_ALPHA_FUNC_GREATER; - case PIPE_FUNC_NOTEQUAL: - return R300_FG_ALPHA_FUNC_NOTEQUAL; - case PIPE_FUNC_GEQUAL: - return R300_FG_ALPHA_FUNC_GE; - case PIPE_FUNC_ALWAYS: - return R300_FG_ALPHA_FUNC_ALWAYS; - default: - debug_printf("r300: Unknown alpha function %d", alpha_func); - break; - } - return 0; -} - /* 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. @@ -329,7 +189,7 @@ static void* } dsa->z_stencil_control |= - (translate_depth_stencil_function(state->depth.func) << + (r300_translate_depth_stencil_function(state->depth.func) << R300_Z_FUNC_SHIFT); } @@ -337,14 +197,14 @@ static void* if (state->stencil[0].enabled) { dsa->z_buffer_control |= R300_STENCIL_ENABLE; dsa->z_stencil_control |= - (translate_depth_stencil_function(state->stencil[0].func) << - R300_S_FRONT_FUNC_SHIFT) | - (translate_stencil_op(state->stencil[0].fail_op) << - R300_S_FRONT_SFAIL_OP_SHIFT) | - (translate_stencil_op(state->stencil[0].zpass_op) << - R300_S_FRONT_ZPASS_OP_SHIFT) | - (translate_stencil_op(state->stencil[0].zfail_op) << - R300_S_FRONT_ZFAIL_OP_SHIFT); + (r300_translate_depth_stencil_function(state->stencil[0].func) << + R300_S_FRONT_FUNC_SHIFT) | + (r300_translate_stencil_op(state->stencil[0].fail_op) << + R300_S_FRONT_SFAIL_OP_SHIFT) | + (r300_translate_stencil_op(state->stencil[0].zpass_op) << + R300_S_FRONT_ZPASS_OP_SHIFT) | + (r300_translate_stencil_op(state->stencil[0].zfail_op) << + R300_S_FRONT_ZFAIL_OP_SHIFT); dsa->stencil_ref_mask = (state->stencil[0].ref_value) | (state->stencil[0].valuemask << R300_STENCILMASK_SHIFT) | @@ -353,14 +213,14 @@ static void* if (state->stencil[1].enabled) { dsa->z_buffer_control |= R300_STENCIL_FRONT_BACK; dsa->z_stencil_control |= - (translate_depth_stencil_function(state->stencil[1].func) << - R300_S_BACK_FUNC_SHIFT) | - (translate_stencil_op(state->stencil[1].fail_op) << - R300_S_BACK_SFAIL_OP_SHIFT) | - (translate_stencil_op(state->stencil[1].zpass_op) << - R300_S_BACK_ZPASS_OP_SHIFT) | - (translate_stencil_op(state->stencil[1].zfail_op) << - R300_S_BACK_ZFAIL_OP_SHIFT); + (r300_translate_depth_stencil_function(state->stencil[1].func) << + R300_S_BACK_FUNC_SHIFT) | + (r300_translate_stencil_op(state->stencil[1].fail_op) << + R300_S_BACK_SFAIL_OP_SHIFT) | + (r300_translate_stencil_op(state->stencil[1].zpass_op) << + R300_S_BACK_ZPASS_OP_SHIFT) | + (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) | @@ -370,7 +230,8 @@ static void* /* Alpha test setup. */ if (state->alpha.enabled) { - dsa->alpha_function = translate_alpha_function(state->alpha.func) | + 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); @@ -567,83 +428,6 @@ static void r300_delete_rs_state(struct pipe_context* pipe, void* state) FREE(state); } -static uint32_t translate_wrap(int wrap) { - switch (wrap) { - case PIPE_TEX_WRAP_REPEAT: - return R300_TX_REPEAT; - case PIPE_TEX_WRAP_CLAMP: - return R300_TX_CLAMP; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - return R300_TX_CLAMP_TO_EDGE; - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - return R300_TX_CLAMP_TO_BORDER; - case PIPE_TEX_WRAP_MIRROR_REPEAT: - return R300_TX_REPEAT | R300_TX_MIRRORED; - case PIPE_TEX_WRAP_MIRROR_CLAMP: - return R300_TX_CLAMP | R300_TX_MIRRORED; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED; - default: - debug_printf("r300: Unknown texture wrap %d", wrap); - return 0; - } -} - -static uint32_t translate_tex_filters(int min, int mag, int mip) { - uint32_t retval = 0; - switch (min) { - case PIPE_TEX_FILTER_NEAREST: - retval |= R300_TX_MIN_FILTER_NEAREST; - case PIPE_TEX_FILTER_LINEAR: - retval |= R300_TX_MIN_FILTER_LINEAR; - case PIPE_TEX_FILTER_ANISO: - retval |= R300_TX_MIN_FILTER_ANISO; - default: - debug_printf("r300: Unknown texture filter %d", min); - break; - } - switch (mag) { - case PIPE_TEX_FILTER_NEAREST: - retval |= R300_TX_MAG_FILTER_NEAREST; - case PIPE_TEX_FILTER_LINEAR: - retval |= R300_TX_MAG_FILTER_LINEAR; - case PIPE_TEX_FILTER_ANISO: - retval |= R300_TX_MAG_FILTER_ANISO; - default: - debug_printf("r300: Unknown texture filter %d", mag); - break; - } - switch (mip) { - case PIPE_TEX_MIPFILTER_NONE: - retval |= R300_TX_MIN_FILTER_MIP_NONE; - case PIPE_TEX_MIPFILTER_NEAREST: - retval |= R300_TX_MIN_FILTER_MIP_NEAREST; - case PIPE_TEX_MIPFILTER_LINEAR: - retval |= R300_TX_MIN_FILTER_MIP_LINEAR; - default: - debug_printf("r300: Unknown texture filter %d", mip); - break; - } - - return retval; -} - -static uint32_t anisotropy(float max_aniso) { - if (max_aniso >= 16.0f) { - return R300_TX_MAX_ANISO_16_TO_1; - } else if (max_aniso >= 8.0f) { - return R300_TX_MAX_ANISO_8_TO_1; - } else if (max_aniso >= 4.0f) { - return R300_TX_MAX_ANISO_4_TO_1; - } else if (max_aniso >= 2.0f) { - return R300_TX_MAX_ANISO_2_TO_1; - } else { - return R300_TX_MAX_ANISO_1_TO_1; - } -} - static void* r300_create_sampler_state(struct pipe_context* pipe, const struct pipe_sampler_state* state) @@ -653,19 +437,19 @@ static void* int lod_bias; sampler->filter0 |= - (translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) | - (translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) | - (translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT); + (r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) | + (r300_translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) | + (r300_translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT); - sampler->filter0 |= translate_tex_filters(state->min_img_filter, - state->mag_img_filter, - state->min_mip_filter); + sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter, + state->mag_img_filter, + state->min_mip_filter); lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1); sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT; - sampler->filter1 |= anisotropy(state->max_anisotropy); + sampler->filter1 |= r300_anisotropy(state->max_anisotropy); util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM, &sampler->border_color); diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 005fb74ed6..e686e1fec6 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -1,5 +1,6 @@ /* * Copyright 2009 Joakim Sindholt + * Corbin Simpson * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,56 +28,287 @@ #include "r300_reg.h" +/* Blend state. */ + +static INLINE uint32_t r300_translate_blend_function(int blend_func) +{ + switch (blend_func) { + case PIPE_BLEND_ADD: + return R300_COMB_FCN_ADD_CLAMP; + case PIPE_BLEND_SUBTRACT: + return R300_COMB_FCN_SUB_CLAMP; + case PIPE_BLEND_REVERSE_SUBTRACT: + return R300_COMB_FCN_RSUB_CLAMP; + case PIPE_BLEND_MIN: + return R300_COMB_FCN_MIN; + case PIPE_BLEND_MAX: + return R300_COMB_FCN_MAX; + default: + debug_printf("r300: Unknown blend function %d\n", blend_func); + break; + } + return 0; +} + +/* XXX we can also offer the D3D versions of some of these... */ +static INLINE uint32_t r300_translate_blend_factor(int blend_fact) +{ + switch (blend_fact) { + case PIPE_BLENDFACTOR_ONE: + return R300_BLEND_GL_ONE; + case PIPE_BLENDFACTOR_SRC_COLOR: + return R300_BLEND_GL_SRC_COLOR; + case PIPE_BLENDFACTOR_SRC_ALPHA: + return R300_BLEND_GL_SRC_ALPHA; + case PIPE_BLENDFACTOR_DST_ALPHA: + return R300_BLEND_GL_DST_ALPHA; + case PIPE_BLENDFACTOR_DST_COLOR: + return R300_BLEND_GL_DST_COLOR; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + return R300_BLEND_GL_SRC_ALPHA_SATURATE; + case PIPE_BLENDFACTOR_CONST_COLOR: + return R300_BLEND_GL_CONST_COLOR; + case PIPE_BLENDFACTOR_CONST_ALPHA: + return R300_BLEND_GL_CONST_ALPHA; + /* XXX WTF are these? + case PIPE_BLENDFACTOR_SRC1_COLOR: + case PIPE_BLENDFACTOR_SRC1_ALPHA: */ + case PIPE_BLENDFACTOR_ZERO: + return R300_BLEND_GL_ZERO; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + return R300_BLEND_GL_ONE_MINUS_SRC_COLOR; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + return R300_BLEND_GL_ONE_MINUS_SRC_ALPHA; + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + return R300_BLEND_GL_ONE_MINUS_DST_ALPHA; + case PIPE_BLENDFACTOR_INV_DST_COLOR: + return R300_BLEND_GL_ONE_MINUS_DST_COLOR; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + return R300_BLEND_GL_ONE_MINUS_CONST_COLOR; + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + return R300_BLEND_GL_ONE_MINUS_CONST_ALPHA; + /* XXX see above + case PIPE_BLENDFACTOR_INV_SRC1_COLOR: + case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */ + default: + debug_printf("r300: Unknown blend factor %d\n", blend_fact); + break; + } + return 0; +} + +/* DSA state. */ + +static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func) +{ + switch (zs_func) { + case PIPE_FUNC_NEVER: + return R300_ZS_NEVER; + case PIPE_FUNC_LESS: + return R300_ZS_LESS; + case PIPE_FUNC_EQUAL: + return R300_ZS_EQUAL; + case PIPE_FUNC_LEQUAL: + return R300_ZS_LEQUAL; + case PIPE_FUNC_GREATER: + return R300_ZS_GREATER; + case PIPE_FUNC_NOTEQUAL: + return R300_ZS_NOTEQUAL; + case PIPE_FUNC_GEQUAL: + return R300_ZS_GEQUAL; + case PIPE_FUNC_ALWAYS: + return R300_ZS_ALWAYS; + default: + debug_printf("r300: Unknown depth/stencil function %d\n", + zs_func); + break; + } + return 0; +} + +static INLINE uint32_t r300_translate_stencil_op(int s_op) +{ + switch (s_op) { + case PIPE_STENCIL_OP_KEEP: + return R300_ZS_KEEP; + case PIPE_STENCIL_OP_ZERO: + return R300_ZS_ZERO; + case PIPE_STENCIL_OP_REPLACE: + return R300_ZS_REPLACE; + case PIPE_STENCIL_OP_INCR: + return R300_ZS_INCR; + case PIPE_STENCIL_OP_DECR: + return R300_ZS_DECR; + case PIPE_STENCIL_OP_INCR_WRAP: + return R300_ZS_INCR_WRAP; + case PIPE_STENCIL_OP_DECR_WRAP: + return R300_ZS_DECR_WRAP; + case PIPE_STENCIL_OP_INVERT: + return R300_ZS_INVERT; + default: + debug_printf("r300: Unknown stencil op %d", s_op); + break; + } + return 0; +} + +static INLINE uint32_t r300_translate_alpha_function(int alpha_func) +{ + switch (alpha_func) { + case PIPE_FUNC_NEVER: + return R300_FG_ALPHA_FUNC_NEVER; + case PIPE_FUNC_LESS: + return R300_FG_ALPHA_FUNC_LESS; + case PIPE_FUNC_EQUAL: + return R300_FG_ALPHA_FUNC_EQUAL; + case PIPE_FUNC_LEQUAL: + return R300_FG_ALPHA_FUNC_LE; + case PIPE_FUNC_GREATER: + return R300_FG_ALPHA_FUNC_GREATER; + case PIPE_FUNC_NOTEQUAL: + return R300_FG_ALPHA_FUNC_NOTEQUAL; + case PIPE_FUNC_GEQUAL: + return R300_FG_ALPHA_FUNC_GE; + case PIPE_FUNC_ALWAYS: + return R300_FG_ALPHA_FUNC_ALWAYS; + default: + debug_printf("r300: Unknown alpha function %d", alpha_func); + break; + } + return 0; +} + +/* Texture sampler state. */ + +static INLINE uint32_t r300_translate_wrap(int wrap) +{ + switch (wrap) { + case PIPE_TEX_WRAP_REPEAT: + return R300_TX_REPEAT; + case PIPE_TEX_WRAP_CLAMP: + return R300_TX_CLAMP; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + return R300_TX_CLAMP_TO_EDGE; + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return R300_TX_CLAMP_TO_BORDER; + case PIPE_TEX_WRAP_MIRROR_REPEAT: + return R300_TX_REPEAT | R300_TX_MIRRORED; + case PIPE_TEX_WRAP_MIRROR_CLAMP: + return R300_TX_CLAMP | R300_TX_MIRRORED; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED; + default: + debug_printf("r300: Unknown texture wrap %d", wrap); + return 0; + } +} + +static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip) +{ + uint32_t retval = 0; + switch (min) { + case PIPE_TEX_FILTER_NEAREST: + retval |= R300_TX_MIN_FILTER_NEAREST; + case PIPE_TEX_FILTER_LINEAR: + retval |= R300_TX_MIN_FILTER_LINEAR; + case PIPE_TEX_FILTER_ANISO: + retval |= R300_TX_MIN_FILTER_ANISO; + default: + debug_printf("r300: Unknown texture filter %d", min); + break; + } + switch (mag) { + case PIPE_TEX_FILTER_NEAREST: + retval |= R300_TX_MAG_FILTER_NEAREST; + case PIPE_TEX_FILTER_LINEAR: + retval |= R300_TX_MAG_FILTER_LINEAR; + case PIPE_TEX_FILTER_ANISO: + retval |= R300_TX_MAG_FILTER_ANISO; + default: + debug_printf("r300: Unknown texture filter %d", mag); + break; + } + switch (mip) { + case PIPE_TEX_MIPFILTER_NONE: + retval |= R300_TX_MIN_FILTER_MIP_NONE; + case PIPE_TEX_MIPFILTER_NEAREST: + retval |= R300_TX_MIN_FILTER_MIP_NEAREST; + case PIPE_TEX_MIPFILTER_LINEAR: + retval |= R300_TX_MIN_FILTER_MIP_LINEAR; + default: + debug_printf("r300: Unknown texture filter %d", mip); + break; + } + + return retval; +} + +static INLINE uint32_t r300_anisotropy(float max_aniso) +{ + if (max_aniso >= 16.0f) { + return R300_TX_MAX_ANISO_16_TO_1; + } else if (max_aniso >= 8.0f) { + return R300_TX_MAX_ANISO_8_TO_1; + } else if (max_aniso >= 4.0f) { + return R300_TX_MAX_ANISO_4_TO_1; + } else if (max_aniso >= 2.0f) { + return R300_TX_MAX_ANISO_2_TO_1; + } else { + return R300_TX_MAX_ANISO_1_TO_1; + } +} + +/* Buffer formats. */ + static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) { switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - return R300_COLOR_FORMAT_ARGB8888; - case PIPE_FORMAT_I8_UNORM: - return R300_COLOR_FORMAT_I8; - case PIPE_FORMAT_A1R5G5B5_UNORM: - return R300_COLOR_FORMAT_ARGB1555; - case PIPE_FORMAT_R5G6B5_UNORM: - return R300_COLOR_FORMAT_RGB565; - /* XXX Not in pipe_format - case PIPE_FORMAT_A32R32G32B32: - return R300_COLOR_FORMAT_ARGB32323232; - case PIPE_FORMAT_A16R16G16B16: - return R300_COLOR_FORMAT_ARGB16161616; */ - case PIPE_FORMAT_A4R4G4B4_UNORM: - return R300_COLOR_FORMAT_ARGB4444; - /* XXX Not in pipe_format - case PIPE_FORMAT_A10R10G10B10_UNORM: - return R500_COLOR_FORMAT_ARGB10101010; - case PIPE_FORMAT_A2R10G10B10_UNORM: - return R500_COLOR_FORMAT_ARGB2101010; - case PIPE_FORMAT_I10_UNORM: - return R500_COLOR_FORMAT_I10; */ - default: - debug_printf("r300: Implementation error: " \ - "Got unsupported color format %s in %s\n", - pf_name(format), __FUNCTION__); - break; + case PIPE_FORMAT_A8R8G8B8_UNORM: + return R300_COLOR_FORMAT_ARGB8888; + case PIPE_FORMAT_I8_UNORM: + return R300_COLOR_FORMAT_I8; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return R300_COLOR_FORMAT_ARGB1555; + case PIPE_FORMAT_R5G6B5_UNORM: + return R300_COLOR_FORMAT_RGB565; + /* XXX Not in pipe_format + case PIPE_FORMAT_A32R32G32B32: + return R300_COLOR_FORMAT_ARGB32323232; + case PIPE_FORMAT_A16R16G16B16: + return R300_COLOR_FORMAT_ARGB16161616; */ + case PIPE_FORMAT_A4R4G4B4_UNORM: + return R300_COLOR_FORMAT_ARGB4444; + /* XXX Not in pipe_format + case PIPE_FORMAT_A10R10G10B10_UNORM: + return R500_COLOR_FORMAT_ARGB10101010; + case PIPE_FORMAT_A2R10G10B10_UNORM: + return R500_COLOR_FORMAT_ARGB2101010; + case PIPE_FORMAT_I10_UNORM: + return R500_COLOR_FORMAT_I10; */ + default: + debug_printf("r300: Implementation error: " \ + "Got unsupported color format %s in %s\n", + pf_name(format), __FUNCTION__); + break; } - return 0; } static INLINE uint32_t r300_translate_zsformat(enum pipe_format format) { switch (format) { - case PIPE_FORMAT_Z16_UNORM: - return R300_DEPTHFORMAT_16BIT_INT_Z; - /* XXX R300_DEPTHFORMAT_16BIT_13E3 anyone? */ - case PIPE_FORMAT_Z24S8_UNORM: - return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL; - default: - debug_printf("r300: Implementation error: " \ - "Got unsupported ZS format %s in %s\n", - pf_name(format), __FUNCTION__); - break; + case PIPE_FORMAT_Z16_UNORM: + return R300_DEPTHFORMAT_16BIT_INT_Z; + case PIPE_FORMAT_Z24S8_UNORM: + return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL; + default: + debug_printf("r300: Implementation error: " \ + "Got unsupported ZS format %s in %s\n", + pf_name(format), __FUNCTION__); + break; } - return 0; } -- cgit v1.2.3 From d1559eac6d7f9ee8757a2adc6271eb951efc546f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 09:12:16 -0800 Subject: r300-gallium: Be more Gallium-ish in some of the math. --- src/gallium/drivers/r300/r300_state.c | 32 +++++++------------------------- 1 file changed, 7 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 f5635591b6..693f3c1c58 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -32,21 +32,7 @@ #include "r300_state_shader.h" /* r300_state: Functions used to intialize state context by translating - * Gallium state objects into semi-native r300 state objects. - * - * XXX break this file up into pieces if it gets too big! */ - -/* Pack a float into a dword. */ -static uint32_t pack_float_32(float f) -{ - union { - float f; - uint32_t u; - } u; - - u.f = f; - return u.u; -} + * Gallium state objects into semi-native r300 state objects. */ /* Create a new blend state based on the CSO blend state. * @@ -114,21 +100,17 @@ static void r300_set_blend_color(struct pipe_context* pipe, const struct pipe_blend_color* color) { struct r300_context* r300 = r300_context(pipe); - uint32_t r, g, b, a; ubyte ur, ug, ub, ua; - r = util_iround(color->color[0] * 1023.0f); - g = util_iround(color->color[1] * 1023.0f); - b = util_iround(color->color[2] * 1023.0f); - a = util_iround(color->color[3] * 1023.0f); - 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]); - r300->blend_color_state->blend_color = (a << 24) | (r << 16) | (g << 8) | b; + 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); @@ -391,15 +373,15 @@ static void* r300_create_rs_state(struct pipe_context* pipe, if (rs->polygon_offset_enable) { rs->depth_offset_front = rs->depth_offset_back = - pack_float_32(state->offset_units); + fui(state->offset_units); rs->depth_scale_front = rs->depth_scale_back = - pack_float_32(state->offset_scale); + fui(state->offset_scale); } if (state->line_stipple_enable) { rs->line_stipple_config = R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE | - (pack_float_32((float)state->line_stipple_factor) & + (fui((float)state->line_stipple_factor) & R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK); /* XXX this might need to be scaled up */ rs->line_stipple_value = state->line_stipple_pattern; -- cgit v1.2.3 From 5f1fdaabd1686c37c45f3ad4cf125fce1df3a4a8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 09:55:09 -0800 Subject: r300-gallium: Cleanup color formats. --- src/gallium/drivers/r300/r300_screen.c | 17 ++++++++--------- src/gallium/drivers/r300/r300_state_inlines.h | 17 +++++++++++------ 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 470e1e2acb..2fcd504812 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -179,8 +179,11 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500) { switch (format) { /* Colorbuffer */ + case PIPE_FORMAT_A4R4G4B4_UNORM: + case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_A1R5G5B5_UNORM: case PIPE_FORMAT_A8R8G8B8_UNORM: - /* Texture */ + /* Colorbuffer or texture */ case PIPE_FORMAT_I8_UNORM: /* Z buffer */ case PIPE_FORMAT_Z16_UNORM: @@ -188,29 +191,25 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500) case PIPE_FORMAT_Z24S8_UNORM: return TRUE; - /* XXX Supported yet unimplemented formats: */ - case PIPE_FORMAT_A1R5G5B5_UNORM: - case PIPE_FORMAT_R5G6B5_UNORM: /* 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) */ - case PIPE_FORMAT_A4R4G4B4_UNORM: + /* 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__); - return FALSE; + return FALSE; */ /* XXX Supported yet unimplemented r5xx formats: */ /* XXX Again, what is UV1010 this time? (r5xx accel page 148) */ /* XXX Even more that don't exist case PIPE_FORMAT_A10R10G10B10_UNORM: case PIPE_FORMAT_A2R10G10B10_UNORM: - case PIPE_FORMAT_I10_UNORM: */ + case PIPE_FORMAT_I10_UNORM: debug_printf( "r300: Warning: Got unimplemented r500 format: %s in %s\n", pf_name(format), __FUNCTION__); - return FALSE; + return FALSE; */ default: debug_printf("r300: Warning: Got unsupported format: %s in %s\n", diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index e686e1fec6..361443a692 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -265,21 +265,24 @@ static INLINE uint32_t r300_anisotropy(float max_aniso) static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) { switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - return R300_COLOR_FORMAT_ARGB8888; + /* 8-bit buffers */ case PIPE_FORMAT_I8_UNORM: return R300_COLOR_FORMAT_I8; - case PIPE_FORMAT_A1R5G5B5_UNORM: - return R300_COLOR_FORMAT_ARGB1555; + /* 16-bit buffers */ case PIPE_FORMAT_R5G6B5_UNORM: return R300_COLOR_FORMAT_RGB565; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return R300_COLOR_FORMAT_ARGB1555; + case PIPE_FORMAT_A4R4G4B4_UNORM: + return R300_COLOR_FORMAT_ARGB4444; + /* 32-bit buffers */ + case PIPE_FORMAT_A8R8G8B8_UNORM: + return R300_COLOR_FORMAT_ARGB8888; /* XXX Not in pipe_format case PIPE_FORMAT_A32R32G32B32: return R300_COLOR_FORMAT_ARGB32323232; case PIPE_FORMAT_A16R16G16B16: return R300_COLOR_FORMAT_ARGB16161616; */ - case PIPE_FORMAT_A4R4G4B4_UNORM: - return R300_COLOR_FORMAT_ARGB4444; /* XXX Not in pipe_format case PIPE_FORMAT_A10R10G10B10_UNORM: return R500_COLOR_FORMAT_ARGB10101010; @@ -299,8 +302,10 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) 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, 8-bit stencil */ case PIPE_FORMAT_Z24S8_UNORM: return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL; default: -- cgit v1.2.3 From b2b2febe2ca5a1e7c005e518a24ea85f033449ab Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Sat, 28 Feb 2009 18:51:09 +0100 Subject: mesa: fix remaining FEEDBACK_TOKEN macros Signed-off-by: Corbin Simpson --- src/mesa/state_tracker/st_cb_feedback.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 86d3542262..93f7145219 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -122,8 +122,8 @@ feedback_tri( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); - FEEDBACK_TOKEN(fs->ctx, (GLfloat) 3); /* three vertices */ + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ feedback_vertex(fs->ctx, draw, prim->v[0]); feedback_vertex(fs->ctx, draw, prim->v[1]); feedback_vertex(fs->ctx, draw, prim->v[2]); @@ -136,11 +136,11 @@ feedback_line( struct draw_stage *stage, struct prim_header *prim ) struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; if (fs->reset_stipple_counter) { - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); fs->reset_stipple_counter = GL_FALSE; } else { - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); } feedback_vertex(fs->ctx, draw, prim->v[0]); feedback_vertex(fs->ctx, draw, prim->v[1]); @@ -152,7 +152,7 @@ feedback_point( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POINT_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); feedback_vertex(fs->ctx, draw, prim->v[0]); } -- cgit v1.2.3 From c88c8d7993547796eae52e5e63685d722c548b52 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 15:42:35 -0700 Subject: mesa: use fp pointer in _tnl_InvalidateState() --- src/mesa/tnl/t_context.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index f0d31fdac3..f69b122046 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -149,13 +149,10 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) /* fixed-function fog */ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); } - else if (ctx->FragmentProgram._Current) { - struct gl_fragment_program *fp = ctx->FragmentProgram._Current; - if (fp) { - if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) { - /* fragment program needs fog coord */ - RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); - } + else if (fp) { + if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) { + /* fragment program needs fog coord */ + RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); } } -- cgit v1.2.3 From c50c2e4e986024c728cc35e56e56250e947080a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 16:44:28 -0700 Subject: mesa: move _GenFlags = 0x0 to texgen loop --- src/mesa/main/texstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 3e6b09baa1..e25c9e732c 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -550,7 +550,6 @@ update_texture_state( GLcontext *ctx ) texUnit->_Current = NULL; texUnit->_ReallyEnabled = 0x0; - texUnit->_GenFlags = 0x0; /* Get the bitmask of texture target enables. * enableBits will be a mask of the TEXTURE_*_BIT flags indicating @@ -609,6 +608,8 @@ update_texture_state( GLcontext *ctx ) for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + texUnit->_GenFlags = 0x0; + if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) continue; -- cgit v1.2.3 From 4c4268dd31ce119d5d3db090adf0935bf3c27831 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 10:58:57 -0700 Subject: mesa: convert some #defines to enums This makes debugging with gdb a bit easier. Ex: (gdb) p ctx->DrawBuffer.Attachment[BUFFER_STENCIL] Note however that gdb only seems to recognize enum types that are actually used to declare a variable somewhere. For example, gl_buffer_index isn't used to declare any vars so it's invisible to gdb. Work around this by adding a dummy function in context.c that declares some vars with these new types. --- src/mesa/main/context.c | 32 +++++++++++++++ src/mesa/main/mtypes.h | 103 +++++++++++++++++++++++++----------------------- 2 files changed, 86 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index fb43054cdd..97ee925c0b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -351,6 +351,36 @@ _mesa_destroy_visual( GLvisual *vis ) /**********************************************************************/ /*@{*/ + +/** + * This is lame. gdb only seems to recognize enum types that are + * actually used somewhere. We want to be able to print/use enum + * values such as TEXTURE_2D_INDEX in gdb. But we don't actually use + * the gl_texture_index type anywhere. Thus, this lame function. + */ +static void +dummy_enum_func(void) +{ + gl_buffer_index bi; + gl_colortable_index ci; + gl_face_index fi; + gl_frag_attrib fa; + gl_frag_result fr; + gl_texture_index ti; + gl_vert_attrib va; + gl_vert_result vr; + + (void) bi; + (void) ci; + (void) fi; + (void) fa; + (void) fr; + (void) ti; + (void) va; + (void) vr; +} + + /** * One-time initialization mutex lock. * @@ -406,6 +436,8 @@ one_time_init( GLcontext *ctx ) alreadyCalled = GL_TRUE; } _glthread_UNLOCK_MUTEX(OneTimeLock); + + dummy_enum_func(); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f608ac42a8..22add9d975 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -103,7 +103,7 @@ typedef struct gl_framebuffer GLframebuffer; * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the * generic attributes are distinct/separate). */ -enum +typedef enum { VERT_ATTRIB_POS = 0, VERT_ATTRIB_WEIGHT = 1, @@ -139,7 +139,7 @@ enum VERT_ATTRIB_GENERIC14 = 30, VERT_ATTRIB_GENERIC15 = 31, VERT_ATTRIB_MAX = 32 -}; +} gl_vert_attrib; /** * Bitflags for vertex attributes. @@ -187,8 +187,7 @@ enum /** * Indexes for vertex program result attributes */ -/*@{*/ -enum +typedef enum { VERT_RESULT_HPOS = 0, VERT_RESULT_COL0 = 1, @@ -208,14 +207,13 @@ enum VERT_RESULT_EDGE = 15, VERT_RESULT_VAR0 = 16 /**< shader varying */, VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) -}; -/*@}*/ +} gl_vert_result; /** * Indexes for fragment program input attributes. */ -enum +typedef enum { FRAG_ATTRIB_WPOS = 0, FRAG_ATTRIB_COL0 = 1, @@ -231,7 +229,7 @@ enum FRAG_ATTRIB_TEX7 = 11, FRAG_ATTRIB_VAR0 = 12, /**< shader varying */ FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING) -}; +} gl_frag_attrib; /** * Bitflags for fragment program input attributes. @@ -268,41 +266,45 @@ enum /** * Fragment program results */ -enum +typedef enum { FRAG_RESULT_COLR = 0, FRAG_RESULT_COLH = 1, FRAG_RESULT_DEPR = 2, FRAG_RESULT_DATA0 = 3, FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) -}; +} gl_frag_result; /** * Indexes for all renderbuffers */ -enum { - BUFFER_FRONT_LEFT = 0, /* the four standard color buffers */ - BUFFER_BACK_LEFT = 1, - BUFFER_FRONT_RIGHT = 2, - BUFFER_BACK_RIGHT = 3, - BUFFER_AUX0 = 4, /* optional aux buffer */ - BUFFER_AUX1 = 5, - BUFFER_AUX2 = 6, - BUFFER_AUX3 = 7, - BUFFER_DEPTH = 8, - BUFFER_STENCIL = 9, - BUFFER_ACCUM = 10, - BUFFER_COLOR0 = 11, /* generic renderbuffers */ - BUFFER_COLOR1 = 12, - BUFFER_COLOR2 = 13, - BUFFER_COLOR3 = 14, - BUFFER_COLOR4 = 15, - BUFFER_COLOR5 = 16, - BUFFER_COLOR6 = 17, - BUFFER_COLOR7 = 18, - BUFFER_COUNT = 19 -}; +typedef enum +{ + /* the four standard color buffers */ + BUFFER_FRONT_LEFT, + BUFFER_BACK_LEFT, + BUFFER_FRONT_RIGHT, + BUFFER_BACK_RIGHT, + /* optional aux buffers */ + BUFFER_AUX0, + BUFFER_AUX1, + BUFFER_AUX2, + BUFFER_AUX3, + BUFFER_DEPTH, + BUFFER_STENCIL, + BUFFER_ACCUM, + /* generic renderbuffers */ + BUFFER_COLOR0, + BUFFER_COLOR1, + BUFFER_COLOR2, + BUFFER_COLOR3, + BUFFER_COLOR4, + BUFFER_COLOR5, + BUFFER_COLOR6, + BUFFER_COLOR7, + BUFFER_COUNT +} gl_buffer_index; /** * Bit flags for all renderbuffers @@ -349,12 +351,13 @@ enum { /** The pixel transfer path has three color tables: */ -/*@{*/ -#define COLORTABLE_PRECONVOLUTION 0 -#define COLORTABLE_POSTCONVOLUTION 1 -#define COLORTABLE_POSTCOLORMATRIX 2 -#define COLORTABLE_MAX 3 -/*@}*/ +typedef enum +{ + COLORTABLE_PRECONVOLUTION, + COLORTABLE_POSTCONVOLUTION, + COLORTABLE_POSTCOLORMATRIX, + COLORTABLE_MAX +} gl_colortable_index; /** @@ -1034,7 +1037,8 @@ struct gl_stencil_attrib * target target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. * Note: the order is from highest priority to lowest priority. */ -enum { +typedef enum +{ TEXTURE_2D_ARRAY_INDEX, TEXTURE_1D_ARRAY_INDEX, TEXTURE_CUBE_INDEX, @@ -1043,7 +1047,7 @@ enum { TEXTURE_2D_INDEX, TEXTURE_1D_INDEX, NUM_TEXTURE_TARGETS -}; +} gl_texture_index; /** @@ -1273,15 +1277,16 @@ struct gl_texture_image /** * Indexes for cube map faces. */ -/*@{*/ -#define FACE_POS_X 0 -#define FACE_NEG_X 1 -#define FACE_POS_Y 2 -#define FACE_NEG_Y 3 -#define FACE_POS_Z 4 -#define FACE_NEG_Z 5 -#define MAX_FACES 6 -/*@}*/ +typedef enum +{ + FACE_POS_X = 0, + FACE_NEG_X = 1, + FACE_POS_Y = 2, + FACE_NEG_Y = 3, + FACE_POS_Z = 4, + FACE_NEG_Z = 5, + MAX_FACES = 6 +} gl_face_index; /** -- cgit v1.2.3 From 7787fa10bac206f7690fc742b952df99254c4ea1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 11:16:00 -0700 Subject: mesa: add gallium state tracker sources to ALL_SOURCES This should fix some missing dependency checking. --- src/mesa/sources.mak | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index a76c7b7441..7c710103cd 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -326,7 +326,8 @@ MESA_SOURCES = \ ALL_SOURCES = \ $(MESA_SOURCES) \ $(GLAPI_SOURCES) \ - $(MESA_ASM_SOURCES) + $(MESA_ASM_SOURCES) \ + $(STATETRACKER_SOURCES) MESA_GALLIUM_SOURCES = \ $(MAIN_SOURCES) \ -- cgit v1.2.3 From 8d475822e6e19fa79719c856a2db5b6a205db1b9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 11:49:46 -0700 Subject: mesa: rename, reorder FRAG_RESULT_x tokens s/FRAG_RESULT_DEPR/FRAG_RESULT_DEPTH/ s/FRAG_RESULT_COLR/FRAG_RESULT/COLOR/ Remove FRAG_RESULT_COLH (NV half-precision) output since we never used it. Next, we might merge the COLOR and DATA outputs (COLOR0, COLOR1, etc). --- src/mesa/drivers/dri/i915/i915_fragprog.c | 4 +-- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_fp.c | 8 ++--- src/mesa/drivers/dri/i965/brw_wm_state.c | 2 +- src/mesa/drivers/dri/r300/r300_fragprog.c | 4 +-- src/mesa/drivers/dri/r300/r500_fragprog.c | 4 +-- src/mesa/drivers/dri/r300/radeon_nqssadce.c | 2 +- src/mesa/drivers/dri/r300/radeon_program_pair.c | 4 +-- src/mesa/main/mtypes.h | 7 ++--- src/mesa/main/texenvprogram.c | 6 ++-- src/mesa/shader/arbprogparse.c | 4 +-- src/mesa/shader/nvfragparse.c | 40 ++++++++----------------- src/mesa/shader/nvfragparse.h | 5 ---- src/mesa/shader/prog_debug.c | 12 +++----- src/mesa/shader/program.c | 6 ++-- src/mesa/shader/programopt.c | 6 ++-- src/mesa/shader/slang/slang_codegen.c | 4 +-- src/mesa/shader/slang/slang_link.c | 2 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 4 +-- src/mesa/state_tracker/st_cb_drawpixels.c | 10 +++---- src/mesa/state_tracker/st_program.c | 10 +++---- src/mesa/swrast/s_context.c | 2 +- src/mesa/swrast/s_fragprog.c | 12 ++++---- 23 files changed, 68 insertions(+), 92 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 f091d600c3..52f09a4b1b 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -180,9 +180,9 @@ get_result_vector(struct i915_fragment_program *p, switch (inst->DstReg.File) { case PROGRAM_OUTPUT: switch (inst->DstReg.Index) { - case FRAG_RESULT_COLR: + case FRAG_RESULT_COLOR: return UREG(REG_TYPE_OC, 0); - case FRAG_RESULT_DEPR: + case FRAG_RESULT_DEPTH: p->depth_written = 1; return UREG(REG_TYPE_OD, 0); default: diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 10f38e02a4..06a6f3f0f4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -198,7 +198,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 & (1<Aux = (i<<1); if (c->fp_fragcolor_emitted) { - outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + 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); @@ -892,7 +892,7 @@ static void emit_fb_write( struct brw_wm_compile *c ) if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0)) outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0); else - outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, outcolor, payload_r0_depth, outdepth); @@ -928,7 +928,7 @@ static void validate_dst_regs( struct brw_wm_compile *c, { if (inst->DstReg.File == PROGRAM_OUTPUT) { GLuint idx = inst->DstReg.Index; - if (idx == FRAG_RESULT_COLR) + if (idx == FRAG_RESULT_COLOR) c->fp_fragcolor_emitted = 1; } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 3c3b3473d6..f7ea756fb0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -103,7 +103,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_DEPR)) != 0; + (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0; /* _NEW_COLOR */ key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 8d030c63fb..32182bb667 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -356,8 +356,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) static void nqssadce_init(struct nqssadce_state* s) { - s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW; - s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W; + s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; + s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 926ddd5964..07a2a7b17c 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -298,8 +298,8 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler) static void nqssadce_init(struct nqssadce_state* s) { - s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW; - s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W; + s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; + s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; } static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/radeon_nqssadce.c index 97ce016c99..a083c3d243 100644 --- a/src/mesa/drivers/dri/r300/radeon_nqssadce.c +++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.c @@ -191,7 +191,7 @@ static void process_instruction(struct nqssadce_state* s) if (inst->Opcode != OPCODE_KIL) { if (s->Descr->RewriteDepthOut) { - if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPR) + if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPTH) rewrite_depth_out(inst); } diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index 58bc0d5843..365e7c1722 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -778,10 +778,10 @@ static void fill_dest_into_pair(struct pair_state *s, struct radeon_pair_instruc struct prog_instruction *inst = s->Program->Instructions + ip; if (inst->DstReg.File == PROGRAM_OUTPUT) { - if (inst->DstReg.Index == FRAG_RESULT_COLR) { + if (inst->DstReg.Index == FRAG_RESULT_COLOR) { pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ; pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); - } else if (inst->DstReg.Index == FRAG_RESULT_DEPR) { + } else if (inst->DstReg.Index == FRAG_RESULT_DEPTH) { pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); } } else { diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 22add9d975..f17b9e1e71 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -268,10 +268,9 @@ typedef enum */ typedef enum { - FRAG_RESULT_COLR = 0, - FRAG_RESULT_COLH = 1, - FRAG_RESULT_DEPR = 2, - FRAG_RESULT_DATA0 = 3, + FRAG_RESULT_DEPTH = 0, + FRAG_RESULT_COLOR = 1, + FRAG_RESULT_DATA0 = 2, FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) } gl_frag_result; diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index d2a9e35dd5..51c13a563d 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1098,7 +1098,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit) rgb_shift) dest = get_temp( p ); else - dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); + dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); /* Emit the RGB and A combine ops */ @@ -1278,7 +1278,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.program->Base.Parameters = _mesa_new_parameter_list(); p.program->Base.InputsRead = 0; - p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR; + p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) p.src_texture[unit] = undef; @@ -1313,7 +1313,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, } cf = get_source( &p, SRC_PREVIOUS, 0 ); - out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR ); + out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR ); if (key->separate_specular) { /* Emit specular add. diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 62edb7f595..ccc0318a53 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1688,7 +1688,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst, */ parse_output_color_num(ctx, inst, Program, &out_color); ASSERT(out_color < MAX_DRAW_BUFFERS); - *outputReg = FRAG_RESULT_COLR; + *outputReg = FRAG_RESULT_COLOR; } else { /* for vtx programs, this is VERTEX_RESULT_POSITION */ @@ -1699,7 +1699,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst, case FRAGMENT_RESULT_DEPTH: if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { /* for frag programs, this is FRAGMENT_RESULT_DEPTH */ - *outputReg = FRAG_RESULT_DEPR; + *outputReg = FRAG_RESULT_DEPTH; } else { /* for vtx programs, this is VERTEX_RESULT_COLOR */ diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 20e4781372..37418ffb6e 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -384,18 +384,12 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = { "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL }; + static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = { - "COLR", "COLH", - /* These are only allows for register combiners */ - /* - "TEX0", "TEX1", "TEX2", "TEX3", - */ - "DEPR", NULL + "DEPR", "COLR", "DATA0", NULL }; - - /**********************************************************************/ /** @@ -828,7 +822,6 @@ static GLboolean Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) { GLubyte token[100]; - GLint j; /* Match "o[" */ if (!Parse_String(parseState, "o[")) @@ -839,19 +832,19 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) RETURN_ERROR; /* try to match an output register name */ - for (j = 0; OutputRegisters[j]; j++) { - if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { - static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH); - *outputRegNum = j; - parseState->outputsWritten |= (1 << j); - if ((parseState->outputsWritten & bothColors) == bothColors) { - RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]"); - } - break; - } + if (_mesa_strcmp((char *) token, "COLR") == 0 || + _mesa_strcmp((char *) token, "COLH") == 0) { + /* note that we don't distinguish between COLR and COLH */ + *outputRegNum = FRAG_RESULT_COLOR; + parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR); } - if (!OutputRegisters[j]) + else if (_mesa_strcmp((char *) token, "DEPR") == 0) { + *outputRegNum = FRAG_RESULT_DEPTH; + parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH); + } + else { RETURN_ERROR1("Invalid output register name"); + } /* Match ']' */ if (!Parse_String(parseState, "]")) @@ -1826,10 +1819,3 @@ _mesa_nv_fragment_input_register_name(GLuint i) return InputRegisters[i]; } - -const char * -_mesa_nv_fragment_output_register_name(GLuint i) -{ - ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS); - return OutputRegisters[i]; -} diff --git a/src/mesa/shader/nvfragparse.h b/src/mesa/shader/nvfragparse.h index de45cf543d..ac97921080 100644 --- a/src/mesa/shader/nvfragparse.h +++ b/src/mesa/shader/nvfragparse.h @@ -44,9 +44,4 @@ _mesa_print_nv_fragment_program(const struct gl_fragment_program *program); extern const char * _mesa_nv_fragment_input_register_name(GLuint i); - -extern const char * -_mesa_nv_fragment_output_register_name(GLuint i); - - #endif diff --git a/src/mesa/shader/prog_debug.c b/src/mesa/shader/prog_debug.c index 7bcb2ef734..35ce37d5ce 100644 --- a/src/mesa/shader/prog_debug.c +++ b/src/mesa/shader/prog_debug.c @@ -222,20 +222,16 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, "glGetProgramRegisterfvMESA(registerName)"); return; } - else if (_mesa_strcmp(reg, "o[COLR]") == 0) { + else if (_mesa_strcmp(reg, "o[COLR]") == 0 || + _mesa_strcmp(reg, "o[COLH]") == 0) { /* Fragment output color */ ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_COLR, v); - } - else if (_mesa_strcmp(reg, "o[COLH]") == 0) { - /* Fragment output color */ - ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_COLH, v); + FRAG_RESULT_COLOR, v); } else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { /* Fragment output depth */ ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, - FRAG_RESULT_DEPR, v); + FRAG_RESULT_DEPTH, v); } else { /* try user-defined identifiers */ diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 00655f0288..2e5632710e 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -738,7 +738,7 @@ _mesa_combine_programs(GLcontext *ctx, /* Connect color outputs of fprogA to color inputs of fprogB, via a * new temporary register. */ - if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) && + if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) && (progB_inputsRead & FRAG_BIT_COL0)) { GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY); if (tempReg < 0) { @@ -748,7 +748,7 @@ _mesa_combine_programs(GLcontext *ctx, } /* replace writes to result.color[0] with tempReg */ replace_registers(newInst, lenA, - PROGRAM_OUTPUT, FRAG_RESULT_COLR, + PROGRAM_OUTPUT, FRAG_RESULT_COLOR, PROGRAM_TEMPORARY, tempReg); /* replace reads from the input color with tempReg */ replace_registers(newInst + lenA, lenB, @@ -758,7 +758,7 @@ _mesa_combine_programs(GLcontext *ctx, /* compute combined program's InputsRead */ inputsB = progB_inputsRead; - if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) { + if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) { inputsB &= ~(1 << FRAG_ATTRIB_COL0); } newProg->InputsRead = progA->InputsRead | inputsB; diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index 56f1eb832e..05d9bdf7ec 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) if (inst->Opcode == OPCODE_END) break; if (inst->DstReg.File == PROGRAM_OUTPUT && - inst->DstReg.Index == FRAG_RESULT_COLR) { + inst->DstReg.Index == FRAG_RESULT_COLOR) { /* change the instruction to write to colorTemp w/ clamping */ inst->DstReg.File = PROGRAM_TEMPORARY; inst->DstReg.Index = colorTemp; @@ -249,7 +249,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) /* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */ inst->Opcode = OPCODE_LRP; inst->DstReg.File = PROGRAM_OUTPUT; - inst->DstReg.Index = FRAG_RESULT_COLR; + inst->DstReg.Index = FRAG_RESULT_COLOR; inst->DstReg.WriteMask = WRITEMASK_XYZ; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; @@ -264,7 +264,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) /* MOV result.color.w, colorTemp.x; # copy alpha */ inst->Opcode = OPCODE_MOV; inst->DstReg.File = PROGRAM_OUTPUT; - inst->DstReg.Index = FRAG_RESULT_COLR; + inst->DstReg.Index = FRAG_RESULT_COLOR; inst->DstReg.WriteMask = WRITEMASK_W; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = colorTemp; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 5e2ce0ce3a..ee24e2e138 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -450,8 +450,8 @@ _slang_output_index(const char *name, GLenum target) { NULL, 0 } }; static const struct output_info fragOutputs[] = { - { "gl_FragColor", FRAG_RESULT_COLR }, - { "gl_FragDepth", FRAG_RESULT_DEPR }, + { "gl_FragColor", FRAG_RESULT_COLOR }, + { "gl_FragDepth", FRAG_RESULT_DEPTH }, { "gl_FragData", FRAG_RESULT_DATA0 }, { NULL, 0 } }; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index bcabe71bfa..f98434892b 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -686,7 +686,7 @@ _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_COLR))) && + if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) && (outputsWritten >= (1 << FRAG_RESULT_DATA0))) { link_error(shProg, "Fragment program cannot write both gl_FragColor" " and gl_FragData[].\n"); diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index ce872458e3..05b69c9d00 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -212,7 +212,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) inst[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0); - fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR); + fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLOR); fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ if (key->scaleAndBias) { @@ -400,7 +400,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) { struct prog_instruction *last = &inst[ic - 1]; last->DstReg.File = PROGRAM_OUTPUT; - last->DstReg.Index = FRAG_RESULT_COLR; + last->DstReg.Index = FRAG_RESULT_COLOR; } /* END; */ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c73d0080ca..cc7a9e7890 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog) if (inst[0].Opcode == OPCODE_MOV && inst[1].Opcode == OPCODE_END && inst[0].DstReg.File == PROGRAM_OUTPUT && - inst[0].DstReg.Index == FRAG_RESULT_COLR && + inst[0].DstReg.Index == FRAG_RESULT_COLOR && inst[0].DstReg.WriteMask == WRITEMASK_XYZW && inst[0].SrcReg[0].File == PROGRAM_INPUT && inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 && @@ -158,7 +158,7 @@ combined_drawpix_fragment_program(GLcontext *ctx) /** * Create fragment shader that does a TEX() instruction to get a Z - * value, then writes to FRAG_RESULT_DEPR. + * value, then writes to FRAG_RESULT_DEPTH. * Pass fragment color through as-is. */ static struct st_fragment_program * @@ -191,7 +191,7 @@ make_fragment_shader_z(struct st_context *st) /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */ p->Instructions[ic].Opcode = OPCODE_TEX; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPR; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; @@ -202,7 +202,7 @@ make_fragment_shader_z(struct st_context *st) /* MOV result.color, fragment.color */ p->Instructions[ic].Opcode = OPCODE_MOV; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; ic++; @@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st) assert(ic == p->NumInstructions); p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; - p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR); + p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH); p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ st->drawpix.z_shader = (struct st_fragment_program *) p; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index d2535b6a2f..f825204915 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -466,23 +466,23 @@ st_translate_fragment_program(struct st_context *st, GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten; /* if z is written, emit that first */ - if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { + if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION; fs_output_semantic_index[fs_num_outputs] = 0; - outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs; + outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs; fs_num_outputs++; - outputsWritten &= ~(1 << FRAG_RESULT_DEPR); + outputsWritten &= ~(1 << FRAG_RESULT_DEPTH); } /* handle remaning outputs (color) */ for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { if (outputsWritten & (1 << attr)) { switch (attr) { - case FRAG_RESULT_DEPR: + case FRAG_RESULT_DEPTH: /* handled above */ assert(0); break; - case FRAG_RESULT_COLR: + case FRAG_RESULT_COLOR: fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; fs_output_semantic_index[fs_num_outputs] = numColors; outputMapping[attr] = fs_num_outputs; diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 297940adbd..719e6b8296 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx) else { const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current; - if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR))) { + if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) { /* Z comes from fragment program/shader */ swrast->_DeferredTexture = GL_FALSE; } diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index c6601f5593..3735f041d6 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -202,9 +202,9 @@ 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_COLR)) { + if (outputsWritten & (1 << FRAG_RESULT_COLOR)) { COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], - machine->Outputs[FRAG_RESULT_COLR]); + machine->Outputs[FRAG_RESULT_COLOR]); } else { /* Multiple drawbuffers / render targets @@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) } /* Store result depth/z */ - if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { - const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2]; + if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { + const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2]; if (depth <= 0.0) span->array->z[i] = 0; else if (depth >= 1.0) @@ -259,12 +259,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span ) run_program(ctx, span, 0, span->end); - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) { + if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) { span->interpMask &= ~SPAN_RGBA; span->arrayMask |= SPAN_RGBA; } - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) { + if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) { span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } -- cgit v1.2.3 From 23682dc6299ff624405eec4ea61fa504d71764c6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Feb 2009 11:56:15 -0700 Subject: mesa: just re-order some parts and update comments in sources.mak --- src/mesa/sources.mak | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 7c710103cd..357661456a 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -308,9 +308,7 @@ COMMON_DRIVER_SOURCES = \ drivers/common/driverfuncs.c - -### All the core C sources - +# Sources for building non-Gallium drivers MESA_SOURCES = \ $(MAIN_SOURCES) \ $(MATH_XFORM_SOURCES) \ @@ -323,12 +321,7 @@ MESA_SOURCES = \ $(ASM_C_SOURCES) \ $(SLANG_SOURCES) -ALL_SOURCES = \ - $(MESA_SOURCES) \ - $(GLAPI_SOURCES) \ - $(MESA_ASM_SOURCES) \ - $(STATETRACKER_SOURCES) - +# Sources for building Gallium drivers MESA_GALLIUM_SOURCES = \ $(MAIN_SOURCES) \ $(MATH_SOURCES) \ @@ -337,6 +330,13 @@ MESA_GALLIUM_SOURCES = \ $(SHADER_SOURCES) \ $(SLANG_SOURCES) +# All the core C sources, for dependency checking +ALL_SOURCES = \ + $(MESA_SOURCES) \ + $(GLAPI_SOURCES) \ + $(MESA_ASM_SOURCES) \ + $(STATETRACKER_SOURCES) + ### Object files -- cgit v1.2.3 From 2b7d39da1f5445e1b0beb3b8b1ef9004e684c600 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 11:20:26 -0800 Subject: r300-gallium: Move maths from r300_state to r300_state_inlines. --- src/gallium/drivers/r300/r300_state.c | 4 ---- src/gallium/drivers/r300/r300_state_inlines.h | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 693f3c1c58..6e64ad2dc3 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -318,10 +318,6 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe, /* XXX */ } -static INLINE int pack_float_16_6x(float f) { - return ((int)(f * 6.0) & 0xffff); -} - /* Create a new rasterizer state based on the CSO rasterizer state. * * This is a very large chunk of state, and covers most of the graphics diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 361443a692..e12540535d 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -28,6 +28,12 @@ #include "r300_reg.h" +/* Some maths. These should probably find their way to u_math, if needed. */ + +static INLINE int pack_float_16_6x(float f) { + return ((int)(f * 6.0) & 0xffff); +} + /* Blend state. */ static INLINE uint32_t r300_translate_blend_function(int blend_func) -- cgit v1.2.3 From 731aa326fff37cdee4867f61c3f7491d0378de7a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 11:21:29 -0800 Subject: r300-gallium: Use rs_state emit for r300_surface, move a few things around. Also a possible fix for non-TCL chipsets and trivial/clear. --- src/gallium/drivers/r300/r300_surface.c | 35 +++++++++++++++------------------ src/gallium/drivers/r300/r300_surface.h | 12 +++++++++++ 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 49e4a96f83..4380bf4b24 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -55,7 +55,12 @@ static void r300_surface_fill(struct pipe_context* pipe, return; }*/ - BEGIN_CS(163 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2)); + 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(143 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -69,7 +74,12 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF); OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0); /* XXX endian */ - OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP); + if (caps->has_tcl) { + OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP); + } else { + OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP | + R300_VAP_TCL_BYPASS); + } OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0); /* XXX magic number not in r300_reg */ OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA); @@ -102,9 +112,6 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_REG(R300_GA_POINT_MINMAX, 0x6 | (0x1800 << R300_GA_POINT_MINMAX_MAX_SHIFT)); /* XXX this big chunk should be refactored into rs_state */ - OUT_CS_REG(R300_GA_LINE_CNTL, 0x00030006); - OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, 0x3BAAAAAB); - OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, 0x00000000); OUT_CS_REG(R300_GA_LINE_S0, 0x00000000); OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000); OUT_CS_REG(R300_GA_ENHANCE, 0x00000002); @@ -117,12 +124,6 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_REG(R300_GA_FOG_SCALE, 0x3DBF1412); OUT_CS_REG(R300_GA_FOG_OFFSET, 0x00000000); OUT_CS_REG(R300_SU_TEX_WRAP, 0x00000000); - OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_SCALE, 0x00000000); - OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_OFFSET, 0x00000000); - OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_SCALE, 0x00000000); - OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_OFFSET, 0x00000000); - OUT_CS_REG(R300_SU_POLY_OFFSET_ENABLE, 0x00000000); - OUT_CS_REG(R300_SU_CULL_MODE, 0x00000000); OUT_CS_REG(R300_SU_DEPTH_SCALE, 0x4B7FFFFF); OUT_CS_REG(R300_SU_DEPTH_OFFSET, 0x00000000); OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C); @@ -190,11 +191,6 @@ static void r300_surface_fill(struct pipe_context* pipe, R300_PS_UCP_MODE_CLIP_AS_TRIFAN); } - /* 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)); - /* XXX */ OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa); @@ -277,9 +273,10 @@ static void r300_surface_fill(struct pipe_context* pipe, } END_CS; - 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); + /* 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)); BEGIN_CS(24); /* Flush colorbuffer and blend caches. */ diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index 442eac2cf2..807aad39e4 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -57,4 +57,16 @@ const struct r300_dsa_state dsa_clear_state = { .stencil_ref_bf = 0x0, }; +const struct r300_rs_state rs_clear_state = { + .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, +}; + #endif /* R300_SURFACE_H */ -- cgit v1.2.3 From ba5f1848291e9b34e99aa54cc2c257c85c17728c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 13:27:28 -0800 Subject: r300-gallium: Fix hardlocks on trivial/clear. I'm so happy I could cry. --- src/gallium/drivers/r300/r300_state_inlines.h | 21 +++++++++++++++++++++ src/gallium/drivers/r300/r300_surface.c | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index e12540535d..630ac3b2fc 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -323,4 +323,25 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format) return 0; } +/* Non-CSO state. (For now.) */ + +static INLINE uint32_t r300_translate_gb_pipes(int pipe_count) +{ + switch (pipe_count) { + case 1: + return R300_GB_TILE_PIPE_COUNT_RV300; + break; + case 2: + return R300_GB_TILE_PIPE_COUNT_R300; + break; + case 3: + return R300_GB_TILE_PIPE_COUNT_R420_3P; + break; + case 4: + return R300_GB_TILE_PIPE_COUNT_R420; + break; + } + return 0; +} + #endif /* R300_STATE_INLINES_H */ diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 4380bf4b24..48f6dfcf86 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -97,7 +97,8 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); OUT_CS_REG(R300_GB_MSPOS1, 0x66666666); /* XXX why doesn't classic Mesa write the number of pipes, too? */ - OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_ENABLE | + OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE | + r300_translate_gb_pipes(caps->num_frag_pipes) | R300_GB_TILE_SIZE_16); OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W); OUT_CS_REG(R300_GB_AA_CONFIG, 0x0); -- cgit v1.2.3 From 0328e838c2803cb730bad04155cb92f070560df0 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 14:01:28 -0800 Subject: r300-gallium: Fix register count. --- src/gallium/drivers/r300/r300_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 48f6dfcf86..d7c624e1f3 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -237,7 +237,7 @@ static void r300_surface_fill(struct pipe_context* pipe, r300_emit_fragment_shader(r300, &r300_passthrough_fragment_shader); } - BEGIN_CS(8 + (caps->has_tcl ? 20 : 2)); + BEGIN_CS(7 + (caps->has_tcl ? 21 : 2)); OUT_CS_REG_SEQ(R300_US_OUT_FMT_0, 4); OUT_CS(R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A); OUT_CS(R300_US_OUT_FMT_UNUSED); -- cgit v1.2.3 From 8b8e954f9e67357b87dac487c838a01fa991d0f1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Feb 2009 14:07:17 -0800 Subject: r300-gallium: Add RADEON_NO_TCL debugging option. Just like R300_NO_TCL, when set, forces HW TCL off. --- 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 9577fd706f..e01a0546b2 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -30,7 +30,7 @@ void r300_parse_chipset(struct r300_capabilities* caps) { /* Reasonable defaults */ - caps->has_tcl = TRUE; + caps->has_tcl = getenv("RADEON_NO_TCL") ? TRUE : FALSE; caps->is_r500 = FALSE; caps->num_vert_fpus = 4; -- cgit v1.2.3 From af8a41e5c7d92cf17c12ce9336a0c3f3e20bd275 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 1 Mar 2009 18:12:05 -0800 Subject: r300-gallium: Split off invariant state. It's kind of like a CSO todo list. :3 --- src/gallium/drivers/r300/Makefile | 1 + src/gallium/drivers/r300/r300_state_invariant.c | 54 +++++++++++++++++++++++++ src/gallium/drivers/r300/r300_state_invariant.h | 33 +++++++++++++++ src/gallium/drivers/r300/r300_surface.c | 17 ++------ 4 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_state_invariant.c create mode 100644 src/gallium/drivers/r300/r300_state_invariant.h (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index 9b7524b523..a0fd17bd59 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -12,6 +12,7 @@ C_SOURCES = \ r300_screen.c \ r300_state.c \ r300_state_derived.c \ + r300_state_invariant.c \ r300_state_shader.c \ r300_surface.c \ r300_swtcl_emit.c \ diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c new file mode 100644 index 0000000000..7fd7aefeb7 --- /dev/null +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -0,0 +1,54 @@ +/* + * Copyright 2009 Joakim Sindholt + * Corbin Simpson + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "r300_state_invariant.h" + +/* Calculate and emit invariant state. This is data that the 3D engine + * will probably want at the beginning of every CS, but it's not currently + * handled by any CSO setup, and in addition it doesn't really change much. + * + * Note that eventually this should be empty, but it's useful for development + * and general unduplication of code. */ +void r300_emit_invariant_state(struct r300_context* r300) +{ + struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; + CS_LOCALS(r300); + + BEGIN_CS(14); + /* Amount of time to wait for vertex fetches in PVS */ + OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xffff); + /* Various GB enables */ + OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE | + R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE); + /* Subpixel multisampling for AA */ + OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); + OUT_CS_REG(R300_GB_MSPOS1, 0x66666666); + /* GB tile config and pipe setup */ + OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE | + r300_translate_gb_pipes(caps->num_frag_pipes)); + /* Source of fog depth */ + OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W); + /* AA enable */ + OUT_CS_REG(R300_GB_AA_CONFIG, 0x0); + END_CS; +} diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h new file mode 100644 index 0000000000..8204bf9588 --- /dev/null +++ b/src/gallium/drivers/r300/r300_state_invariant.h @@ -0,0 +1,33 @@ +/* + * 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_STATE_INVARIANT_H +#define R300_STATE_INVARIANT_H + +#include "r300_context.h" +#include "r300_cs.h" +#include "r300_reg.h" +#include "r300_state_inlines.h" + +void r300_emit_invariant_state(struct r300_context* r300); + +#endif /* R300_STATE_INVARIANT_H */ diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index d7c624e1f3..3b6106a8a1 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -55,12 +55,14 @@ static void r300_surface_fill(struct pipe_context* pipe, return; }*/ + r300_emit_invariant_state(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(143 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2)); + BEGIN_CS(129 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -89,19 +91,6 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_32F(1.0); OUT_CS_32F(1.0); OUT_CS_32F(1.0); - /* XXX is this too long? */ - OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xFFFF); - OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE | - R300_GB_LINE_STUFF_ENABLE | R300_GB_TRIANGLE_STUFF_ENABLE); - /* XXX more magic numbers */ - OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); - OUT_CS_REG(R300_GB_MSPOS1, 0x66666666); - /* XXX why doesn't classic Mesa write the number of pipes, too? */ - OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE | - r300_translate_gb_pipes(caps->num_frag_pipes) | - R300_GB_TILE_SIZE_16); - OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W); - OUT_CS_REG(R300_GB_AA_CONFIG, 0x0); /* XXX point tex stuffing */ OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1); OUT_CS_32F(0.0); -- cgit v1.2.3 From b70f344e223fc10df8df08a6d82a813505225712 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 1 Mar 2009 18:24:40 -0800 Subject: r300-gallium: Clean up casts and indents. --- src/gallium/drivers/r300/r300_emit.c | 23 ++++++++++++----------- src/gallium/drivers/r300/r300_surface.c | 3 ++- 2 files changed, 14 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 2f9ec2c3be..91fac62cbe 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -40,9 +40,9 @@ void r300_emit_blend_state(struct r300_context* r300, void r300_emit_blend_color_state(struct r300_context* r300, struct r300_blend_color_state* bc) { - struct r300_screen* r300screen = - (struct r300_screen*)r300->context.screen; + struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); + if (r300screen->caps->is_r500) { BEGIN_CS(3); OUT_CS_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR, 2); @@ -59,9 +59,9 @@ void r300_emit_blend_color_state(struct r300_context* r300, void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa) { - struct r300_screen* r300screen = - (struct r300_screen*)r300->context.screen; + struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); + BEGIN_CS(r300screen->caps->is_r500 ? 8 : 8); OUT_CS_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function); /* XXX figure out the r300 counterpart for this */ @@ -84,6 +84,7 @@ void r300_emit_fragment_shader(struct r300_context* r300, { CS_LOCALS(r300); int i; + BEGIN_CS(22); OUT_CS_REG(R300_US_CONFIG, MAX2(fs->indirections - 1, 0)); @@ -114,7 +115,8 @@ void r500_emit_fragment_shader(struct r300_context* r300, struct r500_fragment_shader* fs) { CS_LOCALS(r300); - int i = 0; + int i; + BEGIN_CS(9 + (fs->instruction_count * 6)); OUT_CS_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO); OUT_CS_REG(R500_US_PIXSIZE, fs->shader.stack_size); @@ -191,9 +193,9 @@ void r300_emit_fb_state(struct r300_context* r300, void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs) { - struct r300_screen* r300screen = - (struct r300_screen*)r300->context.screen; + struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); + BEGIN_CS(13); OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status); OUT_CS_REG_SEQ(R300_SU_POLY_OFFSET_FRONT_SCALE, 6); @@ -211,8 +213,7 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs) void r300_emit_rs_block_state(struct r300_context* r300, struct r300_rs_block* rs) { - struct r300_screen* r300screen = - (struct r300_screen*)r300->context.screen; + struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); int i; @@ -246,6 +247,7 @@ void r300_emit_scissor_state(struct r300_context* r300, struct r300_scissor_state* scissor) { CS_LOCALS(r300); + BEGIN_CS(3); OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2); OUT_CS(scissor->scissor_top_left); @@ -282,8 +284,7 @@ void r300_emit_vertex_format_state(struct r300_context* r300) /* Emit all dirty state. */ void r300_emit_dirty_state(struct r300_context* r300) { - struct r300_screen* r300screen = - (struct r300_screen*)r300->context.screen; + struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); if (!(r300->dirty_state) && !(r300->dirty_hw)) { diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 3b6106a8a1..288d8dea15 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -33,9 +33,10 @@ static void r300_surface_fill(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); CS_LOCALS(r300); - struct r300_capabilities* caps = ((struct r300_screen*)pipe->screen)->caps; + struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* tex = (struct r300_texture*)dest->texture; int i; + float r, g, b, a; unsigned pixpitch = tex->stride / tex->tex.block.size; r = (float)((color >> 16) & 0xff) / 255.0f; -- cgit v1.2.3