Metal: enable for betsy and lightmapper modules

To support this, the rendering_context_driver_metal.h header was updated
to recognise when it is included in non-Objective-C source files.
This commit is contained in:
Stuart Carnie
2024-08-31 07:22:24 +10:00
parent a5830f6eb9
commit a7a245de92
5 changed files with 175 additions and 107 deletions

View File

@@ -36,6 +36,9 @@
#if defined(VULKAN_ENABLED)
#include "drivers/vulkan/rendering_context_driver_vulkan.h"
#endif
#if defined(METAL_ENABLED)
#include "drivers/metal/rendering_context_driver_metal.h"
#endif
#include "bc6h.glsl.gen.h"
@@ -66,10 +69,16 @@ Error _compress_betsy(BetsyFormat p_format, Image *r_img) {
if (rd == nullptr) {
#if defined(RD_ENABLED)
#if defined(VULKAN_ENABLED)
rcd = memnew(RenderingContextDriverVulkan);
#if defined(METAL_ENABLED)
rcd = memnew(RenderingContextDriverMetal);
rd = memnew(RenderingDevice);
#endif
#if defined(VULKAN_ENABLED)
if (rcd == nullptr) {
rcd = memnew(RenderingContextDriverVulkan);
rd = memnew(RenderingDevice);
}
#endif
#endif
if (rcd != nullptr && rd != nullptr) {
err = rcd->initialize();