p_state.h revision 1a859ecf4a4728cb321b1f68d51491cd285a3c03
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 28f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian 29f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 30984a7c4e9c42cf8ddfcff5b880b522a6dd58bce2José Fonseca * @file 31984a7c4e9c42cf8ddfcff5b880b522a6dd58bce2José Fonseca * 32f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Abstract graphics pipe state objects. 33f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * 34f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Basic notes: 35f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * 1. Want compact representations, so we use bitfields. 36f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * 2. Put bitfields before other (GLfloat) fields. 37f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 38f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian 39f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian 40943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#ifndef PIPE_STATE_H 41943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#define PIPE_STATE_H 428e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 4340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell#include "p_compiler.h" 441c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer#include "p_defines.h" 4554fc80ab31f89520d3119196bfa9c6332b35fe2fBrian#include "p_format.h" 465e27cd46c04a9e7b5904cc014bffd0f4daae31feMichel Dänzer#include "p_screen.h" 4713682d959ddacde1ce65843aa8c5b43dc9017b32Brian 48e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 49e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 50e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonsecaextern "C" { 51e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 52e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 53e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 5413682d959ddacde1ce65843aa8c5b43dc9017b32Brian/** 5513682d959ddacde1ce65843aa8c5b43dc9017b32Brian * Implementation limits 5613682d959ddacde1ce65843aa8c5b43dc9017b32Brian */ 57da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_ATTRIBS 32 58da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_CLIP_PLANES 6 59da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_COLOR_BUFS 8 607c5f255201f42303188137f56ea8acc030444f0eMichal Krol#define PIPE_MAX_CONSTANT_BUFFERS 32 61da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SAMPLERS 16 6215d1b406afd733b5f46b16dc933e29c218cdca39Michal Krol#define PIPE_MAX_VERTEX_SAMPLERS 16 63da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SHADER_INPUTS 16 64da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SHADER_OUTPUTS 16 65da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_TEXTURE_LEVELS 16 6613682d959ddacde1ce65843aa8c5b43dc9017b32Brian 6713682d959ddacde1ce65843aa8c5b43dc9017b32Brian 6838f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonsecastruct pipe_reference 6938f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca{ 7038f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca int32_t count; /* atomic */ 7138f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca}; 7238f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca 7338f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca 741e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell/** 751e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell * The driver will certainly subclass this to include actual memory 761e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell * management information. 771e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell */ 78d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_buffer 79d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 80124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin struct pipe_reference reference; 81124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin unsigned size; 82124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin struct pipe_screen *screen; 83124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin unsigned alignment; 84124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin unsigned usage; 851e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell}; 861e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell 87bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian 88f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 89294401814d1d89cc731de1c22c25333aa5d59374Zack Rusin * Primitive (point/line/tri) rasterization info 90f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 91294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstruct pipe_rasterizer_state 92f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{ 9340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned flatshade:1; 9440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned light_twoside:1; 9540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_winding:2; /**< PIPE_WINDING_x */ 9640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cull_mode:2; /**< PIPE_WINDING_x */ 9740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */ 9840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ 9940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_cw:1; 10040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_ccw:1; 10140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned scissor:1; 10240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_smooth:1; 10340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_stipple_enable:1; 10440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned point_smooth:1; 1054a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger unsigned sprite_coord_enable:PIPE_MAX_SHADER_OUTPUTS; 1064a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger unsigned sprite_coord_mode:1; /**< PIPE_SPRITE_COORD_ */ 10768f93ea3eb83cfad014b8ec93cec3564c1aa9833Roland Scheidegger unsigned point_quad_rasterization:1; /** points rasterized as quads or points */ 108beefc6011bce9e99cb46430186de1c13f027cb05Brian unsigned point_size_per_vertex:1; /**< size computed in vertex shader */ 10940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned multisample:1; /* XXX maybe more ms state in future */ 11040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_smooth:1; 11140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_enable:1; 11240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_factor:8; /**< [1..256] actually */ 11340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_pattern:16; 11499691f38c278f1d4aeb0617b149109644e3571fbKeith Whitwell unsigned line_last_pixel:1; 115683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell 116683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell /** 117683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell * Vertex coordinates are pre-transformed to screen space. Skip 118683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell * the vertex shader, clipping and viewport processing. Note that 119683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell * a vertex shader is still needed though, to indicate the mapping 120683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell * from vertex elements to fragment shader input semantics. 121a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 122a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * XXX: considered for removal. 123683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell */ 124683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell unsigned bypass_vs_clip_and_viewport:1; 125683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell 126a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell /** 127a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * Use the first vertex of a primitive as the provoking vertex for 128a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * flat shading. 129a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell */ 130a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell unsigned flatshade_first:1; 131a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell 132a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell /** 133a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * When true, triangle rasterization uses (0.5, 0.5) pixel centers 134a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * for determining pixel ownership. 135a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 136a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * When false, triangle rasterization uses (0,0) pixel centers for 137a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * determining pixel ownership. 138a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 139a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * Triangle rasterization always uses a 'top,left' rule for pixel 140a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * ownership, this just alters which point we consider the pixel 141a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * center for that test. 142a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell */ 143a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell unsigned gl_rasterization_rules:1; 14440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 14540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float line_width; 14640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float point_size; /**< used when no per-vertex size */ 14740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_units; 14840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_scale; 1498e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1508e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 15163a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian 152d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_poly_stipple 153d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 15440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned stipple[32]; 1558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 158d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_viewport_state 159d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 16040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float scale[4]; 16140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float translate[4]; 1628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 16450eb29ed9492a34db4ba53f1f28a2868b808955aBrian 165d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_scissor_state 166d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 16740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned minx:16; 16840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned miny:16; 16940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxx:16; 17040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxy:16; 1718e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1728e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 17350eb29ed9492a34db4ba53f1f28a2868b808955aBrian 174d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_clip_state 175d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 17640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ucp[PIPE_MAX_CLIP_PLANES][4]; 17740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr; 1788e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1798e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1804824c342c864e870251a7d343c95e51274e50d23Keith Whitwell 181d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_shader_state 182d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 18343d7c1fe9d2544b851afa2f1c1e245a63860e670Brian const struct tgsi_token *tokens; 18443d7c1fe9d2544b851afa2f1c1e245a63860e670Brian}; 18543d7c1fe9d2544b851afa2f1c1e245a63860e670Brian 18650eb29ed9492a34db4ba53f1f28a2868b808955aBrian 187b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_depth_state 188b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 189ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< depth test enabled? */ 190ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned writemask:1; /**< allow depth buffer writes? */ 191ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ 192ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 193ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 194ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 195b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_stencil_state 196b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 197ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */ 198ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 199ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */ 200ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */ 201ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */ 202a7e72231e3c76a9410d192441da309002ea6422dZack Rusin ubyte valuemask; 203a7e72231e3c76a9410d192441da309002ea6422dZack Rusin ubyte writemask; 204ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 205ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 206ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 207b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_alpha_state 208b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 209ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; 210ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 211d6888e811d24eaa7e8d9093be606394f00435c05Zack Rusin float ref_value; /**< reference value */ 212ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 213ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 214ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 215bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwellstruct pipe_depth_stencil_alpha_state 2168f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 217ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_depth_state depth; 218ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_stencil_state stencil[2]; /**< [0] = front, [1] = back */ 219ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_alpha_state alpha; 220493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian}; 2218f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 222bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell 223bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheideggerstruct pipe_rt_blend_state 224d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 22540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned blend_enable:1; 2268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 22740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_func:3; /**< PIPE_BLEND_x */ 22840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 22940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 23140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_func:3; /**< PIPE_BLEND_x */ 23240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 23340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 235bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ 236bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger}; 237bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger 238bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheideggerstruct pipe_blend_state 239bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger{ 240bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger unsigned independent_blend_enable:1; 24140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_enable:1; 24240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ 24340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned dither:1; 244bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS]; 2458e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 24750eb29ed9492a34db4ba53f1f28a2868b808955aBrian 248d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_blend_color 249d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 25040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 2518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2528e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 2531a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheideggerstruct pipe_stencil_ref 2541a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger{ 2551a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger ubyte ref_value[2]; 2561a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger}; 25750eb29ed9492a34db4ba53f1f28a2868b808955aBrian 2588f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 2598f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 26080567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian unsigned width, height; 26180567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian 262f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian /** multiple colorbuffers for multiple render targets */ 2632299f21f8da816fc4588492965e7dac422da1a96Zack Rusin unsigned nr_cbufs; 264f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; 265f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian 2668de2331e432e2ea6f978acb6c80666da99c6c4a1Brian struct pipe_surface *zsbuf; /**< Z/stencil buffer */ 2678f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 2688f6b6eed35832733674372dea7bd5ce69a965c4eBrian 2698f6b6eed35832733674372dea7bd5ce69a965c4eBrian 27002a47549ad182d28d330063d4f452108e3a4b452Brian/** 27102a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 27202a47549ad182d28d330063d4f452108e3a4b452Brian */ 273943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 27402a47549ad182d28d330063d4f452108e3a4b452Brian{ 275d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ 276d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ 277d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ 27840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ 27940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ 28040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ 281d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 282d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_func:3; /**< PIPE_FUNC_x */ 283d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ 284d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float lod_bias; /**< LOD/lambda bias */ 285d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float min_lod, max_lod; /**< LOD clamp range, after bias */ 286d45dd5672ae60f1f49648725974693bf4ebf4bf8Brian float border_color[4]; 28740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float max_anisotropy; 28802a47549ad182d28d330063d4f452108e3a4b452Brian}; 28902a47549ad182d28d330063d4f452108e3a4b452Brian 2905d69aeb0028f44d06093faede5c545908b0df89aBrian 29120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/** 292b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer * 2D surface. This is basically a view into a memory buffer. 29320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc. 29420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */ 29520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface 29620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{ 2975e27cd46c04a9e7b5904cc014bffd0f4daae31feMichel Dänzer struct pipe_reference reference; 29854fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format format; /**< PIPE_FORMAT_x */ 2995531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned width; /**< logical width in pixels */ 3005531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned height; /**< logical height in pixels */ 3018e6a3807981bb96bb6747683dbc9f92ae7117dd2Keith Whitwell unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */ 302b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer unsigned offset; /**< offset from start of buffer, in bytes */ 303429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger unsigned usage; /**< PIPE_BUFFER_USAGE_* */ 304c9ed86a96483063f3d6789ed16645a3dca77d726Keith Whitwell 305124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin unsigned zslice; 3065897383344da3320d158c26adae05de35480471fJosé Fonseca struct pipe_texture *texture; /**< texture into which this is a view */ 307b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned face; 308b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned level; 30920adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian}; 31020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 31120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 3125d69aeb0028f44d06093faede5c545908b0df89aBrian/** 3134617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer * Transfer object. For data transfer to/from a texture. 3144617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer */ 3154617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzerstruct pipe_transfer 3164617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer{ 3174617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned x; /**< x offset from start of texture image */ 3184617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned y; /**< y offset from start of texture image */ 3194617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned width; /**< logical width in pixels */ 3204617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned height; /**< logical height in pixels */ 3214617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned stride; /**< stride in bytes between rows of blocks */ 322a18301790cf2b6f494284cdda6eea8bb1ceacd8eJosé Fonseca enum pipe_transfer_usage usage; /**< PIPE_TRANSFER_* */ 3234617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 3244617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer struct pipe_texture *texture; /**< texture to transfer to/from */ 3254617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned face; 3264617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned level; 3274617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer unsigned zslice; 3284617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer}; 3294617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 3304617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 3314617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer/** 332d8bf051c8b4a1ebe44895413a109d4ab898f7579Brian * Texture object. 333d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 334753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzerstruct pipe_texture 335753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer{ 3365e27cd46c04a9e7b5904cc014bffd0f4daae31feMichel Dänzer struct pipe_reference reference; 3375e27cd46c04a9e7b5904cc014bffd0f4daae31feMichel Dänzer 3381c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ 3391c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_format format; /**< PIPE_FORMAT_x */ 34088723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer 341683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned width0; 342683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned height0; 343683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned depth0; 344d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 34518e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned last_level:8; /**< Index of last mipmap level present/defined */ 346429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger 347b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ 348429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger 349b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul unsigned tex_usage; /* PIPE_TEXTURE_USAGE_* */ 350d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 351d8bf051c8b4a1ebe44895413a109d4ab898f7579Brian struct pipe_screen *screen; /**< screen that this texture belongs to */ 352d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 353d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 354d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 3556e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3566e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer. Typically, all the vertex data/attributes for 3576e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer. But it's also possible, for 3586e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another. 3596e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3608269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer 3618269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 362872b515e8f0bb1be5bad85fd9d01529c71f07ba2Zack Rusin unsigned stride; /**< stride to same attrib in next vertex, in bytes */ 3636e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned max_index; /**< number of vertices in this buffer */ 3646e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 3651e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell struct pipe_buffer *buffer; /**< the actual buffer */ 3668269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3678269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3688269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3696e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3706e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc) 3716e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3728269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element 3738269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 3746e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Offset of this attribute, in bytes, from the start of the vertex */ 37518e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned src_offset; 3766e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 377f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol /** Instance data rate divisor. 0 means this is per-vertex data, 378f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol * n means per-instance data used for n consecutive instances (n > 0). 379f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol */ 380f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol unsigned instance_divisor; 381f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol 3826e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does 3836e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * this attribute live in? 3846e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 38518e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned vertex_buffer_index:8; 38618e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned nr_components:8; 387c31416971e4eac148f8e82d6c4392bd6f9cbc05dKeith Whitwell 38854fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format src_format; /**< PIPE_FORMAT_* */ 3898269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3908269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3918269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 392e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 393e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca} 394e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 395e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 3968e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 397