Added Vulkan stub.

This commit is contained in:
Branimir Karadžić 2015-03-05 20:34:39 -08:00
parent a819a3f73e
commit 2ce33465d5
7 changed files with 43 additions and 3 deletions

View File

@ -19,8 +19,10 @@ typedef enum bgfx_renderer_type
BGFX_RENDERER_TYPE_NULL,
BGFX_RENDERER_TYPE_DIRECT3D9,
BGFX_RENDERER_TYPE_DIRECT3D11,
BGFX_RENDERER_TYPE_OPENGLES = 4,
BGFX_RENDERER_TYPE_DIRECT3D12,
BGFX_RENDERER_TYPE_OPENGLES,
BGFX_RENDERER_TYPE_OPENGL,
BGFX_RENDERER_TYPE_VULKAN,
BGFX_RENDERER_TYPE_COUNT

View File

@ -49,6 +49,7 @@ namespace bgfx
Direct3D12, //!< Direct3D 12.0
OpenGLES, //!< OpenGL ES 2.0+
OpenGL, //!< OpenGL 2.1+
Vulkan, //!< Vulkan
Count
};

View File

@ -1347,6 +1347,9 @@ namespace bgfx
extern RendererContextI* rendererCreateD3D12();
extern void rendererDestroyD3D12();
extern RendererContextI* rendererCreateVK();
extern void rendererDestroyVK();
struct RendererCreator
{
RendererCreateFn createFn;
@ -1363,6 +1366,7 @@ namespace bgfx
{ rendererCreateD3D12, rendererDestroyD3D12, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
{ rendererCreateGL, rendererDestroyGL, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES
{ rendererCreateGL, rendererDestroyGL, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL
{ rendererCreateVK, rendererDestroyVK, BGFX_RENDERER_VULKAN_NAME, !!BGFX_CONFIG_RENDERER_VULKAN }, // Vulkan
};
BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count);

View File

@ -154,6 +154,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_VULKAN_NAME "Vulkan"
#define BGFX_RENDERER_NULL_NAME "NULL"
#if BGFX_CONFIG_RENDERER_OPENGL

View File

@ -17,6 +17,7 @@
&& !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \
&& !defined(BGFX_CONFIG_RENDERER_OPENGL) \
&& !defined(BGFX_CONFIG_RENDERER_OPENGLES) \
&& !defined(BGFX_CONFIG_RENDERER_VULKAN) \
&& !defined(BGFX_CONFIG_RENDERER_NULL)
# ifndef BGFX_CONFIG_RENDERER_DIRECT3D9
@ -59,6 +60,10 @@
? 1 : 0)
# endif // BGFX_CONFIG_RENDERER_OPENGLES
# ifndef BGFX_CONFIG_RENDERER_VULKAN
# define BGFX_CONFIG_RENDERER_VULKAN 0
# endif // BGFX_CONFIG_RENDERER_VULKAN
# ifndef BGFX_CONFIG_RENDERER_NULL
# define BGFX_CONFIG_RENDERER_NULL (!(0 \
|| BGFX_CONFIG_RENDERER_DIRECT3D9 \
@ -89,6 +94,10 @@
# define BGFX_CONFIG_RENDERER_OPENGLES 0
# endif // BGFX_CONFIG_RENDERER_OPENGLES
# ifndef BGFX_CONFIG_RENDERER_VULKAN
# define BGFX_CONFIG_RENDERER_VULKAN 0
# endif // BGFX_CONFIG_RENDERER_VULKAN
# ifndef BGFX_CONFIG_RENDERER_NULL
# define BGFX_CONFIG_RENDERER_NULL 0
# endif // BGFX_CONFIG_RENDERER_NULL

22
src/renderer_vk.cpp Normal file
View File

@ -0,0 +1,22 @@
/*
* 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_VULKAN
# include "../../vk/src/renderer_vk.cpp"
#else
namespace bgfx
{
RendererContextI* rendererCreateVK()
{
return NULL;
}
void rendererDestroyVK()
{
}
} // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_VULKAN

View File

@ -45,7 +45,7 @@ namespace bgfx
&s_attribTypeSizeDx9,
#elif BGFX_CONFIG_RENDERER_DIRECT3D11 || BGFX_CONFIG_RENDERER_DIRECT3D12
&s_attribTypeSizeDx1x,
#elif BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES
#elif BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_VULKAN
&s_attribTypeSizeGl,
#else
&s_attribTypeSizeDx9,
@ -55,6 +55,7 @@ namespace bgfx
&s_attribTypeSizeDx1x, // Direct3D12
&s_attribTypeSizeGl, // OpenGLES
&s_attribTypeSizeGl, // OpenGL
&s_attribTypeSizeGl, // Vulkan
};
BX_STATIC_ASSERT(BX_COUNTOF(s_attribTypeSize) == bgfx::RendererType::Count);
@ -140,7 +141,7 @@ namespace bgfx
_asInt = !!(val&(1<<7) );
}
static const char* s_attrName[] =
static const char* s_attrName[] =
{
"Attrib::Position",
"Attrib::Normal",