present command
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "core/sync/semaphore/metal_semaphore.h"
|
#include "core/sync/semaphore/metal_semaphore.h"
|
||||||
#include "core/presentation_queue/metal_presentation_queue.h"
|
#include "core/presentation_queue/metal_presentation_queue.h"
|
||||||
#include "core/debugger/gryphn_debugger.h"
|
#include "core/debugger/gryphn_debugger.h"
|
||||||
|
#include "core/texture/metal_texture.h"
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) {
|
gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) {
|
||||||
@@ -25,6 +26,20 @@ gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t
|
|||||||
id<MTLRenderCommandEncoder> render = [commandBuffer renderCommandEncoderWithDescriptor:passDesc];
|
id<MTLRenderCommandEncoder> render = [commandBuffer renderCommandEncoderWithDescriptor:passDesc];
|
||||||
[render endEncoding];
|
[render endEncoding];
|
||||||
|
|
||||||
|
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}];
|
||||||
|
|
||||||
|
[blit endEncoding];
|
||||||
|
|
||||||
[commandBuffer presentDrawable:drawable];
|
[commandBuffer presentDrawable:drawable];
|
||||||
[commandBuffer commit];
|
[commandBuffer commit];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user