p_state.h revision 6e02b4c7c3c6efc05ead2ffd46b0928f7c9316bf
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" 4213682d959ddacde1ce65843aa8c5b43dc9017b32Brian 4313682d959ddacde1ce65843aa8c5b43dc9017b32Brian/** 4413682d959ddacde1ce65843aa8c5b43dc9017b32Brian * Implementation limits 4513682d959ddacde1ce65843aa8c5b43dc9017b32Brian */ 4613682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_SAMPLERS 8 4713682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_CLIP_PLANES 6 4813682d959ddacde1ce65843aa8c5b43dc9017b32Brian#define PIPE_MAX_CONSTANT 32 49279ffe3f163fd6a5e7bfa108db14c81acbb06eceBrian#define PIPE_ATTRIB_MAX 32 50f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian#define PIPE_MAX_COLOR_BUFS 8 5140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell#define PIPE_MAX_TEXTURE_LEVELS 16 5213682d959ddacde1ce65843aa8c5b43dc9017b32Brian 5313682d959ddacde1ce65843aa8c5b43dc9017b32Brian 54e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/* fwd decl */ 55e62cf5c69ab605b78324639f5455ac9921e68dbaBrianstruct pipe_surface; 56e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 57bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian/* opaque type */ 58bec2230514ad2e8e52625ecb339fcadfabffd4dfBrianstruct pipe_buffer_handle; 59bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian 60e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 61e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/*** 62e62cf5c69ab605b78324639f5455ac9921e68dbaBrian *** State objects 63e62cf5c69ab605b78324639f5455ac9921e68dbaBrian ***/ 64e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 6513682d959ddacde1ce65843aa8c5b43dc9017b32Brian 66f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian/** 67f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian * Primitive (point/line/tri) setup info 68f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian */ 69f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brianstruct pipe_setup_state 70f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian{ 7140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned flatshade:1; 7240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned light_twoside:1; 7340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_winding:2; /**< PIPE_WINDING_x */ 7440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cull_mode:2; /**< PIPE_WINDING_x */ 7540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */ 7640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */ 7740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_cw:1; 7840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset_ccw:1; 7940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned scissor:1; 8040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_smooth:1; 8140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned poly_stipple_enable:1; 8240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned point_smooth:1; 8340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned multisample:1; /* XXX maybe more ms state in future */ 8440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_smooth:1; 8540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_enable:1; 8640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_factor:8; /**< [1..256] actually */ 8740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned line_stipple_pattern:16; 8840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 8940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float line_width; 9040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float point_size; /**< used when no per-vertex size */ 9140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_units; 9240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float offset_scale; 938e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 948e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 95943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_poly_stipple { 9640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned stipple[32]; 978e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 988e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 998e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 100ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_viewport_state { 10140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float scale[4]; 10240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float translate[4]; 1038e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1048e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 105ea92566ed9cabf5eb5d0993b39c4372d5bfcf3f1Brianstruct pipe_scissor_state { 10640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned minx:16; 10740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned miny:16; 10840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxx:16; 10940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned maxy:16; 1108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 112943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_clip_state { 11340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ucp[PIPE_MAX_CLIP_PLANES][4]; 11440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr; 1158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1174824c342c864e870251a7d343c95e51274e50d23Keith Whitwell 118943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_constant_buffer { 11940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float constant[PIPE_MAX_CONSTANT][4]; 12040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr_constants; 1218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 12443d7c1fe9d2544b851afa2f1c1e245a63860e670Brianstruct pipe_fs_state { 12540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned inputs_read; /* FRAG_ATTRIB_* */ 12643d7c1fe9d2544b851afa2f1c1e245a63860e670Brian const struct tgsi_token *tokens; 12743d7c1fe9d2544b851afa2f1c1e245a63860e670Brian struct pipe_constant_buffer *constants; /* XXX temporary? */ 12843d7c1fe9d2544b851afa2f1c1e245a63860e670Brian}; 12943d7c1fe9d2544b851afa2f1c1e245a63860e670Brian 130943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_depth_state 1318f2888758129b0a40d71fa4ce10d606b4bcf7631Brian{ 13240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned enabled:1; /**< depth test enabled? */ 13340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned writemask:1; /**< allow depth buffer writes? */ 13440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ 13540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned occlusion_count:1; /**< XXX move this elsewhere? */ 13640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float clear; /**< Clear value in [0,1] (XXX correct place?) */ 1378f2888758129b0a40d71fa4ce10d606b4bcf7631Brian}; 1388f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 139493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brianstruct pipe_alpha_test_state { 14040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned enabled:1; 14140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned func:3; /**< PIPE_FUNC_x */ 14240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float ref; /**< reference value */ 143493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brian}; 1448f2888758129b0a40d71fa4ce10d606b4bcf7631Brian 145493f7b5f3ae2eb64eaa65e24e79a7a071c359b81Brianstruct pipe_blend_state { 14640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned blend_enable:1; 1478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 14840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_func:3; /**< PIPE_BLEND_x */ 14940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 15040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 1518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 15240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_func:3; /**< PIPE_BLEND_x */ 15340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ 15440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ 1558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 15640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_enable:1; 15740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned logicop_func:4; /**< PIPE_LOGICOP_x */ 15886352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian 15940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */ 16040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned dither:1; 1618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 163943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_blend_color { 16440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 1658e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 1668e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 16773f96c51052bf5233191d852ef463462306bf1d5Brianstruct pipe_clear_color_state 16873f96c51052bf5233191d852ef463462306bf1d5Brian{ 16940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float color[4]; 17073f96c51052bf5233191d852ef463462306bf1d5Brian}; 17173f96c51052bf5233191d852ef463462306bf1d5Brian 172943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_stencil_state { 17340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_enabled:1; 17440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_func:3; /**< PIPE_FUNC_x */ 17540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_fail_op:3; /**< PIPE_STENCIL_OP_x */ 17640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_zpass_op:3; /**< PIPE_STENCIL_OP_x */ 17740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned front_zfail_op:3; /**< PIPE_STENCIL_OP_x */ 17840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned back_enabled:1; 17940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned back_func:3; /**< PIPE_FUNC_x */ 18040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned back_fail_op:3; /**< PIPE_STENCIL_OP_x */ 18140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned back_zpass_op:3; /**< PIPE_STENCIL_OP_x */ 18240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned back_zfail_op:3; /**< PIPE_STENCIL_OP_x */ 18340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell ubyte ref_value[2]; /**< [0] = front, [1] = back */ 18440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell ubyte value_mask[2]; 18540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell ubyte write_mask[2]; 18640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell ubyte clear_value; 187008fb50174fb6717f3b71836427bc6be4e44613cBrian}; 188008fb50174fb6717f3b71836427bc6be4e44613cBrian 189008fb50174fb6717f3b71836427bc6be4e44613cBrian 1908f6b6eed35832733674372dea7bd5ce69a965c4eBrianstruct pipe_framebuffer_state 1918f6b6eed35832733674372dea7bd5ce69a965c4eBrian{ 192f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian /** multiple colorbuffers for multiple render targets */ 19340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned num_cbufs; 194f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; 195f0f9a22609ccf2b8edc5760480f1a7a78cb504d7Brian 1968f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *zbuf; /**< Z buffer */ 1978f6b6eed35832733674372dea7bd5ce69a965c4eBrian struct pipe_surface *sbuf; /**< Stencil buffer */ 1988f6b6eed35832733674372dea7bd5ce69a965c4eBrian}; 1998f6b6eed35832733674372dea7bd5ce69a965c4eBrian 2008f6b6eed35832733674372dea7bd5ce69a965c4eBrian 20102a47549ad182d28d330063d4f452108e3a4b452Brian/** 20202a47549ad182d28d330063d4f452108e3a4b452Brian * Texture sampler state. 20302a47549ad182d28d330063d4f452108e3a4b452Brian */ 204943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwellstruct pipe_sampler_state 20502a47549ad182d28d330063d4f452108e3a4b452Brian{ 20640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned wrap_s:3; /**< PIPE_TEX_WRAP_x */ 20740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned wrap_t:3; /**< PIPE_TEX_WRAP_x */ 20840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned wrap_r:3; /**< PIPE_TEX_WRAP_x */ 20940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_img_filter:2; /**< PIPE_TEX_FILTER_x */ 21040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned min_mip_filter:2; /**< PIPE_TEX_MIPFILTER_x */ 21140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned mag_img_filter:2; /**< PIPE_TEX_FILTER_x */ 21240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compare:1; /**< shadow/depth compare enabled? */ 21340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */ 21440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compare_func:3; /**< PIPE_FUNC_x */ 21540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float shadow_ambient; /**< shadow test fail color/intensity */ 21640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float min_lod; 21740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float max_lod; 21840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float lod_bias; 21902a47549ad182d28d330063d4f452108e3a4b452Brian#if 0 /* need these? */ 22040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell int BaseLevel; /**< min mipmap level, OpenGL 1.2 */ 22140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell int MaxLevel; /**< max mipmap level, OpenGL 1.2 */ 22240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float border_color[4]; 22302a47549ad182d28d330063d4f452108e3a4b452Brian#endif 22440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell float max_anisotropy; 22502a47549ad182d28d330063d4f452108e3a4b452Brian}; 22602a47549ad182d28d330063d4f452108e3a4b452Brian 2275d69aeb0028f44d06093faede5c545908b0df89aBrian 228e62cf5c69ab605b78324639f5455ac9921e68dbaBrian/*** 22920adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian *** Resource Objects 230e62cf5c69ab605b78324639f5455ac9921e68dbaBrian ***/ 231e62cf5c69ab605b78324639f5455ac9921e68dbaBrian 2322f245bce420c7a6c6928c4927d0f9a5701cde17fBrianstruct pipe_region 2332f245bce420c7a6c6928c4927d0f9a5701cde17fBrian{ 234bec2230514ad2e8e52625ecb339fcadfabffd4dfBrian struct pipe_buffer_handle *buffer; /**< driver private buffer handle */ 23520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 23640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; /**< Reference count for region */ 23740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cpp; /**< bytes per pixel */ 23840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned pitch; /**< in pixels */ 23940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned height; /**< in pixels */ 24040a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell ubyte *map; /**< only non-NULL when region is actually mapped */ 24140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned map_refcount; /**< Reference count for mapping */ 2422f245bce420c7a6c6928c4927d0f9a5701cde17fBrian}; 2432f245bce420c7a6c6928c4927d0f9a5701cde17fBrian 24420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 24520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian/** 246b23f358cbc36a2b6a9e7609290a7458fa48f7ccbBrian * 2D surface. This is basically a view into a pipe_region (memory buffer). 24720adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian * May be a renderbuffer, texture mipmap level, etc. 24820adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian */ 24920adf45c23dd9ec86a1439ad87c1473395bbb1a7Brianstruct pipe_surface 25020adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian{ 25120adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian struct pipe_region *region; 25240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned format:5; /**< PIPE_FORMAT_x */ 25340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned width, height; 25440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned offset; /**< offset from start of region, in bytes */ 25540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; 25620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 257b23f358cbc36a2b6a9e7609290a7458fa48f7ccbBrian /** get block/tile of pixels from surface */ 258b23f358cbc36a2b6a9e7609290a7458fa48f7ccbBrian void (*get_tile)(struct pipe_surface *ps, 25940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned x, unsigned y, unsigned w, unsigned h, float *p); 260b23f358cbc36a2b6a9e7609290a7458fa48f7ccbBrian 261b23f358cbc36a2b6a9e7609290a7458fa48f7ccbBrian /** put block/tile of pixels into surface */ 262b23f358cbc36a2b6a9e7609290a7458fa48f7ccbBrian void (*put_tile)(struct pipe_surface *ps, 26340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned x, unsigned y, unsigned w, unsigned h, const float *p); 26420adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian}; 26520adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 26620adf45c23dd9ec86a1439ad87c1473395bbb1a7Brian 2675d69aeb0028f44d06093faede5c545908b0df89aBrian/** 268d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian * Describes the location of each texture image within a texture region. 269d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 270d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrianstruct pipe_mipmap_level 271d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian{ 27240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned level_offset; 27340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned width; 27440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned height; 27540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned depth; 27640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned nr_images; 277d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 278d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* Explicitly store the offset of each image for each cube face or 279d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian * depth value. Pretty much have to accept that hardware formats 280d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian * are going to be so diverse that there is no unified way to 281d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian * compute the offsets of depth/cube images within a mipmap level, 282d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian * so have to store them as a lookup table: 283d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 28440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned *image_offset; /**< array [depth] of offsets */ 285d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 286d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 287d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrianstruct pipe_mipmap_tree 288d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian{ 289d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* Effectively the key: 290d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 29140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned target; /* XXX convert to PIPE_TEXTURE_x */ 29240a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned internal_format; /* XXX convert to PIPE_FORMAT_x */ 29340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell 29440a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned format; /**< PIPE_FORMAT_x */ 29540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned first_level; 29640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned last_level; 297d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 29840a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned width0, height0, depth0; /**< Level zero image dimensions */ 29940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned cpp; 300d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 30140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned compressed:1; 302d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 303d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* Derived from the above: 304d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 30540a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned pitch; 30640a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned depth_pitch; /* per-image on i945? */ 30740a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned total_height; 308d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 309d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* Includes image offset tables: 310d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 31140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell struct pipe_mipmap_level level[PIPE_MAX_TEXTURE_LEVELS]; 312d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 313d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* The data is held here: 314d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 315d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian struct pipe_region *region; 316d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 317d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian /* These are also refcounted: 318d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian */ 31940a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell unsigned refcount; 320d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian}; 321d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 322d9605cdf7cbbd3c81c506d01eb8e88a11ccfc09bBrian 3236e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3246e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * A vertex buffer. Typically, all the vertex data/attributes for 3256e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * drawing something will be in one buffer. But it's also possible, for 3266e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * example, to put colors in one buffer and texcoords in another. 3276e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3288269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_buffer 3298269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 3306e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned pitch:11; /**< stride to same attrib in next vertex, in bytes */ 3316e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned max_index; /**< number of vertices in this buffer */ 3326e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ 3336e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian struct pipe_buffer_handle *buffer; /**< the actual buffer */ 3348269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3358269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3368269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3376e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian/** 3386e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * Information to describe a vertex attribute (position, color, etc) 3396e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3408269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwellstruct pipe_vertex_element 3418269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell{ 3426e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Offset of this attribute, in bytes, from the start of the vertex */ 3436e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned src_offset:11; 3446e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 3456e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does 3466e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian * this attribute live in? 3476e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian */ 3486e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned vertex_buffer_index:5; 3496e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian 3508269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell unsigned dst_offset:8; 3516e02b4c7c3c6efc05ead2ffd46b0928f7c9316bfBrian unsigned src_format:8; /**< PIPE_FORMAT_* */ 3528269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell}; 3538269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3548269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3558269bc48d8fafaa432b58f4adf5e0dddd81d979dKeith Whitwell 3568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif 357