Vulkan surface now initializing on MacOS

Updated Volk library
This commit is contained in:
2024-01-11 23:05:13 -08:00
parent 8214cf475a
commit 2105e9359e
12 changed files with 31 additions and 56 deletions

View File

@@ -27,6 +27,8 @@ if (WIN32)
else(WIN32)
add_executable(kraken_cube main_macos.mm harness.cpp hello_cube.cpp)
set(CMAKE_CXX_COMPILER "clang++")
list (APPEND EXTRA_LIBS "-framework QuartzCore")
list (APPEND EXTRA_LIBS "-framework Metal")
endif(WIN32)
add_dependencies(kraken_cube kraken_cube_assets)

View File

@@ -34,7 +34,7 @@
#include "kraken.h"
#include "hello_cube.h"
bool test_init(void* windowHandle)
bool test_init(void* platformHandle)
{
KrInitializeInfo init_info = {};
init_info.sType = KR_STRUCTURE_TYPE_INITIALIZE;
@@ -50,11 +50,7 @@ bool test_init(void* windowHandle)
KrCreateWindowSurfaceInfo create_surface_info = {};
create_surface_info.sType = KR_STRUCTURE_TYPE_CREATE_WINDOW_SURFACE;
create_surface_info.surfaceHandle = 1;
#if defined(WIN32) || defined(WIN64)
create_surface_info.hWnd = windowHandle;
#elif defined(__APPLE__)
create_surface_info.view = windowHandle;
#endif
create_surface_info.platformHandle = platformHandle;
res = KrCreateWindowSurface(&create_surface_info);
if (res != KR_SUCCESS) {
//printf("Failed to create window surface.\n");

View File

@@ -31,5 +31,5 @@
#pragma once
bool test_init(void* windowHandle);
bool test_init(void* platformHandle);
bool test_shutdown();

View File

@@ -53,7 +53,7 @@ bool smoke_load()
if (res != KR_SUCCESS) {
//printf("Failed to load resource: %s\n", arg);
KrShutdown();
return 1;
return false;
}
/*
@@ -84,4 +84,6 @@ bool smoke_load()
// create_camera_info.node.camera.skybox_texture = kSkyboxTextureResourceHandle;
res = KrCreateNode(&create_camera_info);
assert(res == KR_SUCCESS);
return true;
}

View File

@@ -30,6 +30,7 @@
//
#import "Cocoa/Cocoa.h"
#import "QuartzCore/CAMetalLayer.h"
#include "kraken.h"
#include "harness.h"
@@ -59,10 +60,11 @@ int main(int argc, const char * argv[])
[windowController autorelease];
NSView *view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 640, 480)];
[view setWantsLayer:YES];
view.wantsLayer = YES;
view.layer = [CAMetalLayer layer];
view.layer.backgroundColor = [[NSColor purpleColor] CGColor];
if (!test_init(static_cast<void*>(view))) {
if (!test_init(static_cast<void*>(view.layer))) {
return 1;
}