Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-10-04 17:29:41 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-10-04 17:29:51 +0300
commit663d23dd9dc4801a679b00e5d8ac80483d9b36a8 (patch)
tree7fdd9ae7250853491b227365ba20f235ea1a5304 /source/blender/gpu
parent56dd7feb06bff69dce11d72828a6091eb48adebe (diff)
Fix T70463 GPU: Very Slow Workbench/Eevee Performance
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_batch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index dcc94cd843c..cffe46f4396 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -856,16 +856,19 @@ void GPU_draw_list_submit(GPUDrawList *list)
uintptr_t offset = list->cmd_offset;
uint cmd_len = list->cmd_len;
size_t bytes_used = cmd_len * sizeof(GPUDrawCommandIndexed);
- list->cmd_offset += bytes_used;
list->cmd_len = 0; /* Avoid reuse. */
- if (USE_MULTI_DRAW_INDIRECT) {
+ /* Only do multidraw indirect if doing more than 2 drawcall.
+ * This avoids the overhead of buffer mapping if scene is
+ * not very instance friendly. */
+ if (USE_MULTI_DRAW_INDIRECT && cmd_len > 2) {
GLenum prim = batch->gl_prim_type;
glBindBuffer(GL_DRAW_INDIRECT_BUFFER, list->buffer_id);
glFlushMappedBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, bytes_used);
glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER);
list->commands = NULL; /* Unmapped */
+ list->cmd_offset += bytes_used;
if (batch->elem) {
glMultiDrawElementsIndirect(prim, INDEX_TYPE(batch->elem), (void *)offset, cmd_len, 0);