Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_extensions.c
| Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | static struct GPUGlobal { | ||||
| eGPUOSType os; | eGPUOSType os; | ||||
| eGPUDriverType driver; | eGPUDriverType driver; | ||||
| float line_width_range[2]; | float line_width_range[2]; | ||||
| /* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers | /* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers | ||||
| * calculate dfdy in shader differently when drawing to an offscreen buffer. First | * calculate dfdy in shader differently when drawing to an offscreen buffer. First | ||||
| * number is factor on screen and second is off-screen */ | * number is factor on screen and second is off-screen */ | ||||
| float dfdyfactors[2]; | float dfdyfactors[2]; | ||||
| float max_anisotropy; | float max_anisotropy; | ||||
| /* Some Intel drivers have limited support for `GLEW_ARB_base_instance` so in | |||||
| * these cases it is best to indicate that it is not supported. See T67951 */ | |||||
| bool glew_arb_base_instance_is_supported; | |||||
| /* Some Intel drivers have issues with using mips as framebuffer targets if | /* Some Intel drivers have issues with using mips as framebuffer targets if | ||||
| * GL_TEXTURE_MAX_LEVEL is higher than the target mip. | * GL_TEXTURE_MAX_LEVEL is higher than the target mip. | ||||
| * We need a workaround in this cases. */ | * We need a workaround in this cases. */ | ||||
| bool mip_render_workaround; | bool mip_render_workaround; | ||||
| /* 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. */ | ||||
| ▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | float GPU_max_line_width(void) | ||||
| return GG.line_width_range[1]; | return GG.line_width_range[1]; | ||||
| } | } | ||||
| void GPU_get_dfdy_factors(float fac[2]) | void GPU_get_dfdy_factors(float fac[2]) | ||||
| { | { | ||||
| copy_v2_v2(fac, GG.dfdyfactors); | copy_v2_v2(fac, GG.dfdyfactors); | ||||
| } | } | ||||
| bool GPU_arb_base_instance_is_supported(void) | |||||
| { | |||||
| return GG.glew_arb_base_instance_is_supported; | |||||
| } | |||||
| bool GPU_mip_render_workaround(void) | bool GPU_mip_render_workaround(void) | ||||
| { | { | ||||
| return GG.mip_render_workaround; | return GG.mip_render_workaround; | ||||
| } | } | ||||
| bool GPU_depth_blitting_workaround(void) | bool GPU_depth_blitting_workaround(void) | ||||
| { | { | ||||
| return GG.depth_blitting_workaround; | return GG.depth_blitting_workaround; | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| GG.os = GPU_OS_WIN; | GG.os = GPU_OS_WIN; | ||||
| #elif defined(__APPLE__) | #elif defined(__APPLE__) | ||||
| GG.os = GPU_OS_MAC; | GG.os = GPU_OS_MAC; | ||||
| #else | #else | ||||
| GG.os = GPU_OS_UNIX; | GG.os = GPU_OS_UNIX; | ||||
| #endif | #endif | ||||
| GG.glew_arb_base_instance_is_supported = GLEW_ARB_base_instance; | |||||
| gpu_detect_mip_render_workaround(); | gpu_detect_mip_render_workaround(); | ||||
| 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); | ||||
| Show All 24 Lines | else { | ||||
| GG.dfdyfactors[1] = 1.0; | GG.dfdyfactors[1] = 1.0; | ||||
| } | } | ||||
| if (strstr(version, "Build 10.18.10.3379") || strstr(version, "Build 10.18.10.3574") || | if (strstr(version, "Build 10.18.10.3379") || strstr(version, "Build 10.18.10.3574") || | ||||
| strstr(version, "Build 10.18.10.4252") || strstr(version, "Build 10.18.10.4358") || | strstr(version, "Build 10.18.10.4252") || strstr(version, "Build 10.18.10.4358") || | ||||
| strstr(version, "Build 10.18.10.4653") || strstr(version, "Build 10.18.10.5069") || | strstr(version, "Build 10.18.10.4653") || strstr(version, "Build 10.18.10.5069") || | ||||
| strstr(version, "Build 10.18.14.4264") || strstr(version, "Build 10.18.14.4432") || | strstr(version, "Build 10.18.14.4264") || strstr(version, "Build 10.18.14.4432") || | ||||
| strstr(version, "Build 10.18.14.5067")) { | strstr(version, "Build 10.18.14.5067")) { | ||||
| /* Maybe not all of these drivers have problems with `GLEW_ARB_base_instance`. | |||||
| * But it's hard to test each case. */ | |||||
| GG.glew_arb_base_instance_is_supported = false; | |||||
| GG.context_local_shaders_workaround = true; | GG.context_local_shaders_workaround = true; | ||||
| } | } | ||||
| } | } | ||||
| GPU_invalid_tex_init(); | GPU_invalid_tex_init(); | ||||
| } | } | ||||
| void gpu_extensions_exit(void) | void gpu_extensions_exit(void) | ||||
| Show All 31 Lines | |||||