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 LP_SETUP_H 28848b8605Smrg#define LP_SETUP_H 29848b8605Smrg 30848b8605Smrg#include "pipe/p_compiler.h" 31848b8605Smrg#include "lp_jit.h" 32848b8605Smrg 33848b8605Smrgstruct draw_context; 34848b8605Smrgstruct vertex_info; 35848b8605Smrg 36848b8605Smrg 37848b8605Smrgstruct pipe_resource; 38848b8605Smrgstruct pipe_query; 39848b8605Smrgstruct pipe_surface; 40848b8605Smrgstruct pipe_blend_color; 41848b8605Smrgstruct pipe_screen; 42848b8605Smrgstruct pipe_framebuffer_state; 43848b8605Smrgstruct lp_fragment_shader_variant; 44848b8605Smrgstruct lp_jit_context; 45848b8605Smrgstruct llvmpipe_query; 46848b8605Smrgstruct pipe_fence_handle; 47848b8605Smrgstruct lp_setup_variant; 48848b8605Smrgstruct lp_setup_context; 49848b8605Smrg 50848b8605Smrgvoid lp_setup_reset( struct lp_setup_context *setup ); 51848b8605Smrg 52848b8605Smrgstruct lp_setup_context * 53848b8605Smrglp_setup_create( struct pipe_context *pipe, 54848b8605Smrg struct draw_context *draw ); 55848b8605Smrg 56848b8605Smrgvoid 57848b8605Smrglp_setup_clear(struct lp_setup_context *setup, 58848b8605Smrg const union pipe_color_union *clear_color, 59848b8605Smrg double clear_depth, 60848b8605Smrg unsigned clear_stencil, 61848b8605Smrg unsigned flags); 62848b8605Smrg 63848b8605Smrg 64848b8605Smrg 65848b8605Smrgvoid 66848b8605Smrglp_setup_flush( struct lp_setup_context *setup, 67848b8605Smrg struct pipe_fence_handle **fence, 68848b8605Smrg const char *reason); 69848b8605Smrg 70848b8605Smrg 71848b8605Smrgvoid 72848b8605Smrglp_setup_bind_framebuffer( struct lp_setup_context *setup, 73848b8605Smrg const struct pipe_framebuffer_state *fb ); 74848b8605Smrg 75848b8605Smrgvoid 76848b8605Smrglp_setup_set_triangle_state( struct lp_setup_context *setup, 77848b8605Smrg unsigned cullmode, 78848b8605Smrg boolean front_is_ccw, 79848b8605Smrg boolean scissor, 80848b8605Smrg boolean half_pixel_center, 81848b8605Smrg boolean bottom_edge_rule); 82848b8605Smrg 83848b8605Smrgvoid 84848b8605Smrglp_setup_set_line_state( struct lp_setup_context *setup, 85848b8605Smrg float line_width); 86848b8605Smrg 87848b8605Smrgvoid 88848b8605Smrglp_setup_set_point_state( struct lp_setup_context *setup, 89848b8605Smrg float point_size, 90848b8605Smrg boolean point_size_per_vertex, 91848b8605Smrg uint sprite_coord_enable, 92848b8605Smrg uint sprite_coord_origin); 93848b8605Smrg 94848b8605Smrgvoid 95848b8605Smrglp_setup_set_setup_variant( struct lp_setup_context *setup, 96848b8605Smrg const struct lp_setup_variant *variant ); 97848b8605Smrg 98848b8605Smrgvoid 99848b8605Smrglp_setup_set_fs_variant( struct lp_setup_context *setup, 100848b8605Smrg struct lp_fragment_shader_variant *variant ); 101848b8605Smrg 102848b8605Smrgvoid 103848b8605Smrglp_setup_set_fs_constants(struct lp_setup_context *setup, 104848b8605Smrg unsigned num, 105848b8605Smrg struct pipe_constant_buffer *buffers); 106848b8605Smrg 107848b8605Smrgvoid 108848b8605Smrglp_setup_set_alpha_ref_value( struct lp_setup_context *setup, 109848b8605Smrg float alpha_ref_value ); 110848b8605Smrg 111848b8605Smrgvoid 112848b8605Smrglp_setup_set_stencil_ref_values( struct lp_setup_context *setup, 113848b8605Smrg const ubyte refs[2] ); 114848b8605Smrg 115848b8605Smrgvoid 116848b8605Smrglp_setup_set_blend_color( struct lp_setup_context *setup, 117848b8605Smrg const struct pipe_blend_color *blend_color ); 118848b8605Smrg 119848b8605Smrgvoid 120848b8605Smrglp_setup_set_scissors( struct lp_setup_context *setup, 121848b8605Smrg const struct pipe_scissor_state *scissors ); 122848b8605Smrg 123848b8605Smrgvoid 124848b8605Smrglp_setup_set_viewports(struct lp_setup_context *setup, 125848b8605Smrg unsigned num_viewports, 126848b8605Smrg const struct pipe_viewport_state *viewports); 127848b8605Smrg 128848b8605Smrgvoid 129848b8605Smrglp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, 130848b8605Smrg unsigned num, 131848b8605Smrg struct pipe_sampler_view **views); 132848b8605Smrg 133848b8605Smrgvoid 134848b8605Smrglp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, 135848b8605Smrg unsigned num, 136848b8605Smrg struct pipe_sampler_state **samplers); 137848b8605Smrg 138848b8605Smrgunsigned 139848b8605Smrglp_setup_is_resource_referenced( const struct lp_setup_context *setup, 140848b8605Smrg const struct pipe_resource *texture ); 141848b8605Smrg 142848b8605Smrgvoid 143848b8605Smrglp_setup_set_flatshade_first( struct lp_setup_context *setup, 144848b8605Smrg boolean flatshade_first ); 145848b8605Smrg 146848b8605Smrgvoid 147848b8605Smrglp_setup_set_rasterizer_discard( struct lp_setup_context *setup, 148848b8605Smrg boolean rasterizer_discard ); 149848b8605Smrg 150848b8605Smrgvoid 151848b8605Smrglp_setup_set_vertex_info( struct lp_setup_context *setup, 152848b8605Smrg struct vertex_info *info ); 153848b8605Smrg 154848b8605Smrgvoid 155848b8605Smrglp_setup_begin_query(struct lp_setup_context *setup, 156848b8605Smrg struct llvmpipe_query *pq); 157848b8605Smrg 158848b8605Smrgvoid 159848b8605Smrglp_setup_end_query(struct lp_setup_context *setup, 160848b8605Smrg struct llvmpipe_query *pq); 161848b8605Smrg 162b8e80941Smrgstatic inline unsigned 163848b8605Smrglp_clamp_viewport_idx(int idx) 164848b8605Smrg{ 165848b8605Smrg return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0; 166848b8605Smrg} 167848b8605Smrg 168848b8605Smrg#endif 169