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>2017-10-10 18:18:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-10-11 03:15:42 +0300
commit12fa6750f5d360ead02ca5820da34c08b0200bb0 (patch)
tree151a6db1408d5452c59e9dd8940a4aa26e5e50cc /source/blender/gpu
parenteb734746a8daa5c1692dd2058aa5a28c1675c137 (diff)
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.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_extensions.h1
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c7
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c16
3 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index d36b0ea15be..d860431b04f 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -64,6 +64,7 @@ typedef enum GPUDeviceType {
GPU_DEVICE_INTEL = (1 << 2),
GPU_DEVICE_SOFTWARE = (1 << 3),
GPU_DEVICE_UNKNOWN = (1 << 4),
+ GPU_DEVICE_AMD_VEGA = (1 << 5),
GPU_DEVICE_ANY = (0xff)
} GPUDeviceType;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 6bf330179d3..1159603f721 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -178,6 +178,13 @@ void gpu_extensions_init(void)
GG.device = GPU_DEVICE_ATI;
GG.driver = GPU_DRIVER_OFFICIAL;
}
+ /* XXX : TODO : Remove this once this sampling mipmap problem is gone.
+ * https://github.com/dfelinto/opengl-sandbox/blob/downsample/README.md */
+ else if (strstr(renderer, "AMD VEGA") ||
+ strstr(vendor, "X.Org")) {
+ GG.device = GPU_DEVICE_AMD_VEGA;
+ GG.driver = GPU_DRIVER_OPENSOURCE;
+ }
else if (strstr(vendor, "NVIDIA")) {
GG.device = GPU_DEVICE_NVIDIA;
GG.driver = GPU_DRIVER_OFFICIAL;
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 6b19cea464b..1d157ecb14c 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -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;