Mesa (master): ilo: fix for half-float vertex arrays

Chia-I Wu olv at kemper.freedesktop.org
Fri Jun 14 17:00:48 UTC 2013


Module: Mesa
Branch: master
Commit: bfa8d21759c5f2b5b0885c696842167bd4c64fee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfa8d21759c5f2b5b0885c696842167bd4c64fee

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Jun 15 00:56:17 2013 +0800

ilo: fix for half-float vertex arrays

Commit 6fe0453c339b6e894e0ee8d2200e7638a43ed21e broke half-float vertex
arrays.  This reverts a part of that commit, and explains why.

---

 src/gallium/drivers/ilo/ilo_gpe_gen6.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
index 536dbf8..89566b7 100644
--- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
@@ -767,7 +767,20 @@ gen6_emit_3DSTATE_VERTEX_BUFFERS(const struct ilo_dev_info *dev,
       if (vb->buffer && vb->stride <= 2048) {
          const struct ilo_buffer *buf = ilo_buffer(vb->buffer);
          const uint32_t start_offset = vb->buffer_offset;
-         const uint32_t end_offset = buf->bo_size - 1;
+         /*
+          * As noted in ilo_translate_format(), we treat some 3-component
+          * formats as 4-component formats to work around hardware
+          * limitations.  Imagine the case where the vertex buffer holds a
+          * single PIPE_FORMAT_R16G16B16_FLOAT vertex, and buf->bo_size is 6.
+          * The hardware would not be able to fetch it because the vertex
+          * buffer is expected to hold a PIPE_FORMAT_R16G16B16A16_FLOAT vertex
+          * and that takes at least 8 bytes.
+          *
+          * For the workaround to work, we query the physical size, which is
+          * page aligned, to calculate end_offset so that the last vertex has
+          * a better chance to be fetched.
+          */
+         const uint32_t end_offset = intel_bo_get_size(buf->bo) - 1;
 
          dw |= vb->stride << BRW_VB0_PITCH_SHIFT;
 




More information about the mesa-commit mailing list