diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_capabilities.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_capabilities.cc | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_capabilities_private.hh | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_viewport.c | 13 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_backend.cc | 7 |
5 files changed, 23 insertions, 4 deletions
diff --git a/source/blender/gpu/GPU_capabilities.h b/source/blender/gpu/GPU_capabilities.h index 0d0542aa528..aedac168a01 100644 --- a/source/blender/gpu/GPU_capabilities.h +++ b/source/blender/gpu/GPU_capabilities.h @@ -40,6 +40,7 @@ bool GPU_mip_render_workaround(void); bool GPU_depth_blitting_workaround(void); bool GPU_use_main_context_workaround(void); bool GPU_use_hq_normals_workaround(void); +bool GPU_clear_viewport_workaround(void); bool GPU_crappy_amd_driver(void); bool GPU_compute_shader_support(void); diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc index b750dacaca6..72b62b3de3d 100644 --- a/source/blender/gpu/intern/gpu_capabilities.cc +++ b/source/blender/gpu/intern/gpu_capabilities.cc @@ -142,6 +142,11 @@ bool GPU_use_hq_normals_workaround() return GCaps.use_hq_normals_workaround; } +bool GPU_clear_viewport_workaround() +{ + return GCaps.clear_viewport_workaround; +} + bool GPU_compute_shader_support() { return GCaps.compute_shader_support; diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh index 4a951eb8458..611c2d6973c 100644 --- a/source/blender/gpu/intern/gpu_capabilities_private.hh +++ b/source/blender/gpu/intern/gpu_capabilities_private.hh @@ -51,6 +51,7 @@ struct GPUCapabilities { bool use_main_context_workaround = false; bool broken_amd_driver = false; bool use_hq_normals_workaround = false; + bool clear_viewport_workaround = false; /* Vulkan related workarounds. */ /* Metal related workarounds. */ diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index a0efe12f523..d528160797d 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -21,6 +21,7 @@ #include "DNA_userdef_types.h" #include "DNA_vec_types.h" +#include "GPU_capabilities.h" #include "GPU_framebuffer.h" #include "GPU_immediate.h" #include "GPU_matrix.h" @@ -126,19 +127,23 @@ static void gpu_viewport_textures_create(GPUViewport *viewport) if (viewport->color_render_tx[0] == NULL) { viewport->color_render_tx[0] = GPU_texture_create_2d( "dtxl_color", UNPACK2(size), 1, GPU_RGBA16F, NULL); - GPU_texture_clear(viewport->color_render_tx[0], GPU_DATA_FLOAT, empty_pixel); viewport->color_overlay_tx[0] = GPU_texture_create_2d( "dtxl_color_overlay", UNPACK2(size), 1, GPU_SRGB8_A8, NULL); - GPU_texture_clear(viewport->color_overlay_tx[0], GPU_DATA_FLOAT, empty_pixel); + if (GPU_clear_viewport_workaround()) { + GPU_texture_clear(viewport->color_render_tx[0], GPU_DATA_FLOAT, empty_pixel); + GPU_texture_clear(viewport->color_overlay_tx[0], GPU_DATA_FLOAT, empty_pixel); + } } if ((viewport->flag & GPU_VIEWPORT_STEREO) != 0 && viewport->color_render_tx[1] == NULL) { viewport->color_render_tx[1] = GPU_texture_create_2d( "dtxl_color_stereo", UNPACK2(size), 1, GPU_RGBA16F, NULL); - GPU_texture_clear(viewport->color_render_tx[1], GPU_DATA_FLOAT, empty_pixel); viewport->color_overlay_tx[1] = GPU_texture_create_2d( "dtxl_color_overlay_stereo", UNPACK2(size), 1, GPU_SRGB8_A8, NULL); - GPU_texture_clear(viewport->color_overlay_tx[1], GPU_DATA_FLOAT, empty_pixel); + if (GPU_clear_viewport_workaround()) { + GPU_texture_clear(viewport->color_render_tx[1], GPU_DATA_FLOAT, empty_pixel); + GPU_texture_clear(viewport->color_overlay_tx[1], GPU_DATA_FLOAT, empty_pixel); + } } /* Can be shared with GPUOffscreen. */ diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 610fd5d980f..0ce01d80a77 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -419,6 +419,13 @@ static void detect_workarounds() GCaps.shader_storage_buffer_objects_support = false; } + /* Certain Intel based platforms don't clear the viewport textures. Always clearing leads to + * noticeable performance regressions. */ + if (GPU_type_matches( + GPU_DEVICE_INTEL, static_cast<eGPUOSType>(GPU_OS_MAC | GPU_OS_UNIX), GPU_DRIVER_ANY)) { + GCaps.clear_viewport_workaround = true; + } + /* Metal-related Workarounds. */ /* Minimum Per-Vertex stride is 1 byte for OpenGL. */ |