gallium: standardize naming of masks
[mesa.git] / src / gallium / include / pipe / p_state.h
index e7ee8c97ed73e076c982d69c804446914bc579e9..0a0ca770da8a79c3a3574b91fc3d6b01483ee397 100644 (file)
@@ -27,6 +27,8 @@
 
 
 /**
+ * @file
+ * 
  * Abstract graphics pipe state objects.
  *
  * Basic notes:
@@ -170,29 +172,41 @@ struct pipe_shader_state
 };
 
 
+struct pipe_depth_state 
+{
+   unsigned enabled:1;         /**< depth test enabled? */
+   unsigned writemask:1;       /**< allow depth buffer writes? */
+   unsigned func:3;            /**< depth test func (PIPE_FUNC_x) */
+   unsigned occlusion_count:1; /**< do occlusion counting? */
+};
+
+
+struct pipe_stencil_state
+{
+   unsigned enabled:1;  /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */
+   unsigned func:3;     /**< PIPE_FUNC_x */
+   unsigned fail_op:3;  /**< PIPE_STENCIL_OP_x */
+   unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */
+   unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */
+   ubyte ref_value;
+   ubyte valuemask;
+   ubyte writemask;
+};
+
+
+struct pipe_alpha_state
+{
+   unsigned enabled:1;
+   unsigned func:3;     /**< PIPE_FUNC_x */
+   float ref;           /**< reference value */
+};
+
+
 struct pipe_depth_stencil_alpha_state
 {
-   struct {
-      unsigned enabled:1;         /**< depth test enabled? */
-      unsigned writemask:1;       /**< allow depth buffer writes? */
-      unsigned func:3;            /**< depth test func (PIPE_FUNC_x) */
-      unsigned occlusion_count:1; /**< do occlusion counting? */
-   } depth;
-   struct {
-      unsigned enabled:1;  /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */
-      unsigned func:3;     /**< PIPE_FUNC_x */
-      unsigned fail_op:3;  /**< PIPE_STENCIL_OP_x */
-      unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */
-      unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */
-      ubyte ref_value;    
-      ubyte value_mask;
-      ubyte write_mask;
-   } stencil[2];           /**< [0] = front, [1] = back */
-   struct {
-      unsigned enabled:1;
-      unsigned func:3;     /**< PIPE_FUNC_x */
-      float ref;           /**< reference value */
-   } alpha;
+   struct pipe_depth_state depth;
+   struct pipe_stencil_state stencil[2]; /**< [0] = front, [1] = back */
+   struct pipe_alpha_state alpha;
 };
 
 
@@ -267,30 +281,24 @@ struct pipe_surface
    enum pipe_format format;      /**< PIPE_FORMAT_x */
    unsigned status;              /**< PIPE_SURFACE_STATUS_x */
    unsigned clear_value;         /**< XXX may be temporary */
-   unsigned cpp;                 /**< bytes per pixel */
-   unsigned width;
-   unsigned height;
-   unsigned pitch;               /**< in pixels */
+   unsigned width;               /**< logical width in pixels */
+   unsigned height;              /**< logical height in pixels */
+   struct pipe_format_block block;
+   unsigned nblocksx;            /**< allocated width in blocks */
+   unsigned nblocksy;            /**< allocated height in blocks */
+   unsigned stride;              /**< stride in bytes between rows of blocks */
    unsigned layout;              /**< PIPE_SURFACE_LAYOUT_x */
    unsigned offset;              /**< offset from start of buffer, in bytes */
    unsigned refcount;
-   unsigned usage;              /**< PIPE_BUFFER_USAGE_*  */
+   unsigned usage;               /**< PIPE_BUFFER_USAGE_*  */
 
-   struct pipe_winsys *winsys;   /**< winsys which owns/created the surface */
-
-   struct pipe_texture *texture; /**< optional texture into which this is a view  */
+   struct pipe_texture *texture; /**< texture into which this is a view  */
    unsigned face;
    unsigned level;
    unsigned zslice;
 };
 
 
-#define PIPE_TEXTURE_USAGE_RENDER_TARGET   0x1
-#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET  0x2 /* ie a backbuffer */
-#define PIPE_TEXTURE_USAGE_PRIMARY         0x4 /* ie a frontbuffer */
-#define PIPE_TEXTURE_USAGE_DEPTH_STENCIL   0x8
-#define PIPE_TEXTURE_USAGE_SAMPLER         0x10
-
 /**
  * Texture object.
  */
@@ -303,11 +311,16 @@ struct pipe_texture
    unsigned height[PIPE_MAX_TEXTURE_LEVELS];
    unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
 
-   unsigned cpp:8;
+   struct pipe_format_block block;
+   unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */
+   unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated height in blocks */
+
    unsigned last_level:8;    /**< Index of last mipmap level present/defined */
    unsigned compressed:1;
-   
-   unsigned tex_usage;          /* PIPE_TEXTURE_USAGE_* */
+
+   unsigned nr_samples:8;    /**< for multisampled surfaces, nr of samples */
+
+   unsigned tex_usage;       /* PIPE_TEXTURE_USAGE_* */
 
    /* These are also refcounted:
     */
@@ -324,7 +337,7 @@ struct pipe_texture
  */
 struct pipe_vertex_buffer
 {
-   unsigned pitch;    /**< stride to same attrib in next vertex, in bytes */
+   unsigned stride;    /**< stride to same attrib in next vertex, in bytes */
    unsigned max_index;   /**< number of vertices in this buffer */
    unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
    struct pipe_buffer *buffer;  /**< the actual buffer */