initial texture object, texture format code

This commit is contained in:
Brian
2007-06-22 13:37:47 -06:00
parent 13682d959d
commit 5d69aeb002
7 changed files with 56 additions and 0 deletions

View File

@@ -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 * );
};

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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:

View File

@@ -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 * );

View File

@@ -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;
}