gallium: Make texture target an enum for better debuggability.
authorMichel Dänzer <michel@tungstengraphics.com>
Fri, 4 Jan 2008 16:06:55 +0000 (17:06 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Fri, 4 Jan 2008 17:21:45 +0000 (18:21 +0100)
Also make enum pipe_format used in a couple more places.

src/mesa/pipe/i965simple/brw_wm_surface_state.c
src/mesa/pipe/p_defines.h
src/mesa/pipe/p_state.h
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_texture.c
src/mesa/state_tracker/st_texture.h

index 5c7dee5790d57d1cd8adf5ca1b862f30d6963cf5..fc40e0438c45b3e5049ca06d3577332a348fc22b 100644 (file)
@@ -33,7 +33,7 @@
 #include "brw_state.h"
 #include "brw_defines.h"
 
-static unsigned translate_tex_target( int target )
+static unsigned translate_tex_target( enum pipe_texture_target target )
 {
    switch (target) {
    case PIPE_TEXTURE_1D:
@@ -54,9 +54,9 @@ static unsigned translate_tex_target( int target )
    }
 }
 
-static unsigned translate_tex_format( unsigned mesa_format )
+static unsigned translate_tex_format( enum pipe_format pipe_format )
 {
-   switch( mesa_format ) {
+   switch( pipe_format ) {
    case PIPE_FORMAT_U_L8:
       return BRW_SURFACEFORMAT_L8_UNORM;
 
index a67ed605472bec674e972a2cd2503042348f76ee..c6d9c02bd91b133bfd2e4b2d47833b4dc5fbebc0 100644 (file)
 #define PIPE_STENCIL_OP_INVERT     7
 
 /** Texture types */
-#define PIPE_TEXTURE_1D   0
-#define PIPE_TEXTURE_2D   1
-#define PIPE_TEXTURE_3D   2
-#define PIPE_TEXTURE_CUBE 3
+enum pipe_texture_target {
+   PIPE_TEXTURE_1D   = 0,
+   PIPE_TEXTURE_2D   = 1,
+   PIPE_TEXTURE_3D   = 2,
+   PIPE_TEXTURE_CUBE = 3
+};
 
 #define PIPE_TEX_FACE_POS_X 0
 #define PIPE_TEX_FACE_NEG_X 1
index 16d50fdb8269b183c71f7bb06d355827906bf52a..76e633e930e59dd91b4db03be9f7db8cd67c0acc 100644 (file)
@@ -39,6 +39,7 @@
 #define PIPE_STATE_H
 
 #include "p_compiler.h"
+#include "p_defines.h"
 #include "p_format.h"
 
 /**
@@ -262,8 +263,8 @@ struct pipe_texture
 { 
    /* Effectively the key:
     */
-   unsigned target;            /**< PIPE_TEXTURE_x */
-   enum pipe_format format;    /**< PIPE_FORMAT_x */
+   enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
+   enum pipe_format format;         /**< PIPE_FORMAT_x */
 
    unsigned first_level;
    unsigned last_level;
index e813bdb47afc5ae5d177d55877723b2b7b3b5710..773fc0012e29e6b88e81792f6d52dfcbc3622053 100644 (file)
@@ -97,7 +97,7 @@ st_get_texobj_texture(struct gl_texture_object *texObj)
 }
 
 
-static unsigned
+static enum pipe_texture_target
 gl_target_to_pipe(GLenum target)
 {
    switch (target) {
index c7d28eeca20bc6349f249f8203b5064bf5d7bf6f..a2bdf846caf030be88375518b09e272fd75c57d0 100644 (file)
@@ -61,8 +61,8 @@ target_to_target(GLenum target)
 
 struct pipe_texture *
 st_texture_create(struct st_context *st,
-                  unsigned target,
-                 unsigned format,
+                  enum pipe_texture_target target,
+                 enum pipe_format format,
                  GLuint first_level,
                  GLuint last_level,
                  GLuint width0,
index 7524c219e06e0633601e1e7c5d0a363cba839fd1..d8b1bcad9d5c8550b6bd71608645f02eaba0739d 100644 (file)
@@ -37,8 +37,8 @@ struct pipe_texture;
 
 extern struct pipe_texture *
 st_texture_create(struct st_context *st,
-                  unsigned target,
-                 unsigned format,
+                  enum pipe_texture_target target,
+                 enum pipe_format format,
                   GLuint first_level,
                   GLuint last_level,
                   GLuint width0,