[Mesa-dev] [PATCH 3/4] mesa/st: specify constant frequency for elements
Luca Barbieri
luca at luca-barbieri.com
Mon Aug 16 04:30:08 PDT 2010
Currently, we set up both vertex elements and buffers at the same
time, and thus can trivially specify constant frequency where stride
is 0.
This allows drivers to improve performance by taking advantage of the
hint in the vertex elements CSO.
---
src/mesa/state_tracker/st_draw.c | 6 ++++--
src/mesa/state_tracker/st_draw_feedback.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 2fe242b..1c69e79 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -388,7 +388,8 @@ setup_interleaved_attribs(GLcontext *ctx,
velements[attr].src_offset =
(unsigned) (arrays[mesaAttr]->Ptr - offset0);
- velements[attr].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
+ velements[attr].frequency = stride ? PIPE_ELEMENT_FREQUENCY_PER_VERTEX
+ : PIPE_ELEMENT_FREQUENCY_CONSTANT;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = 0;
velements[attr].src_format =
@@ -484,7 +485,8 @@ setup_non_interleaved_attribs(GLcontext *ctx,
/* common-case setup */
vbuffer[attr].stride = stride; /* in bytes */
vbuffer[attr].max_index = max_index;
- velements[attr].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
+ velements[attr].frequency = stride ? PIPE_ELEMENT_FREQUENCY_PER_VERTEX
+ : PIPE_ELEMENT_FREQUENCY_CONSTANT;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
velements[attr].src_format
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 564732e..17a71cd 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -180,7 +180,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
/* common-case setup */
vbuffers[attr].stride = arrays[mesaAttr]->StrideB; /* in bytes */
vbuffers[attr].max_index = max_index;
- velements[attr].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
+ velements[attr].frequency = vbuffers[attr].stride ? PIPE_ELEMENT_FREQUENCY_PER_VERTEX
+ : PIPE_ELEMENT_FREQUENCY_CONSTANT;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
velements[attr].src_format =
--
1.7.0.4
More information about the mesa-dev
mailing list