1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
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
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 **************************************************************************/
32 * @author Jose Fonseca <jfonseca@vmware.com>
39 #include "gallivm/lp_bld_struct.h"
41 #include "pipe/p_state.h"
42 #include "lp_texture.h"
45 struct llvmpipe_screen
;
54 uint32_t row_stride
[LP_MAX_TEXTURE_2D_LEVELS
];
55 const void *data
[LP_MAX_TEXTURE_2D_LEVELS
];
60 LP_JIT_TEXTURE_WIDTH
= 0,
61 LP_JIT_TEXTURE_HEIGHT
,
63 LP_JIT_TEXTURE_LAST_LEVEL
,
64 LP_JIT_TEXTURE_ROW_STRIDE
,
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.
83 const float *constants
;
85 float alpha_ref_value
;
87 uint8_t stencil_ref
[2];
89 /** floats, not ints */
90 float scissor_xmin
, scissor_ymin
, scissor_xmax
, scissor_ymax
;
92 /* FIXME: store (also?) in floats */
95 struct lp_jit_texture textures
[PIPE_MAX_SAMPLERS
];
100 * These enum values must match the position of the fields in the
101 * lp_jit_context struct above.
104 LP_JIT_CTX_CONSTANTS
= 0,
105 LP_JIT_CTX_ALPHA_REF
,
106 LP_JIT_CTX_STENCIL_REF
,
107 LP_JIT_CTX_SCISSOR_XMIN
,
108 LP_JIT_CTX_SCISSOR_YMIN
,
109 LP_JIT_CTX_SCISSOR_XMAX
,
110 LP_JIT_CTX_SCISSOR_YMAX
,
111 LP_JIT_CTX_BLEND_COLOR
,
117 #define lp_jit_context_constants(_builder, _ptr) \
118 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
120 #define lp_jit_context_alpha_ref_value(_builder, _ptr) \
121 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
123 #define lp_jit_context_stencil_ref_values(_builder, _ptr) \
124 lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CTX_STENCIL_REF, "stencil_ref")
126 #define lp_jit_context_scissor_xmin_value(_builder, _ptr) \
127 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMIN, "scissor_xmin")
129 #define lp_jit_context_scissor_ymin_value(_builder, _ptr) \
130 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_YMIN, "scissor_ymin")
132 #define lp_jit_context_scissor_xmax_value(_builder, _ptr) \
133 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMAX, "scissor_xmax")
135 #define lp_jit_context_scissor_ymax_value(_builder, _ptr) \
136 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_YMAX, "scissor_ymax")
138 #define lp_jit_context_blend_color(_builder, _ptr) \
139 lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
141 #define lp_jit_context_textures(_builder, _ptr) \
142 lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES, "textures")
146 (*lp_jit_frag_func
)(const struct lp_jit_context
*context
,
157 const int32_t *step1
,
158 const int32_t *step2
,
159 const int32_t *step3
);
163 lp_jit_screen_cleanup(struct llvmpipe_screen
*screen
);
167 lp_jit_screen_init(struct llvmpipe_screen
*screen
);
170 #endif /* LP_JIT_H */