1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright (C) 2012 Rob Clark <robclark@freedesktop.org>
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21bf215546Sopenharmony_ci * SOFTWARE.
22bf215546Sopenharmony_ci *
23bf215546Sopenharmony_ci * Authors:
24bf215546Sopenharmony_ci *    Rob Clark <robclark@freedesktop.org>
25bf215546Sopenharmony_ci *    Jonathan Marek <jonathan@marek.ca>
26bf215546Sopenharmony_ci */
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#include "nir/tgsi_to_nir.h"
29bf215546Sopenharmony_ci#include "pipe/p_state.h"
30bf215546Sopenharmony_ci#include "tgsi/tgsi_dump.h"
31bf215546Sopenharmony_ci#include "tgsi/tgsi_parse.h"
32bf215546Sopenharmony_ci#include "util/format/u_format.h"
33bf215546Sopenharmony_ci#include "util/u_inlines.h"
34bf215546Sopenharmony_ci#include "util/u_memory.h"
35bf215546Sopenharmony_ci#include "util/u_string.h"
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#include "freedreno_program.h"
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci#include "ir2/instr-a2xx.h"
40bf215546Sopenharmony_ci#include "fd2_program.h"
41bf215546Sopenharmony_ci#include "fd2_texture.h"
42bf215546Sopenharmony_ci#include "fd2_util.h"
43bf215546Sopenharmony_ci#include "ir2.h"
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_cistatic struct fd2_shader_stateobj *
46bf215546Sopenharmony_cicreate_shader(struct pipe_context *pctx, gl_shader_stage type)
47bf215546Sopenharmony_ci{
48bf215546Sopenharmony_ci   struct fd2_shader_stateobj *so = CALLOC_STRUCT(fd2_shader_stateobj);
49bf215546Sopenharmony_ci   if (!so)
50bf215546Sopenharmony_ci      return NULL;
51bf215546Sopenharmony_ci   so->type = type;
52bf215546Sopenharmony_ci   so->is_a20x = is_a20x(fd_context(pctx)->screen);
53bf215546Sopenharmony_ci   return so;
54bf215546Sopenharmony_ci}
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_cistatic void
57bf215546Sopenharmony_cidelete_shader(struct fd2_shader_stateobj *so)
58bf215546Sopenharmony_ci{
59bf215546Sopenharmony_ci   if (!so)
60bf215546Sopenharmony_ci      return;
61bf215546Sopenharmony_ci   ralloc_free(so->nir);
62bf215546Sopenharmony_ci   for (int i = 0; i < ARRAY_SIZE(so->variant); i++)
63bf215546Sopenharmony_ci      free(so->variant[i].info.dwords);
64bf215546Sopenharmony_ci   free(so);
65bf215546Sopenharmony_ci}
66bf215546Sopenharmony_ci
67bf215546Sopenharmony_cistatic void
68bf215546Sopenharmony_ciemit(struct fd_ringbuffer *ring, gl_shader_stage type,
69bf215546Sopenharmony_ci     struct ir2_shader_info *info, struct util_dynarray *patches)
70bf215546Sopenharmony_ci{
71bf215546Sopenharmony_ci   unsigned i;
72bf215546Sopenharmony_ci
73bf215546Sopenharmony_ci   assert(info->sizedwords);
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ci   OUT_PKT3(ring, CP_IM_LOAD_IMMEDIATE, 2 + info->sizedwords);
76bf215546Sopenharmony_ci   OUT_RING(ring, type == MESA_SHADER_FRAGMENT);
77bf215546Sopenharmony_ci   OUT_RING(ring, info->sizedwords);
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci   if (patches)
80bf215546Sopenharmony_ci      util_dynarray_append(patches, uint32_t *,
81bf215546Sopenharmony_ci                           &ring->cur[info->mem_export_ptr]);
82bf215546Sopenharmony_ci
83bf215546Sopenharmony_ci   for (i = 0; i < info->sizedwords; i++)
84bf215546Sopenharmony_ci      OUT_RING(ring, info->dwords[i]);
85bf215546Sopenharmony_ci}
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_cistatic int
88bf215546Sopenharmony_ciir2_glsl_type_size(const struct glsl_type *type, bool bindless)
89bf215546Sopenharmony_ci{
90bf215546Sopenharmony_ci   return glsl_count_attribute_slots(type, false);
91bf215546Sopenharmony_ci}
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_cistatic void *
94bf215546Sopenharmony_cifd2_fp_state_create(struct pipe_context *pctx,
95bf215546Sopenharmony_ci                    const struct pipe_shader_state *cso)
96bf215546Sopenharmony_ci{
97bf215546Sopenharmony_ci   struct fd2_shader_stateobj *so = create_shader(pctx, MESA_SHADER_FRAGMENT);
98bf215546Sopenharmony_ci   if (!so)
99bf215546Sopenharmony_ci      return NULL;
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci   so->nir = (cso->type == PIPE_SHADER_IR_NIR)
102bf215546Sopenharmony_ci                ? cso->ir.nir
103bf215546Sopenharmony_ci                : tgsi_to_nir(cso->tokens, pctx->screen, false);
104bf215546Sopenharmony_ci
105bf215546Sopenharmony_ci   NIR_PASS_V(so->nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
106bf215546Sopenharmony_ci              ir2_glsl_type_size, (nir_lower_io_options)0);
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_ci   if (ir2_optimize_nir(so->nir, true))
109bf215546Sopenharmony_ci      goto fail;
110bf215546Sopenharmony_ci
111bf215546Sopenharmony_ci   so->first_immediate = so->nir->num_uniforms;
112bf215546Sopenharmony_ci
113bf215546Sopenharmony_ci   ir2_compile(so, 0, NULL);
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_ci   ralloc_free(so->nir);
116bf215546Sopenharmony_ci   so->nir = NULL;
117bf215546Sopenharmony_ci   return so;
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_cifail:
120bf215546Sopenharmony_ci   delete_shader(so);
121bf215546Sopenharmony_ci   return NULL;
122bf215546Sopenharmony_ci}
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_cistatic void
125bf215546Sopenharmony_cifd2_fp_state_delete(struct pipe_context *pctx, void *hwcso)
126bf215546Sopenharmony_ci{
127bf215546Sopenharmony_ci   struct fd2_shader_stateobj *so = hwcso;
128bf215546Sopenharmony_ci   delete_shader(so);
129bf215546Sopenharmony_ci}
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_cistatic void *
132bf215546Sopenharmony_cifd2_vp_state_create(struct pipe_context *pctx,
133bf215546Sopenharmony_ci                    const struct pipe_shader_state *cso)
134bf215546Sopenharmony_ci{
135bf215546Sopenharmony_ci   struct fd2_shader_stateobj *so = create_shader(pctx, MESA_SHADER_VERTEX);
136bf215546Sopenharmony_ci   if (!so)
137bf215546Sopenharmony_ci      return NULL;
138bf215546Sopenharmony_ci
139bf215546Sopenharmony_ci   so->nir = (cso->type == PIPE_SHADER_IR_NIR)
140bf215546Sopenharmony_ci                ? cso->ir.nir
141bf215546Sopenharmony_ci                : tgsi_to_nir(cso->tokens, pctx->screen, false);
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_ci   NIR_PASS_V(so->nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
144bf215546Sopenharmony_ci              ir2_glsl_type_size, (nir_lower_io_options)0);
145bf215546Sopenharmony_ci
146bf215546Sopenharmony_ci   if (ir2_optimize_nir(so->nir, true))
147bf215546Sopenharmony_ci      goto fail;
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci   so->first_immediate = so->nir->num_uniforms;
150bf215546Sopenharmony_ci
151bf215546Sopenharmony_ci   /* compile binning variant now */
152bf215546Sopenharmony_ci   ir2_compile(so, 0, NULL);
153bf215546Sopenharmony_ci
154bf215546Sopenharmony_ci   return so;
155bf215546Sopenharmony_ci
156bf215546Sopenharmony_cifail:
157bf215546Sopenharmony_ci   delete_shader(so);
158bf215546Sopenharmony_ci   return NULL;
159bf215546Sopenharmony_ci}
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_cistatic void
162bf215546Sopenharmony_cifd2_vp_state_delete(struct pipe_context *pctx, void *hwcso)
163bf215546Sopenharmony_ci{
164bf215546Sopenharmony_ci   struct fd2_shader_stateobj *so = hwcso;
165bf215546Sopenharmony_ci   delete_shader(so);
166bf215546Sopenharmony_ci}
167bf215546Sopenharmony_ci
168bf215546Sopenharmony_cistatic void
169bf215546Sopenharmony_cipatch_vtx_fetch(struct fd_context *ctx, struct pipe_vertex_element *elem,
170bf215546Sopenharmony_ci                instr_fetch_vtx_t *instr, uint16_t dst_swiz) assert_dt
171bf215546Sopenharmony_ci{
172bf215546Sopenharmony_ci   struct surface_format fmt = fd2_pipe2surface(elem->src_format);
173bf215546Sopenharmony_ci
174bf215546Sopenharmony_ci   instr->dst_swiz = fd2_vtx_swiz(elem->src_format, dst_swiz);
175bf215546Sopenharmony_ci   instr->format_comp_all = fmt.sign == SQ_TEX_SIGN_SIGNED;
176bf215546Sopenharmony_ci   instr->num_format_all = fmt.num_format;
177bf215546Sopenharmony_ci   instr->format = fmt.format;
178bf215546Sopenharmony_ci   instr->exp_adjust_all = fmt.exp_adjust;
179bf215546Sopenharmony_ci   instr->stride = ctx->vtx.vertexbuf.vb[elem->vertex_buffer_index].stride;
180bf215546Sopenharmony_ci   instr->offset = elem->src_offset;
181bf215546Sopenharmony_ci}
182bf215546Sopenharmony_ci
183bf215546Sopenharmony_cistatic void
184bf215546Sopenharmony_cipatch_fetches(struct fd_context *ctx, struct ir2_shader_info *info,
185bf215546Sopenharmony_ci              struct fd_vertex_stateobj *vtx,
186bf215546Sopenharmony_ci              struct fd_texture_stateobj *tex) assert_dt
187bf215546Sopenharmony_ci{
188bf215546Sopenharmony_ci   for (int i = 0; i < info->num_fetch_instrs; i++) {
189bf215546Sopenharmony_ci      struct ir2_fetch_info *fi = &info->fetch_info[i];
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ci      instr_fetch_t *instr = (instr_fetch_t *)&info->dwords[fi->offset];
192bf215546Sopenharmony_ci      if (instr->opc == VTX_FETCH) {
193bf215546Sopenharmony_ci         unsigned idx =
194bf215546Sopenharmony_ci            (instr->vtx.const_index - 20) * 3 + instr->vtx.const_index_sel;
195bf215546Sopenharmony_ci         patch_vtx_fetch(ctx, &vtx->pipe[idx], &instr->vtx, fi->vtx.dst_swiz);
196bf215546Sopenharmony_ci         continue;
197bf215546Sopenharmony_ci      }
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_ci      assert(instr->opc == TEX_FETCH);
200bf215546Sopenharmony_ci      instr->tex.const_idx = fd2_get_const_idx(ctx, tex, fi->tex.samp_id);
201bf215546Sopenharmony_ci      instr->tex.src_swiz = fi->tex.src_swiz;
202bf215546Sopenharmony_ci   }
203bf215546Sopenharmony_ci}
204bf215546Sopenharmony_ci
205bf215546Sopenharmony_civoid
206bf215546Sopenharmony_cifd2_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring,
207bf215546Sopenharmony_ci                 struct fd_program_stateobj *prog)
208bf215546Sopenharmony_ci{
209bf215546Sopenharmony_ci   struct fd2_shader_stateobj *fp = NULL, *vp;
210bf215546Sopenharmony_ci   struct ir2_shader_info *fpi, *vpi;
211bf215546Sopenharmony_ci   struct ir2_frag_linkage *f;
212bf215546Sopenharmony_ci   uint8_t vs_gprs, fs_gprs = 0, vs_export = 0;
213bf215546Sopenharmony_ci   enum a2xx_sq_ps_vtx_mode mode = POSITION_1_VECTOR;
214bf215546Sopenharmony_ci   bool binning = (ctx->batch && ring == ctx->batch->binning);
215bf215546Sopenharmony_ci   unsigned variant = 0;
216bf215546Sopenharmony_ci
217bf215546Sopenharmony_ci   vp = prog->vs;
218bf215546Sopenharmony_ci
219bf215546Sopenharmony_ci   /* find variant matching the linked fragment shader */
220bf215546Sopenharmony_ci   if (!binning) {
221bf215546Sopenharmony_ci      fp = prog->fs;
222bf215546Sopenharmony_ci      for (variant = 1; variant < ARRAY_SIZE(vp->variant); variant++) {
223bf215546Sopenharmony_ci         /* if checked all variants, compile a new variant */
224bf215546Sopenharmony_ci         if (!vp->variant[variant].info.sizedwords) {
225bf215546Sopenharmony_ci            ir2_compile(vp, variant, fp);
226bf215546Sopenharmony_ci            break;
227bf215546Sopenharmony_ci         }
228bf215546Sopenharmony_ci
229bf215546Sopenharmony_ci         /* check if fragment shader linkage matches */
230bf215546Sopenharmony_ci         if (!memcmp(&vp->variant[variant].f, &fp->variant[0].f,
231bf215546Sopenharmony_ci                     sizeof(struct ir2_frag_linkage)))
232bf215546Sopenharmony_ci            break;
233bf215546Sopenharmony_ci      }
234bf215546Sopenharmony_ci      assert(variant < ARRAY_SIZE(vp->variant));
235bf215546Sopenharmony_ci   }
236bf215546Sopenharmony_ci
237bf215546Sopenharmony_ci   vpi = &vp->variant[variant].info;
238bf215546Sopenharmony_ci   fpi = &fp->variant[0].info;
239bf215546Sopenharmony_ci   f = &fp->variant[0].f;
240bf215546Sopenharmony_ci
241bf215546Sopenharmony_ci   /* clear/gmem2mem/mem2gmem need to be changed to remove this condition */
242bf215546Sopenharmony_ci   if (prog != &ctx->solid_prog && prog != &ctx->blit_prog[0]) {
243bf215546Sopenharmony_ci      patch_fetches(ctx, vpi, ctx->vtx.vtx, &ctx->tex[PIPE_SHADER_VERTEX]);
244bf215546Sopenharmony_ci      if (fp)
245bf215546Sopenharmony_ci         patch_fetches(ctx, fpi, NULL, &ctx->tex[PIPE_SHADER_FRAGMENT]);
246bf215546Sopenharmony_ci   }
247bf215546Sopenharmony_ci
248bf215546Sopenharmony_ci   emit(ring, MESA_SHADER_VERTEX, vpi,
249bf215546Sopenharmony_ci        binning ? &ctx->batch->shader_patches : NULL);
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_ci   if (fp) {
252bf215546Sopenharmony_ci      emit(ring, MESA_SHADER_FRAGMENT, fpi, NULL);
253bf215546Sopenharmony_ci      fs_gprs = (fpi->max_reg < 0) ? 0x80 : fpi->max_reg;
254bf215546Sopenharmony_ci      vs_export = MAX2(1, f->inputs_count) - 1;
255bf215546Sopenharmony_ci   }
256bf215546Sopenharmony_ci
257bf215546Sopenharmony_ci   vs_gprs = (vpi->max_reg < 0) ? 0x80 : vpi->max_reg;
258bf215546Sopenharmony_ci
259bf215546Sopenharmony_ci   if (vp->writes_psize && !binning)
260bf215546Sopenharmony_ci      mode = POSITION_2_VECTORS_SPRITE;
261bf215546Sopenharmony_ci
262bf215546Sopenharmony_ci   /* set register to use for param (fragcoord/pointcoord/frontfacing) */
263bf215546Sopenharmony_ci   OUT_PKT3(ring, CP_SET_CONSTANT, 2);
264bf215546Sopenharmony_ci   OUT_RING(ring, CP_REG(REG_A2XX_SQ_CONTEXT_MISC));
265bf215546Sopenharmony_ci   OUT_RING(ring,
266bf215546Sopenharmony_ci            A2XX_SQ_CONTEXT_MISC_SC_SAMPLE_CNTL(CENTERS_ONLY) |
267bf215546Sopenharmony_ci               COND(fp, A2XX_SQ_CONTEXT_MISC_PARAM_GEN_POS(f->inputs_count)) |
268bf215546Sopenharmony_ci               /* we need SCREEN_XY for both fragcoord and frontfacing */
269bf215546Sopenharmony_ci               A2XX_SQ_CONTEXT_MISC_SC_OUTPUT_SCREEN_XY);
270bf215546Sopenharmony_ci
271bf215546Sopenharmony_ci   OUT_PKT3(ring, CP_SET_CONSTANT, 2);
272bf215546Sopenharmony_ci   OUT_RING(ring, CP_REG(REG_A2XX_SQ_PROGRAM_CNTL));
273bf215546Sopenharmony_ci   OUT_RING(ring,
274bf215546Sopenharmony_ci            A2XX_SQ_PROGRAM_CNTL_PS_EXPORT_MODE(2) |
275bf215546Sopenharmony_ci               A2XX_SQ_PROGRAM_CNTL_VS_EXPORT_MODE(mode) |
276bf215546Sopenharmony_ci               A2XX_SQ_PROGRAM_CNTL_VS_RESOURCE |
277bf215546Sopenharmony_ci               A2XX_SQ_PROGRAM_CNTL_PS_RESOURCE |
278bf215546Sopenharmony_ci               A2XX_SQ_PROGRAM_CNTL_VS_EXPORT_COUNT(vs_export) |
279bf215546Sopenharmony_ci               A2XX_SQ_PROGRAM_CNTL_PS_REGS(fs_gprs) |
280bf215546Sopenharmony_ci               A2XX_SQ_PROGRAM_CNTL_VS_REGS(vs_gprs) |
281bf215546Sopenharmony_ci               COND(fp && fp->need_param, A2XX_SQ_PROGRAM_CNTL_PARAM_GEN) |
282bf215546Sopenharmony_ci               COND(!fp, A2XX_SQ_PROGRAM_CNTL_GEN_INDEX_VTX));
283bf215546Sopenharmony_ci}
284bf215546Sopenharmony_ci
285bf215546Sopenharmony_civoid
286bf215546Sopenharmony_cifd2_prog_init(struct pipe_context *pctx)
287bf215546Sopenharmony_ci{
288bf215546Sopenharmony_ci   struct fd_context *ctx = fd_context(pctx);
289bf215546Sopenharmony_ci   struct fd_program_stateobj *prog;
290bf215546Sopenharmony_ci   struct fd2_shader_stateobj *so;
291bf215546Sopenharmony_ci   struct ir2_shader_info *info;
292bf215546Sopenharmony_ci   instr_fetch_vtx_t *instr;
293bf215546Sopenharmony_ci
294bf215546Sopenharmony_ci   pctx->create_fs_state = fd2_fp_state_create;
295bf215546Sopenharmony_ci   pctx->delete_fs_state = fd2_fp_state_delete;
296bf215546Sopenharmony_ci
297bf215546Sopenharmony_ci   pctx->create_vs_state = fd2_vp_state_create;
298bf215546Sopenharmony_ci   pctx->delete_vs_state = fd2_vp_state_delete;
299bf215546Sopenharmony_ci
300bf215546Sopenharmony_ci   fd_prog_init(pctx);
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ci   /* XXX maybe its possible to reuse patch_vtx_fetch somehow? */
303bf215546Sopenharmony_ci
304bf215546Sopenharmony_ci   prog = &ctx->solid_prog;
305bf215546Sopenharmony_ci   so = prog->vs;
306bf215546Sopenharmony_ci   ir2_compile(prog->vs, 1, prog->fs);
307bf215546Sopenharmony_ci
308bf215546Sopenharmony_ci#define IR2_FETCH_SWIZ_XY01 0xb08
309bf215546Sopenharmony_ci#define IR2_FETCH_SWIZ_XYZ1 0xa88
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_ci   info = &so->variant[1].info;
312bf215546Sopenharmony_ci
313bf215546Sopenharmony_ci   instr = (instr_fetch_vtx_t *)&info->dwords[info->fetch_info[0].offset];
314bf215546Sopenharmony_ci   instr->const_index = 26;
315bf215546Sopenharmony_ci   instr->const_index_sel = 0;
316bf215546Sopenharmony_ci   instr->format = FMT_32_32_32_FLOAT;
317bf215546Sopenharmony_ci   instr->format_comp_all = false;
318bf215546Sopenharmony_ci   instr->stride = 12;
319bf215546Sopenharmony_ci   instr->num_format_all = true;
320bf215546Sopenharmony_ci   instr->dst_swiz = IR2_FETCH_SWIZ_XYZ1;
321bf215546Sopenharmony_ci
322bf215546Sopenharmony_ci   prog = &ctx->blit_prog[0];
323bf215546Sopenharmony_ci   so = prog->vs;
324bf215546Sopenharmony_ci   ir2_compile(prog->vs, 1, prog->fs);
325bf215546Sopenharmony_ci
326bf215546Sopenharmony_ci   info = &so->variant[1].info;
327bf215546Sopenharmony_ci
328bf215546Sopenharmony_ci   instr = (instr_fetch_vtx_t *)&info->dwords[info->fetch_info[0].offset];
329bf215546Sopenharmony_ci   instr->const_index = 26;
330bf215546Sopenharmony_ci   instr->const_index_sel = 1;
331bf215546Sopenharmony_ci   instr->format = FMT_32_32_FLOAT;
332bf215546Sopenharmony_ci   instr->format_comp_all = false;
333bf215546Sopenharmony_ci   instr->stride = 8;
334bf215546Sopenharmony_ci   instr->num_format_all = false;
335bf215546Sopenharmony_ci   instr->dst_swiz = IR2_FETCH_SWIZ_XY01;
336bf215546Sopenharmony_ci
337bf215546Sopenharmony_ci   instr = (instr_fetch_vtx_t *)&info->dwords[info->fetch_info[1].offset];
338bf215546Sopenharmony_ci   instr->const_index = 26;
339bf215546Sopenharmony_ci   instr->const_index_sel = 0;
340bf215546Sopenharmony_ci   instr->format = FMT_32_32_32_FLOAT;
341bf215546Sopenharmony_ci   instr->format_comp_all = false;
342bf215546Sopenharmony_ci   instr->stride = 12;
343bf215546Sopenharmony_ci   instr->num_format_all = false;
344bf215546Sopenharmony_ci   instr->dst_swiz = IR2_FETCH_SWIZ_XYZ1;
345bf215546Sopenharmony_ci}
346