Home | History | Annotate | Download | only in nvc0

Lines Matching defs:nvc0

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