00001 /************************************************************************** 00002 * 00003 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 00004 * All Rights Reserved. 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a 00007 * copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sub license, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice (including the 00015 * next paragraph) shall be included in all copies or substantial portions 00016 * of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00019 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 00021 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 00022 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00023 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00024 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00025 * 00026 **************************************************************************/ 00027 00028 /* Authors: Keith Whitwell <keith@tungstengraphics.com> 00029 */ 00030 00031 #include "util/u_memory.h" 00032 #include "sp_context.h" 00033 #include "sp_state.h" 00034 00035 00036 void * 00037 softpipe_create_blend_state(struct pipe_context *pipe, 00038 const struct pipe_blend_state *blend) 00039 { 00040 return mem_dup(blend, sizeof(*blend)); 00041 } 00042 00043 void softpipe_bind_blend_state( struct pipe_context *pipe, 00044 void *blend ) 00045 { 00046 struct softpipe_context *softpipe = softpipe_context(pipe); 00047 00048 softpipe->blend = (const struct pipe_blend_state *)blend; 00049 00050 softpipe->dirty |= SP_NEW_BLEND; 00051 } 00052 00053 void softpipe_delete_blend_state(struct pipe_context *pipe, 00054 void *blend) 00055 { 00056 FREE( blend ); 00057 } 00058 00059 00060 void softpipe_set_blend_color( struct pipe_context *pipe, 00061 const struct pipe_blend_color *blend_color ) 00062 { 00063 struct softpipe_context *softpipe = softpipe_context(pipe); 00064 00065 softpipe->blend_color = *blend_color; 00066 00067 softpipe->dirty |= SP_NEW_BLEND; 00068 } 00069 00070 00076 void * 00077 softpipe_create_depth_stencil_state(struct pipe_context *pipe, 00078 const struct pipe_depth_stencil_alpha_state *depth_stencil) 00079 { 00080 return mem_dup(depth_stencil, sizeof(*depth_stencil)); 00081 } 00082 00083 void 00084 softpipe_bind_depth_stencil_state(struct pipe_context *pipe, 00085 void *depth_stencil) 00086 { 00087 struct softpipe_context *softpipe = softpipe_context(pipe); 00088 00089 softpipe->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; 00090 00091 softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; 00092 } 00093 00094 void 00095 softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth) 00096 { 00097 FREE( depth ); 00098 }