p_state.h revision 8f6b6eed35832733674372dea7bd5ce69a965c4e
18e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/************************************************************************** 28e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 38e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 48e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * All Rights Reserved. 58e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 68e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 78e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * copy of this software and associated documentation files (the 88e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * "Software"), to deal in the Software without restriction, including 98e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish, 108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to 118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to 128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * the following conditions: 138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * The above copyright notice and this permission notice (including the 158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * next paragraph) shall be included in all copies or substantial portions 168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * of the Software. 178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell **************************************************************************/ 278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 28943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#ifndef PIPE_STATE_H 29943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#define PIPE_STATE_H 308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#include "mtypes.h" 328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#include "vf/vf.h" 338e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define WINDING_NONE 0 358e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define WINDING_CW 1 368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define WINDING_CCW 2 378e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define WINDING_BOTH (WINDING_CW | WINDING_CCW) 388e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 398e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define FILL_POINT 1 408e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define FILL_LINE 2 418e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define FILL_TRI 3 428e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 43943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_setup_state { 448e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint flatshade:1; 458e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint light_twoside:1; 468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint front_winding:2; 488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 498e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint cull_mode:2; 508e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint fill_cw:2; 528e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint fill_ccw:2; 538e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 548e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint offset_cw:1; 558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint offset_ccw:1; 568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint scissor:1; 588e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint poly_stipple:1; 598e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 608e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint pad:18; 618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLfloat offset_units; 638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLfloat offset_scale; 648e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 658e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 66943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_poly_stipple { 678e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint stipple[32]; 688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 698e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 708e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 71943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_viewport { 728e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLfloat scale[4]; 738e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLfloat translate[4]; 748e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 758e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 76943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_scissor_rect { 778e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLshort minx; 788e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLshort miny; 798e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLshort maxx; 808e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLshort maxy; 818e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 828e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 838e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 84943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#define PIPE_MAX_CLIP_PLANES 6 85f889ad21da2009f8d49d53a3fa03795e826fb56aBrian 86943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_clip_state { 87943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLfloat ucp[PIPE_MAX_CLIP_PLANES][4]; 888e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint nr; 898e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 908e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 91943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_fs_state { 928e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell struct gl_fragment_program *fp; 938e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 948e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 95943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#define PIPE_MAX_CONSTANT 32 968e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 97943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_constant_buffer { 98943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLfloat constant[PIPE_MAX_CONSTANT][4]; 998e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint nr_constants; 1008e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1018e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1028e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 103943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_depth_state 1048f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 1058f2888758129b0a40d71fa4ce10d606b4bcf7631Brian GLuint enabled:1; /**< depth test enabled? */ 1068f2888758129b0a40d71fa4ce10d606b4bcf7631Brian GLuint writemask:1; /**< allow depth buffer writes? */ 1078f2888758129b0a40d71fa4ce10d606b4bcf7631Brian GLuint func:3; /**< depth test func */ 1088f2888758129b0a40d71fa4ce10d606b4bcf7631Brian GLfloat clear; /**< Clear value in [0,1] (XXX correct place?) */ 1098f2888758129b0a40d71fa4ce10d606b4bcf7631Brian}; 1108f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 1118f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 112943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_blend_state { 1138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint blend_enable:1; 1148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1156debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint rgb_func:3; 1166debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint rgb_src_factor:5; 1176debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint rgb_dst_factor:5; 1188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1196debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint alpha_func:3; 1206debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint alpha_src_factor:5; 1216debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint alpha_dst_factor:5; 1228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint logicop_enable:1; 1246debc8078a7170c26d826e62e2b6542e85813a6cBrian GLuint logicop_func:4; 1258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 127943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_blend_color { 1288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLfloat color[4]; 1298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 132943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_stencil_state { 133008fb50174fb6717f3b71836427bc6be4e44613cBrian GLuint front_enabled:1; 134943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint front_func:3; /**< PIPE_STENCIL_FUNC_x */ 135943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint front_fail_op:3; /**< PIPE_STENCIL_OP_x */ 136943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint front_zpass_op:3; /**< PIPE_STENCIL_OP_x */ 137943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint front_zfail_op:3; /**< PIPE_STENCIL_OP_x */ 138008fb50174fb6717f3b71836427bc6be4e44613cBrian GLuint back_enabled:1; 139008fb50174fb6717f3b71836427bc6be4e44613cBrian GLuint back_func:3; 140008fb50174fb6717f3b71836427bc6be4e44613cBrian GLuint back_fail_op:3; 141008fb50174fb6717f3b71836427bc6be4e44613cBrian GLuint back_zpass_op:3; 142008fb50174fb6717f3b71836427bc6be4e44613cBrian GLuint back_zfail_op:3; 143cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian GLubyte ref_value[2]; /**< [0] = front, [1] = back */ 144cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian GLubyte value_mask[2]; 145cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian GLubyte write_mask[2]; 146cbe4dbef8e8e9ff29d64ca588e81c2bb079d99f1Brian GLubyte clear_value; 147008fb50174fb6717f3b71836427bc6be4e44613cBrian}; 148008fb50174fb6717f3b71836427bc6be4e44613cBrian 149008fb50174fb6717f3b71836427bc6be4e44613cBrian 150943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell/* This will change for hardware pipes... 1518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 1528f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_surface 1538f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 1548f6b6eed35832733674372dea7bd5ce69a965c4eBrian GLuint width, height; 1558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLubyte *ptr; 1568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLint stride; 1578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint cpp; 1588e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell GLuint format; 1598e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1608e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1628f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 1638f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 1648f6b6eed35832733674372dea7bd5ce69a965c4eBrian GLuint num_cbufs; /**< Number of color bufs to draw to */ 1658f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *cbufs[4]; /**< OpenGL can write to as many as 1668f6b6eed35832733674372dea7bd5ce69a965c4eBrian 4 color buffers at once */ 1678f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *zbuf; /**< Z buffer */ 1688f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *sbuf; /**< Stencil buffer */ 1698f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *abuf; /**< Accum buffer */ 1708f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 1718f6b6eed35832733674372dea7bd5ce69a965c4eBrian 1728f6b6eed35832733674372dea7bd5ce69a965c4eBrian 17302a47549ad182d28d330063d4f452108e3a4b452Brian/** 17402a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 17502a47549ad182d28d330063d4f452108e3a4b452Brian */ 176943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 17702a47549ad182d28d330063d4f452108e3a4b452Brian{ 178943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint wrap_s:3; /**< PIPE_TEX_WRAP_x */ 179943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint wrap_t:3; /**< PIPE_TEX_WRAP_x */ 180943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint wrap_r:3; /**< PIPE_TEX_WRAP_x */ 181943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint min_filter:3; /**< PIPE_TEX_FILTER_x */ 182943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLuint mag_filter:1; /**< PIPE_TEX_FILTER_LINEAR or _NEAREST */ 18302a47549ad182d28d330063d4f452108e3a4b452Brian GLfloat min_lod; 18402a47549ad182d28d330063d4f452108e3a4b452Brian GLfloat max_lod; 18502a47549ad182d28d330063d4f452108e3a4b452Brian GLfloat lod_bias; 18602a47549ad182d28d330063d4f452108e3a4b452Brian#if 0 /* need these? */ 18702a47549ad182d28d330063d4f452108e3a4b452Brian GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ 18802a47549ad182d28d330063d4f452108e3a4b452Brian GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ 18902a47549ad182d28d330063d4f452108e3a4b452Brian#endif 19002a47549ad182d28d330063d4f452108e3a4b452Brian GLfloat max_anisotropy; 19102a47549ad182d28d330063d4f452108e3a4b452Brian GLuint compare:1; /**< shadow/depth compare enabled? */ 192943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLenum compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 193943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell GLenum compare_func:3; /**< PIPE_DEPTH_FUNC_x */ 19402a47549ad182d28d330063d4f452108e3a4b452Brian GLfloat shadow_ambient; /**< shadow test fail color/intensity */ 19502a47549ad182d28d330063d4f452108e3a4b452Brian}; 19602a47549ad182d28d330063d4f452108e3a4b452Brian 1978e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 198