Support running on the "low power" GPU on dual GPU macOS machines

Fixes #136
This commit is contained in:
Kovid Goyal 2017-12-14 06:14:22 +05:30
parent 7f19424f2d
commit 433640de84
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,8 @@ version 0.6.0 [future]
- Use CoreText instead of FreeType to render text on macOS
- Support running on the "low power" GPU on dual GPU macOS machines
- Add a new "grid" window layout
- Drop the dependency on glfw (kitty now uses a modified, bundled copy of glfw)

View File

@ -227,6 +227,7 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
glfwWindowHint(GLFW_STENCIL_BITS, 0);
#ifdef __APPLE__
if (OPT(macos_hide_titlebar)) glfwWindowHint(GLFW_DECORATED, false);
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, true);
#endif
standard_cursor = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);

View File

@ -114,6 +114,12 @@ layout_sprite_map() {
if (!limits_updated) {
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &(sprite_map.max_texture_size));
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &(sprite_map.max_array_texture_layers));
#ifdef __APPLE__
// Since on Apple we could have multiple GPUs, with different capabilities,
// upper bound the values according to the data from http://developer.apple.com/graphicsimaging/opengl/capabilities/
sprite_map.max_texture_size = MIN(8192, sprite_map.max_texture_size);
sprite_map.max_array_texture_layers = MIN(512, sprite_map.max_array_texture_layers);
#endif
sprite_tracker_set_limits(sprite_map.max_texture_size, sprite_map.max_array_texture_layers);
limits_updated = true;
}