|
|
|
@ -88,6 +88,7 @@ public: |
|
|
|
} |
|
|
|
|
|
|
|
HRESULT ImportIOSurface(void *handle, AvnPixelFormat pixelFormat, IAvnMetalTexture **ppv) override { |
|
|
|
START_COM_ARP_CALL; |
|
|
|
auto surf = (IOSurfaceRef)handle; |
|
|
|
auto width = IOSurfaceGetWidth(surf); |
|
|
|
auto height = IOSurfaceGetHeight(surf); |
|
|
|
@ -112,7 +113,6 @@ public: |
|
|
|
return E_FAIL; |
|
|
|
*ppv = new AvnMetalTexture(texture); |
|
|
|
return S_OK; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
HRESULT ImportSharedEvent(void *mtlSharedEventInstance, IAvnMTLSharedEvent**ppv) override { |
|
|
|
@ -132,11 +132,12 @@ public: |
|
|
|
|
|
|
|
HRESULT SignalOrWait(IAvnMTLSharedEvent *ev, uint64_t value, bool wait) |
|
|
|
{ |
|
|
|
START_ARP_CALL; |
|
|
|
if (@available(macOS 12.0, *)) |
|
|
|
{ |
|
|
|
auto e = dynamic_cast<AvnMTLSharedEvent*>(ev); |
|
|
|
if(e == nullptr) |
|
|
|
return E_FAIL;; |
|
|
|
return E_FAIL; |
|
|
|
auto buf = [queue commandBuffer]; |
|
|
|
if(wait) |
|
|
|
[buf encodeWaitForEvent:e->GetEvent() value:value]; |
|
|
|
@ -204,6 +205,7 @@ public: |
|
|
|
|
|
|
|
~AvnMetalRenderSession() |
|
|
|
{ |
|
|
|
START_ARP_CALL; |
|
|
|
auto buffer = [_queue commandBuffer]; |
|
|
|
[buffer presentDrawable: _drawable]; |
|
|
|
[buffer commit]; |
|
|
|
@ -227,6 +229,7 @@ public: |
|
|
|
} |
|
|
|
|
|
|
|
HRESULT BeginDrawing(IAvnMetalRenderingSession **ret) override { |
|
|
|
START_COM_ARP_CALL; |
|
|
|
if([NSThread isMainThread]) |
|
|
|
{ |
|
|
|
// Flush all existing rendering |
|
|
|
@ -289,7 +292,7 @@ class AvnMetalDisplay : public ComSingleObject<IAvnMetalDisplay, &IID_IAvnMetalD |
|
|
|
public: |
|
|
|
FORWARD_IUNKNOWN() |
|
|
|
HRESULT CreateDevice(IAvnMetalDevice **ret) override { |
|
|
|
|
|
|
|
START_COM_ARP_CALL; |
|
|
|
auto device = MTLCreateSystemDefaultDevice(); |
|
|
|
if(device == nil) { |
|
|
|
ret = nil; |
|
|
|
|