diff options
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r200/r200_context.c')
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r200/r200_context.c | 104 |
1 files changed, 69 insertions, 35 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_context.c b/xc/lib/GL/mesa/src/drv/r200/r200_context.c index 421d61a18..6eb8d2350 100644 --- a/xc/lib/GL/mesa/src/drv/r200/r200_context.c +++ b/xc/lib/GL/mesa/src/drv/r200/r200_context.c @@ -32,6 +32,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <keith@tungstengraphics.com> */ +#include "glheader.h" +#include "api_arrayelt.h" +#include "context.h" +#include "simple_list.h" +#include "imports.h" +#include "matrix.h" +#include "state.h" +#include "extensions.h" +#include "state.h" + +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "array_cache/acache.h" + +#include "tnl/tnl.h" +#include "tnl/t_pipeline.h" #include "r200_context.h" #include "r200_ioctl.h" @@ -44,27 +60,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_vtxfmt.h" #include "r200_maos.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "array_cache/acache.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" - -#include "attrib.h" -#include "api_arrayelt.h" -#include "context.h" -#include "simple_list.h" -#include "mem.h" -#include "matrix.h" -#include "state.h" -#include "extensions.h" -#include "state.h" #if defined(USE_X86_ASM) #include "X86/common_x86_asm.h" #endif -#define R200_DATE "20020827" +#define R200_DATE "20021125" #ifndef R200_DEBUG int R200_DEBUG = (0); @@ -158,17 +158,25 @@ static const GLubyte *r200GetString( GLcontext *ctx, GLenum name ) /* Initialize the extensions supported by this driver. */ -static void r200InitExtensions( GLcontext *ctx ) +static void r200InitExtensions( GLcontext *ctx, r200ScreenPtr r200Screen ) { _mesa_enable_imaging_extensions( ctx ); _mesa_enable_extension( ctx, "GL_ARB_multitexture" ); + if (r200Screen->drmSupportsCubeMaps) + _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" ); _mesa_enable_extension( ctx, "GL_ARB_texture_env_add" ); _mesa_enable_extension( ctx, "GL_ARB_texture_env_combine" ); _mesa_enable_extension( ctx, "GL_ARB_texture_env_dot3" ); + _mesa_enable_extension( ctx, "GL_ARB_texture_mirrored_repeat" ); + _mesa_enable_extension( ctx, "GL_ARB_texture_border_clamp" ); + + _mesa_enable_extension( ctx, "GL_ATI_texture_mirror_once" ); _mesa_enable_extension( ctx, "GL_EXT_blend_logic_op" ); + /*_mesa_enable_extension( ctx, "GL_EXT_fog_coord" );*/ _mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" ); + _mesa_enable_extension( ctx, "GL_EXT_texture_edge_clamp" ); _mesa_enable_extension( ctx, "GL_EXT_texture_env_add" ); _mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" ); _mesa_enable_extension( ctx, "GL_EXT_texture_env_dot3" ); @@ -183,7 +191,6 @@ static void r200InitExtensions( GLcontext *ctx ) _mesa_enable_extension( ctx, "GL_MESA_pack_invert" ); _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" ); _mesa_enable_extension( ctx, "GL_NV_texture_rectangle" ); - } extern const struct gl_pipeline_stage _r200_render_stage; @@ -283,7 +290,7 @@ static void add_debug_flags( const char *debug ) /* Create the device specific context. */ -GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, +GLboolean r200CreateContext( const __GLcontextModes *glVisual, __DRIcontextPrivate *driContextPriv, void *sharedContextPrivate) { @@ -291,9 +298,8 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, r200ScreenPtr r200Screen = (r200ScreenPtr)(sPriv->private); r200ContextPtr rmesa; GLcontext *ctx, *shareCtx; - int i; + int i, memPerUnit; - assert(dpy); assert(glVisual); assert(driContextPriv); assert(r200Screen); @@ -308,7 +314,7 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, shareCtx = ((r200ContextPtr) sharedContextPrivate)->glCtx; else shareCtx = NULL; - rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, rmesa, GL_TRUE); + rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE); if (!rmesa->glCtx) { FREE(rmesa); return GL_FALSE; @@ -316,7 +322,6 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, driContextPriv->driverPrivate = rmesa; /* Init r200 context data */ - rmesa->dri.display = dpy; rmesa->dri.context = driContextPriv; rmesa->dri.screen = sPriv; rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */ @@ -349,19 +354,53 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, * Test for 2 textures * 4 bytes/texel * size * size. */ ctx = rmesa->glCtx; - if (r200Screen->texSize[RADEON_CARD_HEAP] >= 2 * 4 * 2048 * 2048) { + memPerUnit = r200Screen->texSize[RADEON_CARD_HEAP] / 2; + + /* XXX the following code could go into a utility file */ + if (memPerUnit >= 4 * 2048 * 2048) { ctx->Const.MaxTextureLevels = 12; /* 2048x2048 */ } - else if (r200Screen->texSize[RADEON_CARD_HEAP] >= 2 * 4 * 1024 * 1024) { + else if (memPerUnit >= 4 * 1024 * 1024) { ctx->Const.MaxTextureLevels = 11; /* 1024x1024 */ } - else if (r200Screen->texSize[RADEON_CARD_HEAP] >= 2 * 4 * 512 * 512) { + else if (memPerUnit >= 4 * 512 * 512) { ctx->Const.MaxTextureLevels = 10; /* 512x512 */ } else { ctx->Const.MaxTextureLevels = 9; /* 256x256 */ } +#if ENABLE_HW_3D_TEXTURE + if (memPerUnit >= 4 * 256 * 256 * 256) { + ctx->Const.Max3DTextureLevels = 9; /* 256x256x256 */ + } + else if (memPerUnit >= 4 * 64 * 64 * 64) { + ctx->Const.Max3DTextureLevels = 8; /* 128x128x128 */ + } + else if (memPerUnit >= 4 * 32 * 32 * 32) { + ctx->Const.Max3DTextureLevels = 7; /* 64x64x64 */ + } + else { /* 256KBytes */ + ctx->Const.Max3DTextureLevels = 6; /* 32x32x32 */ + } +#endif + + if (memPerUnit >= 4 * 6 * 2048 * 2048) { + ctx->Const.MaxCubeTextureLevels = 12; /* 2048x2048 */ + } + if (memPerUnit >= 4 * 6 * 1024 * 1024) { + ctx->Const.MaxCubeTextureLevels = 11; /* 1024x1024 */ + } + else if (memPerUnit >= 4 * 6 * 512 * 512) { + ctx->Const.MaxCubeTextureLevels = 10; /* 512x512 */ + } + else if (memPerUnit >= 4 * 6 * 256 * 256) { + ctx->Const.MaxCubeTextureLevels = 9; /* 256x256 */ + } + else { /* 393216 bytes */ + ctx->Const.MaxCubeTextureLevels = 8; /* 128x128 */ + } + ctx->Const.MaxTextureUnits = 2; ctx->Const.MaxTextureMaxAnisotropy = 16.0; @@ -378,7 +417,6 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, ctx->Const.MaxLineWidthAA = 10.0; ctx->Const.LineWidthGranularity = 0.0625; - /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); @@ -410,7 +448,7 @@ GLboolean r200CreateContext( Display *dpy, const __GLcontextModes *glVisual, _math_matrix_set_identity( &rmesa->TexGenMatrix[1] ); _math_matrix_set_identity( &rmesa->tmpmat ); - r200InitExtensions( ctx ); + r200InitExtensions( ctx, r200Screen ); r200InitDriverFuncs( ctx ); r200InitIoctlFuncs( ctx ); r200InitStateFuncs( ctx ); @@ -536,19 +574,15 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) void -r200SwapBuffers(Display *dpy, void *drawablePrivate) +r200SwapBuffers( __DRIdrawablePrivate *dPriv ) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; - (void) dpy; - if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { r200ContextPtr rmesa; GLcontext *ctx; rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate; ctx = rmesa->glCtx; if (ctx->Visual.doubleBufferMode) { - _mesa_swapbuffers( ctx ); /* flush pending rendering comands */ - + _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ if ( rmesa->doPageFlip ) { r200PageFlip( dPriv ); } |