Merge branch 'mesa_7_5_branch' into mesa_7_6_branch
[mesa.git] / src / gallium / drivers / llvmpipe / lp_jit.h
1 /**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc.
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 VMWARE 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 * @file
30 * C - JIT interfaces
31 *
32 * @author Jose Fonseca <jfonseca@vmware.com>
33 */
34
35 #ifndef LP_JIT_H
36 #define LP_JIT_H
37
38
39 #include "lp_bld_struct.h"
40
41
42 struct tgsi_sampler;
43 struct llvmpipe_screen;
44
45
46 /**
47 * This structure is passed directly to the generated fragment shader.
48 *
49 * It contains the derived state.
50 *
51 * Changes here must be reflected in the lp_jit_context_* macros and
52 * lp_jit_init_types function. Changes to the ordering should be avoided.
53 *
54 * Only use types with a clear size and padding here, in particular prefer the
55 * stdint.h types to the basic integer types.
56 */
57 struct lp_jit_context
58 {
59 const float *constants;
60
61 struct tgsi_sampler **samplers;
62
63 /* TODO: alpha reference value */
64 float alpha_ref_value;
65
66 /* TODO: blend constant color */
67 uint8_t *blend_color;
68 };
69
70
71 #define lp_jit_context_constants(_builder, _ptr) \
72 lp_build_struct_get(_builder, _ptr, 0, "constants")
73
74 #define lp_jit_context_samplers(_builder, _ptr) \
75 lp_build_struct_get(_builder, _ptr, 1, "samplers")
76
77 #define lp_jit_context_alpha_ref_value(_builder, _ptr) \
78 lp_build_struct_get(_builder, _ptr, 2, "alpha_ref_value")
79
80 #define lp_jit_context_blend_color(_builder, _ptr) \
81 lp_build_struct_get(_builder, _ptr, 3, "blend_color")
82
83
84 typedef void
85 (*lp_jit_frag_func)(struct lp_jit_context *context,
86 uint32_t x,
87 uint32_t y,
88 const void *a0,
89 const void *dadx,
90 const void *dady,
91 uint32_t *mask,
92 void *color,
93 void *depth);
94
95 void PIPE_CDECL
96 lp_fetch_texel_soa( struct tgsi_sampler **samplers,
97 uint32_t unit,
98 float *store );
99
100
101 void
102 lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
103
104
105 void
106 lp_jit_screen_init(struct llvmpipe_screen *screen);
107
108
109 #endif /* LP_JIT_H */