Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_extensions.c
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | static struct GPUGlobal { | ||||
| * still be broken. */ | * still be broken. */ | ||||
| bool depth_blitting_workaround; | bool depth_blitting_workaround; | ||||
| /* Crappy driver don't know how to map framebuffer slot to output vars... | /* Crappy driver don't know how to map framebuffer slot to output vars... | ||||
| * We need to have no "holes" in the output buffer slots. */ | * We need to have no "holes" in the output buffer slots. */ | ||||
| bool unused_fb_slot_workaround; | bool unused_fb_slot_workaround; | ||||
| /* Some crappy Intel drivers don't work well with shaders created in different | /* Some crappy Intel drivers don't work well with shaders created in different | ||||
| * rendering contexts. */ | * rendering contexts. */ | ||||
| bool context_local_shaders_workaround; | bool context_local_shaders_workaround; | ||||
| /* Unmaintained NVIDIA drivers contain certain bugs we need to workaround. */ | |||||
| bool legacy_nvidia_driver; | |||||
| } GG = {1, 0}; | } GG = {1, 0}; | ||||
| static void gpu_detect_mip_render_workaround(void) | static void gpu_detect_mip_render_workaround(void) | ||||
| { | { | ||||
| int cube_size = 2; | int cube_size = 2; | ||||
| float *source_pix = MEM_callocN(sizeof(float) * 4 * 6 * cube_size * cube_size, __func__); | float *source_pix = MEM_callocN(sizeof(float) * 4 * 6 * cube_size * cube_size, __func__); | ||||
| float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f}; | float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f}; | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | bool GPU_unused_fb_slot_workaround(void) | ||||
| return GG.unused_fb_slot_workaround; | return GG.unused_fb_slot_workaround; | ||||
| } | } | ||||
| bool GPU_context_local_shaders_workaround(void) | bool GPU_context_local_shaders_workaround(void) | ||||
| { | { | ||||
| return GG.context_local_shaders_workaround; | return GG.context_local_shaders_workaround; | ||||
| } | } | ||||
| bool GPU_legacy_nvidia_driver(void) | |||||
| { | |||||
| return GG.legacy_nvidia_driver; | |||||
| } | |||||
| bool GPU_crappy_amd_driver(void) | bool GPU_crappy_amd_driver(void) | ||||
| { | { | ||||
| /* Currently are the same drivers with the `unused_fb_slot` problem. */ | /* Currently are the same drivers with the `unused_fb_slot` problem. */ | ||||
| return GPU_unused_fb_slot_workaround(); | return GPU_unused_fb_slot_workaround(); | ||||
| } | } | ||||
| void gpu_extensions_init(void) | void gpu_extensions_init(void) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | if (strstr(renderer, "AMD Radeon Pro") || strstr(renderer, "AMD Radeon R9") || | ||||
| strstr(renderer, "AMD Radeon RX")) { | strstr(renderer, "AMD Radeon RX")) { | ||||
| GG.depth_blitting_workaround = true; | GG.depth_blitting_workaround = true; | ||||
| } | } | ||||
| } | } | ||||
| GG.glew_arb_base_instance_is_supported = GLEW_ARB_base_instance; | GG.glew_arb_base_instance_is_supported = GLEW_ARB_base_instance; | ||||
| gpu_detect_mip_render_workaround(); | gpu_detect_mip_render_workaround(); | ||||
| if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { | |||||
| char *driver_version_str = strstr(version, "NVIDIA ") + 7; | |||||
| int driver_major_version = (int)strtol(driver_version_str, NULL, 10); | |||||
| if (driver_major_version > 0 && driver_major_version < 400) { | |||||
| GG.legacy_nvidia_driver = true; | |||||
| } | |||||
| } | |||||
| if (G.debug & G_DEBUG_GPU_FORCE_WORKAROUNDS) { | if (G.debug & G_DEBUG_GPU_FORCE_WORKAROUNDS) { | ||||
| printf("\n"); | printf("\n"); | ||||
| printf("GPU: Bypassing workaround detection.\n"); | printf("GPU: Bypassing workaround detection.\n"); | ||||
| printf("GPU: OpenGL identification strings\n"); | printf("GPU: OpenGL identification strings\n"); | ||||
| printf("GPU: vendor: %s\n", vendor); | printf("GPU: vendor: %s\n", vendor); | ||||
| printf("GPU: renderer: %s\n", renderer); | printf("GPU: renderer: %s\n", renderer); | ||||
| printf("GPU: version: %s\n\n", version); | printf("GPU: version: %s\n\n", version); | ||||
| GG.mip_render_workaround = true; | GG.mip_render_workaround = true; | ||||
| ▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines | |||||