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