summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-06-22 13:37:47 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-06-22 13:37:47 -0600
commit5d69aeb0028f44d06093faede5c545908b0df89a (patch)
treeab6ed83af7f9f0c590e0ab1cd0b2f156217f127f
parent13682d959ddacde1ce65843aa8c5b43dc9017b32 (diff)
initial texture object, texture format code
-rw-r--r--src/mesa/pipe/p_context.h4
-rw-r--r--src/mesa/pipe/p_defines.h16
-rw-r--r--src/mesa/pipe/p_state.h14
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c1
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h2
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h4
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c15
7 files changed, 56 insertions, 0 deletions
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 7e68699d3e9..d9546a24d2f 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -100,6 +100,10 @@ struct pipe_context {
GLuint unit,
const struct pipe_sampler_state * );
+ void (*set_texture_state)( struct pipe_context *,
+ GLuint unit,
+ struct pipe_texture_object * );
+
void (*set_viewport)( struct pipe_context *,
const struct pipe_viewport * );
};
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h
index 75573107ff2..a0c4d72a3c2 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/mesa/pipe/p_defines.h
@@ -124,4 +124,20 @@
#define PIPE_TEX_COMPARE_NONE 0
#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
+/**
+ * Texture/surface image formats
+ */
+#define PIPE_FORMAT_U_R8_G8_B8_A8 0 /**< ubyte[4] RGBA */
+#define PIPE_FORMAT_U_A8_R8_G8_B8 1 /**< ubyte[4] ARGB */
+#define PIPE_FORMAT_U_R5_G6_B5 2 /**< 5/6/5 RGB */
+#define PIPE_FORMAT_U_L8 3 /**< ubyte luminance */
+#define PIPE_FORMAT_U_A8 4 /**< ubyte alpha */
+#define PIPE_FORMAT_U_I8 5 /**< ubyte intensity */
+#define PIPE_FORMAT_U_L8_A8 6 /**< ubyte luminance, alpha */
+
+#define PIPE_FORMAT_U_Z16 7 /**< ushort Z/depth */
+#define PIPE_FORMAT_F_Z32 8 /**< float Z/depth */
+#define PIPE_FORMAT_YCBCR 9
+#define PIPE_FORMAT_YCBCR_REV 10
+
#endif
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index f3723eb87e5..3e3da7cce6f 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -231,4 +231,18 @@ struct pipe_sampler_state
GLfloat max_anisotropy;
};
+
+/**
+ * XXX rough approximation...
+ */
+struct pipe_texture_object
+{
+ GLuint format:5; /**< PIPE_FORMAT_x */
+ GLuint width:13; /**< 13 bits = 8K max size */
+ GLuint height:13;
+ GLuint depth:13;
+ GLubyte *data; /**< only valid while buffer mapped? */
+};
+
+
#endif
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 07b529fc6e4..0d00c7eb6cd 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -77,6 +77,7 @@ struct pipe_context *softpipe_create( void )
softpipe->pipe.set_fs_state = softpipe_set_fs_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->pipe.set_sampler_state = softpipe_set_sampler_state;
+ softpipe->pipe.set_texture_state = softpipe_set_texture_state;
softpipe->pipe.draw_vb = softpipe_draw_vb;
softpipe->pipe.clear = softpipe_clear;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index d8c0de0ad1a..7c816dbc1a7 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -63,6 +63,7 @@ enum interp_mode {
#define G_NEW_ALPHA_TEST 0x200
#define G_NEW_DEPTH_TEST 0x400
#define G_NEW_SAMPLER 0x800
+#define G_NEW_TEXTURE 0x1000
#define PIPE_ATTRIB_MAX 32
@@ -86,6 +87,7 @@ struct softpipe_context {
struct pipe_scissor_rect scissor;
struct pipe_poly_stipple poly_stipple;
struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];
+ struct pipe_texture_object *texture[PIPE_MAX_SAMPLERS];
GLuint dirty;
/* Clip derived state:
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index faaa043a56c..735d039748a 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -63,6 +63,10 @@ void softpipe_set_sampler_state( struct pipe_context *,
GLuint unit,
const struct pipe_sampler_state * );
+void softpipe_set_texture_state( struct pipe_context *,
+ GLuint unit,
+ struct pipe_texture_object * );
+
void softpipe_set_scissor_rect( struct pipe_context *,
const struct pipe_scissor_rect * );
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index 6b422acfb6c..060e2c8c987 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -43,7 +43,22 @@ softpipe_set_sampler_state(struct pipe_context *pipe,
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ assert(unit < PIPE_MAX_SAMPLERS);
softpipe->sampler[unit] = *sampler;
softpipe->dirty |= G_NEW_SAMPLER;
}
+
+
+void
+softpipe_set_texture_state(struct pipe_context *pipe,
+ GLuint unit,
+ struct pipe_texture_object *texture)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+
+ assert(unit < PIPE_MAX_SAMPLERS);
+ softpipe->texture[unit] = texture; /* ptr, not struct */
+
+ softpipe->dirty |= G_NEW_TEXTURE;
+}