X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_context.h;h=e1c22977dd86a18daf02e3ad1714b341d75e665a;hb=22a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70;hp=6603b56e7dfaaa6896ec4148927725b628b3fcc7;hpb=46b0988c673b28e072fd0cbf477632a9ab6f9f18;p=mesa.git diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index 6603b56e7df..e1c22977dd8 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -1,8 +1,10 @@ +/* $Id: s_context.h,v 1.22 2002/10/29 20:29:00 brianp Exp $ */ + /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -22,7 +24,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell + * Keith Whitwell + */ + +/** + * \file swrast/s_context.h + * \brief fill in description + * \author Keith Whitwell */ #ifndef S_CONTEXT_H @@ -36,10 +44,8 @@ */ typedef void (*TextureSampleFunc)( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ); + GLuint n, GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ); @@ -64,25 +70,25 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, const SWvertex *, const SWvertex *); - -/* - * Bitmasks to indicate which rasterization options are enabled (RasterMask) +/** \defgroup Bitmasks + * Bitmasks to indicate which rasterization options are enabled + * (RasterMask) */ -#define ALPHATEST_BIT 0x001 /* Alpha-test pixels */ -#define BLEND_BIT 0x002 /* Blend pixels */ -#define DEPTH_BIT 0x004 /* Depth-test pixels */ -#define FOG_BIT 0x008 /* Fog pixels */ -#define LOGIC_OP_BIT 0x010 /* Apply logic op in software */ -#define SCISSOR_BIT 0x020 /* Scissor pixels */ -#define STENCIL_BIT 0x040 /* Stencil pixels */ -#define MASKING_BIT 0x080 /* Do glColorMask or glIndexMask */ -#define ALPHABUF_BIT 0x100 /* Using software alpha buffer */ -#define WINCLIP_BIT 0x200 /* Clip pixels/primitives to window */ -#define MULTI_DRAW_BIT 0x400 /* Write to more than one color- */ - /* buffer or no buffers. */ -#define OCCLUSION_BIT 0x800 /* GL_HP_occlusion_test enabled */ -#define TEXTURE_BIT 0x1000 /* Texturing really enabled */ - +/*@{*/ +#define ALPHATEST_BIT 0x001 /**< Alpha-test pixels */ +#define BLEND_BIT 0x002 /**< Blend pixels */ +#define DEPTH_BIT 0x004 /**< Depth-test pixels */ +#define FOG_BIT 0x008 /**< Fog pixels */ +#define LOGIC_OP_BIT 0x010 /**< Apply logic op in software */ +#define CLIP_BIT 0x020 /**< Scissor or window clip pixels */ +#define STENCIL_BIT 0x040 /**< Stencil pixels */ +#define MASKING_BIT 0x080 /**< Do glColorMask or glIndexMask */ +#define ALPHABUF_BIT 0x100 /**< Using software alpha buffer */ +#define MULTI_DRAW_BIT 0x400 /**< Write to more than one color- */ + /**< buffer or no buffers. */ +#define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */ +#define TEXTURE_BIT 0x1000 /**< Texturing really enabled */ +/*@}*/ #define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \ _NEW_SCISSOR| \ @@ -95,40 +101,49 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, _NEW_DEPTH) - +/** + * \struct SWcontext + * \brief SWContext? + */ typedef struct { - /* Configuration mechanisms to make software rasterizer match + /** Driver interface: + */ + struct swrast_device_driver Driver; + + /** Configuration mechanisms to make software rasterizer match * characteristics of the hardware rasterizer (if present): */ GLboolean AllowVertexFog; GLboolean AllowPixelFog; - /* Derived values, invalidated on statechanges, updated from + /** Derived values, invalidated on statechanges, updated from * _swrast_validate_derived(): */ GLuint _RasterMask; - GLboolean _MultiTextureEnabled; - GLuint _MinMagThresh[MAX_TEXTURE_UNITS]; + GLfloat _MinMagThresh[MAX_TEXTURE_UNITS]; GLfloat _backface_sign; GLboolean _PreferPixelFog; + GLboolean _AnyTextureCombine; /* Accum buffer temporaries. */ - GLboolean _IntegerAccumMode; /* Storing unscaled integers? */ - GLfloat _IntegerAccumScaler; /* Implicit scale factor */ + GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */ + GLfloat _IntegerAccumScaler; /**< Implicit scale factor */ /* Working values: */ - struct pixel_buffer* PB; - GLuint StippleCounter; /* Line stipple counter */ + GLuint StippleCounter; /**< Line stipple counter */ GLuint NewState; GLuint StateChanges; + GLenum Primitive; /* current primitive being drawn (ala glBegin) */ + GLuint CurrentBuffer; /* exactly one of FRONT_LEFT_BIT, BACK_LEFT_BIT, etc*/ - /* Mechanism to allow driver (like X11) to register further + /** Mechanism to allow driver (like X11) to register further * software rasterization routines. */ + /*@{*/ void (*choose_point)( GLcontext * ); void (*choose_line)( GLcontext * ); void (*choose_triangle)( GLcontext * ); @@ -136,38 +151,86 @@ typedef struct GLuint invalidate_point; GLuint invalidate_line; GLuint invalidate_triangle; + /*@}*/ - - /* Function pointers for dispatch behind public entrypoints. - */ + /** Function pointers for dispatch behind public entrypoints. */ + /*@{*/ void (*InvalidateState)( GLcontext *ctx, GLuint new_state ); swrast_point_func Point; swrast_line_func Line; swrast_tri_func Triangle; + /*@}*/ - /* Placeholders for when seperate specular (or secondary color) is - * enabled but texturing is not. + /** + * Placeholders for when separate specular (or secondary color) is + * enabled but texturing is not. */ + /*@{*/ swrast_point_func SpecPoint; swrast_line_func SpecLine; swrast_tri_func SpecTriangle; + /*@}*/ + /** + * Typically, we'll allocate a sw_span structure as a local variable + * and set its 'array' pointer to point to this object. The reason is + * this object is big and causes problems when allocated on the stack + * on some systems. + */ + struct span_arrays *SpanArrays; + + /** + * Used to buffer N GL_POINTS, instead of rendering one by one. + */ + struct sw_span PointSpan; - /* Internal hooks, kept uptodate by the same mechanism as above. + /** Internal hooks, kept uptodate by the same mechanism as above. */ blend_func BlendFunc; TextureSampleFunc TextureSample[MAX_TEXTURE_UNITS]; + /** Buffer for saving the sampled texture colors. + * Needed for GL_ARB_texture_env_crossbar implementation. + */ + GLchan *TexelBuffer; + } SWcontext; -void +extern void _swrast_validate_derived( GLcontext *ctx ); #define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context) +#define RENDER_START(SWctx, GLctx) \ + do { \ + if ((SWctx)->Driver.SpanRenderStart) { \ + (*(SWctx)->Driver.SpanRenderStart)(GLctx); \ + } \ + } while (0) + +#define RENDER_FINISH(SWctx, GLctx) \ + do { \ + if ((SWctx)->Driver.SpanRenderFinish) { \ + (*(SWctx)->Driver.SpanRenderFinish)(GLctx); \ + } \ + } while (0) + +/* + * XXX these macros are just bandages for now in order to make + * CHAN_BITS==32 compile cleanly. + * These should probably go elsewhere at some point. + */ +#if CHAN_TYPE == GL_FLOAT +#define ChanToFixed(X) (X) +#define FixedToChan(X) (X) +#else +#define ChanToFixed(X) IntToFixed(X) +#define FixedToChan(X) FixedToInt(X) +#endif + #endif