mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-05 14:52:41 +13:00
ios: Pass CAMetalLayer instead of void* to Obj-C++ bridging header
This commit is contained in:
parent
e378a52b5a
commit
90279e6f9e
4 changed files with 14 additions and 6 deletions
|
@ -673,7 +673,7 @@ if(ENABLE_METAL AND APPLE)
|
|||
target_compile_definitions(AlberCore PUBLIC "PANDA3DS_ENABLE_METAL=1")
|
||||
target_include_directories(AlberCore PRIVATE third_party/metal-cpp)
|
||||
# TODO: check if all of them are needed
|
||||
target_link_libraries(AlberCore PRIVATE "-framework Metal" "-framework Foundation" "-framework QuartzCore" resources_renderer_mtl)
|
||||
target_link_libraries(AlberCore PUBLIC "-framework Metal" "-framework Foundation" "-framework QuartzCore" resources_renderer_mtl)
|
||||
endif()
|
||||
|
||||
source_group("Header Files\\Core" FILES ${HEADER_FILES})
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <QuartzCore/QuartzCore.h>
|
||||
|
||||
void iosCreateEmulator();
|
||||
void iosRunFrame(void* drawable);
|
||||
void iosRunFrame(CAMetalLayer* layer);
|
|
@ -57,7 +57,6 @@ void RendererMTL::reset() {
|
|||
|
||||
void RendererMTL::setMTKLayer(void* layer) {
|
||||
metalLayer = (CA::MetalLayer*)layer;
|
||||
// metalLayer->retain();
|
||||
}
|
||||
|
||||
void RendererMTL::display() {
|
||||
|
@ -127,8 +126,9 @@ void RendererMTL::display() {
|
|||
// Inform the vertex buffer cache that the frame ended
|
||||
vertexBufferCache.endFrame();
|
||||
drawable->release();
|
||||
|
||||
#ifdef PANDA3DS_IOS
|
||||
// metalLayer->release();
|
||||
// metalLayer->autorelease();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,15 @@ IOS_EXPORT void iosCreateEmulator() {
|
|||
printf("Created emulator\n");
|
||||
}
|
||||
|
||||
IOS_EXPORT void iosRunFrame(void* layer) {
|
||||
IOS_EXPORT void iosRunFrame(CAMetalLayer* layer) {
|
||||
printf("Running a frame\n");
|
||||
emulator->getRenderer()->setMTKLayer(layer);
|
||||
// void* layerBridged = (void*)CFBridgingRetain(layer);
|
||||
void* layerBridged = (__bridge void*)layer;
|
||||
|
||||
emulator->getRenderer()->setMTKLayer(layerBridged);
|
||||
emulator->runFrame();
|
||||
CFRelease(layerBridged);
|
||||
|
||||
// CFBridgingAutorelease(layerBridged);
|
||||
printf("Ran a frame\n");
|
||||
}
|
Loading…
Add table
Reference in a new issue