GPU: Set Default Buffer Size Immediate Mode

We set the default buffer size for strict buffers to 0. This increased
the performance on intel but reduced the performance on old AMD cards.
This patch sets back the default buffer size for strict buffers. After
testing I didn't detect a slow-down anymore.

Note that today new firmwares were pushed to the device what might fix
some issues.
This commit is contained in:
Jeroen Bakker 2020-05-04 16:00:47 +02:00
parent 079fc65e0a
commit 37182c369a
Notes: blender-bot 2023-02-14 11:01:33 +01:00
Referenced by issue #76113, Crash closing file browsers with AMD GPUs
1 changed files with 4 additions and 7 deletions

View File

@ -48,7 +48,6 @@ typedef struct ImmediateDrawBuffer {
GLubyte *buffer_data;
uint buffer_offset;
uint buffer_size;
uint default_size;
} ImmediateDrawBuffer;
typedef struct {
@ -96,12 +95,10 @@ void immInit(void)
imm.draw_buffer.vbo_id = GPU_buf_alloc();
imm.draw_buffer.buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE;
imm.draw_buffer.default_size = DEFAULT_INTERNAL_BUFFER_SIZE;
glBindBuffer(GL_ARRAY_BUFFER, imm.draw_buffer.vbo_id);
glBufferData(GL_ARRAY_BUFFER, imm.draw_buffer.buffer_size, NULL, GL_DYNAMIC_DRAW);
imm.draw_buffer_strict.vbo_id = GPU_buf_alloc();
imm.draw_buffer_strict.buffer_size = 0;
imm.draw_buffer_strict.default_size = 0;
imm.draw_buffer_strict.buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE;
glBindBuffer(GL_ARRAY_BUFFER, imm.draw_buffer_strict.vbo_id);
glBufferData(GL_ARRAY_BUFFER, imm.draw_buffer_strict.buffer_size, NULL, GL_DYNAMIC_DRAW);
@ -251,10 +248,10 @@ void immBegin(GPUPrimType prim_type, uint vertex_len)
active_buffer->buffer_size = bytes_needed;
recreate_buffer = true;
}
else if (bytes_needed < active_buffer->default_size &&
active_buffer->buffer_size > active_buffer->default_size) {
else if (bytes_needed < DEFAULT_INTERNAL_BUFFER_SIZE &&
active_buffer->buffer_size > DEFAULT_INTERNAL_BUFFER_SIZE) {
/* shrink the internal buffer */
active_buffer->buffer_size = active_buffer->default_size;
active_buffer->buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE;
recreate_buffer = true;
}