mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
Merge branch 'vulkan2' of https://github.com/coelckers/gzdoom into vulkan2
This commit is contained in:
commit
c2df818012
1 changed files with 30 additions and 32 deletions
|
@ -52,10 +52,7 @@
|
|||
#include "version.h"
|
||||
#include "doomerrors.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/textures/gl_samplers.h"
|
||||
|
||||
#include "vulkan/system/vk_framebuffer.h"
|
||||
|
||||
|
||||
|
@ -182,6 +179,12 @@ namespace
|
|||
|
||||
@implementation OpenGLCocoaView
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
[NSColor.blackColor setFill];
|
||||
NSRectFill(dirtyRect);
|
||||
}
|
||||
|
||||
- (void)resetCursorRects
|
||||
{
|
||||
[super resetCursorRects];
|
||||
|
@ -234,11 +237,6 @@ namespace
|
|||
m_cursor = cursor;
|
||||
}
|
||||
|
||||
-(BOOL) wantsUpdateLayer
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
+(Class) layerClass
|
||||
{
|
||||
return NSClassFromString(@"CAMetalLayer");
|
||||
|
@ -327,9 +325,6 @@ void SetupOpenGLView(CocoaWindow* window)
|
|||
[[glView openGLContext] makeCurrentContext];
|
||||
|
||||
[window setContentView:glView];
|
||||
|
||||
// To be able to use OpenGL functions in SetMode()
|
||||
ogl_LoadFunctions();
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
@ -365,14 +360,10 @@ public:
|
|||
const NSRect contentRect = [ms_window contentRectForFrameRect:[ms_window frame]];
|
||||
|
||||
NSView* vulkanView = [[VulkanCocoaView alloc] initWithFrame:contentRect];
|
||||
[vulkanView setWantsLayer:YES];
|
||||
vulkanView.wantsLayer = YES;
|
||||
vulkanView.layer.backgroundColor = NSColor.blackColor.CGColor;
|
||||
|
||||
[ms_window setContentView:vulkanView];
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupOpenGLView(ms_window);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -385,6 +376,11 @@ public:
|
|||
|
||||
SetupOpenGLView(ms_window);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupOpenGLView(ms_window);
|
||||
}
|
||||
|
||||
if (fb == nullptr)
|
||||
{
|
||||
|
@ -395,6 +391,16 @@ public:
|
|||
fb->SetMode(fullscreen, vid_hidpi);
|
||||
fb->SetSize(fb->GetClientWidth(), fb->GetClientHeight());
|
||||
|
||||
// This lame hack is a temporary workaround for strange performance issues
|
||||
// with fullscreen window and Core Animation's Metal layer
|
||||
// It is somehow related to initial window level and flags
|
||||
// Toggling fullscreen -> window -> fullscreen mysteriously solves the problem
|
||||
if (ms_isVulkanEnabled && fullscreen)
|
||||
{
|
||||
fb->SetMode(false, vid_hidpi);
|
||||
fb->SetMode(true, vid_hidpi);
|
||||
}
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
@ -658,14 +664,6 @@ void SystemGLFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
|
|||
SetWindowedMode();
|
||||
}
|
||||
|
||||
const NSSize viewSize = I_GetContentViewSize(m_window);
|
||||
|
||||
glViewport(0, 0, static_cast<GLsizei>(viewSize.width), static_cast<GLsizei>(viewSize.height));
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
[[NSOpenGLContext currentContext] flushBuffer];
|
||||
|
||||
[m_window updateTitle];
|
||||
|
||||
if (![m_window isKeyWindow])
|
||||
|
|
Loading…
Reference in a new issue