2 * Copyright 2008 Ben Skeggs
3 * Copyright 2010 Christoph Bumiller
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
24 #include "pipe/p_context.h"
25 #include "pipe/p_defines.h"
26 #include "pipe/p_state.h"
27 #include "util/u_inlines.h"
29 #include "nv50/nv50_context.h"
32 nv50_constbufs_validate(struct nv50_context
*nv50
)
34 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
37 for (s
= 0; s
< 3; ++s
) {
40 if (s
== PIPE_SHADER_FRAGMENT
)
41 p
= NV50_3D_SET_PROGRAM_CB_PROGRAM_FRAGMENT
;
43 if (s
== PIPE_SHADER_GEOMETRY
)
44 p
= NV50_3D_SET_PROGRAM_CB_PROGRAM_GEOMETRY
;
46 p
= NV50_3D_SET_PROGRAM_CB_PROGRAM_VERTEX
;
48 while (nv50
->constbuf_dirty
[s
]) {
49 const unsigned i
= (unsigned)ffs(nv50
->constbuf_dirty
[s
]) - 1;
51 assert(i
< NV50_MAX_PIPE_CONSTBUFS
);
52 nv50
->constbuf_dirty
[s
] &= ~(1 << i
);
54 if (nv50
->constbuf
[s
][i
].user
) {
55 const unsigned b
= NV50_CB_PVP
+ s
;
57 unsigned words
= nv50
->constbuf
[s
][0].size
/ 4;
59 NOUVEAU_ERR("user constbufs only supported in slot 0\n");
62 if (!nv50
->state
.uniform_buffer_bound
[s
]) {
63 nv50
->state
.uniform_buffer_bound
[s
] = TRUE
;
64 BEGIN_NV04(push
, NV50_3D(SET_PROGRAM_CB
), 1);
65 PUSH_DATA (push
, (b
<< 12) | (i
<< 8) | p
| 1);
70 if (!PUSH_SPACE(push
, 16))
72 nr
= PUSH_AVAIL(push
);
74 nr
= MIN2(MIN2(nr
- 3, words
), NV04_PFIFO_MAX_PACKET_LEN
);
76 BEGIN_NV04(push
, NV50_3D(CB_ADDR
), 1);
77 PUSH_DATA (push
, (start
<< 8) | b
);
78 BEGIN_NI04(push
, NV50_3D(CB_DATA(0)), nr
);
79 PUSH_DATAp(push
, &nv50
->constbuf
[s
][0].u
.data
[start
* 4], nr
);
85 struct nv04_resource
*res
=
86 nv04_resource(nv50
->constbuf
[s
][i
].u
.buf
);
88 /* TODO: allocate persistent bindings */
89 const unsigned b
= s
* 16 + i
;
91 assert(nouveau_resource_mapped_by_gpu(&res
->base
));
93 BEGIN_NV04(push
, NV50_3D(CB_DEF_ADDRESS_HIGH
), 3);
94 PUSH_DATAh(push
, res
->address
+ nv50
->constbuf
[s
][i
].offset
);
95 PUSH_DATA (push
, res
->address
+ nv50
->constbuf
[s
][i
].offset
);
96 PUSH_DATA (push
, (b
<< 16) |
97 (nv50
->constbuf
[s
][i
].size
& 0xffff));
98 BEGIN_NV04(push
, NV50_3D(SET_PROGRAM_CB
), 1);
99 PUSH_DATA (push
, (b
<< 12) | (i
<< 8) | p
| 1);
101 BCTX_REFN(nv50
->bufctx_3d
, CB(s
, i
), res
, RD
);
103 BEGIN_NV04(push
, NV50_3D(SET_PROGRAM_CB
), 1);
104 PUSH_DATA (push
, (i
<< 8) | p
| 0);
107 nv50
->state
.uniform_buffer_bound
[s
] = FALSE
;
114 nv50_program_validate(struct nv50_context
*nv50
, struct nv50_program
*prog
)
116 if (!prog
->translated
) {
117 prog
->translated
= nv50_program_translate(
118 prog
, nv50
->screen
->base
.device
->chipset
);
119 if (!prog
->translated
)
125 return nv50_program_upload_code(nv50
, prog
);
129 nv50_program_update_context_state(struct nv50_context
*nv50
,
130 struct nv50_program
*prog
, int stage
)
132 const unsigned flags
= NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
;
134 if (prog
&& prog
->tls_space
) {
135 if (nv50
->state
.new_tls_space
)
136 nouveau_bufctx_reset(nv50
->bufctx_3d
, NV50_BIND_TLS
);
137 if (!nv50
->state
.tls_required
|| nv50
->state
.new_tls_space
)
138 BCTX_REFN_bo(nv50
->bufctx_3d
, TLS
, flags
, nv50
->screen
->tls_bo
);
139 nv50
->state
.new_tls_space
= FALSE
;
140 nv50
->state
.tls_required
|= 1 << stage
;
142 if (nv50
->state
.tls_required
== (1 << stage
))
143 nouveau_bufctx_reset(nv50
->bufctx_3d
, NV50_BIND_TLS
);
144 nv50
->state
.tls_required
&= ~(1 << stage
);
149 nv50_vertprog_validate(struct nv50_context
*nv50
)
151 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
152 struct nv50_program
*vp
= nv50
->vertprog
;
154 if (!nv50_program_validate(nv50
, vp
))
156 nv50_program_update_context_state(nv50
, vp
, 0);
158 BEGIN_NV04(push
, NV50_3D(VP_ATTR_EN(0)), 2);
159 PUSH_DATA (push
, vp
->vp
.attrs
[0]);
160 PUSH_DATA (push
, vp
->vp
.attrs
[1]);
161 BEGIN_NV04(push
, NV50_3D(VP_REG_ALLOC_RESULT
), 1);
162 PUSH_DATA (push
, vp
->max_out
);
163 BEGIN_NV04(push
, NV50_3D(VP_REG_ALLOC_TEMP
), 1);
164 PUSH_DATA (push
, vp
->max_gpr
);
165 BEGIN_NV04(push
, NV50_3D(VP_START_ID
), 1);
166 PUSH_DATA (push
, vp
->code_base
);
170 nv50_fragprog_validate(struct nv50_context
*nv50
)
172 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
173 struct nv50_program
*fp
= nv50
->fragprog
;
175 if (!nv50_program_validate(nv50
, fp
))
177 nv50_program_update_context_state(nv50
, fp
, 1);
179 BEGIN_NV04(push
, NV50_3D(FP_REG_ALLOC_TEMP
), 1);
180 PUSH_DATA (push
, fp
->max_gpr
);
181 BEGIN_NV04(push
, NV50_3D(FP_RESULT_COUNT
), 1);
182 PUSH_DATA (push
, fp
->max_out
);
183 BEGIN_NV04(push
, NV50_3D(FP_CONTROL
), 1);
184 PUSH_DATA (push
, fp
->fp
.flags
[0]);
185 BEGIN_NV04(push
, NV50_3D(FP_CTRL_UNK196C
), 1);
186 PUSH_DATA (push
, fp
->fp
.flags
[1]);
187 BEGIN_NV04(push
, NV50_3D(FP_START_ID
), 1);
188 PUSH_DATA (push
, fp
->code_base
);
192 nv50_gmtyprog_validate(struct nv50_context
*nv50
)
194 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
195 struct nv50_program
*gp
= nv50
->gmtyprog
;
198 if (!nv50_program_validate(nv50
, gp
))
200 BEGIN_NV04(push
, NV50_3D(GP_REG_ALLOC_TEMP
), 1);
201 PUSH_DATA (push
, gp
->max_gpr
);
202 BEGIN_NV04(push
, NV50_3D(GP_REG_ALLOC_RESULT
), 1);
203 PUSH_DATA (push
, gp
->max_out
);
204 BEGIN_NV04(push
, NV50_3D(GP_OUTPUT_PRIMITIVE_TYPE
), 1);
205 PUSH_DATA (push
, gp
->gp
.prim_type
);
206 BEGIN_NV04(push
, NV50_3D(GP_VERTEX_OUTPUT_COUNT
), 1);
207 PUSH_DATA (push
, gp
->gp
.vert_count
);
208 BEGIN_NV04(push
, NV50_3D(GP_START_ID
), 1);
209 PUSH_DATA (push
, gp
->code_base
);
211 nv50
->state
.prim_size
= gp
->gp
.prim_type
; /* enum matches vertex count */
213 nv50_program_update_context_state(nv50
, gp
, 2);
215 /* GP_ENABLE is updated in linkage validation */
219 nv50_sprite_coords_validate(struct nv50_context
*nv50
)
221 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
222 uint32_t pntc
[8], mode
;
223 struct nv50_program
*fp
= nv50
->fragprog
;
225 unsigned m
= (nv50
->state
.interpolant_ctrl
>> 8) & 0xff;
227 if (!nv50
->rast
->pipe
.point_quad_rasterization
) {
228 if (nv50
->state
.point_sprite
) {
229 BEGIN_NV04(push
, NV50_3D(POINT_COORD_REPLACE_MAP(0)), 8);
230 for (i
= 0; i
< 8; ++i
)
233 nv50
->state
.point_sprite
= FALSE
;
237 nv50
->state
.point_sprite
= TRUE
;
240 memset(pntc
, 0, sizeof(pntc
));
242 for (i
= 0; i
< fp
->in_nr
; i
++) {
243 unsigned n
= util_bitcount(fp
->in
[i
].mask
);
245 if (fp
->in
[i
].sn
!= TGSI_SEMANTIC_GENERIC
) {
249 if (!(nv50
->rast
->pipe
.sprite_coord_enable
& (1 << fp
->in
[i
].si
))) {
254 for (c
= 0; c
< 4; ++c
) {
255 if (fp
->in
[i
].mask
& (1 << c
)) {
256 pntc
[m
/ 8] |= (c
+ 1) << ((m
% 8) * 4);
262 if (nv50
->rast
->pipe
.sprite_coord_mode
== PIPE_SPRITE_COORD_LOWER_LEFT
)
267 BEGIN_NV04(push
, NV50_3D(POINT_SPRITE_CTRL
), 1);
268 PUSH_DATA (push
, mode
);
270 BEGIN_NV04(push
, NV50_3D(POINT_COORD_REPLACE_MAP(0)), 8);
271 PUSH_DATAp(push
, pntc
, 8);
274 /* Validate state derived from shaders and the rasterizer cso. */
276 nv50_validate_derived_rs(struct nv50_context
*nv50
)
278 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
279 uint32_t color
, psize
;
281 nv50_sprite_coords_validate(nv50
);
283 if (nv50
->state
.rasterizer_discard
!= nv50
->rast
->pipe
.rasterizer_discard
) {
284 nv50
->state
.rasterizer_discard
= nv50
->rast
->pipe
.rasterizer_discard
;
285 BEGIN_NV04(push
, NV50_3D(RASTERIZE_ENABLE
), 1);
286 PUSH_DATA (push
, !nv50
->rast
->pipe
.rasterizer_discard
);
289 if (nv50
->dirty
& NV50_NEW_FRAGPROG
)
291 psize
= nv50
->state
.semantic_psize
& ~NV50_3D_SEMANTIC_PTSZ_PTSZ_EN__MASK
;
292 color
= nv50
->state
.semantic_color
& ~NV50_3D_SEMANTIC_COLOR_CLMP_EN
;
294 if (nv50
->rast
->pipe
.clamp_vertex_color
)
295 color
|= NV50_3D_SEMANTIC_COLOR_CLMP_EN
;
297 if (color
!= nv50
->state
.semantic_color
) {
298 nv50
->state
.semantic_color
= color
;
299 BEGIN_NV04(push
, NV50_3D(SEMANTIC_COLOR
), 1);
300 PUSH_DATA (push
, color
);
303 if (nv50
->rast
->pipe
.point_size_per_vertex
)
304 psize
|= NV50_3D_SEMANTIC_PTSZ_PTSZ_EN__MASK
;
306 if (psize
!= nv50
->state
.semantic_psize
) {
307 nv50
->state
.semantic_psize
= psize
;
308 BEGIN_NV04(push
, NV50_3D(SEMANTIC_PTSZ
), 1);
309 PUSH_DATA (push
, psize
);
314 nv50_vec4_map(uint8_t *map
, int mid
, uint32_t lin
[4],
315 struct nv50_varying
*in
, struct nv50_varying
*out
)
318 uint8_t mv
= out
->mask
, mf
= in
->mask
, oid
= out
->hw
;
320 for (c
= 0; c
< 4; ++c
) {
323 lin
[mid
/ 32] |= 1 << (mid
% 32);
341 nv50_fp_linkage_validate(struct nv50_context
*nv50
)
343 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
344 struct nv50_program
*vp
= nv50
->gmtyprog
? nv50
->gmtyprog
: nv50
->vertprog
;
345 struct nv50_program
*fp
= nv50
->fragprog
;
346 struct nv50_varying dummy
;
349 uint32_t layerid
= vp
->gp
.layerid
;
350 uint32_t psiz
= 0x000;
351 uint32_t interp
= fp
->fp
.interp
;
352 uint32_t colors
= fp
->fp
.colors
;
357 if (!(nv50
->dirty
& (NV50_NEW_VERTPROG
|
359 NV50_NEW_GMTYPROG
))) {
361 ffc
= (nv50
->state
.semantic_color
& NV50_3D_SEMANTIC_COLOR_FFC0_ID__MASK
);
362 bfc
= (nv50
->state
.semantic_color
& NV50_3D_SEMANTIC_COLOR_BFC0_ID__MASK
)
364 if (nv50
->rast
->pipe
.light_twoside
== ((ffc
== bfc
) ? 0 : 1))
368 memset(lin
, 0x00, sizeof(lin
));
370 /* XXX: in buggy-endian mode, is the first element of map (u32)0x000000xx
371 * or is it the first byte ?
373 memset(map
, nv50
->gmtyprog
? 0x80 : 0x40, sizeof(map
));
375 dummy
.mask
= 0xf; /* map all components of HPOS */
377 m
= nv50_vec4_map(map
, 0, lin
, &dummy
, &vp
->out
[0]);
379 for (c
= 0; c
< vp
->vp
.clpd_nr
; ++c
)
380 map
[m
++] = vp
->vp
.clpd
[c
/ 4] + (c
% 4);
382 colors
|= m
<< 8; /* adjust BFC0 id */
386 /* if light_twoside is active, FFC0_ID == BFC0_ID is invalid */
387 if (nv50
->rast
->pipe
.light_twoside
) {
388 for (i
= 0; i
< 2; ++i
) {
390 if (fp
->vp
.bfc
[i
] >= fp
->in_nr
)
392 m
= nv50_vec4_map(map
, m
, lin
, &fp
->in
[fp
->vp
.bfc
[i
]],
393 (n
< vp
->out_nr
) ? &vp
->out
[n
] : &dummy
);
396 colors
+= m
- 4; /* adjust FFC0 id */
397 interp
|= m
<< 8; /* set map id where 'normal' FP inputs start */
399 for (i
= 0; i
< fp
->in_nr
; ++i
) {
400 for (n
= 0; n
< vp
->out_nr
; ++n
)
401 if (vp
->out
[n
].sn
== fp
->in
[i
].sn
&&
402 vp
->out
[n
].si
== fp
->in
[i
].si
)
404 m
= nv50_vec4_map(map
, m
, lin
,
405 &fp
->in
[i
], (n
< vp
->out_nr
) ? &vp
->out
[n
] : &dummy
);
408 /* PrimitiveID either is replaced by the system value, or
409 * written by the geometry shader into an output register
411 if (fp
->gp
.primid
< 0x80) {
413 map
[m
++] = vp
->gp
.primid
;
416 if (vp
->gp
.has_layer
) {
417 // In GL4.x, layer can be an fp input, but not in 3.x. Make sure to add
418 // it to the output map.
422 if (nv50
->rast
->pipe
.point_size_per_vertex
) {
424 map
[m
++] = vp
->vp
.psiz
;
427 if (nv50
->rast
->pipe
.clamp_vertex_color
)
428 colors
|= NV50_3D_SEMANTIC_COLOR_CLMP_EN
;
430 if (unlikely(vp
->so
)) {
431 /* Slot i in STRMOUT_MAP specifies the offset where slot i in RESULT_MAP
435 * Inverting vp->so->map (output -> offset) would probably speed this up.
437 memset(so_map
, 0, sizeof(so_map
));
438 for (i
= 0; i
< vp
->so
->map_size
; ++i
) {
439 if (vp
->so
->map
[i
] == 0xff)
441 for (c
= 0; c
< m
; ++c
)
442 if (map
[c
] == vp
->so
->map
[i
] && !so_map
[c
])
446 map
[m
++] = vp
->so
->map
[i
];
448 so_map
[c
] = 0x80 | i
;
450 for (c
= m
; c
& 3; ++c
)
457 if (unlikely(nv50
->gmtyprog
)) {
458 BEGIN_NV04(push
, NV50_3D(GP_RESULT_MAP_SIZE
), 1);
460 BEGIN_NV04(push
, NV50_3D(GP_RESULT_MAP(0)), n
);
461 PUSH_DATAp(push
, map
, n
);
463 BEGIN_NV04(push
, NV50_3D(VP_GP_BUILTIN_ATTR_EN
), 1);
464 PUSH_DATA (push
, vp
->vp
.attrs
[2]);
466 BEGIN_NV04(push
, NV50_3D(SEMANTIC_PRIM_ID
), 1);
467 PUSH_DATA (push
, primid
);
469 BEGIN_NV04(push
, NV50_3D(VP_RESULT_MAP_SIZE
), 1);
471 BEGIN_NV04(push
, NV50_3D(VP_RESULT_MAP(0)), n
);
472 PUSH_DATAp(push
, map
, n
);
475 BEGIN_NV04(push
, NV50_3D(SEMANTIC_COLOR
), 4);
476 PUSH_DATA (push
, colors
);
477 PUSH_DATA (push
, (vp
->vp
.clpd_nr
<< 8) | 4);
478 PUSH_DATA (push
, layerid
);
479 PUSH_DATA (push
, psiz
);
481 BEGIN_NV04(push
, NV50_3D(LAYER
), 1);
482 PUSH_DATA (push
, vp
->gp
.has_layer
<< 16);
484 BEGIN_NV04(push
, NV50_3D(FP_INTERPOLANT_CTRL
), 1);
485 PUSH_DATA (push
, interp
);
487 nv50
->state
.interpolant_ctrl
= interp
;
489 nv50
->state
.semantic_color
= colors
;
490 nv50
->state
.semantic_psize
= psiz
;
492 BEGIN_NV04(push
, NV50_3D(NOPERSPECTIVE_BITMAP(0)), 4);
493 PUSH_DATAp(push
, lin
, 4);
495 BEGIN_NV04(push
, NV50_3D(GP_ENABLE
), 1);
496 PUSH_DATA (push
, nv50
->gmtyprog
? 1 : 0);
499 BEGIN_NV04(push
, NV50_3D(STRMOUT_MAP(0)), n
);
500 PUSH_DATAp(push
, so_map
, n
);
505 nv50_vp_gp_mapping(uint8_t *map
, int m
,
506 struct nv50_program
*vp
, struct nv50_program
*gp
)
510 for (i
= 0; i
< gp
->in_nr
; ++i
) {
511 uint8_t oid
= 0, mv
= 0, mg
= gp
->in
[i
].mask
;
513 for (j
= 0; j
< vp
->out_nr
; ++j
) {
514 if (vp
->out
[j
].sn
== gp
->in
[i
].sn
&&
515 vp
->out
[j
].si
== gp
->in
[i
].si
) {
516 mv
= vp
->out
[j
].mask
;
522 for (c
= 0; c
< 4; ++c
, mv
>>= 1, mg
>>= 1) {
527 map
[m
++] = (c
== 3) ? 0x41 : 0x40;
535 nv50_gp_linkage_validate(struct nv50_context
*nv50
)
537 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
538 struct nv50_program
*vp
= nv50
->vertprog
;
539 struct nv50_program
*gp
= nv50
->gmtyprog
;
546 memset(map
, 0, sizeof(map
));
548 m
= nv50_vp_gp_mapping(map
, m
, vp
, gp
);
552 BEGIN_NV04(push
, NV50_3D(VP_GP_BUILTIN_ATTR_EN
), 1);
553 PUSH_DATA (push
, vp
->vp
.attrs
[2] | gp
->vp
.attrs
[2]);
555 BEGIN_NV04(push
, NV50_3D(VP_RESULT_MAP_SIZE
), 1);
557 BEGIN_NV04(push
, NV50_3D(VP_RESULT_MAP(0)), n
);
558 PUSH_DATAp(push
, map
, n
);
562 nv50_stream_output_validate(struct nv50_context
*nv50
)
564 struct nouveau_pushbuf
*push
= nv50
->base
.pushbuf
;
565 struct nv50_stream_output_state
*so
;
570 so
= nv50
->gmtyprog
? nv50
->gmtyprog
->so
: nv50
->vertprog
->so
;
572 BEGIN_NV04(push
, NV50_3D(STRMOUT_ENABLE
), 1);
574 if (!so
|| !nv50
->num_so_targets
) {
575 if (nv50
->screen
->base
.class_3d
< NVA0_3D_CLASS
) {
576 BEGIN_NV04(push
, NV50_3D(STRMOUT_PRIMITIVE_LIMIT
), 1);
579 BEGIN_NV04(push
, NV50_3D(STRMOUT_PARAMS_LATCH
), 1);
584 /* previous TFB needs to complete */
585 if (nv50
->screen
->base
.class_3d
< NVA0_3D_CLASS
) {
586 BEGIN_NV04(push
, SUBC_3D(NV50_GRAPH_SERIALIZE
), 1);
591 if (nv50
->screen
->base
.class_3d
>= NVA0_3D_CLASS
)
592 ctrl
|= NVA0_3D_STRMOUT_BUFFERS_CTRL_LIMIT_MODE_OFFSET
;
594 BEGIN_NV04(push
, NV50_3D(STRMOUT_BUFFERS_CTRL
), 1);
595 PUSH_DATA (push
, ctrl
);
597 nouveau_bufctx_reset(nv50
->bufctx_3d
, NV50_BIND_SO
);
599 for (i
= 0; i
< nv50
->num_so_targets
; ++i
) {
600 struct nv50_so_target
*targ
= nv50_so_target(nv50
->so_target
[i
]);
601 struct nv04_resource
*buf
= nv04_resource(targ
->pipe
.buffer
);
603 const unsigned n
= nv50
->screen
->base
.class_3d
>= NVA0_3D_CLASS
? 4 : 3;
605 if (n
== 4 && !targ
->clean
)
606 nv84_query_fifo_wait(push
, targ
->pq
);
607 BEGIN_NV04(push
, NV50_3D(STRMOUT_ADDRESS_HIGH(i
)), n
);
608 PUSH_DATAh(push
, buf
->address
+ targ
->pipe
.buffer_offset
);
609 PUSH_DATA (push
, buf
->address
+ targ
->pipe
.buffer_offset
);
610 PUSH_DATA (push
, so
->num_attribs
[i
]);
612 PUSH_DATA(push
, targ
->pipe
.buffer_size
);
614 BEGIN_NV04(push
, NVA0_3D(STRMOUT_OFFSET(i
)), 1);
617 nv50_query_pushbuf_submit(push
, targ
->pq
, 0x4);
623 const unsigned limit
= targ
->pipe
.buffer_size
/
624 (so
->stride
[i
] * nv50
->state
.prim_size
);
625 prims
= MIN2(prims
, limit
);
627 BCTX_REFN(nv50
->bufctx_3d
, SO
, buf
, WR
);
630 BEGIN_NV04(push
, NV50_3D(STRMOUT_PRIMITIVE_LIMIT
), 1);
631 PUSH_DATA (push
, prims
);
633 BEGIN_NV04(push
, NV50_3D(STRMOUT_PARAMS_LATCH
), 1);
635 BEGIN_NV04(push
, NV50_3D(STRMOUT_ENABLE
), 1);