p_state.h revision aac2cccccfd701ae8d7ce0813c28c64498d4a076
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 74bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian 75f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 76294401814d1d89cc731de1c22c25333aa5d59374Zack Rusin * Primitive (point/line/tri) rasterization info 77f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 78294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstruct pipe_rasterizer_state 79f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{ 8040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned flatshade:1; 8140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned light_twoside:1; 8240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_winding:2; /**< PIPE_WINDING_x */ 8340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cull_mode:2; /**< PIPE_WINDING_x */ 8440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */ 8540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ 8640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_cw:1; 8740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_ccw:1; 8840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned scissor:1; 8940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_smooth:1; 9040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_stipple_enable:1; 9140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned point_smooth:1; 924a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger unsigned sprite_coord_enable:PIPE_MAX_SHADER_OUTPUTS; 934a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger unsigned sprite_coord_mode:1; /**< PIPE_SPRITE_COORD_ */ 9468f93ea3eb83cfad014b8ec93cec3564c1aa9833Roland Scheidegger unsigned point_quad_rasterization:1; /** points rasterized as quads or points */ 95beefc6011bce9e99cb46430186de1c13f027cb05Brian unsigned point_size_per_vertex:1; /**< size computed in vertex shader */ 9640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned multisample:1; /* XXX maybe more ms state in future */ 9740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_smooth:1; 9840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_enable:1; 9940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_factor:8; /**< [1..256] actually */ 10040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_pattern:16; 10199691f38c278f1d4aeb0617b149109644e3571fbKeith Whitwell unsigned line_last_pixel:1; 102683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell 103683e7091a953204c9aee1410ac44be3b69bae9fcKeith Whitwell /** 104a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * Use the first vertex of a primitive as the provoking vertex for 105a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * flat shading. 106a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell */ 107a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell unsigned flatshade_first:1; 108a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell 109a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell /** 110a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * When true, triangle rasterization uses (0.5, 0.5) pixel centers 111a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * for determining pixel ownership. 112a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 113a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * When false, triangle rasterization uses (0,0) pixel centers for 114a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * determining pixel ownership. 115a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * 116a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * Triangle rasterization always uses a 'top,left' rule for pixel 117a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * ownership, this just alters which point we consider the pixel 118a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell * center for that test. 119a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell */ 120a1fa770c01d913658900de1c267fb4c41bc6300dKeith Whitwell unsigned gl_rasterization_rules:1; 12140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 12240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float line_width; 12340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float point_size; /**< used when no per-vertex size */ 12440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_units; 12540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_scale; 1268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 12863a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian 129d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_poly_stipple 130d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 13140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned stipple[32]; 1328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1338e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 135d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_viewport_state 136d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 13740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float scale[4]; 13840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float translate[4]; 1398e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1408e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 14150eb29ed9492a34db4ba53f1f28a2868b808955aBrian 142d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_scissor_state 143d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 14440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned minx:16; 14540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned miny:16; 14640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxx:16; 14740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxy:16; 1488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1498e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 15050eb29ed9492a34db4ba53f1f28a2868b808955aBrian 151d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_clip_state 152d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 15340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ucp[PIPE_MAX_CLIP_PLANES][4]; 15440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr; 1558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1574824c342c864e870251a7d343c95e51274e50d23Keith Whitwell 158d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_shader_state 159d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 16043d7c1fe9d2544b851afa2f1c1e245a63860e670Brian const struct tgsi_token *tokens; 16143d7c1fe9d2544b851afa2f1c1e245a63860e670Brian}; 16243d7c1fe9d2544b851afa2f1c1e245a63860e670Brian 16350eb29ed9492a34db4ba53f1f28a2868b808955aBrian 164b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_depth_state 165b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 166ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< depth test enabled? */ 167ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned writemask:1; /**< allow depth buffer writes? */ 168ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ 169ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 170ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 171ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 172b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_stencil_state 173b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 174ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; /**< stencil[0]: stencil enabled, stencil[1]: two-side enabled */ 175ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 176ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */ 177ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */ 178ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */ 179c59446a4930ec93e55f7cd3d1fffe46585cbe506Roland Scheidegger unsigned valuemask:8; 180c59446a4930ec93e55f7cd3d1fffe46585cbe506Roland Scheidegger unsigned writemask:8; 181ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 182ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 183ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 184b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paulstruct pipe_alpha_state 185b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul{ 186ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned enabled:1; 187ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca unsigned func:3; /**< PIPE_FUNC_x */ 188d6888e811d24eaa7e8d9093be606394f00435c05Zack Rusin float ref_value; /**< reference value */ 189ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca}; 190ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 191ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca 192bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwellstruct pipe_depth_stencil_alpha_state 1938f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 194ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_depth_state depth; 195ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_stencil_state stencil[2]; /**< [0] = front, [1] = back */ 196ca826d79a64d46e7f3bffff22640f148c044cdadJosé Fonseca struct pipe_alpha_state alpha; 197493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian}; 1988f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 199bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell 200bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheideggerstruct pipe_rt_blend_state 201d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 20240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned blend_enable:1; 2038e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 20440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_func:3; /**< PIPE_BLEND_x */ 20540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 20640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2078e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 20840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_func:3; /**< PIPE_BLEND_x */ 20940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 21040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 2118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 212bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ 213bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger}; 214bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger 215bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheideggerstruct pipe_blend_state 216bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger{ 217bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger unsigned independent_blend_enable:1; 21840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_enable:1; 21940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ 22040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned dither:1; 221aac2cccccfd701ae8d7ce0813c28c64498d4a076Roland Scheidegger unsigned alpha_to_coverage:1; 222aac2cccccfd701ae8d7ce0813c28c64498d4a076Roland Scheidegger unsigned alpha_to_one:1; 223bef610f693266c338b99511b4d1eea5d5b97644eRoland Scheidegger struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS]; 2248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 22650eb29ed9492a34db4ba53f1f28a2868b808955aBrian 227d4d2e36a429fd015316c484fc40be7e6d2c69946Brianstruct pipe_blend_color 228d4d2e36a429fd015316c484fc40be7e6d2c69946Brian{ 22940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 2308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 2318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 2321a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheideggerstruct pipe_stencil_ref 2331a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger{ 2341a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger ubyte ref_value[2]; 2351a859ecf4a4728cb321b1f68d51491cd285a3c03Roland Scheidegger}; 23650eb29ed9492a34db4ba53f1f28a2868b808955aBrian 2378f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 2388f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 23980567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian unsigned width, height; 24080567f9c9f84d9df1cdb2d91a3c0814888cc5d08Brian 2414243ca1144eef5783ed080cce9db1a8dda2c6360Brian Paul /** multiple color buffers for multiple render targets */ 2422299f21f8da816fc4588492965e7dac422da1a96Zack Rusin unsigned nr_cbufs; 243f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; 244f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian 2458de2331e432e2ea6f978acb6c80666da99c6c4a1Brian struct pipe_surface *zsbuf; /**< Z/stencil buffer */ 2468f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 2478f6b6eed35832733674372dea7bd5ce69a965c4eBrian 2488f6b6eed35832733674372dea7bd5ce69a965c4eBrian 24902a47549ad182d28d330063d4f452108e3a4b452Brian/** 25002a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 25102a47549ad182d28d330063d4f452108e3a4b452Brian */ 252943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 25302a47549ad182d28d330063d4f452108e3a4b452Brian{ 254d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ 255d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ 256d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ 25740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ 25840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ 25940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ 260d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 261d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned compare_func:3; /**< PIPE_FUNC_x */ 262d4d2e36a429fd015316c484fc40be7e6d2c69946Brian unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ 263ebe12d50064370e4ddec21a1e087b24295940319Roland Scheidegger unsigned max_anisotropy:6; 264d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float lod_bias; /**< LOD/lambda bias */ 265d4d2e36a429fd015316c484fc40be7e6d2c69946Brian float min_lod, max_lod; /**< LOD clamp range, after bias */ 266d45dd5672ae60f1f49648725974693bf4ebf4bf8Brian float border_color[4]; 26702a47549ad182d28d330063d4f452108e3a4b452Brian}; 26802a47549ad182d28d330063d4f452108e3a4b452Brian 2695d69aeb0028f44d06093faede5c545908b0df89aBrian 27020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/** 271b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer * 2D surface. This is basically a view into a memory buffer. 27220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc. 27320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */ 27420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface 27520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{ 2765e27cd46c04a9e7b5904cc014bffd0f4daae31feMichel Dänzer struct pipe_reference reference; 277287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *texture; /**< resource into which this is a view */ 2784243ca1144eef5783ed080cce9db1a8dda2c6360Brian Paul enum pipe_format format; 279287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 2805531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned width; /**< logical width in pixels */ 2815531c986bd34457e113163a68ff4ab98394738f0Brian Paul unsigned height; /**< logical height in pixels */ 282287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 2838e6a3807981bb96bb6747683dbc9f92ae7117dd2Keith Whitwell unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */ 284b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer unsigned offset; /**< offset from start of buffer, in bytes */ 285287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned usage; /**< bitmask of PIPE_BIND_x */ 286c9ed86a96483063f3d6789ed16645a3dca77d726Keith Whitwell 287124a6b1958c630ea049025e2b72547096fdc8f2cZack Rusin unsigned zslice; 288b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned face; 289b59f9c95c1f7aca60c5d6889d4dc388d19fbc3e1Keith Whitwell unsigned level; 29020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian}; 29120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 29220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 2935d69aeb0028f44d06093faede5c545908b0df89aBrian/** 294f6106566081978f663cf08e54bb8908cb58a5316Michal Krol * A view into a texture that can be bound to a shader stage. 295f6106566081978f663cf08e54bb8908cb58a5316Michal Krol */ 296f6106566081978f663cf08e54bb8908cb58a5316Michal Krolstruct pipe_sampler_view 297f6106566081978f663cf08e54bb8908cb58a5316Michal Krol{ 298f6106566081978f663cf08e54bb8908cb58a5316Michal Krol struct pipe_reference reference; 299f6106566081978f663cf08e54bb8908cb58a5316Michal Krol enum pipe_format format; /**< typed PIPE_FORMAT_x */ 300287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *texture; /**< texture into which this is a view */ 301f6106566081978f663cf08e54bb8908cb58a5316Michal Krol struct pipe_context *context; /**< context this view belongs to */ 302f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned first_level:8; /**< first mipmap level */ 303252dc5f897f9d124459e3afebf6686d1fe271511Michal Krol unsigned last_level:8; /**< last mipmap level */ 304f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_r:3; /**< PIPE_SWIZZLE_x for red component */ 305f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_g:3; /**< PIPE_SWIZZLE_x for green component */ 306f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_b:3; /**< PIPE_SWIZZLE_x for blue component */ 307f6106566081978f663cf08e54bb8908cb58a5316Michal Krol unsigned swizzle_a:3; /**< PIPE_SWIZZLE_x for alpha component */ 308f6106566081978f663cf08e54bb8908cb58a5316Michal Krol}; 309f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 310f6106566081978f663cf08e54bb8908cb58a5316Michal Krol 31197831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul/** 31297831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * Subregion of 1D/2D/3D image resource. 31397831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul */ 314287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_box 3154617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer{ 316287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned x; 317287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned y; 318287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned z; 319287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned width; 320287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned height; 321287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned depth; 3224617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer}; 3234617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 3244617981ec72f7985941bee4b03c534d97ff96bc6Michel Dänzer 32597831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul/** 32697831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * A memory object/resource such as a vertex buffer or texture. 32797831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul */ 328287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_resource 329287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell{ 330287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_reference reference; 331287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_screen *screen; /**< screen that this texture belongs to */ 3321c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ 3331c5f27a18b775b3784fcd265d60e0affa0b31581Michel Dänzer enum pipe_format format; /**< PIPE_FORMAT_x */ 33488723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer 335683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned width0; 336683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned height0; 337683e35f726a182ed9fc6b6d5cb07146eebe14deaKeith Whitwell unsigned depth0; 338d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 33918e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned last_level:8; /**< Index of last mipmap level present/defined */ 340b9a3952f8f04a25818aba69e235e3d250c064cb8Brian Paul unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ 341a2a01853f3f40b4ef8b3f01503391877960bdaeeBrian Paul unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */ 342429a08384c2ea66d446e46beb28e33ee3b764d52Roland Scheidegger 34397831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul unsigned bind; /**< bitmask of PIPE_BIND_x */ 34497831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */ 345287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell}; 346d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 347287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 34897831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul/** 34997831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * Extra indexing info for (cube) texture resources. 35097831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul */ 351287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_subresource 352287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell{ 353287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned face:16; 354287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned level:16; 355287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell}; 356287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 357287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 358287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell/** 35997831efdb02ad68c70602a5b3a68c024e49e5715Brian Paul * Transfer object. For data transfer to/from a resource. 360287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell */ 361287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwellstruct pipe_transfer 362287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell{ 363287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *resource; /**< resource to transfer to/from */ 364287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_subresource sr; 365287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell enum pipe_transfer_usage usage; 366287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_box box; 367287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned stride; 368287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell unsigned slice_stride; 369287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell void *data; 370d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 371d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 372d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 373287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell 3746e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3756e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer. Typically, all the vertex data/attributes for 3766e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer. But it's also possible, for 3776e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another. 3786e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3798269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer 3808269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 381872b515e8f0bb1be5bad85fd9d01529c71f07ba2Zack Rusin unsigned stride; /**< stride to same attrib in next vertex, in bytes */ 3826e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned max_index; /**< number of vertices in this buffer */ 3836e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 384287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell struct pipe_resource *buffer; /**< the actual buffer */ 3858269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3868269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3878269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3886e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3896e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc) 3906e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3918269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element 3928269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 3936e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Offset of this attribute, in bytes, from the start of the vertex */ 39418e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned src_offset; 3956e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 396f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol /** Instance data rate divisor. 0 means this is per-vertex data, 397f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol * n means per-instance data used for n consecutive instances (n > 0). 398f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol */ 399f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol unsigned instance_divisor; 400f7d1689cfa8e3eb2aea4b86031510323b4d13110Michal Krol 4016e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does 4026e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * this attribute live in? 4036e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 40418e94e15c0ca881309ac5784075a04160cc1eeb6Keith Whitwell unsigned vertex_buffer_index:8; 405c31416971e4eac148f8e82d6c4392bd6f9cbc05dKeith Whitwell 4064243ca1144eef5783ed080cce9db1a8dda2c6360Brian Paul enum pipe_format src_format; 4078269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 4088269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 4098269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 410e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#ifdef __cplusplus 411e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca} 412e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca#endif 413e4e30089231831339815cccebf3a3a0ea6dcd2a9José Fonseca 4148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 415