swrast: silence unused var warnings in non-debug builds
[mesa.git] / src / mesa / swrast / s_context.h
index 6d81f74768f9dbb4e49eb8445f7b61ff777fe21a..d7ad764a9e2d3ebea45a1b56150b79c1829cf821 100644 (file)
 #include "s_span.h"
 
 
-typedef void (*texture_sample_func)(GLcontext *ctx,
+typedef void (*texture_sample_func)(struct gl_context *ctx,
                                     const struct gl_texture_object *tObj,
                                     GLuint n, const GLfloat texcoords[][4],
                                     const GLfloat lambda[], GLfloat rgba[][4]);
 
-typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n,
+typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n,
                                     const GLubyte mask[],
                                     GLvoid *src, const GLvoid *dst,
                                     GLenum chanType);
 
-typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *);
+typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *);
 
-typedef void (*swrast_line_func)( GLcontext *ctx,
+typedef void (*swrast_line_func)( struct gl_context *ctx,
                                   const SWvertex *, const SWvertex *);
 
-typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
+typedef void (*swrast_tri_func)( struct gl_context *ctx, const SWvertex *,
                                  const SWvertex *, const SWvertex *);
 
 
-typedef void (*validate_texture_image_func)(GLcontext *ctx,
+typedef void (*validate_texture_image_func)(struct gl_context *ctx,
                                             struct gl_texture_object *texObj,
                                             GLuint face, GLuint level);
 
@@ -109,6 +109,67 @@ typedef void (*validate_texture_image_func)(GLcontext *ctx,
                                _NEW_DEPTH)
 
 
+struct swrast_texture_image;
+
+
+/**
+ * Fetch a texel from texture image at given position.
+ */
+typedef void (*FetchTexelFuncF)(const struct swrast_texture_image *texImage,
+                                GLint col, GLint row, GLint img,
+                                GLfloat *texelOut);
+
+
+typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage,
+                               GLint col, GLint row, GLint img,
+                               const void *texel);
+
+/**
+ * Subclass of gl_texture_image.
+ * We need extra fields/info to keep tracking of mapped texture buffers,
+ * strides and Fetch/Store functions.
+ */
+struct swrast_texture_image
+{
+   struct gl_texture_image Base;
+
+   GLboolean _IsPowerOfTwo;  /**< Are all dimensions powers of two? */
+
+   /** used for mipmap LOD computation */
+   GLfloat WidthScale, HeightScale, DepthScale;
+
+#if 0
+   GLubyte *Data;    /**< The actual texture data in malloc'd memory */
+
+   GLint TexelSize;  /**< bytes per texel block */
+#endif
+
+   FetchTexelFuncF FetchTexelf;
+   StoreTexelFunc Store;
+
+#if 0
+   /** These fields only valid when texture memory is mapped */
+   GLubyte **SliceMaps;  /**< points to OneMap or a malloc'd array */
+   GLint RowStride;  /**< bytes per row of blocks */
+#endif
+};
+
+
+/** cast wrapper */
+static inline struct swrast_texture_image *
+swrast_texture_image(struct gl_texture_image *img)
+{
+   return (struct swrast_texture_image *) img;
+}
+
+/** cast wrapper */
+static inline const struct swrast_texture_image *
+swrast_texture_image_const(const struct gl_texture_image *img)
+{
+   return (const struct swrast_texture_image *) img;
+}
+
+
 /**
  * \struct SWcontext
  * \brief  Per-context state that's private to the software rasterizer module.
@@ -135,7 +196,6 @@ typedef struct
    GLboolean _TextureCombinePrimary;
    GLboolean _FogEnabled;
    GLboolean _DeferredTexture;
-   GLenum _FogMode;  /* either GL_FOG_MODE or fragment program's fog mode */
 
    /** List/array of the fragment attributes to interpolate */
    GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
@@ -160,7 +220,7 @@ typedef struct
    GLenum Primitive;    /* current primitive being drawn (ala glBegin) */
    GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */
 
-   void (*InvalidateState)( GLcontext *ctx, GLbitfield new_state );
+   void (*InvalidateState)( struct gl_context *ctx, GLbitfield new_state );
 
    /**
     * When the NewState mask intersects these masks, we invalidate the
@@ -177,9 +237,9 @@ typedef struct
     * Will be called when the GL state change mask intersects the above masks.
     */
    /*@{*/
-   void (*choose_point)( GLcontext * );
-   void (*choose_line)( GLcontext * );
-   void (*choose_triangle)( GLcontext * );
+   void (*choose_point)( struct gl_context * );
+   void (*choose_line)( struct gl_context * );
+   void (*choose_triangle)( struct gl_context * );
    /*@}*/
 
    /**
@@ -234,22 +294,22 @@ typedef struct
 
 
 extern void
-_swrast_validate_derived( GLcontext *ctx );
+_swrast_validate_derived( struct gl_context *ctx );
 
 extern void
-_swrast_update_texture_samplers(GLcontext *ctx);
+_swrast_update_texture_samplers(struct gl_context *ctx);
 
 
-/** Return SWcontext for the given GLcontext */
-static INLINE SWcontext *
-SWRAST_CONTEXT(GLcontext *ctx)
+/** Return SWcontext for the given struct gl_context */
+static inline SWcontext *
+SWRAST_CONTEXT(struct gl_context *ctx)
 {
    return (SWcontext *) ctx->swrast_context;
 }
 
 /** const version of above */
-static INLINE const SWcontext *
-CONST_SWRAST_CONTEXT(const GLcontext *ctx)
+static inline const SWcontext *
+CONST_SWRAST_CONTEXT(const struct gl_context *ctx)
 {
    return (const SWcontext *) ctx->swrast_context;
 }
@@ -260,8 +320,8 @@ CONST_SWRAST_CONTEXT(const GLcontext *ctx)
  * 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)
+static inline void
+swrast_render_start(struct gl_context *ctx)
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    if (swrast->Driver.SpanRenderStart)
@@ -270,8 +330,8 @@ swrast_render_start(GLcontext *ctx)
 
 
 /** Called after framebuffer reading/writing */
-static INLINE void
-swrast_render_finish(GLcontext *ctx)
+static inline void
+swrast_render_finish(struct gl_context *ctx)
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    if (swrast->Driver.SpanRenderFinish)