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 #ifndef LP_JIT_SAMPLE_H
29 #define LP_JIT_SAMPLE_H
30
31 struct lp_sampler_static_state
32 {
33 /*
34 * These attributes are effectively interleaved for more sane key handling.
35 * However, there might be lots of null space if the amount of samplers and
36 * textures isn't the same.
37 */
38 struct lp_static_sampler_state sampler_state;
39 struct lp_static_texture_state texture_state;
40 };
41
42
43 struct lp_image_static_state
44 {
45 struct lp_static_texture_state image_state;
46 };
47
48 struct lp_build_sampler_soa *
49 lp_bld_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
50 unsigned nr_samplers);
51
52 static inline void
lp_bld_llvm_sampler_soa_destroy(struct lp_build_sampler_soa * sampler)53 lp_bld_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
54 {
55 FREE(sampler);
56 }
57
58 struct lp_build_image_soa *
59 lp_bld_llvm_image_soa_create(const struct lp_image_static_state *static_state,
60 unsigned nr_images);
61
62 static inline void
lp_bld_llvm_image_soa_destroy(struct lp_build_image_soa * image)63 lp_bld_llvm_image_soa_destroy(struct lp_build_image_soa *image)
64 {
65 FREE(image);
66 }
67
68 #if LLVM_VERSION_MAJOR >= 15
69 #define LP_TOTAL_IMAGE_OP_COUNT ((LP_IMG_OP_COUNT + LLVMAtomicRMWBinOpFMin) * 2)
70 #else
71 #define LP_TOTAL_IMAGE_OP_COUNT ((LP_IMG_OP_COUNT + 14) * 2)
72 #endif
73
74 #endif
75