iris: Slightly better bounds on buffer sizes
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 18 Mar 2019 07:51:18 +0000 (00:51 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 18 Mar 2019 08:39:43 +0000 (01:39 -0700)
src/gallium/drivers/iris/iris_state.c

index f96c57a1e1e8660b3cbe6248395334f9190e0c44..eaa40d33fdfb9323a375aca18542458daadab020 100644 (file)
@@ -2623,7 +2623,7 @@ iris_set_vertex_buffers(struct pipe_context *ctx,
          vb.AddressModifyEnable = true;
          vb.BufferPitch = buffer->stride;
          if (res) {
-            vb.BufferSize = res->bo->size;
+            vb.BufferSize = res->bo->size - (int) buffer->buffer_offset;
             vb.BufferStartingAddress =
                ro_bo(NULL, res->bo->gtt_offset + (int) buffer->buffer_offset);
             vb.MOCS = mocs(res->bo);
@@ -4947,7 +4947,7 @@ iris_upload_render_state(struct iris_context *ice,
       iris_emit_cmd(batch, GENX(3DSTATE_INDEX_BUFFER), ib) {
          ib.IndexFormat = draw->index_size >> 1;
          ib.MOCS = mocs(bo);
-         ib.BufferSize = bo->size;
+         ib.BufferSize = bo->size - offset;
          ib.BufferStartingAddress = ro_bo(bo, offset);
       }