summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-18 12:28:31 -0700
committerJason Ekstrand <[email protected]>2016-05-23 19:12:34 -0700
commitad3deec8ca9813a746ac833e6a0cc2ed13286c35 (patch)
treef86802c3c6aaadd337ae466d5656df10c1747113 /src
parent8892519751f5a38e12dd64e3fef3976c53eb9e86 (diff)
i965/draw: Use worst-case VBO bounds if brw->num_instances == 0
Previously, we only handled the "I don't know what's going on" case for things with InstanceDivisor == 0. However, in the DrawIndirect case we can get num_instances == 0 and we don't know what's going on with the instanced ones either. This commit makes the worst-case bound the default and then conservatively tightens the bound. Cc: "11.1 11.2" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 0a7725dcb96..725a65e10ab 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -468,17 +468,18 @@ brw_prepare_vertices(struct brw_context *brw)
const uint32_t offset = (uintptr_t)glarray->Ptr;
- uint32_t start, range;
+ /* Start with the worst case */
+ uint32_t start = 0;
+ uint32_t range = intel_buffer->Base.Size;
if (glarray->InstanceDivisor) {
- start = offset;
- range = (glarray->StrideB * ((brw->num_instances /
- glarray->InstanceDivisor) - 1) +
- glarray->_ElementSize);
+ if (brw->num_instances) {
+ start = offset;
+ range = (glarray->StrideB * ((brw->num_instances /
+ glarray->InstanceDivisor) - 1) +
+ glarray->_ElementSize);
+ }
} else {
- if (!brw->vb.index_bounds_valid) {
- start = 0;
- range = intel_buffer->Base.Size;
- } else {
+ if (brw->vb.index_bounds_valid) {
start = offset + min_index * glarray->StrideB;
range = (glarray->StrideB * (max_index - min_index) +
glarray->_ElementSize);