update stuff
This commit is contained in:
@@ -15,12 +15,8 @@
|
||||
#endif
|
||||
|
||||
static gnReturnCode gnCreateGLFWWindowSurface(struct gnWindowSurface_t* windowSurface, struct gnInstance_t* instance, GLFWwindow* window) {
|
||||
MTKView* view = gnCreateMTKView(glfwGetCocoaWindow(window));
|
||||
gnWindowSetMTKView(glfwGetCocoaWindow(window), view);
|
||||
CAMetalLayer* layer = gnGetCAMetalLayer(glfwGetCocoaWindow(window));
|
||||
|
||||
gnMacOSWindowSurfaceInfo surfaceCreateInfo = {
|
||||
.layer = layer
|
||||
.layer = gnCreateCAMetalLayer(glfwGetCocoaWindow(window))
|
||||
};
|
||||
|
||||
return gnCreateMacOSWindowSurface(windowSurface, instance, surfaceCreateInfo);
|
||||
|
@@ -31,15 +31,17 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t
|
||||
|
||||
id<MTLBlitCommandEncoder> blit = [commandBuffer blitCommandEncoder];
|
||||
|
||||
[blit copyFromTexture:info.presentationQueues[0].images[info.imageIndices[0]].texture->texture
|
||||
sourceSlice:0
|
||||
sourceLevel:0
|
||||
sourceOrigin:(MTLOrigin){0, 0, 0}
|
||||
sourceSize:(MTLSize){info.presentationQueues[0].info.imageSize.x, info.presentationQueues[0].info.imageSize.y, 1}
|
||||
toTexture:drawable.texture
|
||||
destinationSlice:0
|
||||
destinationLevel:0
|
||||
destinationOrigin:(MTLOrigin){0, 0, 0}];
|
||||
for (int i =0 ; i < info.presentationQueueCount; i++) {
|
||||
[blit copyFromTexture:info.presentationQueues[i].images[info.imageIndices[i]].texture->texture
|
||||
sourceSlice:0
|
||||
sourceLevel:0
|
||||
sourceOrigin:(MTLOrigin){0, 0, 0}
|
||||
sourceSize:(MTLSize){info.presentationQueues[i].info.imageSize.x, info.presentationQueues[i].info.imageSize.y, 1}
|
||||
toTexture:drawable.texture
|
||||
destinationSlice:0
|
||||
destinationLevel:0
|
||||
destinationOrigin:(MTLOrigin){0, 0, 0}];
|
||||
}
|
||||
|
||||
[blit endEncoding];
|
||||
|
||||
@@ -48,5 +50,12 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t
|
||||
[commandBuffer waitUntilScheduled];
|
||||
device->outputDevice->executingCommandBuffer = commandBuffer;
|
||||
|
||||
for (int i = 0; i < info.presentationQueueCount; i++) {
|
||||
if (info.presentationQueues[i].info.imageSize.x != info.presentationQueues[i].info.surface.windowSurface->layer.drawableSize.width ||
|
||||
info.presentationQueues[i].info.imageSize.y != info.presentationQueues[i].info.surface.windowSurface->layer.drawableSize.height) {
|
||||
return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||
}
|
||||
}
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user