nvfx: expose GLSL
[mesa/mesa-lb.git] / src / gallium / drivers / llvmpipe / lp_jit.h
blob13167ae3bf4edbc4e05a260242238a52d7c45c97
1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
4 * All Rights Reserved.
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:
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.
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.
26 **************************************************************************/
28 /**
29 * @file
30 * C - JIT interfaces
32 * @author Jose Fonseca <jfonseca@vmware.com>
35 #ifndef LP_JIT_H
36 #define LP_JIT_H
39 #include "gallivm/lp_bld_struct.h"
41 #include "pipe/p_state.h"
42 #include "lp_texture.h"
45 struct llvmpipe_screen;
48 struct lp_jit_texture
50 uint32_t width;
51 uint32_t height;
52 uint32_t depth;
53 uint32_t last_level;
54 uint32_t row_stride[LP_MAX_TEXTURE_2D_LEVELS];
55 const void *data[LP_MAX_TEXTURE_2D_LEVELS];
59 enum {
60 LP_JIT_TEXTURE_WIDTH = 0,
61 LP_JIT_TEXTURE_HEIGHT,
62 LP_JIT_TEXTURE_DEPTH,
63 LP_JIT_TEXTURE_LAST_LEVEL,
64 LP_JIT_TEXTURE_ROW_STRIDE,
65 LP_JIT_TEXTURE_DATA
70 /**
71 * This structure is passed directly to the generated fragment shader.
73 * It contains the derived state.
75 * Changes here must be reflected in the lp_jit_context_* macros and
76 * lp_jit_init_types function. Changes to the ordering should be avoided.
78 * Only use types with a clear size and padding here, in particular prefer the
79 * stdint.h types to the basic integer types.
81 struct lp_jit_context
83 const float *constants;
85 float alpha_ref_value;
87 /** floats, not ints */
88 float scissor_xmin, scissor_ymin, scissor_xmax, scissor_ymax;
90 /* FIXME: store (also?) in floats */
91 uint8_t *blend_color;
93 struct lp_jit_texture textures[PIPE_MAX_SAMPLERS];
97 #define lp_jit_context_constants(_builder, _ptr) \
98 lp_build_struct_get(_builder, _ptr, 0, "constants")
100 #define lp_jit_context_alpha_ref_value(_builder, _ptr) \
101 lp_build_struct_get(_builder, _ptr, 1, "alpha_ref_value")
103 #define lp_jit_context_scissor_xmin_value(_builder, _ptr) \
104 lp_build_struct_get(_builder, _ptr, 2, "scissor_xmin")
106 #define lp_jit_context_scissor_ymin_value(_builder, _ptr) \
107 lp_build_struct_get(_builder, _ptr, 3, "scissor_ymin")
109 #define lp_jit_context_scissor_xmax_value(_builder, _ptr) \
110 lp_build_struct_get(_builder, _ptr, 4, "scissor_xmax")
112 #define lp_jit_context_scissor_ymax_value(_builder, _ptr) \
113 lp_build_struct_get(_builder, _ptr, 5, "scissor_ymax")
115 #define lp_jit_context_blend_color(_builder, _ptr) \
116 lp_build_struct_get(_builder, _ptr, 6, "blend_color")
118 #define LP_JIT_CONTEXT_TEXTURES_INDEX 7
120 #define lp_jit_context_textures(_builder, _ptr) \
121 lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES_INDEX, "textures")
124 typedef void
125 (*lp_jit_frag_func)(const struct lp_jit_context *context,
126 uint32_t x,
127 uint32_t y,
128 const void *a0,
129 const void *dadx,
130 const void *dady,
131 uint8_t **color,
132 void *depth,
133 const int32_t c1,
134 const int32_t c2,
135 const int32_t c3,
136 const int32_t *step1,
137 const int32_t *step2,
138 const int32_t *step3);
141 void
142 lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
145 void
146 lp_jit_screen_init(struct llvmpipe_screen *screen);
149 #endif /* LP_JIT_H */