diff options
author | Marek Olšák <[email protected]> | 2016-07-17 11:59:40 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-07-19 23:45:06 +0200 |
commit | fec7f74129622f846c79edc3a6b050db62c89554 (patch) | |
tree | 97d04b402e4344e16051076d2e314229ee8eb1c9 /src/gallium | |
parent | 2596ae2b6eb11bd70f147390126258e76adb51d2 (diff) |
gallium/pb_cache: check parameters that are more likely to fail first
This makes Bioshock Infinite with deferred flushing 2% faster.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_cache.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.c b/src/gallium/auxiliary/pipebuffer/pb_cache.c index ebd06b0e030..6a43cbc85be 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_cache.c @@ -114,25 +114,24 @@ static int pb_cache_is_buffer_compat(struct pb_cache_entry *entry, pb_size size, unsigned alignment, unsigned usage) { + struct pb_cache *mgr = entry->mgr; struct pb_buffer *buf = entry->buffer; - if (usage & entry->mgr->bypass_usage) - return 0; - - if (buf->size < size) + if (!pb_check_usage(usage, buf->usage)) return 0; /* be lenient with size */ - if (buf->size > (unsigned) (entry->mgr->size_factor * size)) + if (buf->size < size || + buf->size > (unsigned) (mgr->size_factor * size)) return 0; - if (!pb_check_alignment(alignment, buf->alignment)) + if (usage & mgr->bypass_usage) return 0; - if (!pb_check_usage(usage, buf->usage)) + if (!pb_check_alignment(alignment, buf->alignment)) return 0; - return entry->mgr->can_reclaim(buf) ? 1 : -1; + return mgr->can_reclaim(buf) ? 1 : -1; } /** |