1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright (C) 2016 Rob Clark <robclark@freedesktop.org>
3bf215546Sopenharmony_ci * Copyright © 2018 Google, Inc.
4bf215546Sopenharmony_ci *
5bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
6bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
7bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
8bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
10bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci *
12bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
13bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
14bf215546Sopenharmony_ci * Software.
15bf215546Sopenharmony_ci *
16bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ci * SOFTWARE.
23bf215546Sopenharmony_ci */
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci#include "fd6_const.h"
26bf215546Sopenharmony_ci#include "fd6_pack.h"
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#define emit_const_user fd6_emit_const_user
29bf215546Sopenharmony_ci#define emit_const_bo   fd6_emit_const_bo
30bf215546Sopenharmony_ci#include "ir3_const.h"
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci/* regid:          base const register
33bf215546Sopenharmony_ci * prsc or dwords: buffer containing constant values
34bf215546Sopenharmony_ci * sizedwords:     size of const value buffer
35bf215546Sopenharmony_ci */
36bf215546Sopenharmony_civoid
37bf215546Sopenharmony_cifd6_emit_const_user(struct fd_ringbuffer *ring,
38bf215546Sopenharmony_ci                    const struct ir3_shader_variant *v, uint32_t regid,
39bf215546Sopenharmony_ci                    uint32_t sizedwords, const uint32_t *dwords)
40bf215546Sopenharmony_ci{
41bf215546Sopenharmony_ci   emit_const_asserts(ring, v, regid, sizedwords);
42bf215546Sopenharmony_ci
43bf215546Sopenharmony_ci   /* NOTE we cheat a bit here, since we know mesa is aligning
44bf215546Sopenharmony_ci    * the size of the user buffer to 16 bytes.  And we want to
45bf215546Sopenharmony_ci    * cut cycles in a hot path.
46bf215546Sopenharmony_ci    */
47bf215546Sopenharmony_ci   uint32_t align_sz = align(sizedwords, 4);
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_ci   if (fd6_geom_stage(v->type)) {
50bf215546Sopenharmony_ci      OUT_PKTBUF(ring, CP_LOAD_STATE6_GEOM, dwords, align_sz,
51bf215546Sopenharmony_ci         CP_LOAD_STATE6_0(.dst_off = regid / 4, .state_type = ST6_CONSTANTS,
52bf215546Sopenharmony_ci                          .state_src = SS6_DIRECT,
53bf215546Sopenharmony_ci                          .state_block = fd6_stage2shadersb(v->type),
54bf215546Sopenharmony_ci                          .num_unit = DIV_ROUND_UP(sizedwords, 4)),
55bf215546Sopenharmony_ci         CP_LOAD_STATE6_1(),
56bf215546Sopenharmony_ci         CP_LOAD_STATE6_2());
57bf215546Sopenharmony_ci   } else {
58bf215546Sopenharmony_ci      OUT_PKTBUF(ring, CP_LOAD_STATE6_FRAG, dwords, align_sz,
59bf215546Sopenharmony_ci         CP_LOAD_STATE6_0(.dst_off = regid / 4, .state_type = ST6_CONSTANTS,
60bf215546Sopenharmony_ci                          .state_src = SS6_DIRECT,
61bf215546Sopenharmony_ci                          .state_block = fd6_stage2shadersb(v->type),
62bf215546Sopenharmony_ci                          .num_unit = DIV_ROUND_UP(sizedwords, 4)),
63bf215546Sopenharmony_ci         CP_LOAD_STATE6_1(),
64bf215546Sopenharmony_ci         CP_LOAD_STATE6_2());
65bf215546Sopenharmony_ci   }
66bf215546Sopenharmony_ci}
67bf215546Sopenharmony_civoid
68bf215546Sopenharmony_cifd6_emit_const_bo(struct fd_ringbuffer *ring,
69bf215546Sopenharmony_ci                  const struct ir3_shader_variant *v, uint32_t regid,
70bf215546Sopenharmony_ci                  uint32_t offset, uint32_t sizedwords, struct fd_bo *bo)
71bf215546Sopenharmony_ci{
72bf215546Sopenharmony_ci   uint32_t dst_off = regid / 4;
73bf215546Sopenharmony_ci   assert(dst_off % 4 == 0);
74bf215546Sopenharmony_ci   uint32_t num_unit = DIV_ROUND_UP(sizedwords, 4);
75bf215546Sopenharmony_ci   assert(num_unit % 4 == 0);
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci   emit_const_asserts(ring, v, regid, sizedwords);
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci   if (fd6_geom_stage(v->type)) {
80bf215546Sopenharmony_ci      OUT_PKT(ring, CP_LOAD_STATE6_GEOM,
81bf215546Sopenharmony_ci              CP_LOAD_STATE6_0(.dst_off = dst_off, .state_type = ST6_CONSTANTS,
82bf215546Sopenharmony_ci                               .state_src = SS6_INDIRECT,
83bf215546Sopenharmony_ci                               .state_block = fd6_stage2shadersb(v->type),
84bf215546Sopenharmony_ci                               .num_unit = num_unit, ),
85bf215546Sopenharmony_ci              CP_LOAD_STATE6_EXT_SRC_ADDR(.bo = bo, .bo_offset = offset));
86bf215546Sopenharmony_ci   } else {
87bf215546Sopenharmony_ci      OUT_PKT(ring, CP_LOAD_STATE6_FRAG,
88bf215546Sopenharmony_ci              CP_LOAD_STATE6_0(.dst_off = dst_off, .state_type = ST6_CONSTANTS,
89bf215546Sopenharmony_ci                               .state_src = SS6_INDIRECT,
90bf215546Sopenharmony_ci                               .state_block = fd6_stage2shadersb(v->type),
91bf215546Sopenharmony_ci                               .num_unit = num_unit, ),
92bf215546Sopenharmony_ci              CP_LOAD_STATE6_EXT_SRC_ADDR(.bo = bo, .bo_offset = offset));
93bf215546Sopenharmony_ci   }
94bf215546Sopenharmony_ci}
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_cistatic bool
97bf215546Sopenharmony_ciis_stateobj(struct fd_ringbuffer *ring)
98bf215546Sopenharmony_ci{
99bf215546Sopenharmony_ci   return true;
100bf215546Sopenharmony_ci}
101bf215546Sopenharmony_ci
102bf215546Sopenharmony_cistatic void
103bf215546Sopenharmony_ciemit_const_ptrs(struct fd_ringbuffer *ring, const struct ir3_shader_variant *v,
104bf215546Sopenharmony_ci                uint32_t dst_offset, uint32_t num, struct fd_bo **bos,
105bf215546Sopenharmony_ci                uint32_t *offsets)
106bf215546Sopenharmony_ci{
107bf215546Sopenharmony_ci   unreachable("shouldn't be called on a6xx");
108bf215546Sopenharmony_ci}
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_cistatic void
111bf215546Sopenharmony_ciemit_stage_tess_consts(struct fd_ringbuffer *ring, struct ir3_shader_variant *v,
112bf215546Sopenharmony_ci                       uint32_t *params, int num_params)
113bf215546Sopenharmony_ci{
114bf215546Sopenharmony_ci   const struct ir3_const_state *const_state = ir3_const_state(v);
115bf215546Sopenharmony_ci   const unsigned regid = const_state->offsets.primitive_param;
116bf215546Sopenharmony_ci   int size = MIN2(1 + regid, v->constlen) - regid;
117bf215546Sopenharmony_ci   if (size > 0)
118bf215546Sopenharmony_ci      fd6_emit_const_user(ring, v, regid * 4, num_params, params);
119bf215546Sopenharmony_ci}
120bf215546Sopenharmony_ci
121bf215546Sopenharmony_cistruct fd_ringbuffer *
122bf215546Sopenharmony_cifd6_build_tess_consts(struct fd6_emit *emit)
123bf215546Sopenharmony_ci{
124bf215546Sopenharmony_ci   struct fd_context *ctx = emit->ctx;
125bf215546Sopenharmony_ci
126bf215546Sopenharmony_ci   struct fd_ringbuffer *constobj = fd_submit_new_ringbuffer(
127bf215546Sopenharmony_ci      ctx->batch->submit, 0x1000, FD_RINGBUFFER_STREAMING);
128bf215546Sopenharmony_ci
129bf215546Sopenharmony_ci   /* VS sizes are in bytes since that's what STLW/LDLW use, while the HS
130bf215546Sopenharmony_ci    * size is dwords, since that's what LDG/STG use.
131bf215546Sopenharmony_ci    */
132bf215546Sopenharmony_ci   unsigned num_vertices = emit->hs
133bf215546Sopenharmony_ci                              ? emit->patch_vertices
134bf215546Sopenharmony_ci                              : emit->gs->gs.vertices_in;
135bf215546Sopenharmony_ci
136bf215546Sopenharmony_ci   uint32_t vs_params[4] = {
137bf215546Sopenharmony_ci      emit->vs->output_size * num_vertices * 4, /* vs primitive stride */
138bf215546Sopenharmony_ci      emit->vs->output_size * 4,                /* vs vertex stride */
139bf215546Sopenharmony_ci      0, 0};
140bf215546Sopenharmony_ci
141bf215546Sopenharmony_ci   emit_stage_tess_consts(constobj, emit->vs, vs_params, ARRAY_SIZE(vs_params));
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_ci   if (emit->hs) {
144bf215546Sopenharmony_ci      uint32_t hs_params[4] = {
145bf215546Sopenharmony_ci         emit->vs->output_size * num_vertices * 4, /* vs primitive stride */
146bf215546Sopenharmony_ci         emit->vs->output_size * 4,                /* vs vertex stride */
147bf215546Sopenharmony_ci         emit->hs->output_size, emit->patch_vertices};
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci      emit_stage_tess_consts(constobj, emit->hs, hs_params,
150bf215546Sopenharmony_ci                             ARRAY_SIZE(hs_params));
151bf215546Sopenharmony_ci
152bf215546Sopenharmony_ci      if (emit->gs)
153bf215546Sopenharmony_ci         num_vertices = emit->gs->gs.vertices_in;
154bf215546Sopenharmony_ci
155bf215546Sopenharmony_ci      uint32_t ds_params[4] = {
156bf215546Sopenharmony_ci         emit->ds->output_size * num_vertices * 4, /* ds primitive stride */
157bf215546Sopenharmony_ci         emit->ds->output_size * 4,                /* ds vertex stride */
158bf215546Sopenharmony_ci         emit->hs->output_size, /* hs vertex stride (dwords) */
159bf215546Sopenharmony_ci         emit->hs->tess.tcs_vertices_out};
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_ci      emit_stage_tess_consts(constobj, emit->ds, ds_params,
162bf215546Sopenharmony_ci                             ARRAY_SIZE(ds_params));
163bf215546Sopenharmony_ci   }
164bf215546Sopenharmony_ci
165bf215546Sopenharmony_ci   if (emit->gs) {
166bf215546Sopenharmony_ci      struct ir3_shader_variant *prev;
167bf215546Sopenharmony_ci      if (emit->ds)
168bf215546Sopenharmony_ci         prev = emit->ds;
169bf215546Sopenharmony_ci      else
170bf215546Sopenharmony_ci         prev = emit->vs;
171bf215546Sopenharmony_ci
172bf215546Sopenharmony_ci      uint32_t gs_params[4] = {
173bf215546Sopenharmony_ci         prev->output_size * num_vertices * 4, /* ds primitive stride */
174bf215546Sopenharmony_ci         prev->output_size * 4,                /* ds vertex stride */
175bf215546Sopenharmony_ci         0,
176bf215546Sopenharmony_ci         0,
177bf215546Sopenharmony_ci      };
178bf215546Sopenharmony_ci
179bf215546Sopenharmony_ci      num_vertices = emit->gs->gs.vertices_in;
180bf215546Sopenharmony_ci      emit_stage_tess_consts(constobj, emit->gs, gs_params,
181bf215546Sopenharmony_ci                             ARRAY_SIZE(gs_params));
182bf215546Sopenharmony_ci   }
183bf215546Sopenharmony_ci
184bf215546Sopenharmony_ci   return constobj;
185bf215546Sopenharmony_ci}
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_cistatic void
188bf215546Sopenharmony_cifd6_emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v,
189bf215546Sopenharmony_ci              struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
190bf215546Sopenharmony_ci{
191bf215546Sopenharmony_ci   const struct ir3_const_state *const_state = ir3_const_state(v);
192bf215546Sopenharmony_ci   int num_ubos = const_state->num_ubos;
193bf215546Sopenharmony_ci
194bf215546Sopenharmony_ci   if (!num_ubos)
195bf215546Sopenharmony_ci      return;
196bf215546Sopenharmony_ci
197bf215546Sopenharmony_ci   OUT_PKT7(ring, fd6_stage2opcode(v->type), 3 + (2 * num_ubos));
198bf215546Sopenharmony_ci   OUT_RING(ring, CP_LOAD_STATE6_0_DST_OFF(0) |
199bf215546Sopenharmony_ci                     CP_LOAD_STATE6_0_STATE_TYPE(ST6_UBO) |
200bf215546Sopenharmony_ci                     CP_LOAD_STATE6_0_STATE_SRC(SS6_DIRECT) |
201bf215546Sopenharmony_ci                     CP_LOAD_STATE6_0_STATE_BLOCK(fd6_stage2shadersb(v->type)) |
202bf215546Sopenharmony_ci                     CP_LOAD_STATE6_0_NUM_UNIT(num_ubos));
203bf215546Sopenharmony_ci   OUT_RING(ring, CP_LOAD_STATE6_1_EXT_SRC_ADDR(0));
204bf215546Sopenharmony_ci   OUT_RING(ring, CP_LOAD_STATE6_2_EXT_SRC_ADDR_HI(0));
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_ci   for (int i = 0; i < num_ubos; i++) {
207bf215546Sopenharmony_ci      /* NIR constant data is packed into the end of the shader. */
208bf215546Sopenharmony_ci      if (i == const_state->constant_data_ubo) {
209bf215546Sopenharmony_ci         int size_vec4s = DIV_ROUND_UP(v->constant_data_size, 16);
210bf215546Sopenharmony_ci         OUT_RELOC(ring, v->bo, v->info.constant_data_offset,
211bf215546Sopenharmony_ci                   (uint64_t)A6XX_UBO_1_SIZE(size_vec4s) << 32, 0);
212bf215546Sopenharmony_ci         continue;
213bf215546Sopenharmony_ci      }
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_ci      struct pipe_constant_buffer *cb = &constbuf->cb[i];
216bf215546Sopenharmony_ci
217bf215546Sopenharmony_ci      /* If we have user pointers (constbuf 0, aka GL uniforms), upload them
218bf215546Sopenharmony_ci       * to a buffer now, and save it in the constbuf so that we don't have
219bf215546Sopenharmony_ci       * to reupload until they get changed.
220bf215546Sopenharmony_ci       */
221bf215546Sopenharmony_ci      if (cb->user_buffer) {
222bf215546Sopenharmony_ci         struct pipe_context *pctx = &ctx->base;
223bf215546Sopenharmony_ci         u_upload_data(pctx->stream_uploader, 0, cb->buffer_size, 64,
224bf215546Sopenharmony_ci                       cb->user_buffer, &cb->buffer_offset, &cb->buffer);
225bf215546Sopenharmony_ci         cb->user_buffer = NULL;
226bf215546Sopenharmony_ci      }
227bf215546Sopenharmony_ci
228bf215546Sopenharmony_ci      if (cb->buffer) {
229bf215546Sopenharmony_ci         int size_vec4s = DIV_ROUND_UP(cb->buffer_size, 16);
230bf215546Sopenharmony_ci         OUT_RELOC(ring, fd_resource(cb->buffer)->bo, cb->buffer_offset,
231bf215546Sopenharmony_ci                   (uint64_t)A6XX_UBO_1_SIZE(size_vec4s) << 32, 0);
232bf215546Sopenharmony_ci      } else {
233bf215546Sopenharmony_ci         OUT_RING(ring, 0xbad00000 | (i << 16));
234bf215546Sopenharmony_ci         OUT_RING(ring, A6XX_UBO_1_SIZE(0));
235bf215546Sopenharmony_ci      }
236bf215546Sopenharmony_ci   }
237bf215546Sopenharmony_ci}
238bf215546Sopenharmony_ci
239bf215546Sopenharmony_cistatic unsigned
240bf215546Sopenharmony_ciuser_consts_cmdstream_size(struct ir3_shader_variant *v)
241bf215546Sopenharmony_ci{
242bf215546Sopenharmony_ci   struct ir3_const_state *const_state = ir3_const_state(v);
243bf215546Sopenharmony_ci   struct ir3_ubo_analysis_state *ubo_state = &const_state->ubo_state;
244bf215546Sopenharmony_ci
245bf215546Sopenharmony_ci   if (unlikely(!ubo_state->cmdstream_size)) {
246bf215546Sopenharmony_ci      unsigned packets, size;
247bf215546Sopenharmony_ci
248bf215546Sopenharmony_ci      /* pre-calculate size required for userconst stateobj: */
249bf215546Sopenharmony_ci      ir3_user_consts_size(ubo_state, &packets, &size);
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_ci      /* also account for UBO addresses: */
252bf215546Sopenharmony_ci      packets += 1;
253bf215546Sopenharmony_ci      size += 2 * const_state->num_ubos;
254bf215546Sopenharmony_ci
255bf215546Sopenharmony_ci      unsigned sizedwords = (4 * packets) + size;
256bf215546Sopenharmony_ci      ubo_state->cmdstream_size = sizedwords * 4;
257bf215546Sopenharmony_ci   }
258bf215546Sopenharmony_ci
259bf215546Sopenharmony_ci   return ubo_state->cmdstream_size;
260bf215546Sopenharmony_ci}
261bf215546Sopenharmony_ci
262bf215546Sopenharmony_cistruct fd_ringbuffer *
263bf215546Sopenharmony_cifd6_build_user_consts(struct fd6_emit *emit)
264bf215546Sopenharmony_ci{
265bf215546Sopenharmony_ci   static const enum pipe_shader_type types[] = {
266bf215546Sopenharmony_ci      PIPE_SHADER_VERTEX,   PIPE_SHADER_TESS_CTRL, PIPE_SHADER_TESS_EVAL,
267bf215546Sopenharmony_ci      PIPE_SHADER_GEOMETRY, PIPE_SHADER_FRAGMENT,
268bf215546Sopenharmony_ci   };
269bf215546Sopenharmony_ci   struct ir3_shader_variant *variants[] = {
270bf215546Sopenharmony_ci      emit->vs, emit->hs, emit->ds, emit->gs, emit->fs,
271bf215546Sopenharmony_ci   };
272bf215546Sopenharmony_ci   struct fd_context *ctx = emit->ctx;
273bf215546Sopenharmony_ci   unsigned sz = 0;
274bf215546Sopenharmony_ci
275bf215546Sopenharmony_ci   for (unsigned i = 0; i < ARRAY_SIZE(types); i++) {
276bf215546Sopenharmony_ci      if (!variants[i])
277bf215546Sopenharmony_ci         continue;
278bf215546Sopenharmony_ci      sz += user_consts_cmdstream_size(variants[i]);
279bf215546Sopenharmony_ci   }
280bf215546Sopenharmony_ci
281bf215546Sopenharmony_ci   struct fd_ringbuffer *constobj =
282bf215546Sopenharmony_ci      fd_submit_new_ringbuffer(ctx->batch->submit, sz, FD_RINGBUFFER_STREAMING);
283bf215546Sopenharmony_ci
284bf215546Sopenharmony_ci   for (unsigned i = 0; i < ARRAY_SIZE(types); i++) {
285bf215546Sopenharmony_ci      if (!variants[i])
286bf215546Sopenharmony_ci         continue;
287bf215546Sopenharmony_ci      ir3_emit_user_consts(ctx->screen, variants[i], constobj,
288bf215546Sopenharmony_ci                           &ctx->constbuf[types[i]]);
289bf215546Sopenharmony_ci      fd6_emit_ubos(ctx, variants[i], constobj, &ctx->constbuf[types[i]]);
290bf215546Sopenharmony_ci   }
291bf215546Sopenharmony_ci
292bf215546Sopenharmony_ci   return constobj;
293bf215546Sopenharmony_ci}
294bf215546Sopenharmony_ci
295bf215546Sopenharmony_cistruct fd_ringbuffer *
296bf215546Sopenharmony_cifd6_build_driver_params(struct fd6_emit *emit)
297bf215546Sopenharmony_ci{
298bf215546Sopenharmony_ci   struct fd_context *ctx = emit->ctx;
299bf215546Sopenharmony_ci   struct fd6_context *fd6_ctx = fd6_context(ctx);
300bf215546Sopenharmony_ci   unsigned num_dp = 0;
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ci   if (emit->vs->need_driver_params)
303bf215546Sopenharmony_ci      num_dp++;
304bf215546Sopenharmony_ci
305bf215546Sopenharmony_ci   if (emit->gs && emit->gs->need_driver_params)
306bf215546Sopenharmony_ci      num_dp++;
307bf215546Sopenharmony_ci
308bf215546Sopenharmony_ci   if (emit->ds && emit->ds->need_driver_params)
309bf215546Sopenharmony_ci      num_dp++;
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_ci   if (!num_dp) {
312bf215546Sopenharmony_ci      fd6_ctx->has_dp_state = false;
313bf215546Sopenharmony_ci      return NULL;
314bf215546Sopenharmony_ci   }
315bf215546Sopenharmony_ci
316bf215546Sopenharmony_ci   unsigned size_dwords = num_dp * (4 + IR3_DP_VS_COUNT);  /* 4dw PKT7 header */
317bf215546Sopenharmony_ci   struct fd_ringbuffer *dpconstobj = fd_submit_new_ringbuffer(
318bf215546Sopenharmony_ci         ctx->batch->submit, size_dwords * 4, FD_RINGBUFFER_STREAMING);
319bf215546Sopenharmony_ci
320bf215546Sopenharmony_ci   if (emit->vs->need_driver_params) {
321bf215546Sopenharmony_ci      ir3_emit_driver_params(emit->vs, dpconstobj, ctx, emit->info,
322bf215546Sopenharmony_ci                             emit->indirect, emit->draw);
323bf215546Sopenharmony_ci   }
324bf215546Sopenharmony_ci
325bf215546Sopenharmony_ci   if (emit->gs && emit->gs->need_driver_params) {
326bf215546Sopenharmony_ci      ir3_emit_driver_params(emit->gs, dpconstobj, ctx, emit->info,
327bf215546Sopenharmony_ci                             emit->indirect, emit->draw);
328bf215546Sopenharmony_ci   }
329bf215546Sopenharmony_ci
330bf215546Sopenharmony_ci   if (emit->ds && emit->ds->need_driver_params) {
331bf215546Sopenharmony_ci      ir3_emit_driver_params(emit->ds, dpconstobj, ctx, emit->info,
332bf215546Sopenharmony_ci                             emit->indirect, emit->draw);
333bf215546Sopenharmony_ci   }
334bf215546Sopenharmony_ci
335bf215546Sopenharmony_ci   fd6_ctx->has_dp_state = true;
336bf215546Sopenharmony_ci
337bf215546Sopenharmony_ci   return dpconstobj;
338bf215546Sopenharmony_ci}
339bf215546Sopenharmony_ci
340bf215546Sopenharmony_civoid
341bf215546Sopenharmony_cifd6_emit_cs_consts(const struct ir3_shader_variant *v,
342bf215546Sopenharmony_ci                   struct fd_ringbuffer *ring, struct fd_context *ctx,
343bf215546Sopenharmony_ci                   const struct pipe_grid_info *info)
344bf215546Sopenharmony_ci{
345bf215546Sopenharmony_ci   ir3_emit_cs_consts(v, ring, ctx, info);
346bf215546Sopenharmony_ci   fd6_emit_ubos(ctx, v, ring, &ctx->constbuf[PIPE_SHADER_COMPUTE]);
347bf215546Sopenharmony_ci}
348bf215546Sopenharmony_ci
349bf215546Sopenharmony_civoid
350bf215546Sopenharmony_cifd6_emit_immediates(struct fd_screen *screen,
351bf215546Sopenharmony_ci                    const struct ir3_shader_variant *v,
352bf215546Sopenharmony_ci                    struct fd_ringbuffer *ring)
353bf215546Sopenharmony_ci{
354bf215546Sopenharmony_ci   ir3_emit_immediates(screen, v, ring);
355bf215546Sopenharmony_ci}
356bf215546Sopenharmony_ci
357bf215546Sopenharmony_civoid
358bf215546Sopenharmony_cifd6_emit_link_map(struct fd_screen *screen,
359bf215546Sopenharmony_ci                  const struct ir3_shader_variant *producer,
360bf215546Sopenharmony_ci                  const struct ir3_shader_variant *v,
361bf215546Sopenharmony_ci                  struct fd_ringbuffer *ring)
362bf215546Sopenharmony_ci{
363bf215546Sopenharmony_ci   ir3_emit_link_map(screen, producer, v, ring);
364bf215546Sopenharmony_ci}
365