1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright 2007 VMware, Inc. 4848b8605Smrg * All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the 8848b8605Smrg * "Software"), to deal in the Software without restriction, including 9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to 11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to 12848b8605Smrg * the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice (including the 15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions 16848b8605Smrg * of the Software. 17848b8605Smrg * 18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25848b8605Smrg * 26848b8605Smrg **************************************************************************/ 27848b8605Smrg#ifndef SP_SETUP_H 28848b8605Smrg#define SP_SETUP_H 29848b8605Smrg 30848b8605Smrgstruct setup_context; 31848b8605Smrgstruct softpipe_context; 32848b8605Smrg 33b8e80941Smrg/** 34b8e80941Smrg * Attribute interpolation mode 35b8e80941Smrg */ 36b8e80941Smrgenum sp_interp_mode { 37b8e80941Smrg SP_INTERP_POS, /**< special case for frag position */ 38b8e80941Smrg SP_INTERP_CONSTANT, 39b8e80941Smrg SP_INTERP_LINEAR, 40b8e80941Smrg SP_INTERP_PERSPECTIVE 41b8e80941Smrg}; 42b8e80941Smrg 43b8e80941Smrg 44b8e80941Smrgstruct sp_setup_info { 45b8e80941Smrg unsigned valid; 46b8e80941Smrg struct { 47b8e80941Smrg unsigned interp:8; /**< SP_INTERP_X */ 48b8e80941Smrg int src_index:8; 49b8e80941Smrg } attrib[PIPE_MAX_SHADER_OUTPUTS]; 50b8e80941Smrg}; 51b8e80941Smrg 52848b8605Smrgvoid 53b8e80941Smrgsp_setup_tri(struct setup_context *setup, 54b8e80941Smrg const float (*v0)[4], 55b8e80941Smrg const float (*v1)[4], 56b8e80941Smrg const float (*v2)[4]); 57848b8605Smrg 58848b8605Smrgvoid 59848b8605Smrgsp_setup_line(struct setup_context *setup, 60848b8605Smrg const float (*v0)[4], 61848b8605Smrg const float (*v1)[4]); 62848b8605Smrg 63848b8605Smrgvoid 64848b8605Smrgsp_setup_point( struct setup_context *setup, 65848b8605Smrg const float (*v0)[4] ); 66848b8605Smrg 67b8e80941Smrgstatic inline unsigned 68b8e80941Smrgsp_clamp_viewport_idx(int idx) 69b8e80941Smrg{ 70b8e80941Smrg return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0; 71b8e80941Smrg} 72848b8605Smrg 73848b8605Smrgstruct setup_context *sp_setup_create_context( struct softpipe_context *softpipe ); 74848b8605Smrgvoid sp_setup_prepare( struct setup_context *setup ); 75848b8605Smrgvoid sp_setup_destroy_context( struct setup_context *setup ); 76848b8605Smrg 77848b8605Smrg#endif 78