p_state.h revision 8ff8c91893cee8b1893de91e145c8496a12ab9ca
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" 4613682d959ddacde1ce65843aa8c5b43dc9017b32Brian 47e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 48e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 49e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonsecaextern "C" { 50e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 51e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 52e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 5313682d959ddacde1ce65843aa8c5b43dc9017b32Brian/** 5413682d959ddacde1ce65843aa8c5b43dc9017b32Brian * Implementation limits 5513682d959ddacde1ce65843aa8c5b43dc9017b32Brian */ 56da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_ATTRIBS 32 578b06b0d19d8fbbc89fa87e29717bca207381024fPaul Berry#define PIPE_MAX_CLIP_PLANES 8 58da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_COLOR_BUFS 8 597c5f255201f42303188137f56ea8acc030444f0eMichal Krol#define PIPE_MAX_CONSTANT_BUFFERS 32 60da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_SAMPLERS 16 61b273928140479f089d45cd2dbc30708306b97ee0Brian Paul#define PIPE_MAX_SHADER_INPUTS 32 628ff8c91893cee8b1893de91e145c8496a12ab9caMarek Olšák#define PIPE_MAX_SHADER_OUTPUTS 48 /* 32 GENERICs + POS, PSIZE, FOG, etc. */ 635f55cbc7d93c6568566893f9345e43fff311a32bFrancisco Jerez#define PIPE_MAX_SHADER_SAMPLER_VIEWS 32 64bdbe77f9c6f06cfaa155f27c2ade3c523d7fbea7Zack Rusin#define PIPE_MAX_SHADER_RESOURCES 32 65da8934034b33adef5dc41395cfde4bdd26ba207cBrian#define PIPE_MAX_TEXTURE_LEVELS 16 66a45b7f47ee0e38b288cc8fc4f6a1c013e8c227bcZack Rusin#define PIPE_MAX_SO_BUFFERS 4 6713682d959ddacde1ce65843aa8c5b43dc9017b32Brian 6813682d959ddacde1ce65843aa8c5b43dc9017b32Brian 6938f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonsecastruct pipe_reference 7038f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca{ 7138f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca int32_t count; /* atomic */ 7238f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca}; 7338f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca 7438f6f23fcf37247fd709d1c612d08bfa9b124e69José Fonseca 75bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian 76f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 77294401814d1d89cc731de1c22c25333aa5d59374Zack Rusin * Primitive (point/line/tri) rasterization info 78f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 79294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstruct pipe_rasterizer_state 80f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{ 8140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned flatshade:1; 8240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned light_twoside:1; 8347e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri unsigned clamp_vertex_color:1; 8447e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri unsigned clamp_fragment_color:1; 850bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned front_ccw:1; 860bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned cull_face:2; /**< PIPE_FACE_x */ 870bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned fill_front:2; /**< PIPE_POLYGON_MODE_x */ 880bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned fill_back:2; /**< PIPE_POLYGON_MODE_x */ 890bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned offset_point:1; 900bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned offset_line:1; 910bd1cbcd0d28dbadfb0c3e1f8b048a18b56bc72cKeith Whitwell unsigned offset_tri:1; 9240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned scissor:1; 9340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_smooth:1; 9440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_stipple_enable:1; 9540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned point_smooth:1; 964a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger unsigned sprite_coord_mode:1; /**< PIPE_SPRITE_COORD_ */ 9768f93ea3eb83cfad014b8ec93cec3564c1aa9833Roland Scheidegger unsigned point_quad_rasterization:1; /** points rasterized as quads or points */ 98beefc6011bce9e99cb46430186de1c13f027cb05Brian unsigned point_size_per_vertex:1; /**< size computed in vertex shader */ 9940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned multisample:1; /* XXX maybe more ms state in future */ 10040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_smooth:1; 10140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_enable:1; 10299691f38c278f1d4aeb0617b149109644e3571fbKeith Whitwell unsigned line_last_pixel:1; 103683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell 10402b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák /** 105a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * Use the first vertex of a primitive as the provoking vertex for 106a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * flat shading. 107a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell */ 10802b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák unsigned flatshade_first:1; 109a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell 11002b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák /** 111a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * When true, triangle rasterization uses (0.5, 0.5) pixel centers 112a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * for determining pixel ownership. 113a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 114a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * When false, triangle rasterization uses (0,0) pixel centers for 115a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * determining pixel ownership. 116a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 117a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * Triangle rasterization always uses a 'top,left' rule for pixel 118a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * ownership, this just alters which point we consider the pixel 119a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * center for that test. 120a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell */ 121a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell unsigned gl_rasterization_rules:1; 12240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 123861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák /** 124861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * When true, rasterization is disabled and no pixels are written. 125861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * This only makes sense with the Stream Out functionality. 126861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák */ 127861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák unsigned rasterizer_discard:1; 128861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 129dc4c821f0817a3db716f965692fb701079f66340Marek Olšák /** 130dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * When false, depth clipping is disabled and the depth value will be 131dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * clamped later at the per-pixel level before depth testing. 132dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * This depends on PIPE_CAP_DEPTH_CLIP_DISABLE. 133dc4c821f0817a3db716f965692fb701079f66340Marek Olšák */ 134dc4c821f0817a3db716f965692fb701079f66340Marek Olšák unsigned depth_clip:1; 135dc4c821f0817a3db716f965692fb701079f66340Marek Olšák 136dc4c821f0817a3db716f965692fb701079f66340Marek Olšák /** 137dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * Enable bits for clipping half-spaces. 138dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * This applies to both user clip planes and shader clip distances. 139dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * Note that if the bound shader exports any clip distances, these 140dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * replace all user clip planes, and clip half-spaces enabled here 141dc4c821f0817a3db716f965692fb701079f66340Marek Olšák * but not written by the shader count as disabled. 142dc4c821f0817a3db716f965692fb701079f66340Marek Olšák */ 143dc4c821f0817a3db716f965692fb701079f66340Marek Olšák unsigned clip_plane_enable:PIPE_MAX_CLIP_PLANES; 144dc4c821f0817a3db716f965692fb701079f66340Marek Olšák 14502b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák unsigned line_stipple_factor:8; /**< [1..256] actually */ 14602b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák unsigned line_stipple_pattern:16; 14702b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák 1488ff8c91893cee8b1893de91e145c8496a12ab9caMarek Olšák unsigned sprite_coord_enable; /* bitfield referring to 32 GENERIC inputs */ 14902b352e2ace126e880d7df6a8c669e181b76e05fMarek Olšák 15040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float line_width; 15140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float point_size; /**< used when no per-vertex size */ 15240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_units; 15340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_scale; 15416f8308c3df020a786908be065d3dcb90c8ca2a5Christoph Bumiller float offset_clamp; 1558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 15763a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian 158d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_poly_stipple 159d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 16040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned stipple[32]; 1618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 164d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_viewport_state 165d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 16640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float scale[4]; 16740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float translate[4]; 1688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1698e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 17050eb29ed9492a34db4ba53f1f28a2868b808955aBrian 171d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_scissor_state 172d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 17340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned minx:16; 17440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned miny:16; 17540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxx:16; 17640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxy:16; 1778e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1788e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 17950eb29ed9492a34db4ba53f1f28a2868b808955aBrian 180d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_clip_state 181d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 18240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ucp[PIPE_MAX_CLIP_PLANES][4]; 1838e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1848e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1854824c342c864e870251a7d343c95e51274e50d23Keith Whitwell 186861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák/** 187861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Stream output for vertex transform feedback. 188861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák */ 189861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšákstruct pipe_stream_output_info 190861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák{ 191861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák unsigned num_outputs; 1922449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák /** stride for an entire vertex for each buffer in dwords */ 1932449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák unsigned stride[PIPE_MAX_SO_BUFFERS]; 1942449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák 195861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák /** 196861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Array of stream outputs, in the order they are to be written in. 197861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Selected components are tightly packed into the output buffer. 198861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák */ 199861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák struct { 2002449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák unsigned register_index:8; /**< 0 to PIPE_MAX_SHADER_OUTPUTS */ 2012449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák unsigned start_component:2; /** 0 to 3 */ 2022449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák unsigned num_components:3; /** 1 to 4 */ 2032449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák unsigned output_buffer:3; /**< 0 to PIPE_MAX_SO_BUFFERS */ 2042449695e822421fdcaf1c66dffc12d7d705ea69dMarek Olšák unsigned dst_offset:16; /**< offset into the buffer in dwords */ 205861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák } output[PIPE_MAX_SHADER_OUTPUTS]; 206861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák}; 207861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 208861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 209d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_shader_state 210d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 21143d7c1fe9d2544b851afa2f1c1e245a63860e670Brian const struct tgsi_token *tokens; 212861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák struct pipe_stream_output_info stream_output; 21343d7c1fe9d2544b851afa2f1c1e245a63860e670Brian}; 21443d7c1fe9d2544b851afa2f1c1e245a63860e670Brian 21550eb29ed9492a34db4ba53f1f28a2868b808955aBrian 216b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_depth_state 217b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 218ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< depth test enabled? */ 219ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned writemask:1; /**< allow depth buffer writes? */ 220ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ 221ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 222ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 223ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 224b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_stencil_state 225b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 226ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */ 227ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 228ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */ 229ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */ 230ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */ 231c59446a4930ec93e55f7cd3d1fffe46585cbe506Roland Scheidegger unsigned valuemask:8; 232c59446a4930ec93e55f7cd3d1fffe46585cbe506Roland Scheidegger unsigned writemask:8; 233ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 234ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 235ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 236b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_alpha_state 237b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 238ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; 239ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 240d6888e811d24eaa7e8d9093be606394f00435c05Zack Rusin float ref_value; /**< reference value */ 241ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 242ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 243ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 244bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwellstruct pipe_depth_stencil_alpha_state 2458f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 246ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_depth_state depth; 247ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_stencil_state stencil[2]; /**< [0] = front, [1] = back */ 248ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_alpha_state alpha; 249493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian}; 2508f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 251bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell 252bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheideggerstruct pipe_rt_blend_state 253d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 25440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned blend_enable:1; 2558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 25640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_func:3; /**< PIPE_BLEND_x */ 25740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 25840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2598e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 26040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_func:3; /**< PIPE_BLEND_x */ 26140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 26240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 264bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ 265bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger}; 266bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger 267bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheideggerstruct pipe_blend_state 268bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger{ 269bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger unsigned independent_blend_enable:1; 27040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_enable:1; 27140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ 27240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned dither:1; 273aac2cccccfd701ae8d7ce0813c28c64498d4a076Roland Scheidegger unsigned alpha_to_coverage:1; 274aac2cccccfd701ae8d7ce0813c28c64498d4a076Roland Scheidegger unsigned alpha_to_one:1; 275bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS]; 2768e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2778e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 27850eb29ed9492a34db4ba53f1f28a2868b808955aBrian 279d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_blend_color 280d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 28140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 2828e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2838e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 2841a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheideggerstruct pipe_stencil_ref 2851a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger{ 2861a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger ubyte ref_value[2]; 2871a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger}; 28850eb29ed9492a34db4ba53f1f28a2868b808955aBrian 2898f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 2908f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 29180567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian unsigned width, height; 29280567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian 2934243ca1144eef5783ed080cce9db1a8dda2c6360Brian Paul /** multiple color buffers for multiple render targets */ 2942299f21f8da816fc4588492965e7dac422da1a96Zack Rusin unsigned nr_cbufs; 295f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; 296f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian 2978de2331e432e2ea6f978acb6c80666da99c6c4a1Brian struct pipe_surface *zsbuf; /**< Z/stencil buffer */ 2988f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 2998f6b6eed35832733674372dea7bd5ce69a965c4eBrian 3008f6b6eed35832733674372dea7bd5ce69a965c4eBrian 30102a47549ad182d28d330063d4f452108e3a4b452Brian/** 30202a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 30302a47549ad182d28d330063d4f452108e3a4b452Brian */ 304943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 30502a47549ad182d28d330063d4f452108e3a4b452Brian{ 306d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ 307d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ 308d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ 30940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ 31040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ 31140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ 312d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 313d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_func:3; /**< PIPE_FUNC_x */ 314d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ 315ebe12d50064370e4ddec21a1e087b24295940319Roland Scheidegger unsigned max_anisotropy:6; 316a5f0a11477ae90f47f3adb59a93c5576dc8c7325Marek Olšák unsigned seamless_cube_map:1; 317d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float lod_bias; /**< LOD/lambda bias */ 318d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float min_lod, max_lod; /**< LOD clamp range, after bias */ 3199f61e43b4903c6cf0ac03a479ec9ed7b15fd6ccfDave Airlie union pipe_color_union border_color; 32002a47549ad182d28d330063d4f452108e3a4b452Brian}; 32102a47549ad182d28d330063d4f452108e3a4b452Brian 3225d69aeb0028f44d06093faede5c545908b0df89aBrian 32320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/** 3244c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger * A view into a texture that can be bound to a color render target / 3254c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger * depth stencil attachment point. 32620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */ 32720adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface 32820adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{ 3295e27cd46c04a9e7b5904cc014bffd0f4daae31feMichel Dänzer struct pipe_reference reference; 330287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *texture; /**< resource into which this is a view */ 331f1334f232f58d449cffccd8bfd79b32d96a9b54eBrian Paul struct pipe_context *context; /**< context this surface belongs to */ 3324243ca1144eef5783ed080cce9db1a8dda2c6360Brian Paul enum pipe_format format; 333287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 3344c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger /* XXX width/height should be removed */ 3355531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned width; /**< logical width in pixels */ 3365531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned height; /**< logical height in pixels */ 337287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 338287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned usage; /**< bitmask of PIPE_BIND_x */ 339b8e808f1ef9462af8545999df514fddbbff34345Francisco Jerez unsigned writable:1; /**< writable shader resource */ 340c9ed86a96483063f3d6789ed16645a3dca77d726Keith Whitwell 3414c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger union { 3424c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger struct { 3434c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned level; 3444c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned first_layer:16; 3454c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned last_layer:16; 3464c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger } tex; 3474c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger struct { 3484c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned first_element; 3494c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned last_element; 3504c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger } buf; 3514c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger } u; 35220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian}; 35320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 35420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 3555d69aeb0028f44d06093faede5c545908b0df89aBrian/** 356f6106566081978f663cf08e54bb8908cb58a5316Michal Krol * A view into a texture that can be bound to a shader stage. 357f6106566081978f663cf08e54bb8908cb58a5316Michal Krol */ 358f6106566081978f663cf08e54bb8908cb58a5316Michal Krolstruct pipe_sampler_view 359f6106566081978f663cf08e54bb8908cb58a5316Michal Krol{ 360f6106566081978f663cf08e54bb8908cb58a5316Michal Krol struct pipe_reference reference; 361f6106566081978f663cf08e54bb8908cb58a5316Michal Krol enum pipe_format format; /**< typed PIPE_FORMAT_x */ 362287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *texture; /**< texture into which this is a view */ 363f6106566081978f663cf08e54bb8908cb58a5316Michal Krol struct pipe_context *context; /**< context this view belongs to */ 3644c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger union { 3654c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger struct { 3664c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned first_layer:16; /**< first layer to use for array textures */ 3674c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned last_layer:16; /**< last layer to use for array textures */ 3684c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned first_level:8; /**< first mipmap level to use */ 3694c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned last_level:8; /**< last mipmap level to use */ 3704c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger } tex; 3714c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger struct { 3724c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned first_element; 3734c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned last_element; 3744c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger } buf; 3754c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger } u; 376f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_r:3; /**< PIPE_SWIZZLE_x for red component */ 377f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_g:3; /**< PIPE_SWIZZLE_x for green component */ 378f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_b:3; /**< PIPE_SWIZZLE_x for blue component */ 379f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_a:3; /**< PIPE_SWIZZLE_x for alpha component */ 380f6106566081978f663cf08e54bb8908cb58a5316Michal Krol}; 381f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 382f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 38397831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul/** 38497831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * Subregion of 1D/2D/3D image resource. 38597831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul */ 386287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_box 3874617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer{ 3881a17c4234431a17ec60503d69d7e84f85b3ae50dMarek Olšák int x; 3891a17c4234431a17ec60503d69d7e84f85b3ae50dMarek Olšák int y; 3901a17c4234431a17ec60503d69d7e84f85b3ae50dMarek Olšák int z; 3911a17c4234431a17ec60503d69d7e84f85b3ae50dMarek Olšák int width; 3921a17c4234431a17ec60503d69d7e84f85b3ae50dMarek Olšák int height; 3931a17c4234431a17ec60503d69d7e84f85b3ae50dMarek Olšák int depth; 3944617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer}; 3954617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 3964617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 39797831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul/** 39897831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * A memory object/resource such as a vertex buffer or texture. 39997831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul */ 400287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_resource 401287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell{ 402287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_reference reference; 403287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_screen *screen; /**< screen that this texture belongs to */ 4041c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ 4051c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_format format; /**< PIPE_FORMAT_x */ 40688723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer 407683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned width0; 408683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned height0; 409683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned depth0; 4104c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned array_size; 411d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 41218e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned last_level:8; /**< Index of last mipmap level present/defined */ 413b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ 414a2a01853f3f40b4ef8b3f01503391877960bdaeeBrian Paul unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */ 415429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger 4164c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned bind; /**< bitmask of PIPE_BIND_x */ 4174c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */ 418287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell}; 419d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 420713fb507596181f91990a0eb1470f0b95bf2f3d9Brian Paul 421713fb507596181f91990a0eb1470f0b95bf2f3d9Brian Paul/** 42297831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * Transfer object. For data transfer to/from a resource. 423287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell */ 424287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_transfer 425287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell{ 426287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *resource; /**< resource to transfer to/from */ 427f9a36a496f874dd3ab20c0f2439a461f4b25deceBrian Paul unsigned level; /**< texture mipmap level */ 428287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell enum pipe_transfer_usage usage; 429f9a36a496f874dd3ab20c0f2439a461f4b25deceBrian Paul struct pipe_box box; /**< region of the resource to access */ 430f9a36a496f874dd3ab20c0f2439a461f4b25deceBrian Paul unsigned stride; /**< row stride in bytes */ 431f9a36a496f874dd3ab20c0f2439a461f4b25deceBrian Paul unsigned layer_stride; /**< image/layer stride in bytes */ 432287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell void *data; 433d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 434d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 435d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 436287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 4376e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 4386e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer. Typically, all the vertex data/attributes for 4396e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer. But it's also possible, for 4406e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another. 4416e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 4428269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer 4438269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 444872b515e8f0bb1be5bad85fd9d01529c71f07ba2Zack Rusin unsigned stride; /**< stride to same attrib in next vertex, in bytes */ 4456e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 446287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *buffer; /**< the actual buffer */ 4474552fd50d959ab99546cfa994f8ba5bdf5d66bc7Marek Olšák const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */ 4488269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 4498269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 4508269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 4516e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 452507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšák * A constant buffer. A subrange of an existing buffer can be set 453507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšák * as a constant buffer. 454507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšák */ 455507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšákstruct pipe_constant_buffer { 456507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšák struct pipe_resource *buffer; /**< the actual buffer */ 457507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšák unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 458507337864fa80caf9f26602324d2c28dd0a75d61Marek Olšák unsigned buffer_size; /**< how much data can be read in shader */ 4590b7d48cbad86eaac21fce3793da41b46db8be3b4Marek Olšák const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */ 4608269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 4618269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 4628269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 4636e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 464861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * A stream output target. The structure specifies the range vertices can 465861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * be written to. 466861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * 467861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * In addition to that, the structure should internally maintain the offset 468861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * into the buffer, which should be incremented everytime something is written 469861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * (appended) to it. The internal offset is buffer_offset + how many bytes 470861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * have been written. The internal offset can be stored on the device 471861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * and the CPU actually doesn't have to query it. 472861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * 473861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Use PIPE_QUERY_SO_STATISTICS to know how many primitives have 474861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * actually been written. 475861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák */ 476861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšákstruct pipe_stream_output_target 477861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák{ 478861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák struct pipe_reference reference; 479f1334f232f58d449cffccd8bfd79b32d96a9b54eBrian Paul struct pipe_resource *buffer; /**< the output buffer */ 480f1334f232f58d449cffccd8bfd79b32d96a9b54eBrian Paul struct pipe_context *context; /**< context this SO target belongs to */ 481861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 482861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák unsigned buffer_offset; /**< offset where data should be written, in bytes */ 483861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák unsigned buffer_size; /**< how much data is allowed to be written */ 484861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák}; 485861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 486861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 487861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák/** 4886e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc) 4896e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 4908269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element 4918269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 4926e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Offset of this attribute, in bytes, from the start of the vertex */ 49318e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned src_offset; 4946e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 495f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol /** Instance data rate divisor. 0 means this is per-vertex data, 496f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol * n means per-instance data used for n consecutive instances (n > 0). 497f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol */ 498f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol unsigned instance_divisor; 499f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol 5006e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does 5016e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * this attribute live in? 5026e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 503d350695a6b86caaee6b2bd1d64b48a26159a8e95Keith Whitwell unsigned vertex_buffer_index; 504c31416971e4eac148f8e82d6c4392bd6f9cbc05dKeith Whitwell 5054243ca1144eef5783ed080cce9db1a8dda2c6360Brian Paul enum pipe_format src_format; 5068269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 5078269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 5088269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 509c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu/** 510c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu * An index buffer. When an index buffer is bound, all indices to vertices 511c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu * will be looked up in the buffer. 512c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu */ 513c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wustruct pipe_index_buffer 514c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu{ 515c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned index_size; /**< size of an index, in bytes */ 516c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned offset; /**< offset to start of data in buffer, in bytes */ 517c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu struct pipe_resource *buffer; /**< the actual buffer */ 518bf469f4edc60bd1c5fd770cb231b8d5ab801427fMarek Olšák const void *user_buffer; /**< pointer to a user buffer if buffer == NULL */ 519c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu}; 520c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 521c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 522c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu/** 523c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu * Information to describe a draw_vbo call. 524c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu */ 525c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wustruct pipe_draw_info 526c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu{ 527c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu boolean indexed; /**< use index buffer */ 528c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 529c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned mode; /**< the mode of the primitive */ 530c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned start; /**< the index of the first vertex */ 531c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned count; /**< number of vertices */ 532c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 533c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned start_instance; /**< first instance id */ 534c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned instance_count; /**< number of instances */ 535c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 536c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu /** 537c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu * For indexed drawing, these fields apply after index lookup. 538c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu */ 539c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu int index_bias; /**< a bias to be added to each index */ 540c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned min_index; /**< the min index */ 541c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu unsigned max_index; /**< the max index */ 542adf35e80d3b3d37b97f0608a5a2f221dbd8c0d64Brian Paul 543adf35e80d3b3d37b97f0608a5a2f221dbd8c0d64Brian Paul /** 544adf35e80d3b3d37b97f0608a5a2f221dbd8c0d64Brian Paul * Primitive restart enable/index (only applies to indexed drawing) 545adf35e80d3b3d37b97f0608a5a2f221dbd8c0d64Brian Paul */ 546adf35e80d3b3d37b97f0608a5a2f221dbd8c0d64Brian Paul boolean primitive_restart; 547adf35e80d3b3d37b97f0608a5a2f221dbd8c0d64Brian Paul unsigned restart_index; 548861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák 549861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák /** 550861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Stream output target. If not NULL, it's used to provide the 'count' 551861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * parameter based on the number vertices captured by the stream output 552861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * stage. (or generally, based on the number of bytes captured) 553861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * 554861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Only 'mode', 'start_instance', and 'instance_count' are taken into 555861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * account, all the other variables from pipe_draw_info are ignored. 556861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * 557861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * 'start' is implicitly 0 and 'count' is set as discussed above. 558861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * The draw command is non-indexed. 559861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * 560861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * Note that this only provides the count. The vertex buffers must 561861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák * be set via set_vertex_buffers manually. 562861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák */ 563861a029ddb31e91bb4d8e18ab708d0d172f63aadMarek Olšák struct pipe_stream_output_target *count_from_stream_output; 564c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu}; 565c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 566c5e9d3114a80d6d35a2f4e65783cdc75fcc2deacChia-I Wu 56794822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller/** 56894822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller * Information to describe a resource_resolve call. 56994822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller */ 57094822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumillerstruct pipe_resolve_info 57194822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller{ 57294822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller struct { 5736286d9810b7ebae588060370cd7a63c327478a2fChristoph Bumiller struct pipe_resource *res; 5746286d9810b7ebae588060370cd7a63c327478a2fChristoph Bumiller unsigned level; 5756286d9810b7ebae588060370cd7a63c327478a2fChristoph Bumiller unsigned layer; 57694822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int x0; /**< always left */ 57794822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int y0; /**< always top */ 57894822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int x1; /**< determines scale if PIPE_CAP_SCALED_RESOLVE is supported */ 57994822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int y1; /**< determines scale if PIPE_CAP_SCALED_RESOLVE is supported */ 58094822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller } dst; 58194822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller 58294822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller struct { 58394822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller struct pipe_resource *res; 58494822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller unsigned layer; 58594822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int x0; 58694822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int y0; 58794822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller int x1; /**< may be < x0 only if PIPE_CAP_SCALED_RESOLVE is supported */ 5886286d9810b7ebae588060370cd7a63c327478a2fChristoph Bumiller int y1; /**< may be < y1 even if PIPE_CAP_SCALED_RESOLVE not supported */ 58994822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller } src; 59094822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller 59194822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller unsigned mask; /**< PIPE_MASK_RGBA, Z, S or ZS */ 59294822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller}; 59394822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller 594f2606413ec176be33a6471bfc10443413d8b110aTom Stellard/** 595f2606413ec176be33a6471bfc10443413d8b110aTom Stellard * Structure used as a header for serialized LLVM programs. 596f2606413ec176be33a6471bfc10443413d8b110aTom Stellard */ 597f2606413ec176be33a6471bfc10443413d8b110aTom Stellardstruct pipe_llvm_program_header 598f2606413ec176be33a6471bfc10443413d8b110aTom Stellard{ 599f2606413ec176be33a6471bfc10443413d8b110aTom Stellard uint32_t num_bytes; /**< Number of bytes in the LLVM bytecode program. */ 600f2606413ec176be33a6471bfc10443413d8b110aTom Stellard}; 601f2606413ec176be33a6471bfc10443413d8b110aTom Stellard 602d9d82dcd006c124e6569789c90390c43c1360c06Francisco Jerezstruct pipe_compute_state 603d9d82dcd006c124e6569789c90390c43c1360c06Francisco Jerez{ 60457c048f291ffcb97d7df3177d92f9634e510dcc0Francisco Jerez const void *prog; /**< Compute program to be executed. */ 605d9d82dcd006c124e6569789c90390c43c1360c06Francisco Jerez unsigned req_local_mem; /**< Required size of the LOCAL resource. */ 606d9d82dcd006c124e6569789c90390c43c1360c06Francisco Jerez unsigned req_private_mem; /**< Required size of the PRIVATE resource. */ 607d9d82dcd006c124e6569789c90390c43c1360c06Francisco Jerez unsigned req_input_mem; /**< Required size of the INPUT resource. */ 608d9d82dcd006c124e6569789c90390c43c1360c06Francisco Jerez}; 60994822c6d83b7811db2a02bb4416df02ae225ba47Christoph Bumiller 610e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 611e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca} 612e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 613e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 6148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 615