Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowCocoa.mm
| /* SPDX-License-Identifier: GPL-2.0-or-later | /* SPDX-License-Identifier: GPL-2.0-or-later | ||||
| * Copyright 2001-2002 NaN Holding BV. All rights reserved. */ | * Copyright 2001-2002 NaN Holding BV. All rights reserved. */ | ||||
| #include "GHOST_WindowCocoa.h" | #include "GHOST_WindowCocoa.h" | ||||
| #include "GHOST_ContextNone.h" | #include "GHOST_ContextNone.h" | ||||
| #include "GHOST_Debug.h" | #include "GHOST_Debug.h" | ||||
| #include "GHOST_SystemCocoa.h" | #include "GHOST_SystemCocoa.h" | ||||
| #include "GHOST_ContextCGL.h" | #include "GHOST_ContextCGL.h" | ||||
| #ifdef WITH_VULKAN_BACKEND | |||||
| # include "GHOST_ContextVK.h" | |||||
| #endif | |||||
| #include <Cocoa/Cocoa.h> | #include <Cocoa/Cocoa.h> | ||||
| #include <Metal/Metal.h> | #include <Metal/Metal.h> | ||||
| #include <QuartzCore/QuartzCore.h> | #include <QuartzCore/QuartzCore.h> | ||||
| #include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
| #pragma mark Cocoa window delegate object | #pragma mark Cocoa window delegate object | ||||
| ▲ Show 20 Lines • Show All 779 Lines • ▼ Show 20 Lines | GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order) | ||||
| [pool drain]; | [pool drain]; | ||||
| return GHOST_kSuccess; | return GHOST_kSuccess; | ||||
| } | } | ||||
| #pragma mark Drawing context | #pragma mark Drawing context | ||||
| GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type) | GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type) | ||||
| { | { | ||||
| #ifdef WITH_VULKAN_BACKEND | |||||
| if (type == GHOST_kDrawingContextTypeVulkan) { | |||||
| GHOST_Context *context = new GHOST_ContextVK(m_wantStereoVisual, m_metalLayer, 1, 0, true); | |||||
| if (!context->initializeDrawingContext()) { | |||||
| delete context; | |||||
| return NULL; | |||||
| } | |||||
| return context; | |||||
| } | |||||
| #endif | |||||
| if (type == GHOST_kDrawingContextTypeOpenGL || type == GHOST_kDrawingContextTypeMetal) { | if (type == GHOST_kDrawingContextTypeOpenGL || type == GHOST_kDrawingContextTypeMetal) { | ||||
| GHOST_Context *context = new GHOST_ContextCGL( | GHOST_Context *context = new GHOST_ContextCGL( | ||||
| m_wantStereoVisual, m_metalView, m_metalLayer, m_openGLView, type); | m_wantStereoVisual, m_metalView, m_metalLayer, m_openGLView, type); | ||||
| if (context->initializeDrawingContext()) | if (context->initializeDrawingContext()) | ||||
| return context; | return context; | ||||
| else | else | ||||
| ▲ Show 20 Lines • Show All 410 Lines • Show Last 20 Lines | |||||