1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2010 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#ifndef DRAW_LLVM_H
29bf215546Sopenharmony_ci#define DRAW_LLVM_H
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#include "draw/draw_private.h"
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci#include "draw/draw_vs.h"
34bf215546Sopenharmony_ci#include "draw/draw_gs.h"
35bf215546Sopenharmony_ci#include "draw/draw_tess.h"
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#include "gallivm/lp_bld_sample.h"
38bf215546Sopenharmony_ci#include "gallivm/lp_bld_limits.h"
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci#include "pipe/p_context.h"
41bf215546Sopenharmony_ci#include "util/list.h"
42bf215546Sopenharmony_ci
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_cistruct draw_llvm;
45bf215546Sopenharmony_cistruct llvm_vertex_shader;
46bf215546Sopenharmony_cistruct llvm_geometry_shader;
47bf215546Sopenharmony_cistruct llvm_tess_ctrl_shader;
48bf215546Sopenharmony_cistruct llvm_tess_eval_shader;
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_cistruct draw_jit_texture
51bf215546Sopenharmony_ci{
52bf215546Sopenharmony_ci   uint32_t width;
53bf215546Sopenharmony_ci   uint32_t height;
54bf215546Sopenharmony_ci   uint32_t depth;
55bf215546Sopenharmony_ci   const void *base;
56bf215546Sopenharmony_ci   uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
57bf215546Sopenharmony_ci   uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
58bf215546Sopenharmony_ci   uint32_t first_level;
59bf215546Sopenharmony_ci   uint32_t last_level;
60bf215546Sopenharmony_ci   uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
61bf215546Sopenharmony_ci   uint32_t num_samples;
62bf215546Sopenharmony_ci   uint32_t sample_stride;
63bf215546Sopenharmony_ci};
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_cistruct draw_sampler_static_state
67bf215546Sopenharmony_ci{
68bf215546Sopenharmony_ci   /*
69bf215546Sopenharmony_ci    * These attributes are effectively interleaved for more sane key handling.
70bf215546Sopenharmony_ci    * However, there might be lots of null space if the amount of samplers and
71bf215546Sopenharmony_ci    * textures isn't the same.
72bf215546Sopenharmony_ci    */
73bf215546Sopenharmony_ci   struct lp_static_sampler_state sampler_state;
74bf215546Sopenharmony_ci   struct lp_static_texture_state texture_state;
75bf215546Sopenharmony_ci};
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_cistruct draw_image_static_state
78bf215546Sopenharmony_ci{
79bf215546Sopenharmony_ci   struct lp_static_texture_state image_state;
80bf215546Sopenharmony_ci};
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ci
83bf215546Sopenharmony_cistruct draw_jit_sampler
84bf215546Sopenharmony_ci{
85bf215546Sopenharmony_ci   float min_lod;
86bf215546Sopenharmony_ci   float max_lod;
87bf215546Sopenharmony_ci   float lod_bias;
88bf215546Sopenharmony_ci   float border_color[4];
89bf215546Sopenharmony_ci   float max_aniso;
90bf215546Sopenharmony_ci};
91bf215546Sopenharmony_ci
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_cistruct draw_jit_image
94bf215546Sopenharmony_ci{
95bf215546Sopenharmony_ci   uint32_t width;
96bf215546Sopenharmony_ci   uint32_t height;
97bf215546Sopenharmony_ci   uint32_t depth;
98bf215546Sopenharmony_ci   const void *base;
99bf215546Sopenharmony_ci   uint32_t row_stride;
100bf215546Sopenharmony_ci   uint32_t img_stride;
101bf215546Sopenharmony_ci   uint32_t num_samples;
102bf215546Sopenharmony_ci   uint32_t sample_stride;
103bf215546Sopenharmony_ci};
104bf215546Sopenharmony_ci
105bf215546Sopenharmony_cienum {
106bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_WIDTH = 0,
107bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_HEIGHT,
108bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_DEPTH,
109bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_BASE,
110bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_ROW_STRIDE,
111bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_IMG_STRIDE,
112bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_FIRST_LEVEL,
113bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_LAST_LEVEL,
114bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_MIP_OFFSETS,
115bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_NUM_SAMPLES,
116bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_SAMPLE_STRIDE,
117bf215546Sopenharmony_ci   DRAW_JIT_TEXTURE_NUM_FIELDS  /* number of fields above */
118bf215546Sopenharmony_ci};
119bf215546Sopenharmony_ci
120bf215546Sopenharmony_ci
121bf215546Sopenharmony_cienum {
122bf215546Sopenharmony_ci   DRAW_JIT_SAMPLER_MIN_LOD,
123bf215546Sopenharmony_ci   DRAW_JIT_SAMPLER_MAX_LOD,
124bf215546Sopenharmony_ci   DRAW_JIT_SAMPLER_LOD_BIAS,
125bf215546Sopenharmony_ci   DRAW_JIT_SAMPLER_BORDER_COLOR,
126bf215546Sopenharmony_ci   DRAW_JIT_SAMPLER_MAX_ANISO,
127bf215546Sopenharmony_ci   DRAW_JIT_SAMPLER_NUM_FIELDS  /* number of fields above */
128bf215546Sopenharmony_ci};
129bf215546Sopenharmony_ci
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_cienum {
132bf215546Sopenharmony_ci   DRAW_JIT_VERTEX_VERTEX_ID = 0,
133bf215546Sopenharmony_ci   DRAW_JIT_VERTEX_CLIP_POS,
134bf215546Sopenharmony_ci   DRAW_JIT_VERTEX_DATA
135bf215546Sopenharmony_ci};
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_cienum {
138bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_WIDTH = 0,
139bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_HEIGHT,
140bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_DEPTH,
141bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_BASE,
142bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_ROW_STRIDE,
143bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_IMG_STRIDE,
144bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_NUM_SAMPLES,
145bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_SAMPLE_STRIDE,
146bf215546Sopenharmony_ci   DRAW_JIT_IMAGE_NUM_FIELDS  /* number of fields above */
147bf215546Sopenharmony_ci};
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci/**
150bf215546Sopenharmony_ci * This structure is passed directly to the generated vertex shader.
151bf215546Sopenharmony_ci *
152bf215546Sopenharmony_ci * It contains the derived state.
153bf215546Sopenharmony_ci *
154bf215546Sopenharmony_ci * Changes here must be reflected in the draw_jit_context_* macros.
155bf215546Sopenharmony_ci * Changes to the ordering should be avoided.
156bf215546Sopenharmony_ci *
157bf215546Sopenharmony_ci * Only use types with a clear size and padding here, in particular prefer the
158bf215546Sopenharmony_ci * stdint.h types to the basic integer types.
159bf215546Sopenharmony_ci */
160bf215546Sopenharmony_cistruct draw_jit_context
161bf215546Sopenharmony_ci{
162bf215546Sopenharmony_ci   const float *vs_constants[LP_MAX_TGSI_CONST_BUFFERS];
163bf215546Sopenharmony_ci   int num_vs_constants[LP_MAX_TGSI_CONST_BUFFERS];
164bf215546Sopenharmony_ci   float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
165bf215546Sopenharmony_ci   struct pipe_viewport_state *viewports;
166bf215546Sopenharmony_ci
167bf215546Sopenharmony_ci   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
168bf215546Sopenharmony_ci   struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
169bf215546Sopenharmony_ci   struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
170bf215546Sopenharmony_ci
171bf215546Sopenharmony_ci   const uint32_t *vs_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
172bf215546Sopenharmony_ci   int num_vs_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
173bf215546Sopenharmony_ci
174bf215546Sopenharmony_ci   const float *aniso_filter_table;
175bf215546Sopenharmony_ci};
176bf215546Sopenharmony_ci
177bf215546Sopenharmony_cienum {
178bf215546Sopenharmony_ci   DRAW_JIT_CTX_CONSTANTS            = 0,
179bf215546Sopenharmony_ci   DRAW_JIT_CTX_NUM_CONSTANTS        = 1,
180bf215546Sopenharmony_ci   DRAW_JIT_CTX_PLANES               = 2,
181bf215546Sopenharmony_ci   DRAW_JIT_CTX_VIEWPORT             = 3,
182bf215546Sopenharmony_ci   DRAW_JIT_CTX_TEXTURES             = 4,
183bf215546Sopenharmony_ci   DRAW_JIT_CTX_SAMPLERS             = 5,
184bf215546Sopenharmony_ci   DRAW_JIT_CTX_IMAGES               = 6,
185bf215546Sopenharmony_ci   DRAW_JIT_CTX_SSBOS                = 7,
186bf215546Sopenharmony_ci   DRAW_JIT_CTX_NUM_SSBOS            = 8,
187bf215546Sopenharmony_ci   DRAW_JIT_CTX_ANISO_FILTER_TABLE   = 9,
188bf215546Sopenharmony_ci   DRAW_JIT_CTX_NUM_FIELDS
189bf215546Sopenharmony_ci};
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ci#define draw_jit_context_vs_constants(_variant, _ptr) \
192bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_CONSTANTS, "vs_constants")
193bf215546Sopenharmony_ci
194bf215546Sopenharmony_ci#define draw_jit_context_num_vs_constants(_variant, _ptr) \
195bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_NUM_CONSTANTS, "num_vs_constants")
196bf215546Sopenharmony_ci
197bf215546Sopenharmony_ci#define draw_jit_context_planes(_gallivm, _type, _ptr) \
198bf215546Sopenharmony_ci   lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_CTX_PLANES, "planes")
199bf215546Sopenharmony_ci
200bf215546Sopenharmony_ci#define draw_jit_context_viewports(_variant, _ptr) \
201bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_VIEWPORT, "viewports")
202bf215546Sopenharmony_ci
203bf215546Sopenharmony_ci#define draw_jit_context_textures(_gallivm, _ptr) \
204bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_ci#define draw_jit_context_samplers(_gallivm, _ptr) \
207bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_SAMPLERS, "samplers")
208bf215546Sopenharmony_ci
209bf215546Sopenharmony_ci#define draw_jit_context_images(_gallivm, _ptr) \
210bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_IMAGES, "images")
211bf215546Sopenharmony_ci
212bf215546Sopenharmony_ci#define draw_jit_context_vs_ssbos(_variant, _ptr) \
213bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_SSBOS, "vs_ssbos")
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_ci#define draw_jit_context_num_vs_ssbos(_variant, _ptr) \
216bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_NUM_SSBOS, "num_vs_ssbos")
217bf215546Sopenharmony_ci
218bf215546Sopenharmony_ci#define draw_jit_context_aniso_filter_table(_variant, _ptr) \
219bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table")
220bf215546Sopenharmony_ci
221bf215546Sopenharmony_ci
222bf215546Sopenharmony_ci#define draw_jit_header_id(_gallivm, _type, _ptr)              \
223bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_gallivm, _type, _ptr, DRAW_JIT_VERTEX_VERTEX_ID, "id")
224bf215546Sopenharmony_ci
225bf215546Sopenharmony_ci#define draw_jit_header_clip_pos(_gallivm, _type, _ptr) \
226bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_gallivm, _type, _ptr, DRAW_JIT_VERTEX_CLIP_POS, "clip_pos")
227bf215546Sopenharmony_ci
228bf215546Sopenharmony_ci#define draw_jit_header_data(_gallivm, _type, _ptr)            \
229bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_gallivm, _type, _ptr, DRAW_JIT_VERTEX_DATA, "data")
230bf215546Sopenharmony_ci
231bf215546Sopenharmony_ci
232bf215546Sopenharmony_ci#define draw_jit_vbuffer_stride(_gallivm, _type, _ptr)         \
233bf215546Sopenharmony_ci   lp_build_struct_get2(_gallivm, _type, _ptr, 0, "stride")
234bf215546Sopenharmony_ci
235bf215546Sopenharmony_ci#define draw_jit_vbuffer_offset(_gallivm, _type, _ptr)         \
236bf215546Sopenharmony_ci   lp_build_struct_get2(_gallivm, _type, _ptr, 2, "buffer_offset")
237bf215546Sopenharmony_ci
238bf215546Sopenharmony_cienum {
239bf215546Sopenharmony_ci   DRAW_JIT_DVBUFFER_MAP = 0,
240bf215546Sopenharmony_ci   DRAW_JIT_DVBUFFER_SIZE,
241bf215546Sopenharmony_ci   DRAW_JIT_DVBUFFER_NUM_FIELDS  /* number of fields above */
242bf215546Sopenharmony_ci};
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci#define draw_jit_dvbuffer_map(_gallivm, _type, _ptr)         \
245bf215546Sopenharmony_ci   lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_DVBUFFER_MAP, "map")
246bf215546Sopenharmony_ci
247bf215546Sopenharmony_ci#define draw_jit_dvbuffer_size(_gallivm, _type, _ptr)        \
248bf215546Sopenharmony_ci   lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_DVBUFFER_SIZE, "size")
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_ci/**
252bf215546Sopenharmony_ci * This structure is passed directly to the generated geometry shader.
253bf215546Sopenharmony_ci *
254bf215546Sopenharmony_ci * It contains the derived state.
255bf215546Sopenharmony_ci *
256bf215546Sopenharmony_ci * Changes here must be reflected in the draw_gs_jit_context_* macros.
257bf215546Sopenharmony_ci * Changes to the ordering should be avoided.
258bf215546Sopenharmony_ci *
259bf215546Sopenharmony_ci * Only use types with a clear size and padding here, in particular prefer the
260bf215546Sopenharmony_ci * stdint.h types to the basic integer types.
261bf215546Sopenharmony_ci */
262bf215546Sopenharmony_cistruct draw_gs_jit_context
263bf215546Sopenharmony_ci{
264bf215546Sopenharmony_ci   const float *constants[LP_MAX_TGSI_CONST_BUFFERS];
265bf215546Sopenharmony_ci   int num_constants[LP_MAX_TGSI_CONST_BUFFERS];
266bf215546Sopenharmony_ci   float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
267bf215546Sopenharmony_ci   struct pipe_viewport_state *viewports;
268bf215546Sopenharmony_ci
269bf215546Sopenharmony_ci   /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
270bf215546Sopenharmony_ci    * DRAW_JIT_CTX_SAMPLERS positions in the struct */
271bf215546Sopenharmony_ci   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
272bf215546Sopenharmony_ci   struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
273bf215546Sopenharmony_ci   struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
274bf215546Sopenharmony_ci
275bf215546Sopenharmony_ci   int **prim_lengths;
276bf215546Sopenharmony_ci   int *emitted_vertices;
277bf215546Sopenharmony_ci   int *emitted_prims;
278bf215546Sopenharmony_ci   const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
279bf215546Sopenharmony_ci   int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
280bf215546Sopenharmony_ci
281bf215546Sopenharmony_ci   const float *aniso_filter_table;
282bf215546Sopenharmony_ci};
283bf215546Sopenharmony_ci
284bf215546Sopenharmony_cienum {
285bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_CONSTANTS = 0,
286bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_NUM_CONSTANTS = 1,
287bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_PLANES = 2,
288bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_VIEWPORT = 3,
289bf215546Sopenharmony_ci   /* Textures and samples are reserved for DRAW_JIT_CTX_TEXTURES
290bf215546Sopenharmony_ci    * and DRAW_JIT_CTX_SAMPLERS, because they both need
291bf215546Sopenharmony_ci    * to be at exactly the same locations as they are in the
292bf215546Sopenharmony_ci    * VS ctx structure for sampling to work. */
293bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES,
294bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS,
295bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES,
296bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_PRIM_LENGTHS = 7,
297bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_EMITTED_VERTICES = 8,
298bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_EMITTED_PRIMS = 9,
299bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_SSBOS = 10,
300bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_NUM_SSBOS = 11,
301bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE = 12,
302bf215546Sopenharmony_ci   DRAW_GS_JIT_CTX_NUM_FIELDS = 13
303bf215546Sopenharmony_ci};
304bf215546Sopenharmony_ci
305bf215546Sopenharmony_ci#define draw_gs_jit_context_constants(_variant, _ptr) \
306bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_CONSTANTS, "constants")
307bf215546Sopenharmony_ci
308bf215546Sopenharmony_ci#define draw_gs_jit_context_num_constants(_variant, _ptr) \
309bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_NUM_CONSTANTS, "num_constants")
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_ci#define draw_gs_jit_context_planes(_gallivm, _ptr) \
312bf215546Sopenharmony_ci   lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_PLANES, "planes")
313bf215546Sopenharmony_ci
314bf215546Sopenharmony_ci#define draw_gs_jit_context_viewports(_gallivm, _ptr) \
315bf215546Sopenharmony_ci   lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_VIEWPORT, "viewports")
316bf215546Sopenharmony_ci
317bf215546Sopenharmony_ci#define draw_gs_jit_context_textures(_gallivm, _ptr) \
318bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_TEXTURES, "textures")
319bf215546Sopenharmony_ci
320bf215546Sopenharmony_ci#define draw_gs_jit_context_samplers(_gallivm, _ptr) \
321bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_SAMPLERS, "samplers")
322bf215546Sopenharmony_ci
323bf215546Sopenharmony_ci#define draw_gs_jit_context_images(_gallivm, _ptr)                      \
324bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_IMAGES, "images")
325bf215546Sopenharmony_ci
326bf215546Sopenharmony_ci#define draw_gs_jit_prim_lengths(_variant, _ptr) \
327bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_PRIM_LENGTHS, "prim_lengths")
328bf215546Sopenharmony_ci
329bf215546Sopenharmony_ci#define draw_gs_jit_emitted_vertices(_variant, _ptr) \
330bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_EMITTED_VERTICES, "emitted_vertices")
331bf215546Sopenharmony_ci
332bf215546Sopenharmony_ci#define draw_gs_jit_emitted_prims(_variant, _ptr) \
333bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_EMITTED_PRIMS, "emitted_prims")
334bf215546Sopenharmony_ci
335bf215546Sopenharmony_ci#define draw_gs_jit_context_ssbos(_variant, _ptr) \
336bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_SSBOS, "ssbos")
337bf215546Sopenharmony_ci
338bf215546Sopenharmony_ci#define draw_gs_jit_context_num_ssbos(_variant, _ptr) \
339bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_NUM_SSBOS, "num_ssbos")
340bf215546Sopenharmony_ci
341bf215546Sopenharmony_ci#define draw_gs_jit_context_aniso_filter_table(_variant, _ptr) \
342bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table")
343bf215546Sopenharmony_ci
344bf215546Sopenharmony_cistruct draw_tcs_jit_context {
345bf215546Sopenharmony_ci   const float *constants[LP_MAX_TGSI_CONST_BUFFERS];
346bf215546Sopenharmony_ci   int num_constants[LP_MAX_TGSI_CONST_BUFFERS];
347bf215546Sopenharmony_ci
348bf215546Sopenharmony_ci   int dummy1;
349bf215546Sopenharmony_ci   int dummy2;
350bf215546Sopenharmony_ci   /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
351bf215546Sopenharmony_ci    * DRAW_JIT_CTX_SAMPLERS positions in the struct */
352bf215546Sopenharmony_ci   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
353bf215546Sopenharmony_ci   struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
354bf215546Sopenharmony_ci   struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
355bf215546Sopenharmony_ci
356bf215546Sopenharmony_ci   const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
357bf215546Sopenharmony_ci   int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
358bf215546Sopenharmony_ci
359bf215546Sopenharmony_ci   const float *aniso_filter_table;
360bf215546Sopenharmony_ci};
361bf215546Sopenharmony_ci
362bf215546Sopenharmony_cienum {
363bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_CONSTANTS = 0,
364bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_NUM_CONSTANTS = 1,
365bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES,
366bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS,
367bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES,
368bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_SSBOS = 7,
369bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_NUM_SSBOS = 8,
370bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_ANISO_FILTER_TABLE = 9,
371bf215546Sopenharmony_ci   DRAW_TCS_JIT_CTX_NUM_FIELDS = 10,
372bf215546Sopenharmony_ci};
373bf215546Sopenharmony_ci
374bf215546Sopenharmony_ci#define draw_tcs_jit_context_constants(_variant, _ptr) \
375bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_CONSTANTS, "constants")
376bf215546Sopenharmony_ci
377bf215546Sopenharmony_ci#define draw_tcs_jit_context_num_constants(_variant, _ptr) \
378bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_NUM_CONSTANTS, "num_constants")
379bf215546Sopenharmony_ci
380bf215546Sopenharmony_ci#define draw_tcs_jit_context_textures(_gallivm, _ptr) \
381bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_TEXTURES, "textures")
382bf215546Sopenharmony_ci
383bf215546Sopenharmony_ci#define draw_tcs_jit_context_samplers(_gallivm, _ptr) \
384bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_SAMPLERS, "samplers")
385bf215546Sopenharmony_ci
386bf215546Sopenharmony_ci#define draw_tcs_jit_context_images(_gallivm, _ptr)                      \
387bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TCS_JIT_CTX_IMAGES, "images")
388bf215546Sopenharmony_ci
389bf215546Sopenharmony_ci#define draw_tcs_jit_context_ssbos(_variant, _ptr) \
390bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_SSBOS, "ssbos")
391bf215546Sopenharmony_ci
392bf215546Sopenharmony_ci#define draw_tcs_jit_context_num_ssbos(_variant, _ptr) \
393bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_NUM_SSBOS, "num_ssbos")
394bf215546Sopenharmony_ci
395bf215546Sopenharmony_ci#define draw_tcs_jit_context_aniso_filter_table(_variant, _ptr) \
396bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TCS_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table")
397bf215546Sopenharmony_ci
398bf215546Sopenharmony_cistruct draw_tes_jit_context {
399bf215546Sopenharmony_ci   const float *constants[LP_MAX_TGSI_CONST_BUFFERS];
400bf215546Sopenharmony_ci   int num_constants[LP_MAX_TGSI_CONST_BUFFERS];
401bf215546Sopenharmony_ci
402bf215546Sopenharmony_ci   int dummy1;
403bf215546Sopenharmony_ci   int dummy2;
404bf215546Sopenharmony_ci   /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
405bf215546Sopenharmony_ci    * DRAW_JIT_CTX_SAMPLERS positions in the struct */
406bf215546Sopenharmony_ci   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
407bf215546Sopenharmony_ci   struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
408bf215546Sopenharmony_ci   struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
409bf215546Sopenharmony_ci
410bf215546Sopenharmony_ci   const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
411bf215546Sopenharmony_ci   int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
412bf215546Sopenharmony_ci
413bf215546Sopenharmony_ci   const float *aniso_filter_table;
414bf215546Sopenharmony_ci};
415bf215546Sopenharmony_ci
416bf215546Sopenharmony_cienum {
417bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_CONSTANTS = 0,
418bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_NUM_CONSTANTS = 1,
419bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES,
420bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS,
421bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES,
422bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_SSBOS = 7,
423bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_NUM_SSBOS = 8,
424bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_ANISO_FILTER_TABLE = 9,
425bf215546Sopenharmony_ci   DRAW_TES_JIT_CTX_NUM_FIELDS = 10,
426bf215546Sopenharmony_ci};
427bf215546Sopenharmony_ci
428bf215546Sopenharmony_ci#define draw_tes_jit_context_constants(_variant, _ptr) \
429bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_CONSTANTS, "constants")
430bf215546Sopenharmony_ci
431bf215546Sopenharmony_ci#define draw_tes_jit_context_num_constants(_variant, _ptr) \
432bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_NUM_CONSTANTS, "num_constants")
433bf215546Sopenharmony_ci
434bf215546Sopenharmony_ci#define draw_tes_jit_context_textures(_gallivm, _ptr) \
435bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_TEXTURES, "textures")
436bf215546Sopenharmony_ci
437bf215546Sopenharmony_ci#define draw_tes_jit_context_samplers(_gallivm, _ptr) \
438bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_SAMPLERS, "samplers")
439bf215546Sopenharmony_ci
440bf215546Sopenharmony_ci#define draw_tes_jit_context_images(_gallivm, _ptr)                      \
441bf215546Sopenharmony_ci   lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_TES_JIT_CTX_IMAGES, "images")
442bf215546Sopenharmony_ci
443bf215546Sopenharmony_ci#define draw_tes_jit_context_ssbos(_variant, _ptr) \
444bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_SSBOS, "ssbos")
445bf215546Sopenharmony_ci
446bf215546Sopenharmony_ci#define draw_tes_jit_context_num_ssbos(_variant, _ptr) \
447bf215546Sopenharmony_ci   lp_build_struct_get_ptr2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_NUM_SSBOS, "num_ssbos")
448bf215546Sopenharmony_ci
449bf215546Sopenharmony_ci#define draw_tes_jit_context_aniso_filter_table(_variant, _ptr) \
450bf215546Sopenharmony_ci   lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_TES_JIT_CTX_ANISO_FILTER_TABLE, "aniso_filter_table")
451bf215546Sopenharmony_ci
452bf215546Sopenharmony_citypedef boolean
453bf215546Sopenharmony_ci(*draw_jit_vert_func)(struct draw_jit_context *context,
454bf215546Sopenharmony_ci                      struct vertex_header *io,
455bf215546Sopenharmony_ci                      const struct draw_vertex_buffer vbuffers[PIPE_MAX_ATTRIBS],
456bf215546Sopenharmony_ci                      unsigned count,
457bf215546Sopenharmony_ci                      unsigned start_or_maxelt,
458bf215546Sopenharmony_ci                      unsigned stride,
459bf215546Sopenharmony_ci                      struct pipe_vertex_buffer *vertex_buffers,
460bf215546Sopenharmony_ci                      unsigned instance_id,
461bf215546Sopenharmony_ci                      unsigned vertex_id_offset,
462bf215546Sopenharmony_ci                      unsigned start_instance,
463bf215546Sopenharmony_ci                      const unsigned *fetch_elts,
464bf215546Sopenharmony_ci                      unsigned draw_id, unsigned view_id);
465bf215546Sopenharmony_ci
466bf215546Sopenharmony_ci
467bf215546Sopenharmony_citypedef int
468bf215546Sopenharmony_ci(*draw_gs_jit_func)(struct draw_gs_jit_context *context,
469bf215546Sopenharmony_ci                    float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS],
470bf215546Sopenharmony_ci                    struct vertex_header **output,
471bf215546Sopenharmony_ci                    unsigned num_prims,
472bf215546Sopenharmony_ci                    unsigned instance_id,
473bf215546Sopenharmony_ci                    int *prim_ids,
474bf215546Sopenharmony_ci                    unsigned invocation_id,
475bf215546Sopenharmony_ci                    unsigned view_id);
476bf215546Sopenharmony_ci
477bf215546Sopenharmony_citypedef int
478bf215546Sopenharmony_ci(*draw_tcs_jit_func)(struct draw_tcs_jit_context *context,
479bf215546Sopenharmony_ci                     float inputs[32][NUM_TCS_INPUTS][TGSI_NUM_CHANNELS],
480bf215546Sopenharmony_ci                     float outputs[32][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS],
481bf215546Sopenharmony_ci                     uint32_t prim_id, uint32_t patch_vertices_in,
482bf215546Sopenharmony_ci                     unsigned view_id);
483bf215546Sopenharmony_ci
484bf215546Sopenharmony_citypedef int
485bf215546Sopenharmony_ci(*draw_tes_jit_func)(struct draw_tes_jit_context *context,
486bf215546Sopenharmony_ci                     float inputs[32][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS],
487bf215546Sopenharmony_ci                     struct vertex_header *io,
488bf215546Sopenharmony_ci                     uint32_t prim_id, uint32_t num_tess_coord,
489bf215546Sopenharmony_ci                     float *tess_coord_x, float *tess_coord_y, float *tess_outer,
490bf215546Sopenharmony_ci                     float *tess_inner, uint32_t patch_vertices_in,
491bf215546Sopenharmony_ci                     unsigned view_id);
492bf215546Sopenharmony_ci
493bf215546Sopenharmony_ci
494bf215546Sopenharmony_cistruct draw_llvm_variant_key
495bf215546Sopenharmony_ci{
496bf215546Sopenharmony_ci   unsigned nr_vertex_elements:8;
497bf215546Sopenharmony_ci   unsigned nr_samplers:8;
498bf215546Sopenharmony_ci   unsigned nr_sampler_views:8;
499bf215546Sopenharmony_ci   unsigned nr_images:8;
500bf215546Sopenharmony_ci   unsigned clamp_vertex_color:1;
501bf215546Sopenharmony_ci   unsigned clip_xy:1;
502bf215546Sopenharmony_ci   unsigned clip_z:1;
503bf215546Sopenharmony_ci   unsigned clip_user:1;
504bf215546Sopenharmony_ci   unsigned clip_halfz:1;
505bf215546Sopenharmony_ci   unsigned bypass_viewport:1;
506bf215546Sopenharmony_ci   unsigned need_edgeflags:1;
507bf215546Sopenharmony_ci   unsigned has_gs_or_tes:1;
508bf215546Sopenharmony_ci   unsigned num_outputs:8;
509bf215546Sopenharmony_ci   unsigned ucp_enable:PIPE_MAX_CLIP_PLANES;
510bf215546Sopenharmony_ci   /* note padding here - must use memset */
511bf215546Sopenharmony_ci
512bf215546Sopenharmony_ci   /* Variable number of vertex elements:
513bf215546Sopenharmony_ci    */
514bf215546Sopenharmony_ci   struct pipe_vertex_element vertex_element[1];
515bf215546Sopenharmony_ci
516bf215546Sopenharmony_ci   /* Followed by variable number of samplers:
517bf215546Sopenharmony_ci    */
518bf215546Sopenharmony_ci/*   struct draw_sampler_static_state sampler; */
519bf215546Sopenharmony_ci   /* Followed by variable number of images
520bf215546Sopenharmony_ci    */
521bf215546Sopenharmony_ci};
522bf215546Sopenharmony_ci
523bf215546Sopenharmony_cistruct draw_gs_llvm_variant_key
524bf215546Sopenharmony_ci{
525bf215546Sopenharmony_ci   unsigned nr_samplers:8;
526bf215546Sopenharmony_ci   unsigned nr_sampler_views:8;
527bf215546Sopenharmony_ci   unsigned nr_images:8;
528bf215546Sopenharmony_ci   unsigned num_outputs:8;
529bf215546Sopenharmony_ci   /* note padding here - must use memset */
530bf215546Sopenharmony_ci   unsigned clamp_vertex_color:1;
531bf215546Sopenharmony_ci   struct draw_sampler_static_state samplers[1];
532bf215546Sopenharmony_ci   /* Followed by variable number of images.*/
533bf215546Sopenharmony_ci};
534bf215546Sopenharmony_ci
535bf215546Sopenharmony_cistruct draw_tcs_llvm_variant_key
536bf215546Sopenharmony_ci{
537bf215546Sopenharmony_ci   unsigned nr_samplers:8;
538bf215546Sopenharmony_ci   unsigned nr_sampler_views:8;
539bf215546Sopenharmony_ci   unsigned nr_images:8;
540bf215546Sopenharmony_ci   struct draw_sampler_static_state samplers[1];
541bf215546Sopenharmony_ci   /* Followed by variable number of images.*/
542bf215546Sopenharmony_ci};
543bf215546Sopenharmony_ci
544bf215546Sopenharmony_cistruct draw_tes_llvm_variant_key
545bf215546Sopenharmony_ci{
546bf215546Sopenharmony_ci   unsigned nr_samplers:8;
547bf215546Sopenharmony_ci   unsigned nr_sampler_views:8;
548bf215546Sopenharmony_ci   unsigned nr_images:8;
549bf215546Sopenharmony_ci   unsigned primid_output:7;
550bf215546Sopenharmony_ci   unsigned primid_needed:1;
551bf215546Sopenharmony_ci   unsigned clamp_vertex_color:1;
552bf215546Sopenharmony_ci   struct draw_sampler_static_state samplers[1];
553bf215546Sopenharmony_ci   /* Followed by variable number of images.*/
554bf215546Sopenharmony_ci};
555bf215546Sopenharmony_ci
556bf215546Sopenharmony_ci#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
557bf215546Sopenharmony_ci   (sizeof(struct draw_llvm_variant_key) +	\
558bf215546Sopenharmony_ci    PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) +	\
559bf215546Sopenharmony_ci    PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
560bf215546Sopenharmony_ci    (PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
561bf215546Sopenharmony_ci
562bf215546Sopenharmony_ci#define DRAW_GS_LLVM_MAX_VARIANT_KEY_SIZE \
563bf215546Sopenharmony_ci   (sizeof(struct draw_gs_llvm_variant_key) +	\
564bf215546Sopenharmony_ci    PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
565bf215546Sopenharmony_ci    PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
566bf215546Sopenharmony_ci
567bf215546Sopenharmony_ci#define DRAW_TCS_LLVM_MAX_VARIANT_KEY_SIZE \
568bf215546Sopenharmony_ci   (sizeof(struct draw_tcs_llvm_variant_key) +	\
569bf215546Sopenharmony_ci    PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
570bf215546Sopenharmony_ci    PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
571bf215546Sopenharmony_ci
572bf215546Sopenharmony_ci#define DRAW_TES_LLVM_MAX_VARIANT_KEY_SIZE \
573bf215546Sopenharmony_ci   (sizeof(struct draw_tes_llvm_variant_key) +	\
574bf215546Sopenharmony_ci    PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
575bf215546Sopenharmony_ci    PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
576bf215546Sopenharmony_ci
577bf215546Sopenharmony_ci
578bf215546Sopenharmony_cistatic inline size_t
579bf215546Sopenharmony_cidraw_llvm_variant_key_size(unsigned nr_vertex_elements,
580bf215546Sopenharmony_ci                           unsigned nr_samplers,
581bf215546Sopenharmony_ci                           unsigned nr_sampler_views,
582bf215546Sopenharmony_ci                           unsigned nr_images)
583bf215546Sopenharmony_ci{
584bf215546Sopenharmony_ci   return (sizeof(struct draw_llvm_variant_key) +
585bf215546Sopenharmony_ci           (nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element) +
586bf215546Sopenharmony_ci           MAX2(nr_samplers, nr_sampler_views) *
587bf215546Sopenharmony_ci               sizeof(struct draw_sampler_static_state) +
588bf215546Sopenharmony_ci           nr_images * sizeof(struct draw_image_static_state));
589bf215546Sopenharmony_ci}
590bf215546Sopenharmony_ci
591bf215546Sopenharmony_ci
592bf215546Sopenharmony_cistatic inline size_t
593bf215546Sopenharmony_cidraw_gs_llvm_variant_key_size(unsigned nr_samplers,
594bf215546Sopenharmony_ci                              unsigned nr_sampler_views,
595bf215546Sopenharmony_ci                              unsigned nr_images)
596bf215546Sopenharmony_ci{
597bf215546Sopenharmony_ci   return (sizeof(struct draw_gs_llvm_variant_key) +
598bf215546Sopenharmony_ci           (MAX2(nr_samplers, nr_sampler_views) - 1) *
599bf215546Sopenharmony_ci               sizeof(struct draw_sampler_static_state) +
600bf215546Sopenharmony_ci           nr_images * sizeof(struct draw_sampler_static_state));
601bf215546Sopenharmony_ci}
602bf215546Sopenharmony_ci
603bf215546Sopenharmony_cistatic inline size_t
604bf215546Sopenharmony_cidraw_tcs_llvm_variant_key_size(unsigned nr_samplers,
605bf215546Sopenharmony_ci                               unsigned nr_sampler_views,
606bf215546Sopenharmony_ci                               unsigned nr_images)
607bf215546Sopenharmony_ci{
608bf215546Sopenharmony_ci   return (sizeof(struct draw_tcs_llvm_variant_key) +
609bf215546Sopenharmony_ci           (MAX2(nr_samplers, nr_sampler_views) - 1) *
610bf215546Sopenharmony_ci               sizeof(struct draw_sampler_static_state) +
611bf215546Sopenharmony_ci           nr_images * sizeof(struct draw_sampler_static_state));
612bf215546Sopenharmony_ci}
613bf215546Sopenharmony_ci
614bf215546Sopenharmony_cistatic inline size_t
615bf215546Sopenharmony_cidraw_tes_llvm_variant_key_size(unsigned nr_samplers,
616bf215546Sopenharmony_ci                               unsigned nr_sampler_views,
617bf215546Sopenharmony_ci                               unsigned nr_images)
618bf215546Sopenharmony_ci{
619bf215546Sopenharmony_ci   return (sizeof(struct draw_tes_llvm_variant_key) +
620bf215546Sopenharmony_ci           (MAX2(nr_samplers, nr_sampler_views) - 1) *
621bf215546Sopenharmony_ci               sizeof(struct draw_sampler_static_state) +
622bf215546Sopenharmony_ci           nr_images * sizeof(struct draw_sampler_static_state));
623bf215546Sopenharmony_ci}
624bf215546Sopenharmony_ci
625bf215546Sopenharmony_cistatic inline struct draw_sampler_static_state *
626bf215546Sopenharmony_cidraw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
627bf215546Sopenharmony_ci{
628bf215546Sopenharmony_ci   return (struct draw_sampler_static_state *)
629bf215546Sopenharmony_ci      &key->vertex_element[key->nr_vertex_elements];
630bf215546Sopenharmony_ci}
631bf215546Sopenharmony_ci
632bf215546Sopenharmony_cistatic inline struct draw_image_static_state *
633bf215546Sopenharmony_cidraw_llvm_variant_key_images(struct draw_llvm_variant_key *key)
634bf215546Sopenharmony_ci{
635bf215546Sopenharmony_ci   struct draw_sampler_static_state *samplers = (struct draw_sampler_static_state *)
636bf215546Sopenharmony_ci      (&key->vertex_element[key->nr_vertex_elements]);
637bf215546Sopenharmony_ci   return (struct draw_image_static_state *)
638bf215546Sopenharmony_ci      &samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
639bf215546Sopenharmony_ci}
640bf215546Sopenharmony_ci
641bf215546Sopenharmony_cistatic inline struct draw_image_static_state *
642bf215546Sopenharmony_cidraw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key *key)
643bf215546Sopenharmony_ci{
644bf215546Sopenharmony_ci   return (struct draw_image_static_state *)
645bf215546Sopenharmony_ci      &key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
646bf215546Sopenharmony_ci}
647bf215546Sopenharmony_ci
648bf215546Sopenharmony_cistatic inline struct draw_image_static_state *
649bf215546Sopenharmony_cidraw_tcs_llvm_variant_key_images(struct draw_tcs_llvm_variant_key *key)
650bf215546Sopenharmony_ci{
651bf215546Sopenharmony_ci   return (struct draw_image_static_state *)
652bf215546Sopenharmony_ci      &key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
653bf215546Sopenharmony_ci}
654bf215546Sopenharmony_ci
655bf215546Sopenharmony_cistatic inline struct draw_image_static_state *
656bf215546Sopenharmony_cidraw_tes_llvm_variant_key_images(struct draw_tes_llvm_variant_key *key)
657bf215546Sopenharmony_ci{
658bf215546Sopenharmony_ci   return (struct draw_image_static_state *)
659bf215546Sopenharmony_ci      &key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
660bf215546Sopenharmony_ci}
661bf215546Sopenharmony_ci
662bf215546Sopenharmony_cistruct draw_llvm_variant_list_item
663bf215546Sopenharmony_ci{
664bf215546Sopenharmony_ci   struct list_head list;
665bf215546Sopenharmony_ci   struct draw_llvm_variant *base;
666bf215546Sopenharmony_ci};
667bf215546Sopenharmony_ci
668bf215546Sopenharmony_cistruct draw_gs_llvm_variant_list_item
669bf215546Sopenharmony_ci{
670bf215546Sopenharmony_ci   struct list_head list;
671bf215546Sopenharmony_ci   struct draw_gs_llvm_variant *base;
672bf215546Sopenharmony_ci};
673bf215546Sopenharmony_ci
674bf215546Sopenharmony_cistruct draw_tcs_llvm_variant_list_item
675bf215546Sopenharmony_ci{
676bf215546Sopenharmony_ci   struct list_head list;
677bf215546Sopenharmony_ci   struct draw_tcs_llvm_variant *base;
678bf215546Sopenharmony_ci};
679bf215546Sopenharmony_ci
680bf215546Sopenharmony_cistruct draw_tes_llvm_variant_list_item
681bf215546Sopenharmony_ci{
682bf215546Sopenharmony_ci   struct list_head list;
683bf215546Sopenharmony_ci   struct draw_tes_llvm_variant *base;
684bf215546Sopenharmony_ci};
685bf215546Sopenharmony_ci
686bf215546Sopenharmony_cistruct draw_llvm_variant
687bf215546Sopenharmony_ci{
688bf215546Sopenharmony_ci   struct gallivm_state *gallivm;
689bf215546Sopenharmony_ci
690bf215546Sopenharmony_ci   /* LLVM JIT builder types */
691bf215546Sopenharmony_ci   LLVMTypeRef context_type;
692bf215546Sopenharmony_ci   LLVMTypeRef context_ptr_type;
693bf215546Sopenharmony_ci
694bf215546Sopenharmony_ci   LLVMTypeRef buffer_type;
695bf215546Sopenharmony_ci   LLVMTypeRef buffer_ptr_type;
696bf215546Sopenharmony_ci
697bf215546Sopenharmony_ci   LLVMTypeRef vb_type;
698bf215546Sopenharmony_ci   LLVMTypeRef vb_ptr_type;
699bf215546Sopenharmony_ci
700bf215546Sopenharmony_ci   LLVMTypeRef vertex_header_type;
701bf215546Sopenharmony_ci   LLVMTypeRef vertex_header_ptr_type;
702bf215546Sopenharmony_ci
703bf215546Sopenharmony_ci   LLVMValueRef function;
704bf215546Sopenharmony_ci   draw_jit_vert_func jit_func;
705bf215546Sopenharmony_ci
706bf215546Sopenharmony_ci   struct llvm_vertex_shader *shader;
707bf215546Sopenharmony_ci
708bf215546Sopenharmony_ci   struct draw_llvm *llvm;
709bf215546Sopenharmony_ci   struct draw_llvm_variant_list_item list_item_global;
710bf215546Sopenharmony_ci   struct draw_llvm_variant_list_item list_item_local;
711bf215546Sopenharmony_ci
712bf215546Sopenharmony_ci   /* key is variable-sized, must be last */
713bf215546Sopenharmony_ci   struct draw_llvm_variant_key key;
714bf215546Sopenharmony_ci};
715bf215546Sopenharmony_ci
716bf215546Sopenharmony_ci
717bf215546Sopenharmony_cistruct draw_gs_llvm_variant
718bf215546Sopenharmony_ci{
719bf215546Sopenharmony_ci   struct gallivm_state *gallivm;
720bf215546Sopenharmony_ci
721bf215546Sopenharmony_ci   /* LLVM JIT builder types */
722bf215546Sopenharmony_ci   LLVMTypeRef context_type;
723bf215546Sopenharmony_ci   LLVMTypeRef context_ptr_type;
724bf215546Sopenharmony_ci
725bf215546Sopenharmony_ci   LLVMTypeRef vertex_header_type;
726bf215546Sopenharmony_ci   LLVMTypeRef vertex_header_ptr_type;
727bf215546Sopenharmony_ci
728bf215546Sopenharmony_ci   LLVMTypeRef input_array_type;
729bf215546Sopenharmony_ci
730bf215546Sopenharmony_ci   LLVMValueRef context_ptr;
731bf215546Sopenharmony_ci   LLVMValueRef io_ptr;
732bf215546Sopenharmony_ci   LLVMValueRef num_prims;
733bf215546Sopenharmony_ci   LLVMValueRef function;
734bf215546Sopenharmony_ci   draw_gs_jit_func jit_func;
735bf215546Sopenharmony_ci
736bf215546Sopenharmony_ci   struct llvm_geometry_shader *shader;
737bf215546Sopenharmony_ci
738bf215546Sopenharmony_ci   struct draw_llvm *llvm;
739bf215546Sopenharmony_ci   struct draw_gs_llvm_variant_list_item list_item_global;
740bf215546Sopenharmony_ci   struct draw_gs_llvm_variant_list_item list_item_local;
741bf215546Sopenharmony_ci
742bf215546Sopenharmony_ci   /* key is variable-sized, must be last */
743bf215546Sopenharmony_ci   struct draw_gs_llvm_variant_key key;
744bf215546Sopenharmony_ci};
745bf215546Sopenharmony_ci
746bf215546Sopenharmony_cistruct draw_tcs_llvm_variant
747bf215546Sopenharmony_ci{
748bf215546Sopenharmony_ci   struct gallivm_state *gallivm;
749bf215546Sopenharmony_ci
750bf215546Sopenharmony_ci   /* LLVM JIT builder types */
751bf215546Sopenharmony_ci   LLVMTypeRef context_type;
752bf215546Sopenharmony_ci   LLVMTypeRef context_ptr_type;
753bf215546Sopenharmony_ci   LLVMTypeRef input_array_type;
754bf215546Sopenharmony_ci   LLVMTypeRef output_array_type;
755bf215546Sopenharmony_ci
756bf215546Sopenharmony_ci   LLVMValueRef context_ptr;
757bf215546Sopenharmony_ci   /* LLVMValueRef io_ptr; */
758bf215546Sopenharmony_ci   LLVMValueRef num_prims;
759bf215546Sopenharmony_ci   LLVMValueRef function;
760bf215546Sopenharmony_ci   draw_tcs_jit_func jit_func;
761bf215546Sopenharmony_ci
762bf215546Sopenharmony_ci   struct llvm_tess_ctrl_shader *shader;
763bf215546Sopenharmony_ci
764bf215546Sopenharmony_ci   struct draw_llvm *llvm;
765bf215546Sopenharmony_ci   struct draw_tcs_llvm_variant_list_item list_item_global;
766bf215546Sopenharmony_ci   struct draw_tcs_llvm_variant_list_item list_item_local;
767bf215546Sopenharmony_ci
768bf215546Sopenharmony_ci   /* key is variable-sized, must be last */
769bf215546Sopenharmony_ci   struct draw_tcs_llvm_variant_key key;
770bf215546Sopenharmony_ci};
771bf215546Sopenharmony_ci
772bf215546Sopenharmony_cistruct draw_tes_llvm_variant
773bf215546Sopenharmony_ci{
774bf215546Sopenharmony_ci   struct gallivm_state *gallivm;
775bf215546Sopenharmony_ci
776bf215546Sopenharmony_ci   /* LLVM JIT builder types */
777bf215546Sopenharmony_ci   LLVMTypeRef context_type;
778bf215546Sopenharmony_ci   LLVMTypeRef context_ptr_type;
779bf215546Sopenharmony_ci   LLVMTypeRef vertex_header_ptr_type;
780bf215546Sopenharmony_ci   LLVMTypeRef input_array_type;
781bf215546Sopenharmony_ci   LLVMTypeRef patch_input_array_type;
782bf215546Sopenharmony_ci
783bf215546Sopenharmony_ci   LLVMTypeRef input_array_deref_type;
784bf215546Sopenharmony_ci   LLVMTypeRef vertex_header_type;
785bf215546Sopenharmony_ci
786bf215546Sopenharmony_ci   LLVMValueRef context_ptr;
787bf215546Sopenharmony_ci   LLVMValueRef io_ptr;
788bf215546Sopenharmony_ci   LLVMValueRef num_prims;
789bf215546Sopenharmony_ci   LLVMValueRef function;
790bf215546Sopenharmony_ci   draw_tes_jit_func jit_func;
791bf215546Sopenharmony_ci
792bf215546Sopenharmony_ci   struct llvm_tess_eval_shader *shader;
793bf215546Sopenharmony_ci
794bf215546Sopenharmony_ci   struct draw_llvm *llvm;
795bf215546Sopenharmony_ci   struct draw_tes_llvm_variant_list_item list_item_global;
796bf215546Sopenharmony_ci   struct draw_tes_llvm_variant_list_item list_item_local;
797bf215546Sopenharmony_ci
798bf215546Sopenharmony_ci   /* key is variable-sized, must be last */
799bf215546Sopenharmony_ci   struct draw_tes_llvm_variant_key key;
800bf215546Sopenharmony_ci};
801bf215546Sopenharmony_ci
802bf215546Sopenharmony_cistruct llvm_vertex_shader {
803bf215546Sopenharmony_ci   struct draw_vertex_shader base;
804bf215546Sopenharmony_ci
805bf215546Sopenharmony_ci   unsigned variant_key_size;
806bf215546Sopenharmony_ci   struct draw_llvm_variant_list_item variants;
807bf215546Sopenharmony_ci   unsigned variants_created;
808bf215546Sopenharmony_ci   unsigned variants_cached;
809bf215546Sopenharmony_ci};
810bf215546Sopenharmony_ci
811bf215546Sopenharmony_cistruct llvm_geometry_shader {
812bf215546Sopenharmony_ci   struct draw_geometry_shader base;
813bf215546Sopenharmony_ci
814bf215546Sopenharmony_ci   unsigned variant_key_size;
815bf215546Sopenharmony_ci   struct draw_gs_llvm_variant_list_item variants;
816bf215546Sopenharmony_ci   unsigned variants_created;
817bf215546Sopenharmony_ci   unsigned variants_cached;
818bf215546Sopenharmony_ci};
819bf215546Sopenharmony_ci
820bf215546Sopenharmony_cistruct llvm_tess_ctrl_shader {
821bf215546Sopenharmony_ci   struct draw_tess_ctrl_shader base;
822bf215546Sopenharmony_ci
823bf215546Sopenharmony_ci   unsigned variant_key_size;
824bf215546Sopenharmony_ci   struct draw_tcs_llvm_variant_list_item variants;
825bf215546Sopenharmony_ci   unsigned variants_created;
826bf215546Sopenharmony_ci   unsigned variants_cached;
827bf215546Sopenharmony_ci};
828bf215546Sopenharmony_ci
829bf215546Sopenharmony_cistruct llvm_tess_eval_shader {
830bf215546Sopenharmony_ci   struct draw_tess_eval_shader base;
831bf215546Sopenharmony_ci
832bf215546Sopenharmony_ci   unsigned variant_key_size;
833bf215546Sopenharmony_ci   struct draw_tes_llvm_variant_list_item variants;
834bf215546Sopenharmony_ci   unsigned variants_created;
835bf215546Sopenharmony_ci   unsigned variants_cached;
836bf215546Sopenharmony_ci};
837bf215546Sopenharmony_ci
838bf215546Sopenharmony_cistruct draw_llvm {
839bf215546Sopenharmony_ci   struct draw_context *draw;
840bf215546Sopenharmony_ci
841bf215546Sopenharmony_ci   LLVMContextRef context;
842bf215546Sopenharmony_ci   boolean context_owned;
843bf215546Sopenharmony_ci
844bf215546Sopenharmony_ci   struct draw_jit_context jit_context;
845bf215546Sopenharmony_ci   struct draw_gs_jit_context gs_jit_context;
846bf215546Sopenharmony_ci   struct draw_tcs_jit_context tcs_jit_context;
847bf215546Sopenharmony_ci   struct draw_tes_jit_context tes_jit_context;
848bf215546Sopenharmony_ci
849bf215546Sopenharmony_ci   struct draw_llvm_variant_list_item vs_variants_list;
850bf215546Sopenharmony_ci   int nr_variants;
851bf215546Sopenharmony_ci
852bf215546Sopenharmony_ci   struct draw_gs_llvm_variant_list_item gs_variants_list;
853bf215546Sopenharmony_ci   int nr_gs_variants;
854bf215546Sopenharmony_ci
855bf215546Sopenharmony_ci   struct draw_tcs_llvm_variant_list_item tcs_variants_list;
856bf215546Sopenharmony_ci   int nr_tcs_variants;
857bf215546Sopenharmony_ci
858bf215546Sopenharmony_ci   struct draw_tes_llvm_variant_list_item tes_variants_list;
859bf215546Sopenharmony_ci   int nr_tes_variants;
860bf215546Sopenharmony_ci};
861bf215546Sopenharmony_ci
862bf215546Sopenharmony_ci
863bf215546Sopenharmony_cistatic inline struct llvm_vertex_shader *
864bf215546Sopenharmony_cillvm_vertex_shader(struct draw_vertex_shader *vs)
865bf215546Sopenharmony_ci{
866bf215546Sopenharmony_ci   return (struct llvm_vertex_shader *)vs;
867bf215546Sopenharmony_ci}
868bf215546Sopenharmony_ci
869bf215546Sopenharmony_cistatic inline struct llvm_geometry_shader *
870bf215546Sopenharmony_cillvm_geometry_shader(struct draw_geometry_shader *gs)
871bf215546Sopenharmony_ci{
872bf215546Sopenharmony_ci   return (struct llvm_geometry_shader *)gs;
873bf215546Sopenharmony_ci}
874bf215546Sopenharmony_ci
875bf215546Sopenharmony_cistatic inline struct llvm_tess_ctrl_shader *
876bf215546Sopenharmony_cillvm_tess_ctrl_shader(struct draw_tess_ctrl_shader *tcs)
877bf215546Sopenharmony_ci{
878bf215546Sopenharmony_ci   return (struct llvm_tess_ctrl_shader *)tcs;
879bf215546Sopenharmony_ci}
880bf215546Sopenharmony_ci
881bf215546Sopenharmony_cistatic inline struct llvm_tess_eval_shader *
882bf215546Sopenharmony_cillvm_tess_eval_shader(struct draw_tess_eval_shader *tes)
883bf215546Sopenharmony_ci{
884bf215546Sopenharmony_ci   return (struct llvm_tess_eval_shader *)tes;
885bf215546Sopenharmony_ci}
886bf215546Sopenharmony_ci
887bf215546Sopenharmony_cistruct draw_llvm *
888bf215546Sopenharmony_cidraw_llvm_create(struct draw_context *draw, LLVMContextRef llvm_context);
889bf215546Sopenharmony_ci
890bf215546Sopenharmony_civoid
891bf215546Sopenharmony_cidraw_llvm_destroy(struct draw_llvm *llvm);
892bf215546Sopenharmony_ci
893bf215546Sopenharmony_cistruct draw_llvm_variant *
894bf215546Sopenharmony_cidraw_llvm_create_variant(struct draw_llvm *llvm,
895bf215546Sopenharmony_ci                         unsigned num_vertex_header_attribs,
896bf215546Sopenharmony_ci                         const struct draw_llvm_variant_key *key);
897bf215546Sopenharmony_ci
898bf215546Sopenharmony_civoid
899bf215546Sopenharmony_cidraw_llvm_destroy_variant(struct draw_llvm_variant *variant);
900bf215546Sopenharmony_ci
901bf215546Sopenharmony_cistruct draw_llvm_variant_key *
902bf215546Sopenharmony_cidraw_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
903bf215546Sopenharmony_ci
904bf215546Sopenharmony_civoid
905bf215546Sopenharmony_cidraw_llvm_dump_variant_key(struct draw_llvm_variant_key *key);
906bf215546Sopenharmony_ci
907bf215546Sopenharmony_ci
908bf215546Sopenharmony_cistruct draw_gs_llvm_variant *
909bf215546Sopenharmony_cidraw_gs_llvm_create_variant(struct draw_llvm *llvm,
910bf215546Sopenharmony_ci                            unsigned num_vertex_header_attribs,
911bf215546Sopenharmony_ci                            const struct draw_gs_llvm_variant_key *key);
912bf215546Sopenharmony_ci
913bf215546Sopenharmony_civoid
914bf215546Sopenharmony_cidraw_gs_llvm_destroy_variant(struct draw_gs_llvm_variant *variant);
915bf215546Sopenharmony_ci
916bf215546Sopenharmony_cistruct draw_gs_llvm_variant_key *
917bf215546Sopenharmony_cidraw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
918bf215546Sopenharmony_ci
919bf215546Sopenharmony_civoid
920bf215546Sopenharmony_cidraw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key);
921bf215546Sopenharmony_ci
922bf215546Sopenharmony_cistruct draw_tcs_llvm_variant *
923bf215546Sopenharmony_cidraw_tcs_llvm_create_variant(struct draw_llvm *llvm,
924bf215546Sopenharmony_ci                             unsigned num_vertex_header_attribs,
925bf215546Sopenharmony_ci                             const struct draw_tcs_llvm_variant_key *key);
926bf215546Sopenharmony_ci
927bf215546Sopenharmony_civoid
928bf215546Sopenharmony_cidraw_tcs_llvm_destroy_variant(struct draw_tcs_llvm_variant *variant);
929bf215546Sopenharmony_ci
930bf215546Sopenharmony_cistruct draw_tcs_llvm_variant_key *
931bf215546Sopenharmony_cidraw_tcs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
932bf215546Sopenharmony_ci
933bf215546Sopenharmony_civoid
934bf215546Sopenharmony_cidraw_tcs_llvm_dump_variant_key(struct draw_tcs_llvm_variant_key *key);
935bf215546Sopenharmony_ci
936bf215546Sopenharmony_cistruct draw_tes_llvm_variant *
937bf215546Sopenharmony_cidraw_tes_llvm_create_variant(struct draw_llvm *llvm,
938bf215546Sopenharmony_ci                             unsigned num_vertex_header_attribs,
939bf215546Sopenharmony_ci                             const struct draw_tes_llvm_variant_key *key);
940bf215546Sopenharmony_ci
941bf215546Sopenharmony_civoid
942bf215546Sopenharmony_cidraw_tes_llvm_destroy_variant(struct draw_tes_llvm_variant *variant);
943bf215546Sopenharmony_ci
944bf215546Sopenharmony_cistruct draw_tes_llvm_variant_key *
945bf215546Sopenharmony_cidraw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
946bf215546Sopenharmony_ci
947bf215546Sopenharmony_civoid
948bf215546Sopenharmony_cidraw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key);
949bf215546Sopenharmony_ci
950bf215546Sopenharmony_cistruct lp_build_sampler_soa *
951bf215546Sopenharmony_cidraw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
952bf215546Sopenharmony_ci                             unsigned nr_samplers);
953bf215546Sopenharmony_ci
954bf215546Sopenharmony_cistruct lp_build_image_soa *
955bf215546Sopenharmony_cidraw_llvm_image_soa_create(const struct draw_image_static_state *static_state,
956bf215546Sopenharmony_ci                           unsigned nr_images);
957bf215546Sopenharmony_ci
958bf215546Sopenharmony_civoid
959bf215546Sopenharmony_cidraw_llvm_set_sampler_state(struct draw_context *draw,
960bf215546Sopenharmony_ci                            enum pipe_shader_type shader_stage);
961bf215546Sopenharmony_ci
962bf215546Sopenharmony_civoid
963bf215546Sopenharmony_cidraw_llvm_set_mapped_texture(struct draw_context *draw,
964bf215546Sopenharmony_ci                             enum pipe_shader_type shader_stage,
965bf215546Sopenharmony_ci                             unsigned sview_idx,
966bf215546Sopenharmony_ci                             uint32_t width, uint32_t height, uint32_t depth,
967bf215546Sopenharmony_ci                             uint32_t first_level, uint32_t last_level,
968bf215546Sopenharmony_ci                             uint32_t num_samples,
969bf215546Sopenharmony_ci                             uint32_t sample_stride,
970bf215546Sopenharmony_ci                             const void *base_ptr,
971bf215546Sopenharmony_ci                             uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
972bf215546Sopenharmony_ci                             uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
973bf215546Sopenharmony_ci                             uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS]);
974bf215546Sopenharmony_ci
975bf215546Sopenharmony_civoid
976bf215546Sopenharmony_cidraw_llvm_set_mapped_image(struct draw_context *draw,
977bf215546Sopenharmony_ci                           enum pipe_shader_type shader_stage,
978bf215546Sopenharmony_ci                           unsigned idx,
979bf215546Sopenharmony_ci                           uint32_t width, uint32_t height, uint32_t depth,
980bf215546Sopenharmony_ci                           const void *base_ptr,
981bf215546Sopenharmony_ci                           uint32_t row_stride,
982bf215546Sopenharmony_ci                           uint32_t img_stride,
983bf215546Sopenharmony_ci                           uint32_t num_samples,
984bf215546Sopenharmony_ci                           uint32_t sample_stride);
985bf215546Sopenharmony_ci#endif
986