diff options
author | Keith Whitwell <[email protected]> | 2007-08-13 16:07:11 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-08-13 16:23:44 +0100 |
commit | 40a86b20478024ca7c55400019c536cb5ff631d1 (patch) | |
tree | 624d3f33b07dfba4328b0c7746af5f58fd496292 /src/mesa/pipe/p_state.h | |
parent | d46779103b38aeab61701759ed7a0b30cc71c0ef (diff) |
Start breaking the #include dependencies between pipe drivers and mesa.
Pipe drivers shouldn't really know much about mesa and certainly shouldn't
be #including files from src/mesa/main and the like.
I've also (in i915simple especially) moved over from GL types to
more conventional int/unsigned usage. This probably isn't really the
ultimate desired set of types to use - possibly C99 would be better. It
may even be that a subset of the GL types is preferable.
Diffstat (limited to 'src/mesa/pipe/p_state.h')
-rw-r--r-- | src/mesa/pipe/p_state.h | 251 |
1 files changed, 121 insertions, 130 deletions
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 6799fdb31c8..dc2b589e555 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -38,9 +38,7 @@ #ifndef PIPE_STATE_H #define PIPE_STATE_H -#include "mtypes.h" - - +#include "p_compiler.h" /** * Implementation limits @@ -50,6 +48,7 @@ #define PIPE_MAX_CONSTANT 32 #define PIPE_ATTRIB_MAX 32 #define PIPE_MAX_COLOR_BUFS 8 +#define PIPE_MAX_TEXTURE_LEVELS 16 /* fwd decl */ @@ -69,138 +68,129 @@ struct pipe_buffer_handle; */ struct pipe_setup_state { - GLuint flatshade:1; - GLuint light_twoside:1; - - GLuint front_winding:2; /**< PIPE_WINDING_x */ - - GLuint cull_mode:2; /**< PIPE_WINDING_x */ - - GLuint fill_cw:2; /**< PIPE_POLYGON_MODE_x */ - GLuint fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ - - GLuint offset_cw:1; - GLuint offset_ccw:1; - - GLuint scissor:1; - - GLuint poly_smooth:1; - GLuint poly_stipple_enable:1; - - GLuint line_smooth:1; - GLuint line_stipple_enable:1; - - GLuint point_smooth:1; - - GLuint multisample:1; /* XXX maybe more ms state in future */ - - GLubyte line_stipple_factor; /**< [1..256] actually */ - GLushort line_stipple_pattern; - GLfloat line_width; - GLfloat point_size; /**< used when no per-vertex size */ - GLfloat offset_units; - GLfloat offset_scale; + unsigned flatshade:1; + unsigned light_twoside:1; + unsigned front_winding:2; /**< PIPE_WINDING_x */ + unsigned cull_mode:2; /**< PIPE_WINDING_x */ + unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */ + unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ + unsigned offset_cw:1; + unsigned offset_ccw:1; + unsigned scissor:1; + unsigned poly_smooth:1; + unsigned poly_stipple_enable:1; + unsigned point_smooth:1; + unsigned multisample:1; /* XXX maybe more ms state in future */ + unsigned line_smooth:1; + unsigned line_stipple_enable:1; + unsigned line_stipple_factor:8; /**< [1..256] actually */ + unsigned line_stipple_pattern:16; + + float line_width; + float point_size; /**< used when no per-vertex size */ + float offset_units; + float offset_scale; }; struct pipe_poly_stipple { - GLuint stipple[32]; + unsigned stipple[32]; }; struct pipe_viewport_state { - GLfloat scale[4]; - GLfloat translate[4]; + float scale[4]; + float translate[4]; }; struct pipe_scissor_state { - GLshort minx; - GLshort miny; - GLshort maxx; - GLshort maxy; + unsigned minx:16; + unsigned miny:16; + unsigned maxx:16; + unsigned maxy:16; }; struct pipe_clip_state { - GLfloat ucp[PIPE_MAX_CLIP_PLANES][4]; - GLuint nr; + float ucp[PIPE_MAX_CLIP_PLANES][4]; + unsigned nr; }; struct pipe_constant_buffer { - GLfloat constant[PIPE_MAX_CONSTANT][4]; - GLuint nr_constants; + float constant[PIPE_MAX_CONSTANT][4]; + unsigned nr_constants; }; struct pipe_fs_state { - GLbitfield inputs_read; /* FRAG_ATTRIB_* */ + unsigned inputs_read; /* FRAG_ATTRIB_* */ const struct tgsi_token *tokens; struct pipe_constant_buffer *constants; /* XXX temporary? */ }; struct pipe_depth_state { - GLuint enabled:1; /**< depth test enabled? */ - GLuint writemask:1; /**< allow depth buffer writes? */ - GLuint func:3; /**< depth test func (PIPE_FUNC_x) */ - GLuint occlusion_count:1; /**< XXX move this elsewhere? */ - GLfloat clear; /**< Clear value in [0,1] (XXX correct place?) */ + 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; /**< XXX move this elsewhere? */ + float clear; /**< Clear value in [0,1] (XXX correct place?) */ }; struct pipe_alpha_test_state { - GLuint enabled:1; - GLuint func:3; /**< PIPE_FUNC_x */ - GLfloat ref; /**< reference value */ + unsigned enabled:1; + unsigned func:3; /**< PIPE_FUNC_x */ + float ref; /**< reference value */ }; struct pipe_blend_state { - GLuint blend_enable:1; + unsigned blend_enable:1; - GLuint rgb_func:3; /**< PIPE_BLEND_x */ - GLuint rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ - GLuint rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ + unsigned rgb_func:3; /**< PIPE_BLEND_x */ + unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ + unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ - GLuint alpha_func:3; /**< PIPE_BLEND_x */ - GLuint alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ - GLuint alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ + unsigned alpha_func:3; /**< PIPE_BLEND_x */ + unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ + unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ - GLuint logicop_enable:1; - GLuint logicop_func:4; /**< PIPE_LOGICOP_x */ + unsigned logicop_enable:1; + unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ - GLuint colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ - GLuint dither:1; + unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ + unsigned dither:1; }; struct pipe_blend_color { - GLfloat color[4]; + float color[4]; }; struct pipe_clear_color_state { - GLfloat color[4]; + float color[4]; }; struct pipe_stencil_state { - GLuint front_enabled:1; - GLuint front_func:3; /**< PIPE_FUNC_x */ - GLuint front_fail_op:3; /**< PIPE_STENCIL_OP_x */ - 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; /**< 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; + unsigned front_enabled:1; + unsigned front_func:3; /**< PIPE_FUNC_x */ + unsigned front_fail_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned front_zpass_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned front_zfail_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned back_enabled:1; + unsigned back_func:3; /**< PIPE_FUNC_x */ + unsigned back_fail_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned back_zpass_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned back_zfail_op:3; /**< PIPE_STENCIL_OP_x */ + ubyte ref_value[2]; /**< [0] = front, [1] = back */ + ubyte value_mask[2]; + ubyte write_mask[2]; + ubyte clear_value; }; struct pipe_framebuffer_state { /** multiple colorbuffers for multiple render targets */ - GLuint num_cbufs; + unsigned num_cbufs; struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; struct pipe_surface *zbuf; /**< Z buffer */ @@ -213,25 +203,25 @@ struct pipe_framebuffer_state */ struct pipe_sampler_state { - GLuint wrap_s:3; /**< PIPE_TEX_WRAP_x */ - GLuint wrap_t:3; /**< PIPE_TEX_WRAP_x */ - GLuint wrap_r:3; /**< PIPE_TEX_WRAP_x */ - GLuint min_img_filter:2; /**< PIPE_TEX_FILTER_x */ - GLuint min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ - GLuint mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ - GLuint compare:1; /**< shadow/depth compare enabled? */ - GLenum compare_mode:1; /**< PIPE_TEX_COMPARE_x */ - GLenum compare_func:3; /**< PIPE_FUNC_x */ - GLfloat shadow_ambient; /**< shadow test fail color/intensity */ - GLfloat min_lod; - GLfloat max_lod; - GLfloat lod_bias; + unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ + unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ + unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ + unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ + unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ + unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ + unsigned compare:1; /**< shadow/depth compare enabled? */ + unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ + unsigned compare_func:3; /**< PIPE_FUNC_x */ + float shadow_ambient; /**< shadow test fail color/intensity */ + float min_lod; + float max_lod; + float lod_bias; #if 0 /* need these? */ - GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ - GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ - GLfloat border_color[4]; + int BaseLevel; /**< min mipmap level, OpenGL 1.2 */ + int MaxLevel; /**< max mipmap level, OpenGL 1.2 */ + float border_color[4]; #endif - GLfloat max_anisotropy; + float max_anisotropy; }; @@ -243,12 +233,12 @@ struct pipe_region { struct pipe_buffer_handle *buffer; /**< driver private buffer handle */ - GLuint refcount; /**< Reference count for region */ - GLuint cpp; /**< bytes per pixel */ - GLuint pitch; /**< in pixels */ - GLuint height; /**< in pixels */ - GLubyte *map; /**< only non-NULL when region is actually mapped */ - GLuint map_refcount; /**< Reference count for mapping */ + unsigned refcount; /**< Reference count for region */ + unsigned cpp; /**< bytes per pixel */ + unsigned pitch; /**< in pixels */ + unsigned height; /**< in pixels */ + ubyte *map; /**< only non-NULL when region is actually mapped */ + unsigned map_refcount; /**< Reference count for mapping */ }; @@ -259,18 +249,18 @@ struct pipe_region struct pipe_surface { struct pipe_region *region; - GLuint format:5; /**< PIPE_FORMAT_x */ - GLuint width, height; - GLuint offset; /**< offset from start of region, in bytes */ - GLint refcount; + unsigned format:5; /**< PIPE_FORMAT_x */ + unsigned width, height; + unsigned offset; /**< offset from start of region, in bytes */ + unsigned refcount; /** get block/tile of pixels from surface */ void (*get_tile)(struct pipe_surface *ps, - GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p); + unsigned x, unsigned y, unsigned w, unsigned h, float *p); /** put block/tile of pixels into surface */ void (*put_tile)(struct pipe_surface *ps, - GLuint x, GLuint y, GLuint w, GLuint h, const GLfloat *p); + unsigned x, unsigned y, unsigned w, unsigned h, const float *p); }; @@ -279,11 +269,11 @@ struct pipe_surface */ struct pipe_mipmap_level { - GLuint level_offset; - GLuint width; - GLuint height; - GLuint depth; - GLuint nr_images; + unsigned level_offset; + unsigned width; + unsigned height; + unsigned depth; + unsigned nr_images; /* Explicitly store the offset of each image for each cube face or * depth value. Pretty much have to accept that hardware formats @@ -291,33 +281,34 @@ struct pipe_mipmap_level * compute the offsets of depth/cube images within a mipmap level, * so have to store them as a lookup table: */ - GLuint *image_offset; /**< array [depth] of offsets */ + unsigned *image_offset; /**< array [depth] of offsets */ }; struct pipe_mipmap_tree { /* Effectively the key: */ - GLenum target; /* XXX convert to PIPE_TEXTURE_x */ - GLenum internal_format; /* XXX convert to PIPE_FORMAT_x */ + unsigned target; /* XXX convert to PIPE_TEXTURE_x */ + unsigned internal_format; /* XXX convert to PIPE_FORMAT_x */ + + unsigned format; /**< PIPE_FORMAT_x */ + unsigned first_level; + unsigned last_level; - GLuint format; /**< PIPE_FORMAT_x */ - GLuint first_level; - GLuint last_level; + unsigned width0, height0, depth0; /**< Level zero image dimensions */ + unsigned cpp; - GLuint width0, height0, depth0; /**< Level zero image dimensions */ - GLuint cpp; - GLboolean compressed; + unsigned compressed:1; /* Derived from the above: */ - GLuint pitch; - GLuint depth_pitch; /* per-image on i945? */ - GLuint total_height; + unsigned pitch; + unsigned depth_pitch; /* per-image on i945? */ + unsigned total_height; /* Includes image offset tables: */ - struct pipe_mipmap_level level[MAX_TEXTURE_LEVELS]; + struct pipe_mipmap_level level[PIPE_MAX_TEXTURE_LEVELS]; /* The data is held here: */ @@ -325,7 +316,7 @@ struct pipe_mipmap_tree /* These are also refcounted: */ - GLuint refcount; + unsigned refcount; }; |