p_state.h revision bfe79babf99e6b9435195178d1ea64687c60d161
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" 4254fc80ab31f89520d3119196bfa9c6332b35fe2fBrian#include "p_format.h" 4313682d959ddacde1ce65843aa8c5b43dc9017b32Brian 4413682d959ddacde1ce65843aa8c5b43dc9017b32Brian/** 4513682d959ddacde1ce65843aa8c5b43dc9017b32Brian * Implementation limits 4613682d959ddacde1ce65843aa8c5b43dc9017b32Brian */ 4713682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_SAMPLERS 8 4813682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_CLIP_PLANES 6 4913682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_CONSTANT 32 50279ffe3f163fd6a5e7bfa108db14c81acbb06eceBrian#define PIPE_ATTRIB_MAX 32 51f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian#define PIPE_MAX_COLOR_BUFS 8 5240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell#define PIPE_MAX_TEXTURE_LEVELS 16 5363a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian#define PIPE_MAX_FEEDBACK_ATTRIBS 16 5437cf13ed9a429c755f121daa1776b1b30a985ab3Brian#define PIPE_MAX_SHADER_INPUTS 16 5537cf13ed9a429c755f121daa1776b1b30a985ab3Brian#define PIPE_MAX_SHADER_OUTPUTS 16 5613682d959ddacde1ce65843aa8c5b43dc9017b32Brian 5713682d959ddacde1ce65843aa8c5b43dc9017b32Brian 58e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/* fwd decl */ 59e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_surface; 60e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 61bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian/* opaque type */ 62bec2230514ad2e8e52625ecb339fcadfabffd4dfBrianstruct pipe_buffer_handle; 63bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian 647d1a04e499564212a2a9aace12b05f424a357d3fBrianstruct pipe_winsys; 657d1a04e499564212a2a9aace12b05f424a357d3fBrian 66e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 67e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/*** 68e62cf5c69ab605b78324639f5455ac9921e68dbaBrian *** State objects 69e62cf5c69ab605b78324639f5455ac9921e68dbaBrian ***/ 70e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 7113682d959ddacde1ce65843aa8c5b43dc9017b32Brian 72f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 73294401814d1d89cc731de1c22c25333aa5d59374Zack Rusin * Primitive (point/line/tri) rasterization info 74f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 75294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstruct pipe_rasterizer_state 76f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{ 7740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned flatshade:1; 7840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned light_twoside:1; 7940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_winding:2; /**< PIPE_WINDING_x */ 8040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cull_mode:2; /**< PIPE_WINDING_x */ 8140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */ 8240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ 8340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_cw:1; 8440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_ccw:1; 8540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned scissor:1; 8640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_smooth:1; 8740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_stipple_enable:1; 8840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned point_smooth:1; 89cd4d732773e06e462e78b8f5bc9f3f1552a198acBrian unsigned point_sprite:1; 90beefc6011bce9e99cb46430186de1c13f027cb05Brian unsigned point_size_per_vertex:1; /**< size computed in vertex shader */ 9140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned multisample:1; /* XXX maybe more ms state in future */ 9240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_smooth:1; 9340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_enable:1; 9440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_factor:8; /**< [1..256] actually */ 9540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_pattern:16; 96f361edae5d495254f4bc27473bf24b1ac7d5af06Brian unsigned bypass_clipping:1; 97017f862de1f857bca29f09794539aaf411014f13Brian unsigned origin_lower_left:1; /**< Is (0,0) the lower-left corner? */ 9840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 9940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float line_width; 10040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float point_size; /**< used when no per-vertex size */ 10140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_units; 10240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_scale; 1031b4852345954af9b582b03a91a3d8399b8fb0e92Brian ubyte sprite_coord_mode[PIPE_MAX_SHADER_OUTPUTS]; /**< PIPE_SPRITE_COORD_ */ 1048e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1058e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 10663a51aee86f76ae54fb1ce572d584fb0f01aaec5Brian 107943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_poly_stipple { 10840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned stipple[32]; 1098e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 112ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_viewport_state { 11340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float scale[4]; 11440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float translate[4]; 1158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 117ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_scissor_state { 11840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned minx:16; 11940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned miny:16; 12040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxx:16; 12140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxy:16; 1228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 124943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_clip_state { 12540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ucp[PIPE_MAX_CLIP_PLANES][4]; 12640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr; 1278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1294824c342c864e870251a7d343c95e51274e50d23Keith Whitwell 130c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian/** 131c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian * Constants for vertex/fragment shaders 132c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian */ 133943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_constant_buffer { 134c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian struct pipe_buffer_handle *buffer; 135c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian unsigned size; /** in bytes */ 1368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1378e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1388e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 139de653b4c9bddcec46f3ddf411ec082dd178d7b38Brianstruct pipe_shader_state { 14043d7c1fe9d2544b851afa2f1c1e245a63860e670Brian const struct tgsi_token *tokens; 14137cf13ed9a429c755f121daa1776b1b30a985ab3Brian ubyte num_inputs; 14237cf13ed9a429c755f121daa1776b1b30a985ab3Brian ubyte num_outputs; 143e785f190f0d49f0367f7468c22b77962d0f14ea0Brian ubyte input_map[PIPE_MAX_SHADER_INPUTS]; /* XXX this may be temporary */ 144f69b5c56feb60791bad27d491ee9592238d4efb0Brian ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */ 145f69b5c56feb60791bad27d491ee9592238d4efb0Brian ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; 146f69b5c56feb60791bad27d491ee9592238d4efb0Brian ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */ 147f69b5c56feb60791bad27d491ee9592238d4efb0Brian ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; 14843d7c1fe9d2544b851afa2f1c1e245a63860e670Brian}; 14943d7c1fe9d2544b851afa2f1c1e245a63860e670Brian 150bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwellstruct pipe_depth_stencil_alpha_state 1518f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 152d6ac959833a8e40a27907940969c622692f749b1Zack Rusin struct { 153d6ac959833a8e40a27907940969c622692f749b1Zack Rusin unsigned enabled:1; /**< depth test enabled? */ 154d6ac959833a8e40a27907940969c622692f749b1Zack Rusin unsigned writemask:1; /**< allow depth buffer writes? */ 155d6ac959833a8e40a27907940969c622692f749b1Zack Rusin unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ 156d6ac959833a8e40a27907940969c622692f749b1Zack Rusin unsigned occlusion_count:1; /**< XXX move this elsewhere? */ 157d6ac959833a8e40a27907940969c622692f749b1Zack Rusin } depth; 158d6ac959833a8e40a27907940969c622692f749b1Zack Rusin struct { 159bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned enabled:1; 160bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned func:3; /**< PIPE_FUNC_x */ 161bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */ 162bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */ 163bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */ 164bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell ubyte ref_value; 165bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell ubyte value_mask; 166bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell ubyte write_mask; 167bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell } stencil[2]; /**< [0] = front, [1] = back */ 1688f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 169bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell struct { 170bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned enabled:1; 171bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell unsigned func:3; /**< PIPE_FUNC_x */ 172bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell float ref; /**< reference value */ 173bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell } alpha; 174493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian}; 1758f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 176bfe79babf99e6b9435195178d1ea64687c60d161Keith Whitwell 177493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brianstruct pipe_blend_state { 17840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned blend_enable:1; 1798e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 18040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_func:3; /**< PIPE_BLEND_x */ 18140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 18240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 1838e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 18440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_func:3; /**< PIPE_BLEND_x */ 18540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 18640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 1878e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 18840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_enable:1; 18940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ 19086352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian 19140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ 19240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned dither:1; 1938e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1948e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 195943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_blend_color { 19640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 1978e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1988e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1998f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 2008f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 201f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian /** multiple colorbuffers for multiple render targets */ 20240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned num_cbufs; 203f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; 204f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian 2058f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *zbuf; /**< Z buffer */ 2068f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *sbuf; /**< Stencil buffer */ 2078f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 2088f6b6eed35832733674372dea7bd5ce69a965c4eBrian 2098f6b6eed35832733674372dea7bd5ce69a965c4eBrian 21002a47549ad182d28d330063d4f452108e3a4b452Brian/** 21102a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 21202a47549ad182d28d330063d4f452108e3a4b452Brian */ 213943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 21402a47549ad182d28d330063d4f452108e3a4b452Brian{ 21540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ 21640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ 21740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ 21840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ 21940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ 22040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ 22140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compare:1; /**< shadow/depth compare enabled? */ 22240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 22340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compare_func:3; /**< PIPE_FUNC_x */ 224369eefc34c8d7acdb881ea5b0516406d71344fc4Brian unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */ 22540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float shadow_ambient; /**< shadow test fail color/intensity */ 22640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float min_lod; 22740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float max_lod; 22840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float lod_bias; 22902a47549ad182d28d330063d4f452108e3a4b452Brian#if 0 /* need these? */ 23040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell int BaseLevel; /**< min mipmap level, OpenGL 1.2 */ 23140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell int MaxLevel; /**< max mipmap level, OpenGL 1.2 */ 23202a47549ad182d28d330063d4f452108e3a4b452Brian#endif 233d45dd5672ae60f1f49648725974693bf4ebf4bf8Brian float border_color[4]; 23440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float max_anisotropy; 23502a47549ad182d28d330063d4f452108e3a4b452Brian}; 23602a47549ad182d28d330063d4f452108e3a4b452Brian 2375d69aeb0028f44d06093faede5c545908b0df89aBrian 23820adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/** 239b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer * 2D surface. This is basically a view into a memory buffer. 24020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc. 24120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */ 24220adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface 24320adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{ 244b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer struct pipe_buffer_handle *buffer; /**< driver private buffer handle */ 245b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer ubyte *map; /**< only non-NULL when surface is actually mapped */ 246b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer unsigned map_refcount; /**< Reference count for mapping */ 24754fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format format; /**< PIPE_FORMAT_x */ 24811a80160fd60d1eb1541b49128c659526a5d8ac8Michel Dänzer unsigned cpp; /**< bytes per pixel */ 24940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned width, height; 25011a80160fd60d1eb1541b49128c659526a5d8ac8Michel Dänzer unsigned pitch; /**< in pixels */ 251b859cdf6f191b4d8b56537c8dc30082a7e2d94b3Michel Dänzer unsigned offset; /**< offset from start of buffer, in bytes */ 25240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; 2537d1a04e499564212a2a9aace12b05f424a357d3fBrian struct pipe_winsys *winsys; /**< winsys which owns/created the surface */ 25420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian}; 25520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 25620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 2575d69aeb0028f44d06093faede5c545908b0df89aBrian/** 258753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer * Texture. Represents one or several texture images on one or several mipmap 259753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer * levels. 260d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 261753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzerstruct pipe_texture 262753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer{ 263d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* Effectively the key: 264d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 26588723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer unsigned target; /**< PIPE_TEXTURE_x */ 26654fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format format; /**< PIPE_FORMAT_x */ 26788723b2fc84628c1bc1e0008b88602b85e8668beMichel Dänzer 26840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned first_level; 26940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned last_level; 270d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 271753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer unsigned width[PIPE_MAX_TEXTURE_LEVELS]; 272753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer unsigned height[PIPE_MAX_TEXTURE_LEVELS]; 273753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer unsigned depth[PIPE_MAX_TEXTURE_LEVELS]; 27440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cpp; 275d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 27640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compressed:1; 277d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 278d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* These are also refcounted: 279d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 28040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; 281d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 282d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 283d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 2846e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 2856e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer. Typically, all the vertex data/attributes for 2866e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer. But it's also possible, for 2876e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another. 2886e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 2898269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer 2908269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 2916e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned pitch:11; /**< stride to same attrib in next vertex, in bytes */ 2926e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned max_index; /**< number of vertices in this buffer */ 2936e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 2946e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian struct pipe_buffer_handle *buffer; /**< the actual buffer */ 2958269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 2968269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 2978269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 2986e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 2996e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc) 3006e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3018269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element 3028269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 3036e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Offset of this attribute, in bytes, from the start of the vertex */ 3046e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned src_offset:11; 3056e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 3066e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does 3076e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * this attribute live in? 3086e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3096e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned vertex_buffer_index:5; 3106e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 3118269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell unsigned dst_offset:8; 31254fc80ab31f89520d3119196bfa9c6332b35fe2fBrian enum pipe_format src_format; /**< PIPE_FORMAT_* */ 3138269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3148269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3158269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3168269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 318