Fixed amalgamated build with multiple renderers.

This commit is contained in:
Branimir Karadžić 2015-03-21 22:11:59 -07:00
parent f5afbffe64
commit 6ba3a60c1a
24 changed files with 201 additions and 174 deletions

View file

@ -1332,23 +1332,41 @@ namespace bgfx
typedef RendererContextI* (*RendererCreateFn)(); typedef RendererContextI* (*RendererCreateFn)();
typedef void (*RendererDestroyFn)(); typedef void (*RendererDestroyFn)();
extern RendererContextI* rendererCreateNULL(); namespace noop
extern void rendererDestroyNULL(); {
extern RendererContextI* rendererCreate();
extern void rendererDestroy();
} // namespace noop
extern RendererContextI* rendererCreateGL(); namespace gl
extern void rendererDestroyGL(); {
extern RendererContextI* rendererCreate();
extern void rendererDestroy();
} // namespace gl
extern RendererContextI* rendererCreateD3D9(); namespace d3d9
extern void rendererDestroyD3D9(); {
extern RendererContextI* rendererCreate();
extern void rendererDestroy();
} // namespace d3d9
extern RendererContextI* rendererCreateD3D11(); namespace d3d11
extern void rendererDestroyD3D11(); {
extern RendererContextI* rendererCreate();
extern void rendererDestroy();
} // namespace d3d11
extern RendererContextI* rendererCreateD3D12(); namespace d3d12
extern void rendererDestroyD3D12(); {
extern RendererContextI* rendererCreate();
extern void rendererDestroy();
} // namespace d3d12
extern RendererContextI* rendererCreateVK(); namespace vk
extern void rendererDestroyVK(); {
extern RendererContextI* rendererCreate();
extern void rendererDestroy();
}
struct RendererCreator struct RendererCreator
{ {
@ -1360,13 +1378,13 @@ namespace bgfx
static const RendererCreator s_rendererCreator[] = static const RendererCreator s_rendererCreator[] =
{ {
{ rendererCreateNULL, rendererDestroyNULL, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null
{ rendererCreateD3D9, rendererDestroyD3D9, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9 { d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9
{ rendererCreateD3D11, rendererDestroyD3D11, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11 { d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
{ rendererCreateD3D12, rendererDestroyD3D12, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12 { d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
{ rendererCreateGL, rendererDestroyGL, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES { gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES
{ rendererCreateGL, rendererDestroyGL, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL { gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL
{ rendererCreateVK, rendererDestroyVK, BGFX_RENDERER_VULKAN_NAME, !!BGFX_CONFIG_RENDERER_VULKAN }, // Vulkan { vk::rendererCreate, vk::rendererDestroy, BGFX_RENDERER_VULKAN_NAME, !!BGFX_CONFIG_RENDERER_VULKAN }, // Vulkan
}; };
BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count); BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count);

View file

@ -8,7 +8,7 @@
#if BX_PLATFORM_IOS #if BX_PLATFORM_IOS
namespace bgfx namespace bgfx { namespace gl
{ {
struct SwapChainGL; struct SwapChainGL;
@ -48,7 +48,7 @@ namespace bgfx
GLuint m_colorRbo; GLuint m_colorRbo;
GLuint m_depthStencilRbo; GLuint m_depthStencilRbo;
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_IOS #endif // BX_PLATFORM_IOS

View file

@ -10,7 +10,7 @@
# include <QuartzCore/CAEAGLLayer.h> # include <QuartzCore/CAEAGLLayer.h>
# include "renderer_gl.h" # include "renderer_gl.h"
namespace bgfx namespace bgfx { namespace gl
{ {
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
# include "glimports.h" # include "glimports.h"
@ -123,6 +123,6 @@ namespace bgfx
{ {
} }
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL) #endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -22,7 +22,7 @@
# define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB # define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
#endif // EGL_CONTEXT_MINOR_VERSION_KHR #endif // EGL_CONTEXT_MINOR_VERSION_KHR
namespace bgfx namespace bgfx { namespace gl
{ {
#if BGFX_USE_GL_DYNAMIC_LIB #if BGFX_USE_GL_DYNAMIC_LIB
@ -369,7 +369,7 @@ EGL_IMPORT
# include "glimports.h" # include "glimports.h"
} }
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
# endif // BGFX_USE_EGL # endif // BGFX_USE_EGL
#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) #endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -10,7 +10,7 @@
#include <EGL/egl.h> #include <EGL/egl.h>
namespace bgfx namespace bgfx { namespace gl
{ {
struct SwapChainGL; struct SwapChainGL;
@ -48,7 +48,7 @@ namespace bgfx
EGLDisplay m_display; EGLDisplay m_display;
EGLSurface m_surface; EGLSurface m_surface;
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_EGL #endif // BGFX_USE_EGL

View file

@ -12,7 +12,7 @@
# define GLX_GLXEXT_PROTOTYPES # define GLX_GLXEXT_PROTOTYPES
# include <glx/glxext.h> # include <glx/glxext.h>
namespace bgfx namespace bgfx { namespace gl
{ {
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval); typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval);
@ -292,7 +292,7 @@ namespace bgfx
# include "glimports.h" # include "glimports.h"
} }
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
# endif // BGFX_USE_GLX # endif // BGFX_USE_GLX

View file

@ -11,7 +11,7 @@
# include <X11/Xlib.h> # include <X11/Xlib.h>
# include <GL/glx.h> # include <GL/glx.h>
namespace bgfx namespace bgfx { namespace gl
{ {
struct SwapChainGL; struct SwapChainGL;
@ -45,7 +45,7 @@ namespace bgfx
GLXContext m_context; GLXContext m_context;
XVisualInfo* m_visualInfo; XVisualInfo* m_visualInfo;
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_GLX #endif // BGFX_USE_GLX

View file

@ -8,7 +8,7 @@
#if BX_PLATFORM_OSX #if BX_PLATFORM_OSX
namespace bgfx namespace bgfx { namespace gl
{ {
struct SwapChainGL; struct SwapChainGL;
@ -39,7 +39,7 @@ namespace bgfx
void* m_view; void* m_view;
void* m_context; void* m_context;
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_OSX #endif // BX_PLATFORM_OSX

View file

@ -10,7 +10,7 @@
# include <Cocoa/Cocoa.h> # include <Cocoa/Cocoa.h>
# include <bx/os.h> # include <bx/os.h>
namespace bgfx namespace bgfx { namespace gl
{ {
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
@ -165,6 +165,6 @@ namespace bgfx
# include "glimports.h" # include "glimports.h"
} }
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL) #endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -9,14 +9,14 @@
# include <bgfxplatform.h> # include <bgfxplatform.h>
# include "renderer_gl.h" # include "renderer_gl.h"
namespace bgfx namespace bgfx { namespace gl
{ {
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
# include "glimports.h" # include "glimports.h"
void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/); void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/);
PP_CompletionCallback naclSwapComplete = PP_CompletionCallback naclSwapComplete =
{ {
naclSwapCompleteCb, naclSwapCompleteCb,
NULL, NULL,
@ -62,7 +62,7 @@ namespace bgfx
PostSwapBuffersFn m_postSwapBuffers; PostSwapBuffersFn m_postSwapBuffers;
bool m_forceSwap; bool m_forceSwap;
}; };
static Ppapi s_ppapi; static Ppapi s_ppapi;
void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/) void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/)
@ -192,6 +192,6 @@ namespace bgfx
return s_ppapi.isValid(); return s_ppapi.isValid();
} }
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) #endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -13,7 +13,7 @@
# include <ppapi/c/ppb_instance.h> # include <ppapi/c/ppb_instance.h>
# include <ppapi/c/ppb_graphics_3d.h> # include <ppapi/c/ppb_graphics_3d.h>
namespace bgfx namespace bgfx { namespace gl
{ {
struct SwapChainGL; struct SwapChainGL;
@ -36,7 +36,7 @@ namespace bgfx
void import(); void import();
bool isValid() const; bool isValid() const;
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BX_PLATFORM_NACL #endif // BX_PLATFORM_NACL

View file

@ -10,7 +10,7 @@
# if BGFX_USE_WGL # if BGFX_USE_WGL
namespace bgfx namespace bgfx { namespace gl
{ {
PFNWGLGETPROCADDRESSPROC wglGetProcAddress; PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
PFNWGLMAKECURRENTPROC wglMakeCurrent; PFNWGLMAKECURRENTPROC wglMakeCurrent;
@ -376,7 +376,7 @@ namespace bgfx
# include "glimports.h" # include "glimports.h"
} }
} // namespace bgfx } } // namespace bgfx
# endif // BGFX_USE_WGL # endif // BGFX_USE_WGL
#endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL) #endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -10,7 +10,7 @@
#include <wgl/wglext.h> #include <wgl/wglext.h>
namespace bgfx namespace bgfx { namespace gl
{ {
typedef PROC (APIENTRYP PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc); typedef PROC (APIENTRYP PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc);
typedef BOOL (APIENTRYP PFNWGLMAKECURRENTPROC) (HDC hdc, HGLRC hglrc); typedef BOOL (APIENTRYP PFNWGLMAKECURRENTPROC) (HDC hdc, HGLRC hglrc);
@ -93,7 +93,7 @@ typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum z
HGLRC m_context; HGLRC m_context;
HDC m_hdc; HDC m_hdc;
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_WGL #endif // BGFX_USE_WGL

View file

@ -1235,49 +1235,49 @@ namespace bgfx
#define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U') #define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U')
#define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0') #define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0')
#define D3DFMT_A8R8G8B8 21 #define DDS_A8R8G8B8 21
#define D3DFMT_R5G6B5 23 #define DDS_R5G6B5 23
#define D3DFMT_A1R5G5B5 25 #define DDS_A1R5G5B5 25
#define D3DFMT_A4R4G4B4 26 #define DDS_A4R4G4B4 26
#define D3DFMT_A2B10G10R10 31 #define DDS_A2B10G10R10 31
#define D3DFMT_G16R16 34 #define DDS_G16R16 34
#define D3DFMT_A2R10G10B10 35 #define DDS_A2R10G10B10 35
#define D3DFMT_A16B16G16R16 36 #define DDS_A16B16G16R16 36
#define D3DFMT_A8L8 51 #define DDS_A8L8 51
#define D3DFMT_R16F 111 #define DDS_R16F 111
#define D3DFMT_G16R16F 112 #define DDS_G16R16F 112
#define D3DFMT_A16B16G16R16F 113 #define DDS_A16B16G16R16F 113
#define D3DFMT_R32F 114 #define DDS_R32F 114
#define D3DFMT_G32R32F 115 #define DDS_G32R32F 115
#define D3DFMT_A32B32G32R32F 116 #define DDS_A32B32G32R32F 116
#define DXGI_FORMAT_R32G32B32A32_FLOAT 2 #define DDS_FORMAT_R32G32B32A32_FLOAT 2
#define DXGI_FORMAT_R32G32B32A32_UINT 3 #define DDS_FORMAT_R32G32B32A32_UINT 3
#define DXGI_FORMAT_R16G16B16A16_FLOAT 10 #define DDS_FORMAT_R16G16B16A16_FLOAT 10
#define DXGI_FORMAT_R16G16B16A16_UNORM 11 #define DDS_FORMAT_R16G16B16A16_UNORM 11
#define DXGI_FORMAT_R16G16B16A16_UINT 12 #define DDS_FORMAT_R16G16B16A16_UINT 12
#define DXGI_FORMAT_R32G32_FLOAT 16 #define DDS_FORMAT_R32G32_FLOAT 16
#define DXGI_FORMAT_R32G32_UINT 17 #define DDS_FORMAT_R32G32_UINT 17
#define DXGI_FORMAT_R10G10B10A2_UNORM 24 #define DDS_FORMAT_R10G10B10A2_UNORM 24
#define DXGI_FORMAT_R16G16_FLOAT 34 #define DDS_FORMAT_R16G16_FLOAT 34
#define DXGI_FORMAT_R16G16_UNORM 35 #define DDS_FORMAT_R16G16_UNORM 35
#define DXGI_FORMAT_R32_FLOAT 41 #define DDS_FORMAT_R32_FLOAT 41
#define DXGI_FORMAT_R32_UINT 42 #define DDS_FORMAT_R32_UINT 42
#define DXGI_FORMAT_R8G8_UNORM 49 #define DDS_FORMAT_R8G8_UNORM 49
#define DXGI_FORMAT_R16_FLOAT 54 #define DDS_FORMAT_R16_FLOAT 54
#define DXGI_FORMAT_R16_UNORM 56 #define DDS_FORMAT_R16_UNORM 56
#define DXGI_FORMAT_R8_UNORM 61 #define DDS_FORMAT_R8_UNORM 61
#define DXGI_FORMAT_BC1_UNORM 71 #define DDS_FORMAT_BC1_UNORM 71
#define DXGI_FORMAT_BC2_UNORM 74 #define DDS_FORMAT_BC2_UNORM 74
#define DXGI_FORMAT_BC3_UNORM 77 #define DDS_FORMAT_BC3_UNORM 77
#define DXGI_FORMAT_BC4_UNORM 80 #define DDS_FORMAT_BC4_UNORM 80
#define DXGI_FORMAT_BC5_UNORM 83 #define DDS_FORMAT_BC5_UNORM 83
#define DXGI_FORMAT_B5G6R5_UNORM 85 #define DDS_FORMAT_B5G6R5_UNORM 85
#define DXGI_FORMAT_B5G5R5A1_UNORM 86 #define DDS_FORMAT_B5G5R5A1_UNORM 86
#define DXGI_FORMAT_B8G8R8A8_UNORM 87 #define DDS_FORMAT_B8G8R8A8_UNORM 87
#define DXGI_FORMAT_BC6H_SF16 96 #define DDS_FORMAT_BC6H_SF16 96
#define DXGI_FORMAT_BC7_UNORM 98 #define DDS_FORMAT_BC7_UNORM 98
#define DXGI_FORMAT_B4G4R4A4_UNORM 115 #define DDS_FORMAT_B4G4R4A4_UNORM 115
#define DDSD_CAPS 0x00000001 #define DDSD_CAPS 0x00000001
#define DDSD_HEIGHT 0x00000002 #define DDSD_HEIGHT 0x00000002
@ -1331,57 +1331,57 @@ namespace bgfx
{ DDS_BC4U, TextureFormat::BC4 }, { DDS_BC4U, TextureFormat::BC4 },
{ DDS_ATI2, TextureFormat::BC5 }, { DDS_ATI2, TextureFormat::BC5 },
{ DDS_BC5U, TextureFormat::BC5 }, { DDS_BC5U, TextureFormat::BC5 },
{ D3DFMT_A16B16G16R16, TextureFormat::RGBA16 }, { DDS_A16B16G16R16, TextureFormat::RGBA16 },
{ D3DFMT_A16B16G16R16F, TextureFormat::RGBA16F }, { DDS_A16B16G16R16F, TextureFormat::RGBA16F },
{ DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8 }, { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8 },
{ DDPF_INDEXED, TextureFormat::R8 }, { DDPF_INDEXED, TextureFormat::R8 },
{ DDPF_LUMINANCE, TextureFormat::R8 }, { DDPF_LUMINANCE, TextureFormat::R8 },
{ DDPF_ALPHA, TextureFormat::R8 }, { DDPF_ALPHA, TextureFormat::R8 },
{ D3DFMT_R16F, TextureFormat::R16F }, { DDS_R16F, TextureFormat::R16F },
{ D3DFMT_R32F, TextureFormat::R32F }, { DDS_R32F, TextureFormat::R32F },
{ D3DFMT_A8L8, TextureFormat::RG8 }, { DDS_A8L8, TextureFormat::RG8 },
{ D3DFMT_G16R16, TextureFormat::RG16 }, { DDS_G16R16, TextureFormat::RG16 },
{ D3DFMT_G16R16F, TextureFormat::RG16F }, { DDS_G16R16F, TextureFormat::RG16F },
{ D3DFMT_G32R32F, TextureFormat::RG32F }, { DDS_G32R32F, TextureFormat::RG32F },
{ D3DFMT_A8R8G8B8, TextureFormat::BGRA8 }, { DDS_A8R8G8B8, TextureFormat::BGRA8 },
{ D3DFMT_A16B16G16R16, TextureFormat::RGBA16 }, { DDS_A16B16G16R16, TextureFormat::RGBA16 },
{ D3DFMT_A16B16G16R16F, TextureFormat::RGBA16F }, { DDS_A16B16G16R16F, TextureFormat::RGBA16F },
{ D3DFMT_A32B32G32R32F, TextureFormat::RGBA32F }, { DDS_A32B32G32R32F, TextureFormat::RGBA32F },
{ D3DFMT_R5G6B5, TextureFormat::R5G6B5 }, { DDS_R5G6B5, TextureFormat::R5G6B5 },
{ D3DFMT_A4R4G4B4, TextureFormat::RGBA4 }, { DDS_A4R4G4B4, TextureFormat::RGBA4 },
{ D3DFMT_A1R5G5B5, TextureFormat::RGB5A1 }, { DDS_A1R5G5B5, TextureFormat::RGB5A1 },
{ D3DFMT_A2B10G10R10, TextureFormat::RGB10A2 }, { DDS_A2B10G10R10, TextureFormat::RGB10A2 },
}; };
static TranslateDdsFormat s_translateDxgiFormat[] = static TranslateDdsFormat s_translateDxgiFormat[] =
{ {
{ DXGI_FORMAT_BC1_UNORM, TextureFormat::BC1 }, { DDS_FORMAT_BC1_UNORM, TextureFormat::BC1 },
{ DXGI_FORMAT_BC2_UNORM, TextureFormat::BC2 }, { DDS_FORMAT_BC2_UNORM, TextureFormat::BC2 },
{ DXGI_FORMAT_BC3_UNORM, TextureFormat::BC3 }, { DDS_FORMAT_BC3_UNORM, TextureFormat::BC3 },
{ DXGI_FORMAT_BC4_UNORM, TextureFormat::BC4 }, { DDS_FORMAT_BC4_UNORM, TextureFormat::BC4 },
{ DXGI_FORMAT_BC5_UNORM, TextureFormat::BC5 }, { DDS_FORMAT_BC5_UNORM, TextureFormat::BC5 },
{ DXGI_FORMAT_BC6H_SF16, TextureFormat::BC6H }, { DDS_FORMAT_BC6H_SF16, TextureFormat::BC6H },
{ DXGI_FORMAT_BC7_UNORM, TextureFormat::BC7 }, { DDS_FORMAT_BC7_UNORM, TextureFormat::BC7 },
{ DXGI_FORMAT_R8_UNORM, TextureFormat::R8 }, { DDS_FORMAT_R8_UNORM, TextureFormat::R8 },
{ DXGI_FORMAT_R16_UNORM, TextureFormat::R16 }, { DDS_FORMAT_R16_UNORM, TextureFormat::R16 },
{ DXGI_FORMAT_R16_FLOAT, TextureFormat::R16F }, { DDS_FORMAT_R16_FLOAT, TextureFormat::R16F },
{ DXGI_FORMAT_R32_UINT, TextureFormat::R32 }, { DDS_FORMAT_R32_UINT, TextureFormat::R32 },
{ DXGI_FORMAT_R32_FLOAT, TextureFormat::R32F }, { DDS_FORMAT_R32_FLOAT, TextureFormat::R32F },
{ DXGI_FORMAT_R8G8_UNORM, TextureFormat::RG8 }, { DDS_FORMAT_R8G8_UNORM, TextureFormat::RG8 },
{ DXGI_FORMAT_R16G16_UNORM, TextureFormat::RG16 }, { DDS_FORMAT_R16G16_UNORM, TextureFormat::RG16 },
{ DXGI_FORMAT_R16G16_FLOAT, TextureFormat::RG16F }, { DDS_FORMAT_R16G16_FLOAT, TextureFormat::RG16F },
{ DXGI_FORMAT_R32G32_UINT, TextureFormat::RG32 }, { DDS_FORMAT_R32G32_UINT, TextureFormat::RG32 },
{ DXGI_FORMAT_R32G32_FLOAT, TextureFormat::RG32F }, { DDS_FORMAT_R32G32_FLOAT, TextureFormat::RG32F },
{ DXGI_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 }, { DDS_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 },
{ DXGI_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 }, { DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 },
{ DXGI_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F }, { DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
{ DXGI_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 }, { DDS_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 },
{ DXGI_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F }, { DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
{ DXGI_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 }, { DDS_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 },
{ DXGI_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 }, { DDS_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 },
{ DXGI_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 }, { DDS_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 },
{ DXGI_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 }, { DDS_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 },
}; };
struct TranslateDdsPixelFormat struct TranslateDdsPixelFormat

View file

@ -3,9 +3,14 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause * License: http://www.opensource.org/licenses/BSD-2-Clause
*/ */
#ifndef BGFX_RENDERDOC_H_HEADER_GUARD
#define BGFX_RENDERDOC_H_HEADER_GUARD
namespace bgfx namespace bgfx
{ {
void* loadRenderDoc(); void* loadRenderDoc();
void unloadRenderDoc(void*); void unloadRenderDoc(void*);
} // namespace bgfx } // namespace bgfx
#endif // BGFX_RENDERDOC_H_HEADER_GUARD

View file

@ -8,7 +8,7 @@
#if BGFX_CONFIG_RENDERER_DIRECT3D11 #if BGFX_CONFIG_RENDERER_DIRECT3D11
# include "renderer_d3d11.h" # include "renderer_d3d11.h"
namespace bgfx namespace bgfx { namespace d3d11
{ {
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -2299,14 +2299,14 @@ namespace bgfx
static RendererContextD3D11* s_renderD3D11; static RendererContextD3D11* s_renderD3D11;
RendererContextI* rendererCreateD3D11() RendererContextI* rendererCreate()
{ {
s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11); s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11);
s_renderD3D11->init(); s_renderD3D11->init();
return s_renderD3D11; return s_renderD3D11;
} }
void rendererDestroyD3D11() void rendererDestroy()
{ {
s_renderD3D11->shutdown(); s_renderD3D11->shutdown();
BX_DELETE(g_allocator, s_renderD3D11); BX_DELETE(g_allocator, s_renderD3D11);
@ -3839,20 +3839,20 @@ namespace bgfx
PIX_ENDEVENT(); PIX_ENDEVENT();
} }
} }
} // namespace bgfx } /* namespace d3d11 */ } // namespace bgfx
#else #else
namespace bgfx namespace bgfx { namespace d3d11
{ {
RendererContextI* rendererCreateD3D11() RendererContextI* rendererCreate()
{ {
return NULL; return NULL;
} }
void rendererDestroyD3D11() void rendererDestroy()
{ {
} }
} // namespace bgfx } /* namespace d3d11 */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_DIRECT3D11 #endif // BGFX_CONFIG_RENDERER_DIRECT3D11

View file

@ -70,7 +70,7 @@ BX_PRAGMA_DIAGNOSTIC_POP()
# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX # define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
#endif // D3D11_APPEND_ALIGNED_ELEMENT #endif // D3D11_APPEND_ALIGNED_ELEMENT
namespace bgfx namespace bgfx { namespace d3d11
{ {
struct BufferD3D11 struct BufferD3D11
{ {
@ -280,6 +280,6 @@ namespace bgfx
uint8_t m_num; uint8_t m_num;
}; };
} // namespace bgfx } /* namespace d3d11 */ } // namespace bgfx
#endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD #endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD

View file

@ -9,16 +9,16 @@
# include "../../d3d12/src/renderer_d3d12.cpp" # include "../../d3d12/src/renderer_d3d12.cpp"
#else #else
namespace bgfx namespace bgfx { namespace d3d12
{ {
RendererContextI* rendererCreateD3D12() RendererContextI* rendererCreate()
{ {
return NULL; return NULL;
} }
void rendererDestroyD3D12() void rendererDestroy()
{ {
} }
} // namespace bgfx } /* namespace d3d12 */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_DIRECT3D12 #endif // BGFX_CONFIG_RENDERER_DIRECT3D12

View file

@ -8,7 +8,7 @@
#if BGFX_CONFIG_RENDERER_DIRECT3D9 #if BGFX_CONFIG_RENDERER_DIRECT3D9
# include "renderer_d3d9.h" # include "renderer_d3d9.h"
namespace bgfx namespace bgfx { namespace d3d9
{ {
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -1731,14 +1731,14 @@ namespace bgfx
static RendererContextD3D9* s_renderD3D9; static RendererContextD3D9* s_renderD3D9;
RendererContextI* rendererCreateD3D9() RendererContextI* rendererCreate()
{ {
s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9); s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9);
s_renderD3D9->init(); s_renderD3D9->init();
return s_renderD3D9; return s_renderD3D9;
} }
void rendererDestroyD3D9() void rendererDestroy()
{ {
s_renderD3D9->shutdown(); s_renderD3D9->shutdown();
BX_DELETE(g_allocator, s_renderD3D9); BX_DELETE(g_allocator, s_renderD3D9);
@ -3460,20 +3460,20 @@ namespace bgfx
device->EndScene(); device->EndScene();
} }
} // namespace bgfx } /* namespace d3d9 */ } // namespace bgfx
#else #else
namespace bgfx namespace bgfx { namespace d3d9
{ {
RendererContextI* rendererCreateD3D9() RendererContextI* rendererCreate()
{ {
return NULL; return NULL;
} }
void rendererDestroyD3D9() void rendererDestroy()
{ {
} }
} // namespace bgfx } /* namespace d3d9 */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_DIRECT3D9 #endif // BGFX_CONFIG_RENDERER_DIRECT3D9

View file

@ -41,7 +41,7 @@
#include "renderer.h" #include "renderer.h"
#include "renderer_d3d.h" #include "renderer_d3d.h"
namespace bgfx namespace bgfx { namespace d3d9
{ {
# if defined(D3D_DISABLE_9EX) # if defined(D3D_DISABLE_9EX)
# define D3DFMT_S8_LOCKABLE D3DFORMAT( 85) # define D3DFMT_S8_LOCKABLE D3DFORMAT( 85)
@ -386,6 +386,6 @@ namespace bgfx
bool m_needResolve; bool m_needResolve;
}; };
} // namespace bgfx } /* namespace d3d9 */ } // namespace bgfx
#endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD #endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD

View file

@ -10,7 +10,7 @@
# include <bx/timer.h> # include <bx/timer.h>
# include <bx/uint32_t.h> # include <bx/uint32_t.h>
namespace bgfx namespace bgfx { namespace gl
{ {
static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@ -2579,14 +2579,14 @@ namespace bgfx
RendererContextGL* s_renderGL; RendererContextGL* s_renderGL;
RendererContextI* rendererCreateGL() RendererContextI* rendererCreate()
{ {
s_renderGL = BX_NEW(g_allocator, RendererContextGL); s_renderGL = BX_NEW(g_allocator, RendererContextGL);
s_renderGL->init(); s_renderGL->init();
return s_renderGL; return s_renderGL;
} }
void rendererDestroyGL() void rendererDestroy()
{ {
s_renderGL->shutdown(); s_renderGL->shutdown();
BX_DELETE(g_allocator, s_renderGL); BX_DELETE(g_allocator, s_renderGL);
@ -5354,21 +5354,21 @@ namespace bgfx
GL_CHECK(glFrameTerminatorGREMEDY() ); GL_CHECK(glFrameTerminatorGREMEDY() );
} }
} // namespace bgfx } } // namespace bgfx
#else #else
namespace bgfx namespace bgfx { namespace gl
{ {
RendererContextI* rendererCreateGL() RendererContextI* rendererCreate()
{ {
return NULL; return NULL;
} }
void rendererDestroyGL() void rendererDestroy()
{ {
} }
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) #endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View file

@ -611,6 +611,10 @@ typedef uint64_t GLuint64;
namespace bgfx namespace bgfx
{ {
class ConstantBuffer; class ConstantBuffer;
} // namespace bgfx
namespace bgfx { namespace gl
{
void dumpExtensions(const char* _extensions); void dumpExtensions(const char* _extensions);
const char* glEnumName(GLenum _enum); const char* glEnumName(GLenum _enum);
@ -1001,6 +1005,6 @@ namespace bgfx
GLuint m_queries[64]; GLuint m_queries[64];
}; };
} // namespace bgfx } /* namespace gl */ } // namespace bgfx
#endif // BGFX_RENDERER_GL_H_HEADER_GUARD #endif // BGFX_RENDERER_GL_H_HEADER_GUARD

View file

@ -7,7 +7,7 @@
#if BGFX_CONFIG_RENDERER_NULL #if BGFX_CONFIG_RENDERER_NULL
namespace bgfx namespace bgfx { namespace noop
{ {
struct RendererContextNULL : public RendererContextI struct RendererContextNULL : public RendererContextI
{ {
@ -168,31 +168,31 @@ namespace bgfx
static RendererContextNULL* s_renderNULL; static RendererContextNULL* s_renderNULL;
RendererContextI* rendererCreateNULL() RendererContextI* rendererCreate()
{ {
s_renderNULL = BX_NEW(g_allocator, RendererContextNULL); s_renderNULL = BX_NEW(g_allocator, RendererContextNULL);
return s_renderNULL; return s_renderNULL;
} }
void rendererDestroyNULL() void rendererDestroy()
{ {
BX_DELETE(g_allocator, s_renderNULL); BX_DELETE(g_allocator, s_renderNULL);
s_renderNULL = NULL; s_renderNULL = NULL;
} }
} // namespace bgfx } /* namespace noop */ } // namespace bgfx
#else #else
namespace bgfx namespace bgfx { namespace noop
{ {
RendererContextI* rendererCreateNULL() RendererContextI* rendererCreate()
{ {
return NULL; return NULL;
} }
void rendererDestroyNULL() void rendererDestroy()
{ {
} }
} // namespace bgfx } /* namespace noop */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_NULL #endif // BGFX_CONFIG_RENDERER_NULL

View file

@ -8,16 +8,16 @@
# include "../../vk/src/renderer_vk.cpp" # include "../../vk/src/renderer_vk.cpp"
#else #else
namespace bgfx namespace bgfx { namespace vk
{ {
RendererContextI* rendererCreateVK() RendererContextI* rendererCreate()
{ {
return NULL; return NULL;
} }
void rendererDestroyVK() void rendererDestroy()
{ {
} }
} // namespace bgfx } /* namespace vk */ } // namespace bgfx
#endif // BGFX_CONFIG_RENDERER_VULKAN #endif // BGFX_CONFIG_RENDERER_VULKAN