1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
4 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
30 * @author Jose Fonseca <jfonseca@vmware.com>
31 * @author Keith Whitwell <keith@tungstengraphics.com>
34 #include "util/u_memory.h"
35 #include "util/u_math.h"
36 #include "util/u_debug_dump.h"
37 #include "lp_screen.h"
38 #include "lp_context.h"
43 llvmpipe_create_blend_state(struct pipe_context
*pipe
,
44 const struct pipe_blend_state
*blend
)
46 return mem_dup(blend
, sizeof(*blend
));
49 void llvmpipe_bind_blend_state( struct pipe_context
*pipe
,
52 struct llvmpipe_context
*llvmpipe
= llvmpipe_context(pipe
);
54 llvmpipe
->blend
= blend
;
56 llvmpipe
->dirty
|= LP_NEW_BLEND
;
59 void llvmpipe_delete_blend_state(struct pipe_context
*pipe
,
66 void llvmpipe_set_blend_color( struct pipe_context
*pipe
,
67 const struct pipe_blend_color
*blend_color
)
69 struct llvmpipe_context
*llvmpipe
= llvmpipe_context(pipe
);
72 for (i
= 0; i
< 4; ++i
)
73 for (j
= 0; j
< 16; ++j
)
74 llvmpipe
->blend_color
[i
][j
] = float_to_ubyte(blend_color
->color
[i
]);
76 llvmpipe
->dirty
|= LP_NEW_BLEND
;
80 /** XXX move someday? Or consolidate all these simple state setters
86 llvmpipe_create_depth_stencil_state(struct pipe_context
*pipe
,
87 const struct pipe_depth_stencil_alpha_state
*depth_stencil
)
89 return mem_dup(depth_stencil
, sizeof(*depth_stencil
));
93 llvmpipe_bind_depth_stencil_state(struct pipe_context
*pipe
,
96 struct llvmpipe_context
*llvmpipe
= llvmpipe_context(pipe
);
98 llvmpipe
->depth_stencil
= (const struct pipe_depth_stencil_alpha_state
*)depth_stencil
;
100 llvmpipe
->dirty
|= LP_NEW_DEPTH_STENCIL_ALPHA
;
104 llvmpipe_delete_depth_stencil_state(struct pipe_context
*pipe
, void *depth
)