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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-04 22:29:30 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-05 04:51:48 +0300
commit53685404316e05879bc9ff46837dd224ba3cce4f (patch)
tree28dfb1b80186a35c235fa1fa73804e444cfb50a8 /source
parentf4261cd2ed4a1e3bfcd12a6602abdaf717c349cd (diff)
Workbench: Fix workbench broken on some config due to usuned fb slot
This seems to be a driver bug. Only windows + Radeon HD 7500M seems to be affected. Fix can be extended to more config if necessary.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c6
-rw-r--r--source/blender/gpu/GPU_extensions.h1
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c16
3 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index a07c9f37ac9..1e401b278be 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -403,6 +403,7 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
const GPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
const GPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_R11F_G11F_B10F;
+ const GPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
e_data.object_id_tx = NULL;
e_data.color_buffer_tx = NULL;
@@ -412,8 +413,9 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
e_data.color_buffer_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_RGBA8, &draw_engine_workbench_solid);
e_data.composite_buffer_tx = DRW_texture_pool_query_2D(size[0], size[1], comp_tex_format, &draw_engine_workbench_solid);
- if (OBJECT_ID_PASS_ENABLED(wpd)) {
- e_data.object_id_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_R32UI, &draw_engine_workbench_solid);
+
+ if (OBJECT_ID_PASS_ENABLED(wpd) || GPU_unused_fb_slot_workaround()) {
+ e_data.object_id_tx = DRW_texture_pool_query_2D(size[0], size[1], id_tex_format, &draw_engine_workbench_solid);
}
if (NORMAL_VIEWPORT_PASS_ENABLED(wpd)) {
e_data.normal_buffer_tx = DRW_texture_pool_query_2D(size[0], size[1], nor_tex_format, &draw_engine_workbench_solid);
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 12a640747da..22eb917f0bd 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -54,6 +54,7 @@ int GPU_color_depth(void);
void GPU_get_dfdy_factors(float fac[2]);
bool GPU_mip_render_workaround(void);
bool GPU_depth_blitting_workaround(void);
+bool GPU_unused_fb_slot_workaround(void);
bool GPU_mem_stats_supported(void);
void GPU_mem_stats_get(int *totalmem, int *freemem);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 99f770b4d03..92d91bd440d 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -95,6 +95,9 @@ static struct GPUGlobal {
* GPU_DEPTH32F_STENCIL8. Then Blitting depth will work but blitting stencil will
* still be broken. */
bool depth_blitting_workaround;
+ /* Crappy driver don't know how to map framebuffer slot to output vars...
+ * We need to have no "holes" in the output buffer slots. */
+ bool unused_fb_slot_workaround;
} GG = {1, 0};
@@ -211,6 +214,11 @@ bool GPU_depth_blitting_workaround(void)
return GG.depth_blitting_workaround;
}
+bool GPU_unused_fb_slot_workaround(void)
+{
+ return GG.unused_fb_slot_workaround;
+}
+
void gpu_extensions_init(void)
{
/* during 2.8 development each platform has its own OpenGL minimum requirements
@@ -262,6 +270,14 @@ void gpu_extensions_init(void)
GG.device = GPU_DEVICE_ATI;
GG.driver = GPU_DRIVER_OFFICIAL;
+#ifdef _WIN32
+ if (strstr(vendor, "Radeon HD 7500M") ||
+ strstr(vendor, "Radeon HD 7570M"))
+ {
+ GG.unused_fb_slot_workaround = true;
+ }
+#endif
+
#if defined(__APPLE__)
if (strstr(renderer, "AMD Radeon Pro") ||
strstr(renderer, "AMD Radeon R9") ||