mesa: add _mesa_program_state_value_size() helper
[mesa.git] / src / mesa / swrast / s_context.h
index 7b3c740c1caeee7ac767fb1a0535f2672b2188b8..9ccba6b2276f47f70c9957557c79eca23fde4ada 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.3
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
@@ -27,7 +26,7 @@
 /**
  * \file swrast/s_context.h
  * \brief Software rasterization context and private types.
- * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Keith Whitwell <keithw@vmware.com>
  */
 
 /**
 #ifndef S_CONTEXT_H
 #define S_CONTEXT_H
 
-#include "main/compiler.h"
 #include "main/mtypes.h"
 #include "main/texcompress.h"
 #include "program/prog_execute.h"
 #include "swrast.h"
 #include "s_fragprog.h"
 #include "s_span.h"
+#include "util/rounding.h"
 
 
 typedef void (*texture_sample_func)(struct gl_context *ctx,
@@ -59,10 +58,10 @@ typedef void (*texture_sample_func)(struct gl_context *ctx,
                                     GLuint n, const GLfloat texcoords[][4],
                                     const GLfloat lambda[], GLfloat rgba[][4]);
 
-typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n,
-                                    const GLubyte mask[],
-                                    GLvoid *src, const GLvoid *dst,
-                                    GLenum chanType);
+typedef void (*swrast_blend_func)(struct gl_context *ctx, GLuint n,
+                                  const GLubyte mask[],
+                                  GLvoid *src, const GLvoid *dst,
+                                  GLenum chanType);
 
 typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *);
 
@@ -138,11 +137,24 @@ struct swrast_texture_image
    /** used for mipmap LOD computation */
    GLfloat WidthScale, HeightScale, DepthScale;
 
-   /** These fields only valid when texture memory is mapped */
-   GLint RowStride;            /**< Padded width in units of texels */
-   void **ImageSlices;          /**< if 3D texture: array [Depth] of offsets to
-                                     each 2D slice in 'Data', in texels */
-   GLubyte *Map;               /**< Pointer to mapped image memory */
+   /**
+    * Byte stride between rows in ImageSlices.
+    *
+    * For compressed textures, this is the byte stride between one row of
+    * blocks and the next row of blocks.
+    *
+    * Only valid while one of the ImageSlices is mapped, and must be the same
+    * between all slices.
+    */
+   GLint RowStride;
+   /**
+    * When a texture image is mapped for swrast, this array contains pointers
+    * to the beginning of each slice.
+    *
+    * For swrast-allocated textures, these pointers will always stay
+    * initialized to point within Buffer.
+    */
+   void **ImageSlices;
 
    /** Malloc'd texture memory */
    GLubyte *Buffer;
@@ -299,8 +311,8 @@ typedef struct
 
    /** Internal hooks, kept up to date by the same mechanism as above.
     */
-   blend_func BlendFunc;
-   texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS];
+   swrast_blend_func BlendFunc;
+   texture_sample_func TextureSample[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
 
    /** Buffer for saving the sampled texture colors.
     * Needed for GL_ARB_texture_env_crossbar implementation.
@@ -422,7 +434,7 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx);
 #define FIXED_EPSILON   1
 #define FIXED_SCALE     ((float) FIXED_ONE)
 #define FIXED_DBL_SCALE ((double) FIXED_ONE)
-#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define FloatToFixed(X) (lroundf((X) * FIXED_SCALE))
 #define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
 #define IntToFixed(I)   ((I) << FIXED_SHIFT)
 #define FixedToInt(X)   ((X) >> FIXED_SHIFT)