swrast: replace RENDER_START/FINISH macros with inline functions
[mesa.git] / src / mesa / swrast / s_context.h
index daa07e15783af7dfd0cd555c8d7390c65d8cf122..cdd6fa5048d6df2b3968323e20ef29c26b21f6e9 100644 (file)
@@ -128,17 +128,14 @@ typedef struct
     * _swrast_validate_derived():
     */
    GLbitfield _RasterMask;
-   GLfloat _BackfaceSign;
+   GLfloat _BackfaceSign;      /** +1 or -1 */
+   GLfloat _BackfaceCullSign;  /** +1, 0, or -1 */
    GLboolean _PreferPixelFog;    /* Compute fog blend factor per fragment? */
    GLboolean _AnyTextureCombine;
    GLboolean _FogEnabled;
    GLboolean _DeferredTexture;
    GLenum _FogMode;  /* either GL_FOG_MODE or fragment program's fog mode */
 
-   /** Multiple render targets */
-   GLbitfield _ColorOutputsMask;
-   GLuint _NumColorOutputs;
-
    /** List/array of the fragment attributes to interpolate */
    GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
    /** Same info, but as a bitmask */
@@ -156,6 +153,7 @@ typedef struct
    /* Working values:
     */
    GLuint StippleCounter;    /**< Line stipple counter */
+   GLuint PointLineFacing;
    GLbitfield NewState;
    GLuint StateChanges;
    GLenum Primitive;    /* current primitive being drawn (ala glBegin) */
@@ -208,6 +206,7 @@ typedef struct
     * on some systems.
     */
    SWspanarrays *SpanArrays;
+   SWspanarrays *ZoomedArrays;  /**< For pixel zooming */
 
    /**
     * Used to buffer N GL_POINTS, instead of rendering one by one.
@@ -239,21 +238,43 @@ extern void
 _swrast_update_texture_samplers(GLcontext *ctx);
 
 
-#define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context)
+/** Return SWcontext for the given GLcontext */
+static INLINE SWcontext *
+SWRAST_CONTEXT(GLcontext *ctx)
+{
+   return (SWcontext *) ctx->swrast_context;
+}
+
+/** const version of above */
+static INLINE const SWcontext *
+CONST_SWRAST_CONTEXT(const GLcontext *ctx)
+{
+   return (const SWcontext *) ctx->swrast_context;
+}
+
+
+/**
+ * Called prior to framebuffer reading/writing.
+ * For drivers that rely on swrast for fallback rendering, this is the
+ * driver's opportunity to map renderbuffers and textures.
+ */
+static INLINE void
+swrast_render_start(GLcontext *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Driver.SpanRenderStart)
+      swrast->Driver.SpanRenderStart(ctx);
+}
 
-#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)
+/** Called after framebuffer reading/writing */
+static INLINE void
+swrast_render_finish(GLcontext *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   if (swrast->Driver.SpanRenderFinish)
+      swrast->Driver.SpanRenderFinish(ctx);
+}