Eevee : Add a workaround for bug with AMD RX VEGA Linux + Mesa Driver

This bug (explained here https://github.com/dfelinto/opengl-sandbox/blob/downsample/README.md) is breaking eevee beyond the point it's workable.

This patch workaround the issue by making sure every fbo have mipmaps that are strictly greater than 16px. This break the bloom visuals a bit but only for this setup.
This commit is contained in:
Clément Foucault
2017-10-10 17:18:29 +02:00
parent eb734746a8
commit 12fa6750f5
4 changed files with 43 additions and 6 deletions

View File

@@ -34,6 +34,7 @@
#include "GPU_batch.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_framebuffer.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
@@ -573,7 +574,20 @@ void GPU_framebuffer_recursive_downsample(
glReadBuffer(GL_COLOR_ATTACHMENT0);
}
for (i = 1; i < num_iter + 1 && (current_dim[0] > 4 && current_dim[1] > 4); i++) {
for (i = 1; i < num_iter + 1; i++) {
if (GPU_type_matches(GPU_DEVICE_AMD_VEGA, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
/* NOTE : here 16 is because of a bug on AMD Vega GPU + non-pro drivers, that prevents us
* from sampling mipmaps that are smaller or equal to 16px. (9) */
if (current_dim[0] / 2 > 16 && current_dim[1] / 2 > 16) {
break;
}
}
else {
if (current_dim[0] / 2 > 1 && current_dim[1] / 2 > 1) {
break;
}
}
/* calculate next viewport size */
current_dim[0] /= 2;