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 "lp_bld_struct.h"
41 #include "pipe/p_state.h"
45 struct llvmpipe_screen
;
58 LP_JIT_TEXTURE_WIDTH
= 0,
59 LP_JIT_TEXTURE_HEIGHT
,
60 LP_JIT_TEXTURE_STRIDE
,
67 * This structure is passed directly to the generated fragment shader.
69 * It contains the derived state.
71 * Changes here must be reflected in the lp_jit_context_* macros and
72 * lp_jit_init_types function. Changes to the ordering should be avoided.
74 * Only use types with a clear size and padding here, in particular prefer the
75 * stdint.h types to the basic integer types.
79 const float *constants
;
81 struct tgsi_sampler
**samplers
;
83 float alpha_ref_value
;
85 /* FIXME: store (also?) in floats */
88 struct lp_jit_texture textures
[PIPE_MAX_SAMPLERS
];
92 #define lp_jit_context_constants(_builder, _ptr) \
93 lp_build_struct_get(_builder, _ptr, 0, "constants")
95 #define lp_jit_context_samplers(_builder, _ptr) \
96 lp_build_struct_get(_builder, _ptr, 1, "samplers")
98 #define lp_jit_context_alpha_ref_value(_builder, _ptr) \
99 lp_build_struct_get(_builder, _ptr, 2, "alpha_ref_value")
101 #define lp_jit_context_blend_color(_builder, _ptr) \
102 lp_build_struct_get(_builder, _ptr, 3, "blend_color")
104 #define LP_JIT_CONTEXT_TEXTURES_INDEX 4
106 #define lp_jit_context_textures(_builder, _ptr) \
107 lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES_INDEX, "textures")
111 (*lp_jit_frag_func
)(struct lp_jit_context
*context
,
122 lp_fetch_texel_soa( struct tgsi_sampler
**samplers
,
128 lp_jit_screen_cleanup(struct llvmpipe_screen
*screen
);
132 lp_jit_screen_init(struct llvmpipe_screen
*screen
);
135 #endif /* LP_JIT_H */