Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/opengl/gl_backend.cc
| Show All 32 Lines | |||||
| #include "gl_backend.hh" | #include "gl_backend.hh" | ||||
| namespace blender::gpu { | namespace blender::gpu { | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Platform | /** \name Platform | ||||
| * \{ */ | * \{ */ | ||||
| static bool match_renderer(StringRef renderer, const Vector<std::string> &items) | |||||
| { | |||||
| for (const std::string &item : items) { | |||||
| const std::string wrapped = " " + item + " "; | |||||
| if (renderer.endswith(item) || renderer.find(wrapped) != StringRef::not_found) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| void GLBackend::platform_init() | void GLBackend::platform_init() | ||||
| { | { | ||||
| BLI_assert(!GPG.initialized); | BLI_assert(!GPG.initialized); | ||||
| GPG.initialized = true; | GPG.initialized = true; | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| GPG.os = GPU_OS_WIN; | GPG.os = GPU_OS_WIN; | ||||
| #elif defined(__APPLE__) | #elif defined(__APPLE__) | ||||
| ▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE) && | ||||
| GCaps.shader_image_load_store_support = false; | GCaps.shader_image_load_store_support = false; | ||||
| GCaps.broken_amd_driver = true; | GCaps.broken_amd_driver = true; | ||||
| } | } | ||||
| /* See T82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the | /* See T82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the | ||||
| * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags. | * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags. | ||||
| * The work around uses `GPU_RGBA16I`. | * The work around uses `GPU_RGBA16I`. | ||||
| */ | */ | ||||
| if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { | if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { | ||||
| if (strstr(renderer, " RX 460 ") || strstr(renderer, " RX 470 ") || | const Vector<std::string> matches = {"RX 460", | ||||
| strstr(renderer, " RX 480 ") || strstr(renderer, " RX 490 ") || | "RX 470", | ||||
| strstr(renderer, " RX 560 ") || strstr(renderer, " RX 560X ") || | "RX 480", | ||||
| strstr(renderer, " RX 570 ") || strstr(renderer, " RX 580 ") || | "RX 490", | ||||
| strstr(renderer, " RX 580X ") || strstr(renderer, " RX 590 ") || | "RX 560", | ||||
| strstr(renderer, " RX550/550 ") || strstr(renderer, "(TM) 520 ") || | "RX 560X", | ||||
| strstr(renderer, "(TM) 530 ") || strstr(renderer, "(TM) 535 ") || | "RX 570", | ||||
| strstr(renderer, " R5 ") || strstr(renderer, " R7 ") || strstr(renderer, " R9 ")) { | "RX 580", | ||||
| "RX 580X", | |||||
| "RX 590", | |||||
| "RX550/550", | |||||
| "(TM) 520", | |||||
| "(TM) 530", | |||||
| "(TM) 535", | |||||
| "R5", | |||||
| "R7", | |||||
| "R9"}; | |||||
| if (match_renderer(renderer, matches)) { | |||||
| GCaps.use_hq_normals_workaround = true; | GCaps.use_hq_normals_workaround = true; | ||||
| } | } | ||||
| } | } | ||||
| /* There is an issue with the #glBlitFramebuffer on MacOS with radeon pro graphics. | /* There is an issue with the #glBlitFramebuffer on MacOS with radeon pro graphics. | ||||
| * Blitting depth with#GL_DEPTH24_STENCIL8 is buggy so the workaround is to use | * Blitting depth with#GL_DEPTH24_STENCIL8 is buggy so the workaround is to use | ||||
| * #GPU_DEPTH32F_STENCIL8. Then Blitting depth will work but blitting stencil will | * #GPU_DEPTH32F_STENCIL8. Then Blitting depth will work but blitting stencil will | ||||
| * still be broken. */ | * still be broken. */ | ||||
| if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_MAC, GPU_DRIVER_OFFICIAL)) { | if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_MAC, GPU_DRIVER_OFFICIAL)) { | ||||
| ▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines | |||||