diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 7ac7060e..e59c46f2 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1332,23 +1332,41 @@ namespace bgfx typedef RendererContextI* (*RendererCreateFn)(); typedef void (*RendererDestroyFn)(); - extern RendererContextI* rendererCreateNULL(); - extern void rendererDestroyNULL(); + namespace noop + { + extern RendererContextI* rendererCreate(); + extern void rendererDestroy(); + } // namespace noop - extern RendererContextI* rendererCreateGL(); - extern void rendererDestroyGL(); + namespace gl + { + extern RendererContextI* rendererCreate(); + extern void rendererDestroy(); + } // namespace gl - extern RendererContextI* rendererCreateD3D9(); - extern void rendererDestroyD3D9(); + namespace d3d9 + { + extern RendererContextI* rendererCreate(); + extern void rendererDestroy(); + } // namespace d3d9 - extern RendererContextI* rendererCreateD3D11(); - extern void rendererDestroyD3D11(); + namespace d3d11 + { + extern RendererContextI* rendererCreate(); + extern void rendererDestroy(); + } // namespace d3d11 - extern RendererContextI* rendererCreateD3D12(); - extern void rendererDestroyD3D12(); + namespace d3d12 + { + extern RendererContextI* rendererCreate(); + extern void rendererDestroy(); + } // namespace d3d12 - extern RendererContextI* rendererCreateVK(); - extern void rendererDestroyVK(); + namespace vk + { + extern RendererContextI* rendererCreate(); + extern void rendererDestroy(); + } struct RendererCreator { @@ -1360,13 +1378,13 @@ namespace bgfx static const RendererCreator s_rendererCreator[] = { - { rendererCreateNULL, rendererDestroyNULL, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null - { rendererCreateD3D9, rendererDestroyD3D9, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9 - { rendererCreateD3D11, rendererDestroyD3D11, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11 - { 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 + { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Null + { 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 + { 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 }; BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count); diff --git a/src/glcontext_eagl.h b/src/glcontext_eagl.h index 9c6775d8..5c26a71f 100644 --- a/src/glcontext_eagl.h +++ b/src/glcontext_eagl.h @@ -8,7 +8,7 @@ #if BX_PLATFORM_IOS -namespace bgfx +namespace bgfx { namespace gl { struct SwapChainGL; @@ -48,7 +48,7 @@ namespace bgfx GLuint m_colorRbo; GLuint m_depthStencilRbo; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BX_PLATFORM_IOS diff --git a/src/glcontext_eagl.mm b/src/glcontext_eagl.mm index 4a10d43f..4348eb65 100644 --- a/src/glcontext_eagl.mm +++ b/src/glcontext_eagl.mm @@ -10,7 +10,7 @@ # include # include "renderer_gl.h" -namespace bgfx +namespace bgfx { namespace gl { # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL # 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) diff --git a/src/glcontext_egl.cpp b/src/glcontext_egl.cpp index 1a70e37b..a3fe4e77 100644 --- a/src/glcontext_egl.cpp +++ b/src/glcontext_egl.cpp @@ -22,7 +22,7 @@ # define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB #endif // EGL_CONTEXT_MINOR_VERSION_KHR -namespace bgfx +namespace bgfx { namespace gl { #if BGFX_USE_GL_DYNAMIC_LIB @@ -369,7 +369,7 @@ EGL_IMPORT # include "glimports.h" } -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx # endif // BGFX_USE_EGL #endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) diff --git a/src/glcontext_egl.h b/src/glcontext_egl.h index 98fd63f7..122591ca 100644 --- a/src/glcontext_egl.h +++ b/src/glcontext_egl.h @@ -10,7 +10,7 @@ #include -namespace bgfx +namespace bgfx { namespace gl { struct SwapChainGL; @@ -48,7 +48,7 @@ namespace bgfx EGLDisplay m_display; EGLSurface m_surface; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BGFX_USE_EGL diff --git a/src/glcontext_glx.cpp b/src/glcontext_glx.cpp index af40d2d9..7d24497b 100644 --- a/src/glcontext_glx.cpp +++ b/src/glcontext_glx.cpp @@ -12,7 +12,7 @@ # define GLX_GLXEXT_PROTOTYPES # include -namespace bgfx +namespace bgfx { namespace gl { typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval); @@ -292,7 +292,7 @@ namespace bgfx # include "glimports.h" } -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx # endif // BGFX_USE_GLX diff --git a/src/glcontext_glx.h b/src/glcontext_glx.h index 3fa7dbf2..cff6faa1 100644 --- a/src/glcontext_glx.h +++ b/src/glcontext_glx.h @@ -11,7 +11,7 @@ # include # include -namespace bgfx +namespace bgfx { namespace gl { struct SwapChainGL; @@ -45,7 +45,7 @@ namespace bgfx GLXContext m_context; XVisualInfo* m_visualInfo; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BGFX_USE_GLX diff --git a/src/glcontext_nsgl.h b/src/glcontext_nsgl.h index cde844df..c88673d8 100644 --- a/src/glcontext_nsgl.h +++ b/src/glcontext_nsgl.h @@ -8,7 +8,7 @@ #if BX_PLATFORM_OSX -namespace bgfx +namespace bgfx { namespace gl { struct SwapChainGL; @@ -39,7 +39,7 @@ namespace bgfx void* m_view; void* m_context; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BX_PLATFORM_OSX diff --git a/src/glcontext_nsgl.mm b/src/glcontext_nsgl.mm index 70630a08..688232b8 100644 --- a/src/glcontext_nsgl.mm +++ b/src/glcontext_nsgl.mm @@ -10,7 +10,7 @@ # include # include -namespace bgfx +namespace bgfx { namespace gl { # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func @@ -165,6 +165,6 @@ namespace bgfx # 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) diff --git a/src/glcontext_ppapi.cpp b/src/glcontext_ppapi.cpp index f22228e0..76581b1d 100644 --- a/src/glcontext_ppapi.cpp +++ b/src/glcontext_ppapi.cpp @@ -9,14 +9,14 @@ # include # include "renderer_gl.h" -namespace bgfx +namespace bgfx { namespace gl { # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func # include "glimports.h" void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/); - PP_CompletionCallback naclSwapComplete = + PP_CompletionCallback naclSwapComplete = { naclSwapCompleteCb, NULL, @@ -62,7 +62,7 @@ namespace bgfx PostSwapBuffersFn m_postSwapBuffers; bool m_forceSwap; }; - + static Ppapi s_ppapi; void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/) @@ -192,6 +192,6 @@ namespace bgfx return s_ppapi.isValid(); } -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) diff --git a/src/glcontext_ppapi.h b/src/glcontext_ppapi.h index e3acc876..3142b6ac 100644 --- a/src/glcontext_ppapi.h +++ b/src/glcontext_ppapi.h @@ -13,7 +13,7 @@ # include # include -namespace bgfx +namespace bgfx { namespace gl { struct SwapChainGL; @@ -36,7 +36,7 @@ namespace bgfx void import(); bool isValid() const; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BX_PLATFORM_NACL diff --git a/src/glcontext_wgl.cpp b/src/glcontext_wgl.cpp index 56aad127..84c32a06 100644 --- a/src/glcontext_wgl.cpp +++ b/src/glcontext_wgl.cpp @@ -10,7 +10,7 @@ # if BGFX_USE_WGL -namespace bgfx +namespace bgfx { namespace gl { PFNWGLGETPROCADDRESSPROC wglGetProcAddress; PFNWGLMAKECURRENTPROC wglMakeCurrent; @@ -376,7 +376,7 @@ namespace bgfx # include "glimports.h" } -} // namespace bgfx +} } // namespace bgfx # endif // BGFX_USE_WGL #endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL) diff --git a/src/glcontext_wgl.h b/src/glcontext_wgl.h index 4d0f64fb..98338f09 100644 --- a/src/glcontext_wgl.h +++ b/src/glcontext_wgl.h @@ -10,7 +10,7 @@ #include -namespace bgfx +namespace bgfx { namespace gl { typedef PROC (APIENTRYP PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc); 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; HDC m_hdc; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BGFX_USE_WGL diff --git a/src/image.cpp b/src/image.cpp index c18d4e93..b420b2da 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1235,49 +1235,49 @@ namespace bgfx #define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U') #define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0') -#define D3DFMT_A8R8G8B8 21 -#define D3DFMT_R5G6B5 23 -#define D3DFMT_A1R5G5B5 25 -#define D3DFMT_A4R4G4B4 26 -#define D3DFMT_A2B10G10R10 31 -#define D3DFMT_G16R16 34 -#define D3DFMT_A2R10G10B10 35 -#define D3DFMT_A16B16G16R16 36 -#define D3DFMT_A8L8 51 -#define D3DFMT_R16F 111 -#define D3DFMT_G16R16F 112 -#define D3DFMT_A16B16G16R16F 113 -#define D3DFMT_R32F 114 -#define D3DFMT_G32R32F 115 -#define D3DFMT_A32B32G32R32F 116 +#define DDS_A8R8G8B8 21 +#define DDS_R5G6B5 23 +#define DDS_A1R5G5B5 25 +#define DDS_A4R4G4B4 26 +#define DDS_A2B10G10R10 31 +#define DDS_G16R16 34 +#define DDS_A2R10G10B10 35 +#define DDS_A16B16G16R16 36 +#define DDS_A8L8 51 +#define DDS_R16F 111 +#define DDS_G16R16F 112 +#define DDS_A16B16G16R16F 113 +#define DDS_R32F 114 +#define DDS_G32R32F 115 +#define DDS_A32B32G32R32F 116 -#define DXGI_FORMAT_R32G32B32A32_FLOAT 2 -#define DXGI_FORMAT_R32G32B32A32_UINT 3 -#define DXGI_FORMAT_R16G16B16A16_FLOAT 10 -#define DXGI_FORMAT_R16G16B16A16_UNORM 11 -#define DXGI_FORMAT_R16G16B16A16_UINT 12 -#define DXGI_FORMAT_R32G32_FLOAT 16 -#define DXGI_FORMAT_R32G32_UINT 17 -#define DXGI_FORMAT_R10G10B10A2_UNORM 24 -#define DXGI_FORMAT_R16G16_FLOAT 34 -#define DXGI_FORMAT_R16G16_UNORM 35 -#define DXGI_FORMAT_R32_FLOAT 41 -#define DXGI_FORMAT_R32_UINT 42 -#define DXGI_FORMAT_R8G8_UNORM 49 -#define DXGI_FORMAT_R16_FLOAT 54 -#define DXGI_FORMAT_R16_UNORM 56 -#define DXGI_FORMAT_R8_UNORM 61 -#define DXGI_FORMAT_BC1_UNORM 71 -#define DXGI_FORMAT_BC2_UNORM 74 -#define DXGI_FORMAT_BC3_UNORM 77 -#define DXGI_FORMAT_BC4_UNORM 80 -#define DXGI_FORMAT_BC5_UNORM 83 -#define DXGI_FORMAT_B5G6R5_UNORM 85 -#define DXGI_FORMAT_B5G5R5A1_UNORM 86 -#define DXGI_FORMAT_B8G8R8A8_UNORM 87 -#define DXGI_FORMAT_BC6H_SF16 96 -#define DXGI_FORMAT_BC7_UNORM 98 -#define DXGI_FORMAT_B4G4R4A4_UNORM 115 +#define DDS_FORMAT_R32G32B32A32_FLOAT 2 +#define DDS_FORMAT_R32G32B32A32_UINT 3 +#define DDS_FORMAT_R16G16B16A16_FLOAT 10 +#define DDS_FORMAT_R16G16B16A16_UNORM 11 +#define DDS_FORMAT_R16G16B16A16_UINT 12 +#define DDS_FORMAT_R32G32_FLOAT 16 +#define DDS_FORMAT_R32G32_UINT 17 +#define DDS_FORMAT_R10G10B10A2_UNORM 24 +#define DDS_FORMAT_R16G16_FLOAT 34 +#define DDS_FORMAT_R16G16_UNORM 35 +#define DDS_FORMAT_R32_FLOAT 41 +#define DDS_FORMAT_R32_UINT 42 +#define DDS_FORMAT_R8G8_UNORM 49 +#define DDS_FORMAT_R16_FLOAT 54 +#define DDS_FORMAT_R16_UNORM 56 +#define DDS_FORMAT_R8_UNORM 61 +#define DDS_FORMAT_BC1_UNORM 71 +#define DDS_FORMAT_BC2_UNORM 74 +#define DDS_FORMAT_BC3_UNORM 77 +#define DDS_FORMAT_BC4_UNORM 80 +#define DDS_FORMAT_BC5_UNORM 83 +#define DDS_FORMAT_B5G6R5_UNORM 85 +#define DDS_FORMAT_B5G5R5A1_UNORM 86 +#define DDS_FORMAT_B8G8R8A8_UNORM 87 +#define DDS_FORMAT_BC6H_SF16 96 +#define DDS_FORMAT_BC7_UNORM 98 +#define DDS_FORMAT_B4G4R4A4_UNORM 115 #define DDSD_CAPS 0x00000001 #define DDSD_HEIGHT 0x00000002 @@ -1331,57 +1331,57 @@ namespace bgfx { DDS_BC4U, TextureFormat::BC4 }, { DDS_ATI2, TextureFormat::BC5 }, { DDS_BC5U, TextureFormat::BC5 }, - { D3DFMT_A16B16G16R16, TextureFormat::RGBA16 }, - { D3DFMT_A16B16G16R16F, TextureFormat::RGBA16F }, + { DDS_A16B16G16R16, TextureFormat::RGBA16 }, + { DDS_A16B16G16R16F, TextureFormat::RGBA16F }, { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8 }, { DDPF_INDEXED, TextureFormat::R8 }, { DDPF_LUMINANCE, TextureFormat::R8 }, { DDPF_ALPHA, TextureFormat::R8 }, - { D3DFMT_R16F, TextureFormat::R16F }, - { D3DFMT_R32F, TextureFormat::R32F }, - { D3DFMT_A8L8, TextureFormat::RG8 }, - { D3DFMT_G16R16, TextureFormat::RG16 }, - { D3DFMT_G16R16F, TextureFormat::RG16F }, - { D3DFMT_G32R32F, TextureFormat::RG32F }, - { D3DFMT_A8R8G8B8, TextureFormat::BGRA8 }, - { D3DFMT_A16B16G16R16, TextureFormat::RGBA16 }, - { D3DFMT_A16B16G16R16F, TextureFormat::RGBA16F }, - { D3DFMT_A32B32G32R32F, TextureFormat::RGBA32F }, - { D3DFMT_R5G6B5, TextureFormat::R5G6B5 }, - { D3DFMT_A4R4G4B4, TextureFormat::RGBA4 }, - { D3DFMT_A1R5G5B5, TextureFormat::RGB5A1 }, - { D3DFMT_A2B10G10R10, TextureFormat::RGB10A2 }, + { DDS_R16F, TextureFormat::R16F }, + { DDS_R32F, TextureFormat::R32F }, + { DDS_A8L8, TextureFormat::RG8 }, + { DDS_G16R16, TextureFormat::RG16 }, + { DDS_G16R16F, TextureFormat::RG16F }, + { DDS_G32R32F, TextureFormat::RG32F }, + { DDS_A8R8G8B8, TextureFormat::BGRA8 }, + { DDS_A16B16G16R16, TextureFormat::RGBA16 }, + { DDS_A16B16G16R16F, TextureFormat::RGBA16F }, + { DDS_A32B32G32R32F, TextureFormat::RGBA32F }, + { DDS_R5G6B5, TextureFormat::R5G6B5 }, + { DDS_A4R4G4B4, TextureFormat::RGBA4 }, + { DDS_A1R5G5B5, TextureFormat::RGB5A1 }, + { DDS_A2B10G10R10, TextureFormat::RGB10A2 }, }; static TranslateDdsFormat s_translateDxgiFormat[] = { - { DXGI_FORMAT_BC1_UNORM, TextureFormat::BC1 }, - { DXGI_FORMAT_BC2_UNORM, TextureFormat::BC2 }, - { DXGI_FORMAT_BC3_UNORM, TextureFormat::BC3 }, - { DXGI_FORMAT_BC4_UNORM, TextureFormat::BC4 }, - { DXGI_FORMAT_BC5_UNORM, TextureFormat::BC5 }, - { DXGI_FORMAT_BC6H_SF16, TextureFormat::BC6H }, - { DXGI_FORMAT_BC7_UNORM, TextureFormat::BC7 }, + { DDS_FORMAT_BC1_UNORM, TextureFormat::BC1 }, + { DDS_FORMAT_BC2_UNORM, TextureFormat::BC2 }, + { DDS_FORMAT_BC3_UNORM, TextureFormat::BC3 }, + { DDS_FORMAT_BC4_UNORM, TextureFormat::BC4 }, + { DDS_FORMAT_BC5_UNORM, TextureFormat::BC5 }, + { DDS_FORMAT_BC6H_SF16, TextureFormat::BC6H }, + { DDS_FORMAT_BC7_UNORM, TextureFormat::BC7 }, - { DXGI_FORMAT_R8_UNORM, TextureFormat::R8 }, - { DXGI_FORMAT_R16_UNORM, TextureFormat::R16 }, - { DXGI_FORMAT_R16_FLOAT, TextureFormat::R16F }, - { DXGI_FORMAT_R32_UINT, TextureFormat::R32 }, - { DXGI_FORMAT_R32_FLOAT, TextureFormat::R32F }, - { DXGI_FORMAT_R8G8_UNORM, TextureFormat::RG8 }, - { DXGI_FORMAT_R16G16_UNORM, TextureFormat::RG16 }, - { DXGI_FORMAT_R16G16_FLOAT, TextureFormat::RG16F }, - { DXGI_FORMAT_R32G32_UINT, TextureFormat::RG32 }, - { DXGI_FORMAT_R32G32_FLOAT, TextureFormat::RG32F }, - { DXGI_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 }, - { DXGI_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 }, - { DXGI_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F }, - { DXGI_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 }, - { DXGI_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F }, - { DXGI_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 }, - { DXGI_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 }, - { DXGI_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 }, - { DXGI_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 }, + { DDS_FORMAT_R8_UNORM, TextureFormat::R8 }, + { DDS_FORMAT_R16_UNORM, TextureFormat::R16 }, + { DDS_FORMAT_R16_FLOAT, TextureFormat::R16F }, + { DDS_FORMAT_R32_UINT, TextureFormat::R32 }, + { DDS_FORMAT_R32_FLOAT, TextureFormat::R32F }, + { DDS_FORMAT_R8G8_UNORM, TextureFormat::RG8 }, + { DDS_FORMAT_R16G16_UNORM, TextureFormat::RG16 }, + { DDS_FORMAT_R16G16_FLOAT, TextureFormat::RG16F }, + { DDS_FORMAT_R32G32_UINT, TextureFormat::RG32 }, + { DDS_FORMAT_R32G32_FLOAT, TextureFormat::RG32F }, + { DDS_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 }, + { DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 }, + { DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F }, + { DDS_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 }, + { DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F }, + { DDS_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 }, + { DDS_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 }, + { DDS_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 }, + { DDS_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 }, }; struct TranslateDdsPixelFormat diff --git a/src/renderdoc.h b/src/renderdoc.h index e52a030c..9a7e6eb0 100644 --- a/src/renderdoc.h +++ b/src/renderdoc.h @@ -3,9 +3,14 @@ * License: http://www.opensource.org/licenses/BSD-2-Clause */ +#ifndef BGFX_RENDERDOC_H_HEADER_GUARD +#define BGFX_RENDERDOC_H_HEADER_GUARD + namespace bgfx { void* loadRenderDoc(); void unloadRenderDoc(void*); } // namespace bgfx + +#endif // BGFX_RENDERDOC_H_HEADER_GUARD diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 1ccaeffd..7f840dc0 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -8,7 +8,7 @@ #if BGFX_CONFIG_RENDERER_DIRECT3D11 # include "renderer_d3d11.h" -namespace bgfx +namespace bgfx { namespace d3d11 { static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -2299,14 +2299,14 @@ namespace bgfx static RendererContextD3D11* s_renderD3D11; - RendererContextI* rendererCreateD3D11() + RendererContextI* rendererCreate() { s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11); s_renderD3D11->init(); return s_renderD3D11; } - void rendererDestroyD3D11() + void rendererDestroy() { s_renderD3D11->shutdown(); BX_DELETE(g_allocator, s_renderD3D11); @@ -3839,20 +3839,20 @@ namespace bgfx PIX_ENDEVENT(); } } -} // namespace bgfx +} /* namespace d3d11 */ } // namespace bgfx #else -namespace bgfx +namespace bgfx { namespace d3d11 { - RendererContextI* rendererCreateD3D11() + RendererContextI* rendererCreate() { return NULL; } - void rendererDestroyD3D11() + void rendererDestroy() { } -} // namespace bgfx +} /* namespace d3d11 */ } // namespace bgfx #endif // BGFX_CONFIG_RENDERER_DIRECT3D11 diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h index 3d485e39..296121ce 100644 --- a/src/renderer_d3d11.h +++ b/src/renderer_d3d11.h @@ -70,7 +70,7 @@ BX_PRAGMA_DIAGNOSTIC_POP() # define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX #endif // D3D11_APPEND_ALIGNED_ELEMENT -namespace bgfx +namespace bgfx { namespace d3d11 { struct BufferD3D11 { @@ -280,6 +280,6 @@ namespace bgfx uint8_t m_num; }; -} // namespace bgfx +} /* namespace d3d11 */ } // namespace bgfx #endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 25054230..b41207cb 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -9,16 +9,16 @@ # include "../../d3d12/src/renderer_d3d12.cpp" #else -namespace bgfx +namespace bgfx { namespace d3d12 { - RendererContextI* rendererCreateD3D12() + RendererContextI* rendererCreate() { return NULL; } - void rendererDestroyD3D12() + void rendererDestroy() { } -} // namespace bgfx +} /* namespace d3d12 */ } // namespace bgfx #endif // BGFX_CONFIG_RENDERER_DIRECT3D12 diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 8d4e3621..d1381054 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -8,7 +8,7 @@ #if BGFX_CONFIG_RENDERER_DIRECT3D9 # include "renderer_d3d9.h" -namespace bgfx +namespace bgfx { namespace d3d9 { static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -1731,14 +1731,14 @@ namespace bgfx static RendererContextD3D9* s_renderD3D9; - RendererContextI* rendererCreateD3D9() + RendererContextI* rendererCreate() { s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9); s_renderD3D9->init(); return s_renderD3D9; } - void rendererDestroyD3D9() + void rendererDestroy() { s_renderD3D9->shutdown(); BX_DELETE(g_allocator, s_renderD3D9); @@ -3460,20 +3460,20 @@ namespace bgfx device->EndScene(); } -} // namespace bgfx +} /* namespace d3d9 */ } // namespace bgfx #else -namespace bgfx +namespace bgfx { namespace d3d9 { - RendererContextI* rendererCreateD3D9() + RendererContextI* rendererCreate() { return NULL; } - void rendererDestroyD3D9() + void rendererDestroy() { } -} // namespace bgfx +} /* namespace d3d9 */ } // namespace bgfx #endif // BGFX_CONFIG_RENDERER_DIRECT3D9 diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index e32a91a1..5ff37625 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -41,7 +41,7 @@ #include "renderer.h" #include "renderer_d3d.h" -namespace bgfx +namespace bgfx { namespace d3d9 { # if defined(D3D_DISABLE_9EX) # define D3DFMT_S8_LOCKABLE D3DFORMAT( 85) @@ -386,6 +386,6 @@ namespace bgfx bool m_needResolve; }; -} // namespace bgfx +} /* namespace d3d9 */ } // namespace bgfx #endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 6d4dc557..88cd5b93 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -10,7 +10,7 @@ # include # include -namespace bgfx +namespace bgfx { namespace gl { static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -2579,14 +2579,14 @@ namespace bgfx RendererContextGL* s_renderGL; - RendererContextI* rendererCreateGL() + RendererContextI* rendererCreate() { s_renderGL = BX_NEW(g_allocator, RendererContextGL); s_renderGL->init(); return s_renderGL; } - void rendererDestroyGL() + void rendererDestroy() { s_renderGL->shutdown(); BX_DELETE(g_allocator, s_renderGL); @@ -5354,21 +5354,21 @@ namespace bgfx GL_CHECK(glFrameTerminatorGREMEDY() ); } -} // namespace bgfx +} } // namespace bgfx #else -namespace bgfx +namespace bgfx { namespace gl { - RendererContextI* rendererCreateGL() + RendererContextI* rendererCreate() { return NULL; } - void rendererDestroyGL() + void rendererDestroy() { } -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) diff --git a/src/renderer_gl.h b/src/renderer_gl.h index 9160fbfe..17cbdd7a 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -611,6 +611,10 @@ typedef uint64_t GLuint64; namespace bgfx { class ConstantBuffer; +} // namespace bgfx + +namespace bgfx { namespace gl +{ void dumpExtensions(const char* _extensions); const char* glEnumName(GLenum _enum); @@ -1001,6 +1005,6 @@ namespace bgfx GLuint m_queries[64]; }; -} // namespace bgfx +} /* namespace gl */ } // namespace bgfx #endif // BGFX_RENDERER_GL_H_HEADER_GUARD diff --git a/src/renderer_null.cpp b/src/renderer_null.cpp index cde647bf..76cd0fad 100644 --- a/src/renderer_null.cpp +++ b/src/renderer_null.cpp @@ -7,7 +7,7 @@ #if BGFX_CONFIG_RENDERER_NULL -namespace bgfx +namespace bgfx { namespace noop { struct RendererContextNULL : public RendererContextI { @@ -168,31 +168,31 @@ namespace bgfx static RendererContextNULL* s_renderNULL; - RendererContextI* rendererCreateNULL() + RendererContextI* rendererCreate() { s_renderNULL = BX_NEW(g_allocator, RendererContextNULL); return s_renderNULL; } - void rendererDestroyNULL() + void rendererDestroy() { BX_DELETE(g_allocator, s_renderNULL); s_renderNULL = NULL; } -} // namespace bgfx +} /* namespace noop */ } // namespace bgfx #else -namespace bgfx +namespace bgfx { namespace noop { - RendererContextI* rendererCreateNULL() + RendererContextI* rendererCreate() { return NULL; } - void rendererDestroyNULL() + void rendererDestroy() { } -} // namespace bgfx +} /* namespace noop */ } // namespace bgfx #endif // BGFX_CONFIG_RENDERER_NULL diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index 809a0c8e..e2ff8cdf 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -8,16 +8,16 @@ # include "../../vk/src/renderer_vk.cpp" #else -namespace bgfx +namespace bgfx { namespace vk { - RendererContextI* rendererCreateVK() + RendererContextI* rendererCreate() { return NULL; } - void rendererDestroyVK() + void rendererDestroy() { } -} // namespace bgfx +} /* namespace vk */ } // namespace bgfx #endif // BGFX_CONFIG_RENDERER_VULKAN