Lines Matching refs:nvc0
166 nvc0_set_constant_vertex_attrib(struct nvc0_context *nvc0, const unsigned a) in nvc0_set_constant_vertex_attrib() argument
168 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_set_constant_vertex_attrib()
169 struct pipe_vertex_element *ve = &nvc0->vertex->element[a].pipe; in nvc0_set_constant_vertex_attrib()
170 struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[ve->vertex_buffer_index]; in nvc0_set_constant_vertex_attrib()
199 nvc0_user_vbuf_range(struct nvc0_context *nvc0, int vbi, in nvc0_user_vbuf_range() argument
202 if (unlikely(nvc0->vertex->instance_bufs & (1 << vbi))) { in nvc0_user_vbuf_range()
203 const uint32_t div = nvc0->vertex->min_instance_div[vbi]; in nvc0_user_vbuf_range()
204 *base = nvc0->instance_off * nvc0->vtxbuf[vbi].stride; in nvc0_user_vbuf_range()
205 *size = (nvc0->instance_max / div) * nvc0->vtxbuf[vbi].stride + in nvc0_user_vbuf_range()
206 nvc0->vertex->vb_access_size[vbi]; in nvc0_user_vbuf_range()
209 assert(nvc0->vb_elt_limit != ~0); in nvc0_user_vbuf_range()
210 *base = nvc0->vb_elt_first * nvc0->vtxbuf[vbi].stride; in nvc0_user_vbuf_range()
211 *size = nvc0->vb_elt_limit * nvc0->vtxbuf[vbi].stride + in nvc0_user_vbuf_range()
212 nvc0->vertex->vb_access_size[vbi]; in nvc0_user_vbuf_range()
217 nvc0_release_user_vbufs(struct nvc0_context *nvc0) in nvc0_release_user_vbufs() argument
219 if (nvc0->vbo_user) { in nvc0_release_user_vbufs()
220 nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX_TMP); in nvc0_release_user_vbufs()
221 nouveau_scratch_done(&nvc0->base); in nvc0_release_user_vbufs()
226 nvc0_update_user_vbufs(struct nvc0_context *nvc0) in nvc0_update_user_vbufs() argument
229 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_update_user_vbufs()
233 PUSH_SPACE(push, nvc0->vertex->num_elements * 8); in nvc0_update_user_vbufs()
234 for (i = 0; i < nvc0->vertex->num_elements; ++i) { in nvc0_update_user_vbufs()
235 struct pipe_vertex_element *ve = &nvc0->vertex->element[i].pipe; in nvc0_update_user_vbufs()
237 struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[b]; in nvc0_update_user_vbufs()
240 if (!(nvc0->vbo_user & (1 << b))) in nvc0_update_user_vbufs()
243 nvc0_set_constant_vertex_attrib(nvc0, i); in nvc0_update_user_vbufs()
246 nvc0_user_vbuf_range(nvc0, b, &base, &size); in nvc0_update_user_vbufs()
252 address[b] = nouveau_scratch_data(&nvc0->base, vb->user_buffer, in nvc0_update_user_vbufs()
255 BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, bo_flags, bo); in nvc0_update_user_vbufs()
265 nvc0->base.vbo_dirty = TRUE; in nvc0_update_user_vbufs()
269 nvc0_update_user_vbufs_shared(struct nvc0_context *nvc0) in nvc0_update_user_vbufs_shared() argument
271 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_update_user_vbufs_shared()
272 uint32_t mask = nvc0->vbo_user & ~nvc0->constant_vbos; in nvc0_update_user_vbufs_shared()
274 PUSH_SPACE(push, nvc0->num_vtxbufs * 8); in nvc0_update_user_vbufs_shared()
283 nvc0_user_vbuf_range(nvc0, b, &base, &size); in nvc0_update_user_vbufs_shared()
285 address = nouveau_scratch_data(&nvc0->base, nvc0->vtxbuf[b].user_buffer, in nvc0_update_user_vbufs_shared()
288 BCTX_REFN_bo(nvc0->bufctx_3d, VTX_TMP, bo_flags, bo); in nvc0_update_user_vbufs_shared()
298 mask = nvc0->state.constant_elts; in nvc0_update_user_vbufs_shared()
302 nvc0_set_constant_vertex_attrib(nvc0, i); in nvc0_update_user_vbufs_shared()
307 nvc0_validate_vertex_buffers(struct nvc0_context *nvc0) in nvc0_validate_vertex_buffers() argument
309 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_validate_vertex_buffers()
310 const struct nvc0_vertex_stateobj *vertex = nvc0->vertex; in nvc0_validate_vertex_buffers()
322 if (nvc0->state.constant_elts & (1 << i)) in nvc0_validate_vertex_buffers()
326 vb = &nvc0->vtxbuf[b]; in nvc0_validate_vertex_buffers()
362 BCTX_REFN(nvc0->bufctx_3d, VTX, res, RD); in nvc0_validate_vertex_buffers()
365 if (nvc0->vbo_user) in nvc0_validate_vertex_buffers()
366 nvc0_update_user_vbufs(nvc0); in nvc0_validate_vertex_buffers()
370 nvc0_validate_vertex_buffers_shared(struct nvc0_context *nvc0) in nvc0_validate_vertex_buffers_shared() argument
372 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_validate_vertex_buffers_shared()
374 const uint32_t mask = nvc0->vbo_user; in nvc0_validate_vertex_buffers_shared()
376 PUSH_SPACE(push, nvc0->num_vtxbufs * 8); in nvc0_validate_vertex_buffers_shared()
377 for (b = 0; b < nvc0->num_vtxbufs; ++b) { in nvc0_validate_vertex_buffers_shared()
378 struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[b]; in nvc0_validate_vertex_buffers_shared()
402 BCTX_REFN(nvc0->bufctx_3d, VTX, buf, RD); in nvc0_validate_vertex_buffers_shared()
404 if (nvc0->vbo_user) in nvc0_validate_vertex_buffers_shared()
405 nvc0_update_user_vbufs_shared(nvc0); in nvc0_validate_vertex_buffers_shared()
409 nvc0_vertex_arrays_validate(struct nvc0_context *nvc0) in nvc0_vertex_arrays_validate() argument
411 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_vertex_arrays_validate()
412 struct nvc0_vertex_stateobj *vertex = nvc0->vertex; in nvc0_vertex_arrays_validate()
419 nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_VTX); in nvc0_vertex_arrays_validate()
422 unlikely(nvc0->vertprog->vp.edgeflag < PIPE_MAX_ATTRIBS)) { in nvc0_vertex_arrays_validate()
425 vbo_mode = (nvc0->vbo_user && nvc0->vbo_push_hint) ? 1 : 0; in nvc0_vertex_arrays_validate()
427 const_vbos = vbo_mode ? 0 : nvc0->constant_vbos; in nvc0_vertex_arrays_validate()
429 update_vertex = (nvc0->dirty & NVC0_NEW_VERTEX) || in nvc0_vertex_arrays_validate()
430 (const_vbos != nvc0->state.constant_vbos) || in nvc0_vertex_arrays_validate()
431 (vbo_mode != nvc0->state.vbo_mode); in nvc0_vertex_arrays_validate()
434 const unsigned n = MAX2(vertex->num_elements, nvc0->state.num_vtxelts); in nvc0_vertex_arrays_validate()
436 nvc0->state.constant_vbos = const_vbos; in nvc0_vertex_arrays_validate()
437 nvc0->state.constant_elts = 0; in nvc0_vertex_arrays_validate()
438 nvc0->state.num_vtxelts = vertex->num_elements; in nvc0_vertex_arrays_validate()
439 nvc0->state.vbo_mode = vbo_mode; in nvc0_vertex_arrays_validate()
442 if (unlikely(nvc0->state.instance_elts & 3)) { in nvc0_vertex_arrays_validate()
444 nvc0->state.instance_elts &= ~3; in nvc0_vertex_arrays_validate()
466 if (unlikely(vertex->instance_elts != nvc0->state.instance_elts)) { in nvc0_vertex_arrays_validate()
467 nvc0->state.instance_elts = vertex->instance_elts; in nvc0_vertex_arrays_validate()
483 nvc0->state.constant_elts |= 1 << i; in nvc0_vertex_arrays_validate()
494 if (nvc0->state.vbo_mode) /* using translate, don't set up arrays here */ in nvc0_vertex_arrays_validate()
498 nvc0_validate_vertex_buffers_shared(nvc0); in nvc0_vertex_arrays_validate()
500 nvc0_validate_vertex_buffers(nvc0); in nvc0_vertex_arrays_validate()
504 nvc0_idxbuf_validate(struct nvc0_context *nvc0) in nvc0_idxbuf_validate() argument
506 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_idxbuf_validate()
507 struct nv04_resource *buf = nv04_resource(nvc0->idxbuf.buffer); in nvc0_idxbuf_validate()
514 PUSH_DATAh(push, buf->address + nvc0->idxbuf.offset); in nvc0_idxbuf_validate()
515 PUSH_DATA (push, buf->address + nvc0->idxbuf.offset); in nvc0_idxbuf_validate()
518 PUSH_DATA (push, nvc0->idxbuf.index_size >> 1); in nvc0_idxbuf_validate()
520 BCTX_REFN(nvc0->bufctx_3d, IDX, buf, RD); in nvc0_idxbuf_validate()
560 nvc0_draw_arrays(struct nvc0_context *nvc0, in nvc0_draw_arrays() argument
564 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_draw_arrays()
567 if (nvc0->state.index_bias) { in nvc0_draw_arrays()
570 nvc0->state.index_bias = 0; in nvc0_draw_arrays()
686 nvc0_draw_elements(struct nvc0_context *nvc0, boolean shorten, in nvc0_draw_elements() argument
690 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_draw_elements()
692 const unsigned index_size = nvc0->idxbuf.index_size; in nvc0_draw_elements()
696 if (index_bias != nvc0->state.index_bias) { in nvc0_draw_elements()
700 nvc0->state.index_bias = index_bias; in nvc0_draw_elements()
703 if (nvc0->idxbuf.buffer) { in nvc0_draw_elements()
719 const void *data = nvc0->idxbuf.user_buffer; in nvc0_draw_elements()
751 nvc0_draw_stream_output(struct nvc0_context *nvc0, in nvc0_draw_stream_output() argument
754 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_draw_stream_output()
787 struct nvc0_context *nvc0 = nvc0_context(pipe); in nvc0_draw_vbo() local
788 struct nouveau_pushbuf *push = nvc0->base.pushbuf; in nvc0_draw_vbo()
791 nvc0->vb_elt_first = info->min_index + info->index_bias; in nvc0_draw_vbo()
792 nvc0->vb_elt_limit = info->max_index - info->min_index; in nvc0_draw_vbo()
793 nvc0->instance_off = info->start_instance; in nvc0_draw_vbo()
794 nvc0->instance_max = info->instance_count - 1; in nvc0_draw_vbo()
799 nvc0->vbo_push_hint = in nvc0_draw_vbo()
800 info->indexed && (nvc0->vb_elt_limit >= (info->count * 2)); in nvc0_draw_vbo()
803 if (nvc0->vbo_user && !(nvc0->dirty & (NVC0_NEW_ARRAYS | NVC0_NEW_VERTEX))) { in nvc0_draw_vbo()
804 if (nvc0->vbo_push_hint != !!nvc0->state.vbo_mode) in nvc0_draw_vbo()
805 if (nvc0->state.vbo_mode != 3) in nvc0_draw_vbo()
806 nvc0->dirty |= NVC0_NEW_ARRAYS; in nvc0_draw_vbo()
808 if (!(nvc0->dirty & NVC0_NEW_ARRAYS) && nvc0->state.vbo_mode == 0) { in nvc0_draw_vbo()
809 if (nvc0->vertex->shared_slots) in nvc0_draw_vbo()
810 nvc0_update_user_vbufs_shared(nvc0); in nvc0_draw_vbo()
812 nvc0_update_user_vbufs(nvc0); in nvc0_draw_vbo()
817 nvc0_state_validate(nvc0, ~0, 8); in nvc0_draw_vbo()
821 if (nvc0->state.vbo_mode) { in nvc0_draw_vbo()
822 nvc0_push_vbo(nvc0, info); in nvc0_draw_vbo()
830 if (nvc0->state.instance_base != info->start_instance) { in nvc0_draw_vbo()
831 nvc0->state.instance_base = info->start_instance; in nvc0_draw_vbo()
837 if (nvc0->base.vbo_dirty) { in nvc0_draw_vbo()
839 nvc0->base.vbo_dirty = FALSE; in nvc0_draw_vbo()
845 if (info->primitive_restart != nvc0->state.prim_restart) { in nvc0_draw_vbo()
856 nvc0->state.prim_restart = info->primitive_restart; in nvc0_draw_vbo()
866 nvc0_draw_elements(nvc0, shorten, in nvc0_draw_vbo()
871 nvc0_draw_stream_output(nvc0, info); in nvc0_draw_vbo()
873 nvc0_draw_arrays(nvc0, in nvc0_draw_vbo()
879 nvc0_release_user_vbufs(nvc0); in nvc0_draw_vbo()