diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-06-29 13:03:01 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-06-29 13:03:01 -0600 |
commit | e62cf5c69ab605b78324639f5455ac9921e68dba (patch) | |
tree | 7301c5f6027f63c2f3dec16c439bbc30f69c7cca | |
parent | 48076dc784c910dfee1ebaa6970375495209b839 (diff) |
more work on tex objects, surfaces, mappable buffers
-rw-r--r-- | src/mesa/pipe/p_state.h | 84 |
1 files changed, 65 insertions, 19 deletions
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index e0fa4d54c3..6a9a86fa97 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -50,6 +50,14 @@ #define PIPE_MAX_CONSTANT 32 +/* fwd decl */ +struct pipe_surface; + + +/*** + *** State objects + ***/ + /** * Primitive (point/line/tri) setup info @@ -164,29 +172,17 @@ struct pipe_stencil_state { GLuint front_zpass_op:3; /**< PIPE_STENCIL_OP_x */ GLuint front_zfail_op:3; /**< PIPE_STENCIL_OP_x */ GLuint back_enabled:1; - GLuint back_func:3; - GLuint back_fail_op:3; - GLuint back_zpass_op:3; - GLuint back_zfail_op:3; - GLubyte ref_value[2]; /**< [0] = front, [1] = back */ + GLuint back_func:3; /**< PIPE_FUNC_x */ + GLuint back_fail_op:3; /**< PIPE_STENCIL_OP_x */ + GLuint back_zpass_op:3; /**< PIPE_STENCIL_OP_x */ + GLuint back_zfail_op:3; /**< PIPE_STENCIL_OP_x */ + GLubyte ref_value[2]; /**< [0] = front, [1] = back */ GLubyte value_mask[2]; GLubyte write_mask[2]; GLubyte clear_value; }; -/* This will change for hardware pipes... - */ -struct pipe_surface -{ - GLuint width, height; - GLubyte *ptr; - GLint stride; - GLuint cpp; - GLuint format; -}; - - struct pipe_framebuffer_state { GLuint num_cbufs; /**< Number of color bufs to draw to */ @@ -223,16 +219,66 @@ struct pipe_sampler_state }; +/*** + *** Non-state Objects + ***/ + + +/** + * A mappable buffer (vertex data, pixel data, etc) + */ +struct pipe_buffer +{ + void *(*map)(struct pipe_buffer *pb, GLuint access_mode); + void (*unmap)(struct pipe_buffer *pb); + void *ptr; /**< address, only valid while mapped */ + GLuint mode; /**< PIPE_MAP_x, only valid while mapped */ +}; + + +/** + * 2D surface. + * May be a renderbuffer, texture mipmap level, etc. + */ +struct pipe_surface +{ + struct pipe_buffer buffer; /**< surfaces can be mapped */ + GLuint format:5; /**< PIPE_FORMAT_x */ + GLuint width, height; +#if 0 + GLubyte *ptr; + GLint stride; + GLuint cpp; + GLuint format; +#endif +}; + + /** - * XXX rough approximation... + * Texture object. + * Mipmap levels, cube faces, 3D slices can be accessed as surfaces. */ struct pipe_texture_object { + GLuint type:2; /**< PIPE_TEXTURE_x */ 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? */ + GLuint mipmapped:1; + + /** to access a 1D or 2D texture object as a surface */ + struct pipe_surface *(*get_2d_surface)(struct pipe_texture_object *pto, + GLuint level); + /** to access a 3D texture object as a surface */ + struct pipe_surface *(*get_3d_surface)(struct pipe_texture_object *pto, + GLuint level, GLuint slice); + /** to access a cube texture object as a surface */ + struct pipe_surface *(*get_cube_surface)(struct pipe_texture_object *pto, + GLuint face, GLuint level); + /** when finished with surface: */ + void (*release_surface)(struct pipe_texture_object *pto, + struct pipe_surface *ps); }; |