ilo: fix textureSize() for single-layered array textures
[mesa.git] / src / gallium / drivers / llvmpipe / lp_scene.c
index fec2f7460b117e2efd2c24861686b91432e4209c..771ad085a120138a03b639dbd483cdb01ba3c2d8 100644 (file)
@@ -64,6 +64,21 @@ lp_scene_create( struct pipe_context *pipe )
 
    pipe_mutex_init(scene->mutex);
 
+#ifdef DEBUG
+   /* Do some scene limit sanity checks here */
+   {
+      size_t maxBins = TILES_X * TILES_Y;
+      size_t maxCommandBytes = sizeof(struct cmd_block) * maxBins;
+      size_t maxCommandPlusData = maxCommandBytes + DATA_BLOCK_SIZE;
+      /* We'll need at least one command block per bin.  Make sure that's
+       * less than the max allowed scene size.
+       */
+      assert(maxCommandBytes < LP_SCENE_MAX_SIZE);
+      /* We'll also need space for at least one other data block */
+      assert(maxCommandPlusData <= LP_SCENE_MAX_SIZE);
+   }
+#endif
+
    return scene;
 }
 
@@ -142,15 +157,13 @@ lp_scene_begin_rasterization(struct lp_scene *scene)
    for (i = 0; i < scene->fb.nr_cbufs; i++) {
       struct pipe_surface *cbuf = scene->fb.cbufs[i];
       if (llvmpipe_resource_is_texture(cbuf->texture)) {
-         assert(cbuf->u.tex.first_layer == cbuf->u.tex.last_layer);
          scene->cbufs[i].stride = llvmpipe_resource_stride(cbuf->texture,
                                                            cbuf->u.tex.level);
 
          scene->cbufs[i].map = llvmpipe_resource_map(cbuf->texture,
                                                      cbuf->u.tex.level,
                                                      cbuf->u.tex.first_layer,
-                                                     LP_TEX_USAGE_READ_WRITE,
-                                                     LP_TEX_LAYOUT_LINEAR);
+                                                     LP_TEX_USAGE_READ_WRITE);
       }
       else {
          struct llvmpipe_resource *lpr = llvmpipe_resource(cbuf->texture);
@@ -163,7 +176,6 @@ lp_scene_begin_rasterization(struct lp_scene *scene)
 
    if (fb->zsbuf) {
       struct pipe_surface *zsbuf = scene->fb.zsbuf;
-      assert(zsbuf->u.tex.first_layer == zsbuf->u.tex.last_layer);
       scene->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->u.tex.level);
       scene->zsbuf.blocksize = 
          util_format_get_blocksize(zsbuf->texture->format);
@@ -171,8 +183,7 @@ lp_scene_begin_rasterization(struct lp_scene *scene)
       scene->zsbuf.map = llvmpipe_resource_map(zsbuf->texture,
                                                zsbuf->u.tex.level,
                                                zsbuf->u.tex.first_layer,
-                                               LP_TEX_USAGE_READ_WRITE,
-                                               LP_TEX_LAYOUT_NONE);
+                                               LP_TEX_USAGE_READ_WRITE);
    }
 }
 
@@ -457,7 +468,7 @@ lp_scene_bin_iter_begin( struct lp_scene *scene )
  * of work (a bin) to work on.
  */
 struct cmd_bin *
-lp_scene_bin_iter_next( struct lp_scene *scene )
+lp_scene_bin_iter_next( struct lp_scene *scene , int *x, int *y)
 {
    struct cmd_bin *bin = NULL;
 
@@ -474,6 +485,8 @@ lp_scene_bin_iter_next( struct lp_scene *scene )
    }
 
    bin = lp_scene_get_bin(scene, scene->curr_x, scene->curr_y);
+   *x = scene->curr_x;
+   *y = scene->curr_y;
 
 end:
    /*printf("return bin %p at %d, %d\n", (void *) bin, *bin_x, *bin_y);*/