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.
This commit is contained in:
Clément Foucault 2018-12-04 20:29:30 +01:00
parent f4261cd2ed
commit 5368540431
3 changed files with 21 additions and 2 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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") ||