Start working towards Metal
This commit is contained in:
parent
f51a74a861
commit
665cc74bd1
@ -219,16 +219,22 @@ if (NOT BB_IS_CI)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
execute_process(
|
find_library(METAL_LIBRARY Metal)
|
||||||
COMMAND brew --prefix vulkan-headers
|
target_link_libraries(${COMPILER_NAME} PRIVATE ${METAL_LIBRARY})
|
||||||
OUTPUT_VARIABLE VULKAN_HEADERS_PREFIX
|
else()
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
if (APPLE)
|
||||||
)
|
execute_process(
|
||||||
include_directories("${VULKAN_HEADERS_PREFIX}/include")
|
COMMAND brew --prefix vulkan-headers
|
||||||
|
OUTPUT_VARIABLE VULKAN_HEADERS_PREFIX
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
include_directories("${VULKAN_HEADERS_PREFIX}/include")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(dependencies/volk-1.3.301 volk)
|
||||||
|
target_link_libraries(${COMPILER_NAME} PRIVATE volk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(dependencies/volk-1.3.301 volk)
|
|
||||||
target_link_libraries(${COMPILER_NAME} PRIVATE volk)
|
|
||||||
target_sources(${COMPILER_NAME} PRIVATE
|
target_sources(${COMPILER_NAME} PRIVATE
|
||||||
"bootstrap/std/image_loader.c"
|
"bootstrap/std/image_loader.c"
|
||||||
"bootstrap/std/shader_compilation.c"
|
"bootstrap/std/shader_compilation.c"
|
||||||
|
@ -4,6 +4,95 @@
|
|||||||
#include <std/image_loader.h>
|
#include <std/image_loader.h>
|
||||||
#include <std/virtual_buffer.h>
|
#include <std/virtual_buffer.h>
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
|
||||||
|
#include <objc/message.h>
|
||||||
|
|
||||||
|
STRUCT(Renderer)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
fn void send_message(void* this_pointer)
|
||||||
|
{
|
||||||
|
objc_msgSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct MTLDevice MTLDevice;
|
||||||
|
typedef struct MTLCommandQueue MTLCommandQueue;
|
||||||
|
typedef struct CAMetalLayer CAMetalLayer;
|
||||||
|
extern MTLDevice* MTLCreateSystemDefaultDevice();
|
||||||
|
|
||||||
|
fn MTLCommandQueue* metal_device_new_command_queue(MTLDevice* device)
|
||||||
|
{
|
||||||
|
typedef MTLCommandQueue* MetalDeviceNewCommandQueue(MTLDevice* device, SEL sel);
|
||||||
|
auto* function = (MetalDeviceNewCommandQueue*)&objc_msgSend;
|
||||||
|
return function(device, sel_registerName("newCommandQueue"));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn CAMetalLayer* metal_layer()
|
||||||
|
{
|
||||||
|
typedef CAMetalLayer* CAMetalLayerLayer(Class class, SEL sel);
|
||||||
|
auto class = objc_lookUpClass("CAMetalLayer");
|
||||||
|
auto sel = sel_registerName("layer");
|
||||||
|
|
||||||
|
auto* function = (CAMetalLayerLayer*)&objc_msgSend;
|
||||||
|
return function(class, sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
Renderer* renderer_initialize(Arena* arena)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
U32Vec2 renderer_font_compute_string_rect(Renderer* renderer, RenderFontType type, String string)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderer_queue_font_update(Renderer* renderer, RenderWindow* window, RenderFontType type, TextureAtlas atlas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureIndex renderer_texture_create(Renderer* renderer, TextureMemory texture_memory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderer_window_frame_begin(Renderer* renderer, RenderWindow* window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderer_window_frame_end(Renderer* renderer, RenderWindow* window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderWindow* renderer_window_initialize(Renderer* renderer, OSWindow window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_queue_rect_texture_update(RenderWindow* window, RectTextureSlot slot, TextureIndex texture_index)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_texture_update_begin(RenderWindow* window, BBPipeline pipeline_index, u32 descriptor_count)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_rect_texture_update_begin(RenderWindow* window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_rect_texture_update_end(Renderer* renderer, RenderWindow* window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_render_rect(RenderWindow* window, RectDraw draw)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_render_text(Renderer* renderer, RenderWindow* window, String string, Color color, RenderFontType font_type, u32 x_offset, u32 y_offset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
|
||||||
#define MAX_SWAPCHAIN_IMAGE_COUNT (16)
|
#define MAX_SWAPCHAIN_IMAGE_COUNT (16)
|
||||||
@ -2360,3 +2449,6 @@ U32Vec2 renderer_font_compute_string_rect(Renderer* renderer, RenderFontType typ
|
|||||||
auto result = texture_atlas_compute_string_rect(string, texture_atlas);
|
auto result = texture_atlas_compute_string_rect(string, texture_atlas);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include <std/window.h>
|
#include <std/window.h>
|
||||||
|
|
||||||
|
#ifndef __APPLE__
|
||||||
#include <volk.h>
|
#include <volk.h>
|
||||||
|
#endif
|
||||||
#define GLFW_INCLUDE_NONE
|
#define GLFW_INCLUDE_NONE
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <GLFW/glfw3native.h>
|
#include <GLFW/glfw3native.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user