p_state.h revision 5531c986bd34457e113163a68ff4ab98394738f0
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/** 30f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Abstract graphics pipe state objects. 31f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * 32f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Basic notes: 33f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * 1. Want compact representations, so we use bitfields. 34f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * 2. Put bitfields before other (GLfloat) fields. 35f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 36f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian 37f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian 38943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#ifndef PIPE_STATE_H 39943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#define PIPE_STATE_H 408e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 4140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell#include "p_compiler.h" 421c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer#include "p_defines.h" 4354fc80ab31f89520d3119196bfa9c6332b35fe2fBrian#include "p_format.h" 4413682d959ddacde1ce65843aa8c5b43dc9017b32Brian 45e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 46e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 47e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonsecaextern "C" { 48e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 49e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 50e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 5113682d959ddacde1ce65843aa8c5b43dc9017b32Brian/** 5213682d959ddacde1ce65843aa8c5b43dc9017b32Brian * Implementation limits 5313682d959ddacde1ce65843aa8c5b43dc9017b32Brian */ 54da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_ATTRIBS 32 55da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_CLIP_PLANES 6 56da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_COLOR_BUFS 8 57da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_CONSTANT 32 58da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SAMPLERS 16 59da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SHADER_INPUTS 16 60da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SHADER_OUTPUTS 16 61da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_TEXTURE_LEVELS 16 6213682d959ddacde1ce65843aa8c5b43dc9017b32Brian 6313682d959ddacde1ce65843aa8c5b43dc9017b32Brian 6450eb29ed9492a34db4ba53f1f28a2868b808955aBrian/* fwd decls */ 65aa59a937ccf41609081d3f9a4973df5478979785Brianstruct pipe_screen; 66e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_surface; 6750eb29ed9492a34db4ba53f1f28a2868b808955aBrianstruct pipe_winsys; 68e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 691e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell 701e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell 711e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell/** 721e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell * The driver will certainly subclass this to include actual memory 731e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell * management information. 741e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell */ 75d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_buffer 76d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 771e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell unsigned alignment; 781e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell unsigned usage; 791e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell unsigned size; 801e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell 811e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell /** Reference count */ 821e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell unsigned refcount; 831e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell}; 841e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell 85bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian 86f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 87294401814d1d89cc731de1c22c25333aa5d59374Zack Rusin * Primitive (point/line/tri) rasterization info 88f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 89294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstruct pipe_rasterizer_state 90f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{ 9140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned flatshade:1; 9240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned light_twoside:1; 9340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_winding:2; /**< PIPE_WINDING_x */ 9440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cull_mode:2; /**< PIPE_WINDING_x */ 9540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */ 9640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ 9740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_cw:1; 9840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_ccw:1; 9940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned scissor:1; 10040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_smooth:1; 10140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_stipple_enable:1; 10240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned point_smooth:1; 103cd4d732773e06e462e78b8f5bc9f3f1552a198acBrian unsigned point_sprite:1; 104beefc6011bce9e99cb46430186de1c13f027cb05Brian unsigned point_size_per_vertex:1; /**< size computed in vertex shader */ 10540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned multisample:1; /* XXX maybe more ms state in future */ 10640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_smooth:1; 10740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_enable:1; 10840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_factor:8; /**< [1..256] actually */ 10940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_pattern:16; 11099691f38c278f1d4aeb0617b149109644e3571fbKeith Whitwell unsigned line_last_pixel:1; 111f361edae5d495254f4bc27473bf24b1ac7d5af06Brian unsigned bypass_clipping:1; 11223b03c536daa47b53e585fa98476bad96eb73529Brian unsigned bypass_vs:1; /**< Skip the vertex shader. Note that the shader is 11323b03c536daa47b53e585fa98476bad96eb73529Brian still needed though, to indicate inputs/outputs */ 114017f862de1f857bca29f09794539aaf411014f13Brian unsigned origin_lower_left:1; /**< Is (0,0) the lower-left corner? */ 115dc9757e1a8a0451a198d329880558b805adff42aMichal Krol unsigned flatshade_first:1; /**< take color attribute from the first vertex of a primitive */ 1168e33194837dd206d920889851d9cf22190100c99Keith Whitwell unsigned gl_rasterization_rules:1; /**< enable tweaks for GL rasterization? */ 11740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 11840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float line_width; 11940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float point_size; /**< used when no per-vertex size */ 120bc739440c29c551fcc44e9e12d0d9c170d8d24fbKeith Whitwell float point_size_min; /* XXX - temporary, will go away */ 121bc739440c29c551fcc44e9e12d0d9c170d8d24fbKeith Whitwell float point_size_max; /* XXX - temporary, will go away */ 12240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_units; 12340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_scale; 1241b4852345954af9b582b03a91a3d8399b8fb0e92Brian ubyte sprite_coord_mode[PIPE_MAX_SHADER_OUTPUTS]; /**< PIPE_SPRITE_COORD_ */ 1258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 12763a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian 128d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_poly_stipple 129d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 13040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned stipple[32]; 1318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1338e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 134d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_viewport_state 135d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 13640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float scale[4]; 13740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float translate[4]; 1388e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1398e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 14050eb29ed9492a34db4ba53f1f28a2868b808955aBrian 141d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_scissor_state 142d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 14340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned minx:16; 14440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned miny:16; 14540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxx:16; 14640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxy:16; 1478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 14950eb29ed9492a34db4ba53f1f28a2868b808955aBrian 150d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_clip_state 151d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 15240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ucp[PIPE_MAX_CLIP_PLANES][4]; 15340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr; 1548e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1564824c342c864e870251a7d343c95e51274e50d23Keith Whitwell 157c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian/** 158c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian * Constants for vertex/fragment shaders 159c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian */ 160d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_constant_buffer 161d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 1621e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell struct pipe_buffer *buffer; 16399691f38c278f1d4aeb0617b149109644e3571fbKeith Whitwell unsigned size; /** in bytes (XXX: redundant!) */ 1648e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1658e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1668e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 167d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_shader_state 168d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 16943d7c1fe9d2544b851afa2f1c1e245a63860e670Brian const struct tgsi_token *tokens; 17043d7c1fe9d2544b851afa2f1c1e245a63860e670Brian}; 17143d7c1fe9d2544b851afa2f1c1e245a63860e670Brian 17250eb29ed9492a34db4ba53f1f28a2868b808955aBrian 173ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonsecastruct pipe_depth_state { 174ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< depth test enabled? */ 175ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned writemask:1; /**< allow depth buffer writes? */ 176ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ 177ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned occlusion_count:1; /**< do occlusion counting? */ 178ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 179ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 180ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 181ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonsecastruct pipe_stencil_state { 182ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */ 183ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 184ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */ 185ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */ 186ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */ 187ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca ubyte ref_value; 188ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca ubyte value_mask; 189ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca ubyte write_mask; 190ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 191ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 192ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 193ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonsecastruct pipe_alpha_state { 194ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; 195ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 196ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca float ref; /**< reference value */ 197ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 198ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 199ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 200bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwellstruct pipe_depth_stencil_alpha_state 2018f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 202ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_depth_state depth; 203ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_stencil_state stencil[2]; /**< [0] = front, [1] = back */ 204ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_alpha_state alpha; 205493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian}; 2068f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 207bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell 208d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_blend_state 209d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 21040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned blend_enable:1; 2118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 21240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_func:3; /**< PIPE_BLEND_x */ 21340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 21440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 21640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_func:3; /**< PIPE_BLEND_x */ 21740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 21840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 22040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_enable:1; 22140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ 22286352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian 22340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ 22440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned dither:1; 2258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 22750eb29ed9492a34db4ba53f1f28a2868b808955aBrian 228d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_blend_color 229d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 23040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 2318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 23350eb29ed9492a34db4ba53f1f28a2868b808955aBrian 2348f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 2358f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 23680567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian unsigned width, height; 23780567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian 238f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian /** multiple colorbuffers for multiple render targets */ 23940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned num_cbufs; 240f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; 241f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian 2428de2331e432e2ea6f978acb6c80666da99c6c4a1Brian struct pipe_surface *zsbuf; /**< Z/stencil buffer */ 2438f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 2448f6b6eed35832733674372dea7bd5ce69a965c4eBrian 2458f6b6eed35832733674372dea7bd5ce69a965c4eBrian 24602a47549ad182d28d330063d4f452108e3a4b452Brian/** 24702a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 24802a47549ad182d28d330063d4f452108e3a4b452Brian */ 249943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 25002a47549ad182d28d330063d4f452108e3a4b452Brian{ 251d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ 252d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ 253d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ 25440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ 25540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ 25640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ 257d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 258d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_func:3; /**< PIPE_FUNC_x */ 259d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ 26099691f38c278f1d4aeb0617b149109644e3571fbKeith Whitwell unsigned prefilter:4; /**< Wierd sampling state exposed by some api's */ 261d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float shadow_ambient; /**< shadow test fail color/intensity */ 262d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float lod_bias; /**< LOD/lambda bias */ 263d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float min_lod, max_lod; /**< LOD clamp range, after bias */ 264d45dd5672ae60f1f49648725974693bf4ebf4bf8Brian float border_color[4]; 26540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float max_anisotropy; 26602a47549ad182d28d330063d4f452108e3a4b452Brian}; 26702a47549ad182d28d330063d4f452108e3a4b452Brian 2685d69aeb0028f44d06093faede5c545908b0df89aBrian 26920adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/** 270b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer * 2D surface. This is basically a view into a memory buffer. 27120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc. 27220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */ 27320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface 27420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{ 275d4d2e36a429fd015316c484fc40be7e6d2c69946Brian struct pipe_buffer *buffer; /**< surface's buffer/memory */ 27654fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format format; /**< PIPE_FORMAT_x */ 277dd5a8d234b95c6f85d0a6ecb18db8aadefb71dbdBrian unsigned status; /**< PIPE_SURFACE_STATUS_x */ 278d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned clear_value; /**< XXX may be temporary */ 2795531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned width; /**< logical width in pixels */ 2805531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned height; /**< logical height in pixels */ 2814ddd65967915ca4846f2831bc676c878a29dae4aJosé Fonseca struct pipe_format_block block; 2825531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned nblocksx; /**< allocated width in blocks */ 2835531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned nblocksy; /**< allocated height in blocks */ 2845531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned stride; /**< stride in bytes between rows of blocks */ 2858e6a3807981bb96bb6747683dbc9f92ae7117dd2Keith Whitwell unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */ 286b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer unsigned offset; /**< offset from start of buffer, in bytes */ 28740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; 288429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger unsigned usage; /**< PIPE_BUFFER_USAGE_* */ 289c9ed86a96483063f3d6789ed16645a3dca77d726Keith Whitwell 2907d1a04e499564212a2a9aace12b05f424a357d3fBrian struct pipe_winsys *winsys; /**< winsys which owns/created the surface */ 291c9ed86a96483063f3d6789ed16645a3dca77d726Keith Whitwell 292c9ed86a96483063f3d6789ed16645a3dca77d726Keith Whitwell struct pipe_texture *texture; /**< optional texture into which this is a view */ 293b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned face; 294b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned level; 295b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned zslice; 29620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian}; 29720adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 29820adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 2995d69aeb0028f44d06093faede5c545908b0df89aBrian/** 300d8bf051c8b4a1ebe44895413a109d4ab898f7579Brian * Texture object. 301d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 302753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzerstruct pipe_texture 303753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer{ 3041c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ 3051c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_format format; /**< PIPE_FORMAT_x */ 30688723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer 307753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer unsigned width[PIPE_MAX_TEXTURE_LEVELS]; 308753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer unsigned height[PIPE_MAX_TEXTURE_LEVELS]; 309753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer unsigned depth[PIPE_MAX_TEXTURE_LEVELS]; 310d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 3114ddd65967915ca4846f2831bc676c878a29dae4aJosé Fonseca struct pipe_format_block block; 3125531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */ 3135531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated height in blocks */ 3144ddd65967915ca4846f2831bc676c878a29dae4aJosé Fonseca 31518e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned last_level:8; /**< Index of last mipmap level present/defined */ 31640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compressed:1; 317429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger 318429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ 319429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger 320a73ae3d5eb8419feab5aea26573aa41b72f941ebKeith Whitwell unsigned tex_usage; /* PIPE_TEXTURE_USAGE_* */ 321d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 322d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* These are also refcounted: 323d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 32440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; 3254da19dbcaa9f3e2d20fffd0145bf0bc756dd7542Brian 326d8bf051c8b4a1ebe44895413a109d4ab898f7579Brian struct pipe_screen *screen; /**< screen that this texture belongs to */ 327d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 328d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 329d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 3306e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3316e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer. Typically, all the vertex data/attributes for 3326e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer. But it's also possible, for 3336e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another. 3346e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3358269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer 3368269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 33718e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned pitch; /**< stride to same attrib in next vertex, in bytes */ 3386e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned max_index; /**< number of vertices in this buffer */ 3396e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 3401e0d30a515e4cac891b6c590f12a33e0e8a8e295Keith Whitwell struct pipe_buffer *buffer; /**< the actual buffer */ 3418269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3428269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3438269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3446e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3456e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc) 3466e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3478269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element 3488269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 3496e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Offset of this attribute, in bytes, from the start of the vertex */ 35018e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned src_offset; 3516e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 3526e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does 3536e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * this attribute live in? 3546e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 35518e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned vertex_buffer_index:8; 35618e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned nr_components:8; 357c31416971e4eac148f8e82d6c4392bd6f9cbc05dKeith Whitwell 35854fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format src_format; /**< PIPE_FORMAT_* */ 3598269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3608269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3618269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 362e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 363e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca} 364e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 365e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 3668e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 367