head 3.31; access; symbols merge-1:3.29.2.2 autoconf:3.29.0.4 experimental-1:3.29.0.2 mesa-3-1-with-kw3:3.26 mesa-3-1-prior-to-kw3:3.25; locks; strict; comment @ * @; 3.31 date 99.07.12.12.05.24; author keithw; state Exp; branches; next 3.30; 3.30 date 99.06.18.20.03.37; author brianp; state Exp; branches; next 3.29; 3.29 date 99.03.31.20.18.39; author keithw; state Exp; branches 3.29.2.1; next 3.28; 3.28 date 99.03.31.11.15.04; author brianp; state Exp; branches; next 3.27; 3.27 date 99.03.28.20.56.15; author brianp; state Exp; branches; next 3.26; 3.26 date 99.02.25.14.12.31; author keithw; state Exp; branches; next 3.25; 3.25 date 99.02.24.22.48.06; author jens; state Exp; branches; next 3.24; 3.24 date 99.02.17.02.38.23; author brianp; state Exp; branches; next 3.23; 3.23 date 99.02.14.03.46.34; author brianp; state Exp; branches; next 3.22; 3.22 date 99.01.30.04.29.16; author brianp; state Exp; branches; next 3.21; 3.21 date 99.01.22.04.29.29; author brianp; state Exp; branches; next 3.20; 3.20 date 98.11.17.02.51.35; author brianp; state Exp; branches; next 3.19; 3.19 date 98.11.17.01.52.47; author brianp; state Exp; branches; next 3.18; 3.18 date 98.10.23.01.03.47; author brianp; state Exp; branches; next 3.17; 3.17 date 98.10.20.02.27.12; author brianp; state Exp; branches; next 3.16; 3.16 date 98.10.05.00.40.15; author brianp; state Exp; branches; next 3.15; 3.15 date 98.10.03.13.16.44; author brianp; state Exp; branches; next 3.14; 3.14 date 98.09.18.02.32.02; author brianp; state Exp; branches; next 3.13; 3.13 date 98.07.18.03.33.53; author brianp; state Exp; branches; next 3.12; 3.12 date 98.06.19.02.37.58; author brianp; state Exp; branches; next 3.11; 3.11 date 98.06.07.22.18.52; author brianp; state Exp; branches; next 3.10; 3.10 date 98.04.22.00.52.42; author brianp; state Exp; branches; next 3.9; 3.9 date 98.04.14.00.02.10; author brianp; state Exp; branches; next 3.8; 3.8 date 98.03.27.04.39.44; author brianp; state Exp; branches; next 3.7; 3.7 date 98.03.19.02.04.22; author brianp; state Exp; branches; next 3.6; 3.6 date 98.03.15.18.50.25; author brianp; state Exp; branches; next 3.5; 3.5 date 98.03.15.18.32.12; author brianp; state Exp; branches; next 3.4; 3.4 date 98.02.20.04.50.44; author brianp; state Exp; branches; next 3.3; 3.3 date 98.02.01.16.37.19; author brianp; state Exp; branches; next 3.2; 3.2 date 98.02.01.15.23.52; author brianp; state Exp; branches; next 3.1; 3.1 date 98.01.31.23.58.19; author brianp; state Exp; branches; next 3.0; 3.0 date 98.01.31.20.59.27; author brianp; state Exp; branches; next ; 3.29.2.1 date 99.05.21.21.29.26; author keithw; state Exp; branches; next 3.29.2.2; 3.29.2.2 date 99.06.19.15.04.14; author keithw; state Exp; branches; next ; desc @miscellaneous functions @ 3.31 log @merge from experimental branch upto merge-1 tag @ text @/* $Id: misc.c,v 3.30 1999/06/18 20:03:37 brianp Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 * * Copyright (C) 1999 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifdef PC_HEADER #include "all.h" #else #include #include #include #include "accum.h" #include "alphabuf.h" #include "context.h" #include "depth.h" #include "enums.h" #include "extensions.h" #include "macros.h" #include "masking.h" #include "misc.h" #include "stencil.h" #include "types.h" #ifdef XFree86Server #undef MISC_H #include "GL/xf86glx.h" #endif #endif void gl_ClearIndex( GLcontext *ctx, GLfloat c ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex"); ctx->Color.ClearIndex = (GLuint) c; if (!ctx->Visual->RGBAflag) { /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); } } void gl_ClearColor( GLcontext *ctx, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearColor"); ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F ); ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F ); ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F ); ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F ); if (ctx->Visual->RGBAflag) { GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F); (*ctx->Driver.ClearColor)( ctx, r, g, b, a ); } } /* * Clear the color buffer when glColorMask or glIndexMask is in effect. */ static void clear_color_buffer_with_masking( GLcontext *ctx ) { GLint x, y, height, width; /* Compute region to clear */ if (ctx->Scissor.Enabled) { x = ctx->Buffer->Xmin; y = ctx->Buffer->Ymin; height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; } else { x = 0; y = 0; height = ctx->Buffer->Height; width = ctx->Buffer->Width; } if (ctx->Visual->RGBAflag) { /* RGBA mode */ GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F); GLint i; for (i=0;iDriver.WriteRGBASpan)( ctx, width, x, y, (const GLubyte (*)[4])rgba, NULL ); } } else { /* Color index mode */ GLuint indx[MAX_WIDTH]; GLubyte mask[MAX_WIDTH]; GLint i, j; MEMSET( mask, 1, width ); for (i=0;iColor.ClearIndex; } gl_mask_index_span( ctx, width, x, y, indx ); (*ctx->Driver.WriteCI32Span)( ctx, width, x, y, indx, mask ); } } } /* * Clear the front and/or back color buffers. Also clear the alpha * buffer(s) if present. */ static void clear_color_buffers( GLcontext *ctx ) { if (ctx->RasterMask & MULTI_DRAW_BIT) { GLuint bufferBit; if (ctx->Color.DrawBuffer == GL_NONE) return; /* loop over four possible dest color buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { if (bufferBit & ctx->Color.DrawDestMask) { if (bufferBit == FRONT_LEFT_BIT) { (*ctx->Driver.SetBuffer)( ctx, GL_FRONT_LEFT); ctx->Buffer->Alpha = ctx->Buffer->FrontLeftAlpha; } else if (bufferBit == FRONT_RIGHT_BIT) { (*ctx->Driver.SetBuffer)( ctx, GL_FRONT_RIGHT); ctx->Buffer->Alpha = ctx->Buffer->FrontRightAlpha; } else if (bufferBit == BACK_LEFT_BIT) { (*ctx->Driver.SetBuffer)( ctx, GL_BACK_LEFT); ctx->Buffer->Alpha = ctx->Buffer->BackLeftAlpha; } else { (*ctx->Driver.SetBuffer)( ctx, GL_BACK_RIGHT); ctx->Buffer->Alpha = ctx->Buffer->BackRightAlpha; } if (ctx->Color.SWmasking) { clear_color_buffer_with_masking( ctx ); } else { GLint x = ctx->Buffer->Xmin; GLint y = ctx->Buffer->Ymin; GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; (void) (*ctx->Driver.Clear)( ctx, GL_COLOR_BUFFER_BIT, !ctx->Scissor.Enabled, x, y, width, height ); } } } /* restore default dest buffer */ (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DriverDrawBuffer ); } else { /* normal case: clear exactly one color buffer */ if (ctx->Color.SWmasking) { clear_color_buffer_with_masking( ctx ); } else { GLint x = ctx->Buffer->Xmin; GLint y = ctx->Buffer->Ymin; GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; (void) (*ctx->Driver.Clear)( ctx, GL_COLOR_BUFFER_BIT, !ctx->Scissor.Enabled, x, y, width, height ); } } } void gl_Clear( GLcontext *ctx, GLbitfield mask ) { #ifdef PROFILE GLdouble t0 = gl_time(); #endif ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClear"); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glClear 0x%x\n", mask); if (ctx->RenderMode==GL_RENDER) { GLint x, y, width, height; GLbitfield newMask; if (ctx->NewState) { gl_update_state( ctx ); } x = ctx->Buffer->Xmin; y = ctx->Buffer->Ymin; height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; /* clear software alpha buffer(s) */ if ( (mask & GL_COLOR_BUFFER_BIT) && (ctx->RasterMask & ALPHABUF_BIT) ) { gl_clear_alpha_buffers( ctx ); } /* let device driver try to clear the buffers */ if ((mask & GL_COLOR_BUFFER_BIT) != 0 && (ctx->Color.SWmasking || (ctx->RasterMask & MULTI_DRAW_BIT))) { /* Driver can't clear color buffer for some reason, let it try * to clear the other ancillary buffers. */ GLbitfield mask2 = mask & (~GL_COLOR_BUFFER_BIT); newMask = (*ctx->Driver.Clear)( ctx, mask2, !ctx->Scissor.Enabled, x, y, width, height ); newMask |= GL_COLOR_BUFFER_BIT; } else { newMask = (*ctx->Driver.Clear)( ctx, mask, !ctx->Scissor.Enabled, x, y, width, height ); } if (newMask & GL_COLOR_BUFFER_BIT) clear_color_buffers( ctx ); if (newMask & GL_DEPTH_BUFFER_BIT) gl_clear_depth_buffer( ctx ); if (newMask & GL_ACCUM_BUFFER_BIT) gl_clear_accum_buffer( ctx ); if (newMask & GL_STENCIL_BUFFER_BIT) gl_clear_stencil_buffer( ctx ); #ifdef PROFILE ctx->ClearTime += gl_time() - t0; ctx->ClearCount++; #endif } } const GLubyte *gl_GetString( GLcontext *ctx, GLenum name ) { static char result[1000]; static char *vendor = "Brian Paul"; static char *version = "1.2 Mesa 3.1 beta"; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0); /* First see if device driver can satisfy this call */ switch (name) { case GL_VENDOR: case GL_RENDERER: case GL_VERSION: if (ctx->Driver.GetString) { const GLubyte *str = (*ctx->Driver.GetString)(ctx, name); if (str && str[0]) return str; } break; /* Extensions always handled by extensions.c */ case GL_EXTENSIONS: return (GLubyte *) gl_extensions_get_string( ctx ); default: gl_error( ctx, GL_INVALID_ENUM, "glGetString" ); return (GLubyte *) 0; } /* If we get here, device driver didn't return a string */ switch (name) { case GL_VENDOR: return (GLubyte *) vendor; case GL_RENDERER: strcpy(result, "Mesa"); if (ctx->Driver.RendererString) { strcat(result, " "); strcat(result, (*ctx->Driver.RendererString)()); } return (GLubyte *) result; case GL_VERSION: return (GLubyte *) version; default: /* caught above */ return NULL; } } void gl_Finish( GLcontext *ctx ) { /* Don't compile into display list */ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFinish"); if (ctx->Driver.Finish) { (*ctx->Driver.Finish)( ctx ); } } void gl_Flush( GLcontext *ctx ) { /* Don't compile into display list */ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFlush"); if (ctx->Driver.Flush) { (*ctx->Driver.Flush)( ctx ); } } GLboolean gl_Hint( GLcontext *ctx, GLenum target, GLenum mode ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glHint", GL_FALSE); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode); switch (target) { case GL_FOG_HINT: ctx->Hint.Fog = mode; break; case GL_LINE_SMOOTH_HINT: ctx->Hint.LineSmooth = mode; break; case GL_PERSPECTIVE_CORRECTION_HINT: ctx->Hint.PerspectiveCorrection = mode; break; case GL_POINT_SMOOTH_HINT: ctx->Hint.PointSmooth = mode; break; case GL_POLYGON_SMOOTH_HINT: ctx->Hint.PolygonSmooth = mode; break; case GL_PREFER_DOUBLEBUFFER_HINT_PGI: case GL_STRICT_DEPTHFUNC_HINT_PGI: break; case GL_STRICT_LIGHTING_HINT_PGI: ctx->Hint.StrictLighting = mode; break; case GL_STRICT_SCISSOR_HINT_PGI: case GL_FULL_STIPPLE_HINT_PGI: case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI: case GL_NATIVE_GRAPHICS_END_HINT_PGI: case GL_CONSERVE_MEMORY_HINT_PGI: case GL_RECLAIM_MEMORY_HINT_PGI: break; case GL_ALWAYS_FAST_HINT_PGI: if (mode) { ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawSpn = GL_FALSE; ctx->Hint.AllowDrawMem = GL_FALSE; } else { ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawSpn = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; } break; case GL_ALWAYS_SOFT_HINT_PGI: ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawSpn = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: break; case GL_ALLOW_DRAW_WIN_HINT_PGI: ctx->Hint.AllowDrawWin = mode; break; case GL_ALLOW_DRAW_SPN_HINT_PGI: ctx->Hint.AllowDrawSpn = mode; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: ctx->Hint.AllowDrawMem = mode; break; case GL_CLIP_NEAR_HINT_PGI: case GL_CLIP_FAR_HINT_PGI: case GL_WIDE_LINE_HINT_PGI: case GL_BACK_NORMALS_HINT_PGI: case GL_NATIVE_GRAPHICS_HANDLE_PGI: break; /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: ctx->Hint.ClipVolumeClipping = mode; break; default: gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" ); return GL_FALSE; } ctx->NewState |= NEW_ALL; /* just to be safe */ if (ctx->Driver.Hint) { (*ctx->Driver.Hint)( ctx, target, mode ); } return GL_TRUE; } void gl_DrawBuffer( GLcontext *ctx, GLenum mode ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawBuffer"); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode)); switch (mode) { case GL_AUX0: case GL_AUX1: case GL_AUX2: case GL_AUX3: /* AUX buffers not implemented in Mesa at this time */ gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; case GL_RIGHT: if (!ctx->Visual->StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } if (ctx->Visual->DBflag) ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT; else ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; break; case GL_FRONT_RIGHT: if (!ctx->Visual->StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; break; case GL_BACK_RIGHT: if (!ctx->Visual->StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } if (!ctx->Visual->DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawDestMask = BACK_RIGHT_BIT; break; case GL_BACK_LEFT: if (!ctx->Visual->DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawDestMask = BACK_LEFT_BIT; break; case GL_FRONT_AND_BACK: if (!ctx->Visual->DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } if (ctx->Visual->StereoFlag) ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT | FRONT_RIGHT_BIT | BACK_RIGHT_BIT; else ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; break; case GL_BACK: if (!ctx->Visual->DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } if (ctx->Visual->StereoFlag) ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT; else ctx->Color.DrawDestMask = BACK_LEFT_BIT; break; case GL_LEFT: /* never an error */ if (ctx->Visual->DBflag) ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; else ctx->Color.DrawDestMask = FRONT_LEFT_BIT; break; case GL_FRONT_LEFT: /* never an error */ ctx->Color.DrawDestMask = FRONT_LEFT_BIT; break; case GL_FRONT: /* never an error */ if (ctx->Visual->StereoFlag) ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT; else ctx->Color.DrawDestMask = FRONT_LEFT_BIT; break; case GL_NONE: /* never an error */ ctx->Color.DrawDestMask = 0; break; default: gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" ); return; } /* * Make the dest buffer mode more precise if possible */ if (mode == GL_LEFT && !ctx->Visual->DBflag) ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; else if (mode == GL_RIGHT && !ctx->Visual->DBflag) ctx->Color.DriverDrawBuffer = GL_FRONT_RIGHT; else if (mode == GL_FRONT && !ctx->Visual->StereoFlag) ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; else if (mode == GL_BACK && !ctx->Visual->StereoFlag) ctx->Color.DriverDrawBuffer = GL_BACK_LEFT; else ctx->Color.DriverDrawBuffer = mode; /* * Set current alpha buffer pointer */ if (ctx->Visual->SoftwareAlpha) { if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT) ctx->Buffer->Alpha = ctx->Buffer->FrontLeftAlpha; else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT) ctx->Buffer->Alpha = ctx->Buffer->BackLeftAlpha; else if (ctx->Color.DriverDrawBuffer == GL_FRONT_RIGHT) ctx->Buffer->Alpha = ctx->Buffer->FrontRightAlpha; else if (ctx->Color.DriverDrawBuffer == GL_BACK_RIGHT) ctx->Buffer->Alpha = ctx->Buffer->BackRightAlpha; } /* * If we get here there can't have been an error. * Now see if device driver can implement the drawing to the target * buffer(s). The driver may not be able to do GL_FRONT_AND_BACK mode * for example. We'll take care of that in the core code by looping * over the individual buffers. */ ASSERT(ctx->Driver.SetBuffer); if ( (*ctx->Driver.SetBuffer)(ctx, ctx->Color.DriverDrawBuffer) ) { /* All OK, the driver will do all buffer writes */ ctx->Color.MultiDrawBuffer = GL_FALSE; } else { /* We'll have to loop over the multiple draw buffer targets */ ctx->Color.MultiDrawBuffer = GL_TRUE; /* Set drawing buffer to front for now */ (*ctx->Driver.SetBuffer)(ctx, GL_FRONT_LEFT); } ctx->Color.DrawBuffer = mode; ctx->NewState |= NEW_RASTER_OPS; } void gl_ReadBuffer( GLcontext *ctx, GLenum mode ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glReadBuffer"); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode)); switch (mode) { case GL_AUX0: case GL_AUX1: case GL_AUX2: case GL_AUX3: /* AUX buffers not implemented in Mesa at this time */ gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; case GL_LEFT: case GL_FRONT: case GL_FRONT_LEFT: /* Front-Left buffer, always exists */ ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT; break; case GL_BACK: case GL_BACK_LEFT: /* Back-Left buffer, requires double buffering */ if (!ctx->Visual->DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } ctx->Pixel.DriverReadBuffer = GL_BACK_LEFT; break; case GL_FRONT_RIGHT: case GL_RIGHT: if (!ctx->Visual->StereoFlag) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } ctx->Pixel.DriverReadBuffer = GL_FRONT_RIGHT; break; case GL_BACK_RIGHT: if (!ctx->Visual->StereoFlag || !ctx->Visual->DBflag) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } ctx->Pixel.DriverReadBuffer = GL_BACK_RIGHT; break; default: gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); return; } ctx->Pixel.ReadBuffer = mode; ctx->NewState |= NEW_RASTER_OPS; } @ 3.30 log @changed hint mode to GLenum @ text @d1 1 a1 1 /* $Id: misc.c,v 3.29 1999/03/31 20:18:39 keithw Exp $ */ d33 1 d38 1 d125 2 a126 1 (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y, rgba, NULL ); d226 3 d280 1 a280 3 static char *vendor = "Brian Paul\n" "\tMesa CVA Extension (C) 1999 Keith Whitwell"; d353 4 d445 3 d595 3 @ 3.29 log @Compiled vertex arrays @ text @d1 1 a1 1 /* $Id: misc.c,v 3.28 1999/03/31 11:15:04 brianp Exp $ */ d346 1 a346 1 GLboolean gl_Hint( GLcontext *ctx, GLenum target, GLint mode ) @ 3.29.2.1 log @Quake3 inspired optimizations @ text @d1 1 a1 1 /* $Id: misc.c,v 3.29 1999/03/31 20:18:39 keithw Exp $ */ a32 1 #include a36 1 #include "enums.h" d123 1 a123 2 (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y, (const GLubyte (*)[4])rgba, NULL ); a222 3 if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glClear 0x%x\n", mask); a348 4 if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode); a436 3 if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode)); a583 3 if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode)); @ 3.29.2.2 log @Removed SGIS multitexture, added FX/X86 assm directory @ text @d1 1 a1 1 /* $Id: misc.c,v 3.29.2.1 1999/05/21 21:29:26 keithw Exp $ */ d280 3 a282 1 static char *vendor = "Brian Paul"; @ 3.28 log @fixed bug in gl_DrawBuffer @ text @d1 1 a1 1 /* $Id: misc.c,v 3.27 1999/03/28 20:56:15 brianp Exp $ */ a27 1 d37 1 d274 3 a276 1 static char *vendor = "Brian Paul"; a277 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_stencil_wrap GL_INGR_blend_func_separate GL_ARB_multitexture GL_NV_texgen_reflection"; a285 1 case GL_EXTENSIONS: d292 3 a312 9 case GL_EXTENSIONS: if (ctx->Driver.ExtensionString) { /* driver specifies the extensions */ return (const GLubyte *) (*ctx->Driver.ExtensionString)(ctx); } else { /* return default extensions */ return (const GLubyte *) extensions; } d343 4 a346 1 void gl_Hint( GLcontext *ctx, GLenum target, GLenum mode ) d348 1 a348 5 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHint"); if (mode!=GL_DONT_CARE && mode!=GL_FASTEST && mode!=GL_NICEST) { gl_error( ctx, GL_INVALID_ENUM, "glHint(mode)" ); return; } d350 70 a419 18 case GL_FOG_HINT: ctx->Hint.Fog = mode; break; case GL_LINE_SMOOTH_HINT: ctx->Hint.LineSmooth = mode; break; case GL_PERSPECTIVE_CORRECTION_HINT: ctx->Hint.PerspectiveCorrection = mode; break; case GL_POINT_SMOOTH_HINT: ctx->Hint.PointSmooth = mode; break; case GL_POLYGON_SMOOTH_HINT: ctx->Hint.PolygonSmooth = mode; break; default: gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" ); return; d426 2 d430 1 @ 3.27 log @better handling of multi draw buffers, software alpha buffers @ text @d1 1 a1 1 /* $Id: misc.c,v 3.26 1999/02/25 14:12:31 keithw Exp $ */ a518 1 ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; /* default buffer */ d524 1 a524 1 (*ctx->Driver.SetBuffer)(ctx, GL_FRONT); @ 3.26 log @Merged in kw3 patch @ text @d1 1 a1 1 /* $Id: misc.c,v 3.25 1999/02/24 22:48:06 jens Exp $ */ a123 3 if (ctx->RasterMask & ALPHABUF_BIT) { gl_write_alpha_span( ctx, width, x, y, rgba, NULL ); } d150 44 a193 2 if (ctx->Color.SWmasking) { clear_color_buffer_with_masking( ctx ); d196 1 a196 12 GLint x = ctx->Buffer->Xmin; GLint y = ctx->Buffer->Ymin; GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; (void) (*ctx->Driver.Clear)( ctx, GL_COLOR_BUFFER_BIT, !ctx->Scissor.Enabled, x, y, width, height ); if (ctx->RasterMask & ALPHABUF_BIT) { /* front and/or back alpha buffers will be cleared here */ gl_clear_alpha_buffers( ctx ); } } a197 3 if (ctx->RasterMask & FRONT_AND_BACK_BIT) { /*** Also clear the back buffer ***/ (*ctx->Driver.SetBuffer)( ctx, GL_BACK ); a209 1 (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ); d236 5 d242 5 a246 2 if ((mask & GL_COLOR_BUFFER_BIT) != 0 && ctx->Color.SWmasking) { /* driver can't clear color buffer with color/index masking */ d249 1 a249 1 x, y, width, height ); a256 18 /* check if only clearing of alpha buffer needed */ if ( (mask & GL_COLOR_BUFFER_BIT) && (!(newMask & GL_COLOR_BUFFER_BIT)) && (ctx->RasterMask & ALPHABUF_BIT) ) { gl_clear_alpha_buffers( ctx ); } if ((mask & GL_COLOR_BUFFER_BIT) && ctx->RasterMask & FRONT_AND_BACK_BIT) { /*** Also clear the back color buffer ***/ (*ctx->Driver.SetBuffer)( ctx, GL_BACK ); (void) (*ctx->Driver.Clear)( ctx, GL_COLOR_BUFFER_BIT, !ctx->Scissor.Enabled, x, y, width, height ); (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ); } d388 1 a389 82 case GL_FRONT_AND_BACK: if ( (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ) == GL_FALSE ) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha; ctx->NewState |= NEW_RASTER_OPS; break; case GL_FRONT: case GL_FRONT_LEFT: case GL_FRONT_RIGHT: if ( (*ctx->Driver.SetBuffer)( ctx, mode ) == GL_FALSE ) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha; ctx->NewState |= NEW_RASTER_OPS; break; case GL_BACK: case GL_BACK_LEFT: case GL_BACK_RIGHT: if ( (*ctx->Driver.SetBuffer)( ctx, mode ) == GL_FALSE) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->BackAlpha; ctx->NewState |= NEW_RASTER_OPS; break; case GL_LEFT: switch (ctx->Color.DrawBuffer) { case GL_BACK: case GL_BACK_LEFT: case GL_BACK_RIGHT: mode = GL_BACK_LEFT; break; case GL_FRONT: case GL_FRONT_LEFT: case GL_FRONT_RIGHT: mode = GL_FRONT_LEFT; break; default: gl_problem( ctx, "default case in gl_DrawBuffer(GL_LEFT)"); } if ( (*ctx->Driver.SetBuffer)( ctx, mode ) == GL_FALSE) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->BackAlpha; ctx->NewState |= NEW_RASTER_OPS; break; case GL_RIGHT: switch (ctx->Color.DrawBuffer) { case GL_BACK: case GL_BACK_LEFT: case GL_BACK_RIGHT: mode = GL_BACK_RIGHT; break; case GL_FRONT: case GL_FRONT_LEFT: case GL_FRONT_RIGHT: mode = GL_FRONT_RIGHT; break; default: gl_problem( ctx, "default case in gl_DrawBuffer(GL_RIGHT)"); } if ( (*ctx->Driver.SetBuffer)( ctx, mode ) == GL_FALSE) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->BackAlpha; ctx->NewState |= NEW_RASTER_OPS; break; case GL_NONE: ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = NULL; ctx->NewState |= NEW_RASTER_OPS; break; d394 1 d396 78 d477 1 d479 51 d537 1 d539 8 d549 7 a555 1 if ( (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ) == GL_FALSE) { d559 1 a559 3 ctx->Pixel.ReadBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha; ctx->NewState |= NEW_RASTER_OPS; d561 3 a563 3 case GL_BACK: case GL_BACK_LEFT: if ( (*ctx->Driver.SetBuffer)( ctx, GL_BACK ) == GL_FALSE) { d567 1 a567 3 ctx->Pixel.ReadBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->BackAlpha; ctx->NewState |= NEW_RASTER_OPS; a568 1 case GL_FRONT_RIGHT: d570 5 a574 7 case GL_LEFT: case GL_RIGHT: case GL_AUX0: case GL_AUX1: case GL_AUX2: case GL_AUX3: gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); d578 1 d581 2 a582 2 /* Remember, the draw buffer is the default state */ (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DrawBuffer ); @ 3.25 log @Added header file to get XMesa to compile standalone and inside XFree86 @ text @d1 1 a1 1 /* $Id: misc.c,v 3.24 1999/02/17 02:38:23 brianp Exp $ */ a27 79 /* * $Log: misc.c,v $ * Revision 3.24 1999/02/17 02:38:23 brianp * fixed bug when clearing color buffer with RGBA or index masking * * Revision 3.23 1999/02/14 03:46:34 brianp * new copyright * * Revision 3.22 1999/01/30 04:29:16 brianp * stereo updates (KendallB@@scitechsoft.com) * * Revision 3.21 1999/01/22 04:29:29 brianp * hooked in new GetString() device driver function * * Revision 3.20 1998/11/17 02:51:35 brianp * added a bunch of new device driver functions (Keith Harrison) * * Revision 3.19 1998/11/17 01:52:47 brianp * implemented GL_NV_texgen_reflection extension (MJK) * * Revision 3.18 1998/10/23 01:03:47 brianp * added GL_ARB_multitexture extension * * Revision 3.17 1998/10/20 02:27:12 brianp * removed GL_EXT_multitexture extension * * Revision 3.16 1998/10/05 00:40:15 brianp * added GL_INGR_blend_func_separate extension * * Revision 3.15 1998/10/03 13:16:44 brianp * implemented GL_EXT_stencil_wrap * * Revision 3.14 1998/09/18 02:32:02 brianp * fixed alpha clear problem reported by Sam Jordan * * Revision 3.13 1998/07/18 03:33:53 brianp * glRead/DrawBuffer() generated GL_INVALID_ENUM instead of GL_INVALID_OPERATION * * Revision 3.12 1998/06/19 02:37:58 brianp * fixed an error code in glReadBuffer() * * Revision 3.11 1998/06/07 22:18:52 brianp * implemented GL_EXT_multitexture extension * * Revision 3.10 1998/04/22 00:52:42 brianp * added GLcontext parameter to driver ExtensionString() * * Revision 3.9 1998/04/14 00:02:10 brianp * fixed bug in which whole buffer might be cleared instead of scissor rect * * Revision 3.8 1998/03/27 04:39:44 brianp * Driver.ExtensionString() must now return complete extension list * * Revision 3.7 1998/03/19 02:04:22 brianp * added GL_SGIS_texture_edge_clamp * * Revision 3.6 1998/03/15 18:50:25 brianp * added GL_EXT_abgr extension * * Revision 3.5 1998/03/15 18:32:12 brianp * applied DavidB's patches for v0.23 of fxmesa driver * * Revision 3.4 1998/02/20 04:50:44 brianp * implemented GL_SGIS_multitexture * * Revision 3.3 1998/02/01 16:37:19 brianp * added GL_EXT_rescale_normal extension * * Revision 3.2 1998/02/01 15:23:52 brianp * added ExtensionString() function to device driver * * Revision 3.1 1998/01/31 23:58:19 brianp * new gl_Clear: removed ClearDepthBuffer and ClearColorAndDepth functions * * Revision 3.0 1998/01/31 20:59:27 brianp * initial rev * */ d53 1 a53 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glClearIndex" ); return; } d66 1 a66 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glClearColor" ); return; } d197 1 a197 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glClear" ); return; } d264 1 a264 5 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glGetString" ); return (GLubyte *) 0; } d316 1 a316 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glFinish" ); return; } d327 1 a327 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glFlush" ); return; } d337 1 a337 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glHint" ); return; } d373 1 a373 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } d472 1 a472 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } @ 3.24 log @fixed bug when clearing color buffer with RGBA or index masking @ text @d1 1 a1 1 /* $Id: misc.c,v 3.23 1999/02/14 03:46:34 brianp Exp brianp $ */ d30 3 d122 4 @ 3.23 log @new copyright @ text @d1 1 a1 1 /* $Id: misc.c,v 3.22 1999/01/30 04:29:16 brianp Exp brianp $ */ d30 3 d294 4 a297 1 newMask = (*ctx->Driver.Clear)( ctx, mask, !ctx->Scissor.Enabled, d299 6 @ 3.22 log @stereo updates (KendallB@@scitechsoft.com) @ text @d1 1 a1 1 /* $Id: misc.c,v 3.21 1999/01/22 04:29:29 brianp Exp brianp $ */ d6 19 a24 15 * Copyright (C) 1995-1999 Brian Paul * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. d30 3 @ 3.21 log @hooked in new GetString() device driver function @ text @d1 1 a1 1 /* $Id: misc.c,v 3.20 1998/11/17 02:51:35 brianp Exp brianp $ */ d26 3 d372 2 a373 1 ; /* caught above */ d453 9 d464 7 a470 7 case GL_FRONT_AND_BACK: if ( (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ) == GL_FALSE ) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha; d472 1 a472 1 break; d475 23 a497 3 if ( (*ctx->Driver.SetBuffer)( ctx, GL_BACK ) == GL_FALSE) { gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; d499 29 a527 2 ctx->Color.DrawBuffer = mode; ctx->Buffer->Alpha = ctx->Buffer->BackAlpha; d529 1 a529 1 break; a534 4 case GL_FRONT_RIGHT: case GL_BACK_RIGHT: case GL_LEFT: case GL_RIGHT: @ 3.20 log @added a bunch of new device driver functions (Keith Harrison) @ text @d1 1 a1 1 /* $Id: misc.c,v 3.19 1998/11/17 01:52:47 brianp Exp brianp $ */ d6 1 a6 1 * Copyright (C) 1995-1998 Brian Paul d26 3 d328 19 d369 1 a369 2 gl_error( ctx, GL_INVALID_ENUM, "glGetString" ); return (GLubyte *) 0; @ 3.19 log @implemented GL_NV_texgen_reflection extension (MJK) @ text @d1 1 a1 1 /* $Id: misc.c,v 3.18 1998/10/23 01:03:47 brianp Exp brianp $ */ d26 3 d410 1 d413 4 @ 3.18 log @added GL_ARB_multitexture extension @ text @d1 1 a1 1 /* $Id: misc.c,v 3.17 1998/10/20 02:27:12 brianp Exp brianp $ */ d26 3 d315 1 a315 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_stencil_wrap GL_INGR_blend_func_separate GL_ARB_multitexture"; @ 3.17 log @removed GL_EXT_multitexture extension @ text @d1 1 a1 1 /* $Id: misc.c,v 3.16 1998/10/05 00:40:15 brianp Exp brianp $ */ d26 3 d312 1 a312 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_stencil_wrap GL_INGR_blend_func_separate"; @ 3.16 log @added GL_INGR_blend_func_separate extension @ text @d1 1 a1 1 /* $Id: misc.c,v 3.15 1998/10/03 13:16:44 brianp Exp brianp $ */ d26 3 d309 1 a309 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_multitexture GL_EXT_stencil_wrap GL_INGR_blend_func_separate"; @ 3.15 log @implemented GL_EXT_stencil_wrap @ text @d1 1 a1 1 /* $Id: misc.c,v 3.14 1998/09/18 02:32:02 brianp Exp brianp $ */ d5 1 a5 1 * Version: 3.0 d26 3 d306 1 a306 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_multitexture GL_EXT_stencil_wrap"; @ 3.14 log @fixed alpha clear problem reported by Sam Jordan @ text @d1 1 a1 1 /* $Id: misc.c,v 3.13 1998/07/18 03:33:53 brianp Exp brianp $ */ d26 3 d302 2 a303 2 static char *version = "1.2 Mesa 3.0"; static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture GL_EXT_multitexture"; @ 3.13 log @glRead/DrawBuffer() generated GL_INVALID_ENUM instead of GL_INVALID_OPERATION @ text @d1 1 a1 1 /* $Id: misc.c,v 3.12 1998/06/19 02:37:58 brianp Exp brianp $ */ d26 3 d262 8 @ 3.12 log @fixed an error code in glReadBuffer() @ text @d1 1 a1 1 /* $Id: misc.c,v 3.11 1998/06/07 22:18:52 brianp Exp brianp $ */ d26 3 d398 1 a398 1 gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" ); d408 1 a408 1 gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" ); d425 3 d447 1 a447 1 gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); d457 1 a457 1 gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); d469 4 a472 1 gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); @ 3.11 log @implemented GL_EXT_multitexture extension @ text @d1 1 a1 1 /* $Id: misc.c,v 3.10 1998/04/22 00:52:42 brianp Exp brianp $ */ d26 3 d463 1 a463 1 gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); @ 3.10 log @added GLcontext parameter to driver ExtensionString() @ text @d1 1 a1 1 /* $Id: misc.c,v 3.9 1998/04/14 00:02:10 brianp Exp brianp $ */ d26 3 d283 1 a283 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_SGIS_multitexture"; @ 3.9 log @fixed bug in which whole buffer might be cleared instead of scissor rect @ text @d1 1 a1 1 /* $Id: misc.c,v 3.8 1998/03/27 04:39:44 brianp Exp brianp $ */ d26 3 d302 1 a302 1 return (const GLubyte *) (*ctx->Driver.ExtensionString)(); @ 3.8 log @Driver.ExtensionString() must now return complete extension list @ text @d1 1 a1 1 /* $Id: misc.c,v 3.7 1998/03/19 02:04:22 brianp Exp brianp $ */ d26 3 d232 1 a232 4 GLint x = ctx->Buffer->Xmin; GLint y = ctx->Buffer->Ymin; GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; d238 5 @ 3.7 log @added GL_SGIS_texture_edge_clamp @ text @d1 1 a1 1 /* $Id: misc.c,v 3.6 1998/03/15 18:50:25 brianp Exp brianp $ */ d26 3 a271 1 #ifndef FX a272 3 #else static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp"; #endif a291 1 strcpy(result, extensions); d293 6 a298 2 strcat(result, " "); strcat(result, (*ctx->Driver.ExtensionString)()); a299 1 return (GLubyte *) result; @ 3.6 log @added GL_EXT_abgr extension @ text @d1 1 a1 1 /* $Id: misc.c,v 3.5 1998/03/15 18:32:12 brianp Exp brianp $ */ d26 3 d270 1 a270 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_multitexture"; d272 1 a272 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr"; @ 3.5 log @applied DavidB's patches for v0.23 of fxmesa driver @ text @d1 1 a1 1 /* $Id: misc.c,v 3.4 1998/02/20 04:50:44 brianp Exp brianp $ */ d26 3 d267 1 a267 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_SGIS_multitexture"; d269 1 a269 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal"; @ 3.4 log @implemented GL_SGIS_multitexture @ text @d1 1 a1 1 /* $Id: misc.c,v 3.3 1998/02/01 16:37:19 brianp Exp brianp $ */ d26 3 d262 2 a263 1 static char *version = "1.1 Mesa 3.0"; d265 3 @ 3.3 log @added GL_EXT_rescale_normal extension @ text @d1 1 a1 1 /* $Id: misc.c,v 3.2 1998/02/01 15:23:52 brianp Exp brianp $ */ d26 3 d260 1 a260 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal"; @ 3.2 log @added ExtensionString() function to device driver @ text @d1 1 a1 1 /* $Id: misc.c,v 3.1 1998/01/31 23:58:19 brianp Exp brianp $ */ d26 3 d257 1 a257 1 static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette"; @ 3.1 log @new gl_Clear: removed ClearDepthBuffer and ClearColorAndDepth functions @ text @d1 1 a1 1 /* $Id: misc.c,v 3.0 1998/01/31 20:59:27 brianp Exp brianp $ */ d26 3 d251 1 a251 1 static char renderer[1000]; a253 3 #ifdef FX static char *extensions = "GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette 3DFX_set_global_palette"; #else a254 1 #endif d265 1 a265 1 strcpy(renderer, "Mesa"); d267 2 a268 2 strcat(renderer, " "); strcat(renderer, (*ctx->Driver.RendererString)()); d270 1 a270 1 return (GLubyte *) renderer; d274 6 a279 1 return (GLubyte *) extensions; @ 3.0 log @initial rev @ text @d1 1 a1 1 /* $Id$ */ d25 4 a28 1 * $Log$ d166 3 a168 2 (*ctx->Driver.Clear)( ctx, !ctx->Scissor.Enabled, x, y, width, height ); d186 3 a188 2 (*ctx->Driver.Clear)( ctx, !ctx->Scissor.Enabled, x, y, width, height ); d208 6 d218 18 a235 26 /* See if we can call device driver function to clear both the * color and depth buffers. */ if (ctx->Driver.ClearColorAndDepth && (mask & GL_COLOR_BUFFER_BIT) && (mask & GL_DEPTH_BUFFER_BIT)) { GLint x = ctx->Buffer->Xmin; GLint y = ctx->Buffer->Ymin; GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1; GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1; (*ctx->Driver.ClearColorAndDepth)( ctx, !ctx->Scissor.Enabled, x, y, width, height ); if (ctx->RasterMask & FRONT_AND_BACK_BIT) { /*** Also clear the back buffer ***/ (*ctx->Driver.SetBuffer)( ctx, GL_BACK ); (*ctx->Driver.ClearColorAndDepth)( ctx, !ctx->Scissor.Enabled, x, y, width, height ); (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ); } } else { /* normal procedure for clearing buffers */ if (mask & GL_COLOR_BUFFER_BIT) clear_color_buffers( ctx ); if (mask & GL_DEPTH_BUFFER_BIT) (*ctx->Driver.ClearDepthBuffer)(ctx); if (mask & GL_ACCUM_BUFFER_BIT) gl_clear_accum_buffer( ctx ); if (mask & GL_STENCIL_BUFFER_BIT) gl_clear_stencil_buffer( ctx ); } @