gallium: add PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS
[mesa.git] / src / gallium / drivers / nouveau / nv30 / nv30_context.c
index 46590eecdf363b5d70a4c0e078e85555862db62e..e137525c2b82b46cf62365613515e3a94ee2bc85 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "draw/draw_context.h"
+#include "util/u_upload_mgr.h"
 
 #include "nv_object.xml.h"
 #include "nv30/nv30-40_3d.xml.h"
@@ -114,7 +115,7 @@ nv30_invalidate_resource_storage(struct nouveau_context *nv,
 
    if (res->bind & PIPE_BIND_VERTEX_BUFFER) {
       for (i = 0; i < nv30->num_vtxbufs; ++i) {
-         if (nv30->vtxbuf[i].buffer == res) {
+         if (nv30->vtxbuf[i].buffer.resource == res) {
             nv30->dirty |= NV30_NEW_ARRAYS;
             nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VTXBUF);
             if (!--ref)
@@ -122,13 +123,6 @@ nv30_invalidate_resource_storage(struct nouveau_context *nv,
          }
       }
    }
-   if (res->bind & PIPE_BIND_INDEX_BUFFER) {
-      if (nv30->idxbuf.buffer == res) {
-         nouveau_bufctx_reset(nv30->bufctx, BUFCTX_IDXBUF);
-         if (!--ref)
-            return ref;
-      }
-   }
 
    if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
       for (i = 0; i < nv30->fragprog.num_textures; ++i) {
@@ -165,6 +159,9 @@ nv30_context_destroy(struct pipe_context *pipe)
    if (nv30->draw)
       draw_destroy(nv30->draw);
 
+   if (nv30->base.pipe.stream_uploader)
+      u_upload_destroy(nv30->base.pipe.stream_uploader);
+
    if (nv30->blit_vp)
       nouveau_heap_free(&nv30->blit_vp);
 
@@ -190,7 +187,7 @@ nv30_context_destroy(struct pipe_context *pipe)
    } while(0)
 
 struct pipe_context *
-nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
+nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
 {
    struct nv30_screen *screen = nv30_screen(pscreen);
    struct nv30_context *nv30 = CALLOC_STRUCT(nv30_context);
@@ -211,6 +208,13 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
    pipe->destroy = nv30_context_destroy;
    pipe->flush = nv30_context_flush;
 
+   nv30->base.pipe.stream_uploader = u_upload_create_default(&nv30->base.pipe);
+   if (!nv30->base.pipe.stream_uploader) {
+      nv30_context_destroy(pipe);
+      return NULL;
+   }
+   nv30->base.pipe.const_uploader = nv30->base.pipe.stream_uploader;
+
    /*XXX: *cough* per-context client */
    nv30->base.client = screen->base.client;
 
@@ -242,6 +246,7 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
    if (debug_get_bool_option("NV30_SWTNL", false))
       nv30->draw_flags |= NV30_NEW_SWTNL;
 
+   nouveau_context_init(&nv30->base);
    nv30->sample_mask = 0xffff;
    nv30_vbo_init(pipe);
    nv30_query_init(pipe);