[Mesa-dev] [PATCH] i965: Set 3DSTATE_VERTEX_BUFFER::Null Vertex Buffer.
Kenneth Graunke
kenneth at whitecape.org
Mon Oct 9 02:47:09 UTC 2017
According to the Broadwell VERTEX_BUFFER_STATE documentation,
"VERTEX_BUFFER_STATE.Null Vertex Buffer must be set when the
VERTEX_BUFFER_STATE.Buffer Size is 0x0.
---
src/intel/blorp/blorp_genX_exec.h | 2 ++
src/mesa/drivers/dri/i965/genX_state_upload.c | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
I'm not sure why anyone would ever /use/ a vertex buffer of size 0,
but...easy enough to follow the required programming...
diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h
index 53892620986..e3fb6d9ae5f 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -280,6 +280,7 @@ blorp_emit_vertex_buffers(struct blorp_batch *batch,
vb[0].BufferAccessType = VERTEXDATA;
vb[0].EndAddress = vb[0].BufferStartingAddress;
vb[0].EndAddress.offset += size - 1;
+ vb[0].NullVertexBuffer = size == 0;
#elif GEN_GEN == 4
vb[0].BufferAccessType = VERTEXDATA;
vb[0].MaxIndex = 2;
@@ -301,6 +302,7 @@ blorp_emit_vertex_buffers(struct blorp_batch *batch,
vb[1].BufferAccessType = INSTANCEDATA;
vb[1].EndAddress = vb[1].BufferStartingAddress;
vb[1].EndAddress.offset += size - 1;
+ vb[1].NullVertexBuffer = size == 0;
#elif GEN_GEN == 4
vb[1].BufferAccessType = INSTANCEDATA;
vb[1].MaxIndex = 0;
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index ecf5a9ae68d..7fe1f12d5ed 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -317,12 +317,14 @@ genX(emit_vertex_buffer_state)(struct brw_context *brw,
unsigned stride,
unsigned step_rate)
{
+ UNUSED unsigned size = end_offset - start_offset;
+
struct GENX(VERTEX_BUFFER_STATE) buf_state = {
.VertexBufferIndex = buffer_nr,
.BufferPitch = stride,
.BufferStartingAddress = ro_bo(bo, start_offset),
#if GEN_GEN >= 8
- .BufferSize = end_offset - start_offset,
+ .BufferSize = size,
#endif
#if GEN_GEN >= 7
@@ -334,6 +336,7 @@ genX(emit_vertex_buffer_state)(struct brw_context *brw,
.InstanceDataStepRate = step_rate,
#if GEN_GEN >= 5
.EndAddress = ro_bo(bo, end_offset - 1),
+ .NullVertexBuffer = size == 0,
#endif
#endif
--
2.14.2
More information about the mesa-dev
mailing list