mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Added Metal renderer backend stub.
This commit is contained in:
parent
9cae56fb96
commit
52cfaf0aaa
9 changed files with 41 additions and 3 deletions
|
@ -20,6 +20,7 @@ typedef enum bgfx_renderer_type
|
|||
BGFX_RENDERER_TYPE_DIRECT3D9,
|
||||
BGFX_RENDERER_TYPE_DIRECT3D11,
|
||||
BGFX_RENDERER_TYPE_DIRECT3D12,
|
||||
BGFX_RENDERER_TYPE_METAL,
|
||||
BGFX_RENDERER_TYPE_OPENGLES,
|
||||
BGFX_RENDERER_TYPE_OPENGL,
|
||||
BGFX_RENDERER_TYPE_VULKAN,
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace bgfx
|
|||
Direct3D9, //!< Direct3D 9.0
|
||||
Direct3D11, //!< Direct3D 11.0
|
||||
Direct3D12, //!< Direct3D 12.0
|
||||
Metal, //!< Metal
|
||||
OpenGLES, //!< OpenGL ES 2.0+
|
||||
OpenGL, //!< OpenGL 2.1+
|
||||
Vulkan, //!< Vulkan
|
||||
|
|
|
@ -1338,6 +1338,7 @@ namespace bgfx
|
|||
BGFX_RENDERER_CONTEXT(d3d9);
|
||||
BGFX_RENDERER_CONTEXT(d3d11);
|
||||
BGFX_RENDERER_CONTEXT(d3d12);
|
||||
BGFX_RENDERER_CONTEXT(mtl);
|
||||
BGFX_RENDERER_CONTEXT(gl);
|
||||
BGFX_RENDERER_CONTEXT(vk);
|
||||
|
||||
|
@ -1353,10 +1354,11 @@ namespace bgfx
|
|||
|
||||
static const RendererCreator s_rendererCreator[] =
|
||||
{
|
||||
{ noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null
|
||||
{ noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Noop
|
||||
{ d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9
|
||||
{ d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
|
||||
{ d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
|
||||
{ mtl::rendererCreate, mtl::rendererDestroy, BGFX_RENDERER_METAL_NAME, !!BGFX_CONFIG_RENDERER_METAL }, // Metal
|
||||
{ gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES
|
||||
{ gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL
|
||||
{ vk::rendererCreate, vk::rendererDestroy, BGFX_RENDERER_VULKAN_NAME, !!BGFX_CONFIG_RENDERER_VULKAN }, // Vulkan
|
||||
|
|
|
@ -174,6 +174,7 @@ namespace stl
|
|||
#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9"
|
||||
#define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11"
|
||||
#define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12"
|
||||
#define BGFX_RENDERER_METAL_NAME "Metal"
|
||||
#define BGFX_RENDERER_VULKAN_NAME "Vulkan"
|
||||
#define BGFX_RENDERER_NULL_NAME "NULL"
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#if !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \
|
||||
&& !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \
|
||||
&& !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \
|
||||
&& !defined(BGFX_CONFIG_RENDERER_METAL) \
|
||||
&& !defined(BGFX_CONFIG_RENDERER_OPENGL) \
|
||||
&& !defined(BGFX_CONFIG_RENDERER_OPENGLES) \
|
||||
&& !defined(BGFX_CONFIG_RENDERER_VULKAN) \
|
||||
|
@ -40,6 +41,10 @@
|
|||
? 1 : 0)
|
||||
# endif // BGFX_CONFIG_RENDERER_DIRECT3D12
|
||||
|
||||
# ifndef BGFX_CONFIG_RENDERER_METAL
|
||||
# define BGFX_CONFIG_RENDERER_METAL 0
|
||||
# endif // BGFX_CONFIG_RENDERER_METAL
|
||||
|
||||
# ifndef BGFX_CONFIG_RENDERER_OPENGL
|
||||
# define BGFX_CONFIG_RENDERER_OPENGL (0 \
|
||||
|| BX_PLATFORM_FREEBSD \
|
||||
|
@ -86,6 +91,10 @@
|
|||
# define BGFX_CONFIG_RENDERER_DIRECT3D12 0
|
||||
# endif // BGFX_CONFIG_RENDERER_DIRECT3D12
|
||||
|
||||
# ifndef BGFX_CONFIG_RENDERER_METAL
|
||||
# define BGFX_CONFIG_RENDERER_METAL 0
|
||||
# endif // BGFX_CONFIG_RENDERER_METAL
|
||||
|
||||
# ifndef BGFX_CONFIG_RENDERER_OPENGL
|
||||
# define BGFX_CONFIG_RENDERER_OPENGL 0
|
||||
# endif // BGFX_CONFIG_RENDERER_OPENGL
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "bgfx_p.h"
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_DIRECT3D12
|
||||
# include "../../d3d12/src/renderer_d3d12.cpp"
|
||||
# include "../../bgfx-ext/src/renderer_d3d12.cpp"
|
||||
#else
|
||||
|
||||
namespace bgfx { namespace d3d12
|
||||
|
|
23
src/renderer_mtl.cpp
Normal file
23
src/renderer_mtl.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright 2011-2015 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "bgfx_p.h"
|
||||
#if BGFX_CONFIG_RENDERER_METAL
|
||||
# include "../../bgfx-ext/src/renderer_mtl.cpp"
|
||||
#else
|
||||
|
||||
namespace bgfx { namespace mtl
|
||||
{
|
||||
RendererContextI* rendererCreate()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void rendererDestroy()
|
||||
{
|
||||
}
|
||||
} /* namespace mtl */ } // namespace bgfx
|
||||
|
||||
#endif // BGFX_CONFIG_RENDERER_METAL
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "bgfx_p.h"
|
||||
#if BGFX_CONFIG_RENDERER_VULKAN
|
||||
# include "../../vk/src/renderer_vk.cpp"
|
||||
# include "../../bgfx-ext/src/renderer_vk.cpp"
|
||||
#else
|
||||
|
||||
namespace bgfx { namespace vk
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace bgfx
|
|||
&s_attribTypeSizeDx9, // Direct3D9
|
||||
&s_attribTypeSizeDx1x, // Direct3D11
|
||||
&s_attribTypeSizeDx1x, // Direct3D12
|
||||
&s_attribTypeSizeGl, // Metal
|
||||
&s_attribTypeSizeGl, // OpenGLES
|
||||
&s_attribTypeSizeGl, // OpenGL
|
||||
&s_attribTypeSizeGl, // Vulkan
|
||||
|
|
Loading…
Reference in a new issue