cso_context.h revision e5b19a0f833b5a3d5ffcf50d25a620d00bd8914b
1/************************************************************************** 2 * 3 * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28 29#ifndef CSO_CONTEXT_H 30#define CSO_CONTEXT_H 31 32#include "pipe/p_context.h" 33#include "pipe/p_state.h" 34 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40struct cso_context; 41 42struct cso_context *cso_create_context( struct pipe_context *pipe ); 43 44void cso_set_blend( struct cso_context *cso, 45 const struct pipe_blend_state *blend ); 46 47void cso_unset_blend(struct cso_context *cso); 48 49void cso_set_depth_stencil_alpha( struct cso_context *cso, 50 const struct pipe_depth_stencil_alpha_state *dsa ); 51 52void cso_unset_depth_stencil_alpha( struct cso_context *cso ); 53 54void cso_set_rasterizer( struct cso_context *cso, 55 const struct pipe_rasterizer_state *rasterizer ); 56 57void cso_unset_rasterizer( struct cso_context *cso ); 58 59void cso_set_samplers( struct cso_context *cso, 60 unsigned count, 61 const struct pipe_sampler_state **states ); 62 63void cso_unset_samplers( struct cso_context *cso ); 64 65 66/* Alternate interface to support state trackers that like to modify 67 * samplers one at a time: 68 */ 69void cso_single_sampler( struct cso_context *cso, 70 unsigned nr, 71 const struct pipe_sampler_state *states ); 72 73void cso_single_sampler_done( struct cso_context *cso ); 74 75 76/* These aren't really sensible -- most of the time the api provides 77 * object semantics for shaders anyway, and the cases where it doesn't 78 * (eg mesa's internall-generated texenv programs), it will be up to 79 * the state tracker to implement their own specialized caching. 80 */ 81void cso_set_fragment_shader( struct cso_context *cso, 82 const struct pipe_shader_state *shader ); 83 84void cso_unset_fragment_shader( struct cso_context *cso ); 85 86void cso_set_vertex_shader( struct cso_context *cso, 87 const struct pipe_shader_state *shader ); 88 89void cso_unset_vertex_shader( struct cso_context *cso ); 90 91void cso_destroy_context( struct cso_context *cso ); 92 93 94#ifdef __cplusplus 95} 96#endif 97 98#endif 99