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;
55 uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
56 uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
57 const void *data[LP_MAX_TEXTURE_LEVELS];
58 /* sampler state, actually */
62 float border_color[4];
67 LP_JIT_TEXTURE_WIDTH = 0,
68 LP_JIT_TEXTURE_HEIGHT,
70 LP_JIT_TEXTURE_FIRST_LEVEL,
71 LP_JIT_TEXTURE_LAST_LEVEL,
72 LP_JIT_TEXTURE_ROW_STRIDE,
73 LP_JIT_TEXTURE_IMG_STRIDE,
75 LP_JIT_TEXTURE_MIN_LOD,
76 LP_JIT_TEXTURE_MAX_LOD,
77 LP_JIT_TEXTURE_LOD_BIAS,
78 LP_JIT_TEXTURE_BORDER_COLOR,
79 LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
85 * This structure is passed directly to the generated fragment shader.
87 * It contains the derived state.
89 * Changes here must be reflected in the lp_jit_context_* macros and
90 * lp_jit_init_types function. Changes to the ordering should be avoided.
92 * Only use types with a clear size and padding here, in particular prefer the
93 * stdint.h types to the basic integer types.
97 const float *constants;
99 float alpha_ref_value;
101 uint32_t stencil_ref_front, stencil_ref_back;
103 /* FIXME: store (also?) in floats */
104 uint8_t *blend_color;
106 struct lp_jit_texture textures[PIPE_MAX_SAMPLERS];
111 * These enum values must match the position of the fields in the
112 * lp_jit_context struct above.
115 LP_JIT_CTX_CONSTANTS = 0,
116 LP_JIT_CTX_ALPHA_REF,
117 LP_JIT_CTX_STENCIL_REF_FRONT,
118 LP_JIT_CTX_STENCIL_REF_BACK,
119 LP_JIT_CTX_BLEND_COLOR,
125 #define lp_jit_context_constants(_gallivm, _ptr) \
126 lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
128 #define lp_jit_context_alpha_ref_value(_gallivm, _ptr) \
129 lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
131 #define lp_jit_context_stencil_ref_front_value(_gallivm, _ptr) \
132 lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_STENCIL_REF_FRONT, "stencil_ref_front")
134 #define lp_jit_context_stencil_ref_back_value(_gallivm, _ptr) \
135 lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_STENCIL_REF_BACK, "stencil_ref_back")
137 #define lp_jit_context_blend_color(_gallivm, _ptr) \
138 lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
140 #define lp_jit_context_textures(_gallivm, _ptr) \
141 lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_TEXTURES, "textures")
146 (*lp_jit_frag_func)(const struct lp_jit_context *context,
160 lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
164 lp_jit_screen_init(struct llvmpipe_screen *screen);
168 lp_jit_get_context_type(struct llvmpipe_context *lp);
171 #endif /* LP_JIT_H */