Changeset View
Standalone View
source/blender/windowmanager/intern/wm_platform_support.c
- This file was added.
| #include "BLI_sys_types.h" | |||||
| #include "BKE_global.h" | |||||
| #include "GHOST_C-api.h" | |||||
| #include "GPU_glew.h" | |||||
| #include <string.h> | |||||
| typedef struct WM_PlatformSupport { | |||||
| /* Have we already initialized this struct. Must be the first field */ | |||||
| bool initialized; | |||||
| } WM_PlatformSupport; | |||||
| typedef enum eWMSupportLevel { | |||||
| WM_SUPPORT_LEVEL_SUPPORTED, | |||||
| WM_SUPPORT_LEVEL_LIMITTED, | |||||
| WM_SUPPORT_LEVEL_UNSUPPORTED, | |||||
| } eWMSupportLevel; | |||||
| static WM_PlatformSupport WM_PLATFORM_SUPPRORT = {false}; | |||||
| static int wm_platform_support_ghost_callback(char *message, char *link) | |||||
| { | |||||
| /* User has already seen the message or has already confirmed in a | |||||
| * previous run */ | |||||
| if (WM_PLATFORM_SUPPRORT.initialized) { | |||||
| return GHOST_DialogNoDialog; | |||||
| } | |||||
| eWMSupportLevel support_level = WM_SUPPORT_LEVEL_SUPPORTED; | |||||
| /* don't show the messagebox when running in background mode. Only | |||||
| * print it in the console */ | |||||
| if (G.background) { | |||||
| return false; | |||||
| } | |||||
| const char *vendor = (const char *)glGetString(GL_VENDOR); | |||||
| const char *renderer = (const char *)glGetString(GL_RENDERER); | |||||
| const char *version = (const char *)glGetString(GL_VERSION); | |||||
| if (!GLEW_VERSION_3_3) { | |||||
| support_level = WM_SUPPORT_LEVEL_UNSUPPORTED; | |||||
| } | |||||
| /* update the message and link based on the found support level */ | |||||
| switch (support_level) { | |||||
| default: | |||||
| case WM_SUPPORT_LEVEL_SUPPORTED: | |||||
| return GHOST_DialogNoDialog; | |||||
| case WM_SUPPORT_LEVEL_LIMITTED: | |||||
| strcpy(message, "Limitted Supported Platform"); | |||||
| strcpy(link, "Limitted Supported Platform"); | |||||
| return GHOST_DialogShow; | |||||
| case WM_SUPPORT_LEVEL_UNSUPPORTED: | |||||
| strcpy(message, "Unsupported Platform"); | |||||
| return GHOST_DialogShow | GHOST_DialogExit; | |||||
| } | |||||
| } | |||||
| No newline at end of file | |||||
brecht: Limitted -> Limited | |||||
Done Inline ActionsI think we should deduplicate this code with gpu_extensions_init. What I suggest is to add gpu_platform.c containing gpu_platform_init() to detect GG.device, GG.driver and GG.os. GPU_type_matches(), eWM_SupportLevel, WM_PlatformSupportTest would all in that file as well then. gpu_extensions_init() would use GPU_type_matches(). brecht: I think we should deduplicate this code with `gpu_extensions_init`.
What I suggest is to add… | |||||
Done Inline Actions__APPLE -> __APPLE__ brecht: `__APPLE` -> `__APPLE__` | |||||
Done Inline ActionsWhy not save in background mode? brecht: Why not save in background mode? | |||||
Done Inline ActionsWhen running in background mode the user might not notice that there is a support issue. By not doing this during background we know for sure that the message has been seen. jbakker: When running in background mode the user might not notice that there is a support issue.
There… | |||||
Done Inline ActionsIf a computer has graphics switching and both cards are unsupported, we will show the warning many times. So I think this should store multiple keys. For the implementation, BLI_file_read_as_lines could be used. New lines would have to be stripped. It's may also be simplest if wm_platform_support_load_state and wm_platform_support_save_state get merged into a single function. It can check if the given key is in the file, and if not append it. brecht: If a computer has graphics switching and both cards are unsupported, we will show the warning… | |||||
Done Inline ActionsDon't show a warning for unknown vendors, we should purely be blacklisting, not whitelisting. brecht: Don't show a warning for unknown vendors, we should purely be blacklisting, not whitelisting. | |||||
Done Inline Actionsand -> or brecht: and -> or | |||||
Done Inline ActionsThis seems to say a solution is definitely possible, might want to formulate it a bit different. brecht: This seems to say a solution is definitely possible, might want to formulate it a bit different. | |||||
Done Inline Actionsthis writes a \n that later will be returned in wm_platform_support_load_state causing the strcmp later on to fail and give the popup every time the user starts blender. LazyDodo: this writes a `\n` that later will be returned in `wm_platform_support_load_state` causing the… | |||||
Done Inline ActionsGotcha! well we will be refactoring load_state and save_state so this will not be an issue anymore jbakker: Gotcha! well we will be refactoring load_state and save_state so this will not be an issue… | |||||
Done Inline ActionsLazyDodo: {F7785798}
1) layout doesn't look great
2) `Your graphics card and driver has limited.`… | |||||
Done Inline Actionsis -> are LazyDodo: is -> are | |||||
Done Inline ActionsChange latest to dev since the 2.80 manual does not have this info. We could change it after the release, though maybe it is better regardless to always link to the very latest manual, in case the driver download links change or we want to add extra info. brecht: Change `latest` to `dev` since the 2.80 manual does not have this info.
We could change it… | |||||

Limitted -> Limited