diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index 1a43695d180..30df03b0008 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -593,6 +593,7 @@ Todo - Animated mesh example. - Direct3D 12 renderer backend. - Metal renderer backend. + - Vulkan renderer backend. Contact ------- diff --git a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp index 1c094cf4576..41ecbd7f2ff 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp +++ b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp @@ -152,9 +152,6 @@ void VectorDisplay::beginFrame() void VectorDisplay::endFrame() { float proj[16]; - float ident[16]; - bx::mtxIdentity(ident); - bx::mtxOrtho(proj, 0.0f, (float)m_screenWidth, (float)m_screenHeight, 0.0f, 0.0f, 1000.0f); bgfx::setViewRect(m_view, 0, 0, m_screenWidth, m_screenHeight); @@ -171,14 +168,6 @@ void VectorDisplay::endFrame() ); m_vertexBuffersSize[m_currentDrawStep] = (uint32_t)m_points.size(); - //if the index buffer is cleared from the last "submit"-call everything is fine, but if not - //we clear it here again just to be sure it's not set... (the same for the Transform) - bgfx::IndexBufferHandle ib; - ib.idx = bgfx::invalidHandle; - bgfx::setIndexBuffer(ib); - - bgfx::setTransform(ident); - for (int loopvar = 0; loopvar < m_numberDecaySteps; loopvar++) { int stepi = m_numberDecaySteps - loopvar - 1; diff --git a/3rdparty/bgfx/examples/common/entry/entry_osx.mm b/3rdparty/bgfx/examples/common/entry/entry_osx.mm index d09ccb4b45e..51e9d86be00 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_osx.mm +++ b/3rdparty/bgfx/examples/common/entry/entry_osx.mm @@ -77,7 +77,10 @@ namespace entry struct Context { Context() - : m_scroll(0) + : m_scrollf(0.0f) + , m_mx(0) + , m_my(0) + , m_scroll(0) , m_exit(false) { s_translateKey[27] = Key::Esc; @@ -170,20 +173,19 @@ namespace entry return mask; } - Key::Enum handleKeyEvent(NSEvent* event, uint8_t* specialKeys) + Key::Enum handleKeyEvent(NSEvent* event, uint8_t* specialKeys, uint8_t* _pressedChar) { NSString* key = [event charactersIgnoringModifiers]; unichar keyChar = 0; -//DBG("keyChar %d", keyChar); if ([key length] == 0) { return Key::None; } keyChar = [key characterAtIndex:0]; + *_pressedChar = (uint8_t)keyChar; int keyCode = keyChar; -//DBG("keyCode %d", keyCode); *specialKeys = translateModifiers([event modifierFlags]); // if this is a unhandled key just return None @@ -236,80 +238,81 @@ namespace entry case NSRightMouseDragged: case NSOtherMouseDragged: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll); + getMousePos(&m_mx, &m_my); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll); break; } case NSLeftMouseDown: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Left, true); + // TODO: remove! + // Shift + Left Mouse Button acts as middle! This just a temporary solution! + // This is becase the average OSX user doesn't have middle mouse click. + MouseButton::Enum mb = ([event modifierFlags] & NSShiftKeyMask) ? MouseButton::Middle : MouseButton::Left; + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, mb, true); break; } case NSLeftMouseUp: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Left, false); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Left, false); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Middle, false); // TODO: remove! break; } case NSRightMouseDown: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Right, true); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Right, true); break; } case NSRightMouseUp: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Right, false); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Right, false); break; } case NSOtherMouseDown: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Middle, true); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Middle, true); break; } case NSOtherMouseUp: { - int x, y; - getMousePos(&x, &y); - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Middle, false); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Middle, false); break; } case NSScrollWheel: { - int x, y; - getMousePos(&x, &y); - m_scroll += ([event deltaY] > 0.0f) ? 1 : -1; - m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll); + m_scrollf += [event deltaY]; + + m_scroll = (int32_t)m_scrollf; + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll); break; } case NSKeyDown: { uint8_t modifiers = 0; - Key::Enum key = handleKeyEvent(event, &modifiers); + uint8_t pressedChar[4]; + Key::Enum key = handleKeyEvent(event, &modifiers, &pressedChar[0]); - // If KeyCode is none we don't don't handle the key and special case for cmd+q (quit) - // Note that return false here means that we take care of the key (instead of the default behavior) + // Returning false means that we take care of the key (instead of the default behavior) if (key != Key::None) { - if (key != Key::KeyQ - && !(modifiers & Modifier::RightMeta) ) + if (key == Key::KeyQ && (modifiers & Modifier::RightMeta) ) + { + m_eventQueue.postExitEvent(); + } + else if ( (Key::Key0 <= key && key <= Key::KeyZ) + || (Key::Esc <= key && key <= Key::Minus) ) + { + m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar); + return false; + } + else { m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true); return false; @@ -322,7 +325,10 @@ namespace entry case NSKeyUp: { uint8_t modifiers = 0; - Key::Enum key = handleKeyEvent(event, &modifiers); + uint8_t pressedChar[4]; + Key::Enum key = handleKeyEvent(event, &modifiers, &pressedChar[0]); + + BX_UNUSED(pressedChar); if (key != Key::None) { @@ -347,10 +353,15 @@ namespace entry { WindowHandle handle = { 0 }; NSWindow* window = m_window[handle.idx]; - NSRect rect = [window frame]; + NSRect originalFrame = [window frame]; + NSRect rect = [NSWindow contentRectForFrameRect: originalFrame styleMask: NSTitledWindowMask]; uint32_t width = uint32_t(rect.size.width); uint32_t height = uint32_t(rect.size.height); m_eventQueue.postSizeEvent(handle, width, height); + + // Make sure mouse button state is 'up' after resize. + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Left, false); + m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Right, false); } int32_t run(int _argc, char** _argv) @@ -429,7 +440,6 @@ namespace entry } } - m_eventQueue.postExitEvent(); while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() ) {}; @@ -443,8 +453,11 @@ namespace entry bx::HandleAllocT m_windowAlloc; NSWindow* m_window[ENTRY_CONFIG_MAX_WINDOWS]; + float m_scrollf; + int32_t m_mx; + int32_t m_my; int32_t m_scroll; - bool m_exit; + bool m_exit; }; static Context s_ctx; diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index 7fa19965b07..cdd918c0fbb 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -1405,7 +1405,7 @@ struct Imgui { const size_t cursor = size_t(strlen(_str)); - if (m_char == 0x08) //backspace + if (m_char == 0x08 || m_char == 0x7f) //backspace or delete { _str[cursor-1] = '\0'; } diff --git a/3rdparty/bgfx/include/bgfx.c99.h b/3rdparty/bgfx/include/bgfx.c99.h index d44b85fba82..43effbcc5ec 100644 --- a/3rdparty/bgfx/include/bgfx.c99.h +++ b/3rdparty/bgfx/include/bgfx.c99.h @@ -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 @@ -104,6 +106,7 @@ typedef enum bgfx_texture_format BGFX_TEXTURE_FORMAT_RG32, BGFX_TEXTURE_FORMAT_RG32F, BGFX_TEXTURE_FORMAT_BGRA8, + BGFX_TEXTURE_FORMAT_RGBA8, BGFX_TEXTURE_FORMAT_RGBA16, BGFX_TEXTURE_FORMAT_RGBA16F, BGFX_TEXTURE_FORMAT_RGBA32, diff --git a/3rdparty/bgfx/include/bgfx.h b/3rdparty/bgfx/include/bgfx.h index f414e5887ad..dd3b4c5db79 100644 --- a/3rdparty/bgfx/include/bgfx.h +++ b/3rdparty/bgfx/include/bgfx.h @@ -49,6 +49,7 @@ namespace bgfx Direct3D12, //!< Direct3D 12.0 OpenGLES, //!< OpenGL ES 2.0+ OpenGL, //!< OpenGL 2.1+ + Vulkan, //!< Vulkan Count }; @@ -142,6 +143,7 @@ namespace bgfx RG32, RG32F, BGRA8, + RGBA8, RGBA16, RGBA16F, RGBA32, diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua index 82fcad846b3..8b67642d903 100644 --- a/3rdparty/bgfx/scripts/bgfx.lua +++ b/3rdparty/bgfx/scripts/bgfx.lua @@ -62,6 +62,13 @@ function bgfxProject(_name, _kind, _defines) "$(DXSDK_DIR)/include", } + if (_OPTIONS["vs"] == "vs2012-xp") or (_OPTIONS["vs"] == "vs2013-xp") then + configuration { "vs201*" } + includedirs { + "$(DXSDK_DIR)/include", + } + end + configuration { "winphone8*"} linkoptions { "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata diff --git a/3rdparty/bgfx/scripts/example-common.lua b/3rdparty/bgfx/scripts/example-common.lua index e0983378104..6ab71ab9602 100644 --- a/3rdparty/bgfx/scripts/example-common.lua +++ b/3rdparty/bgfx/scripts/example-common.lua @@ -35,7 +35,12 @@ project ("example-common") includedirs { "$(DXSDK_DIR)/include", } - + if (_OPTIONS["vs"] == "vs2012-xp") or (_OPTIONS["vs"] == "vs2013-xp") then + configuration { "vs201*" } + includedirs { + "$(DXSDK_DIR)/include", + } + end configuration { "winphone8*"} linkoptions { diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index 7775f60a0ed..7ac7060e641 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -972,16 +972,16 @@ namespace bgfx m_viewRemap[ii] = ii; } - memset(m_fb, 0xff, sizeof(m_fb) ); - memset(m_clear, 0, sizeof(m_clear) ); - memset(m_rect, 0, sizeof(m_rect) ); + memset(m_fb, 0xff, sizeof(m_fb) ); + memset(m_clear, 0, sizeof(m_clear) ); + memset(m_rect, 0, sizeof(m_rect) ); memset(m_scissor, 0, sizeof(m_scissor) ); - memset(m_seq, 0, sizeof(m_seq) ); + memset(m_seq, 0, sizeof(m_seq) ); memset(m_seqMask, 0, sizeof(m_seqMask) ); for (uint32_t ii = 0; ii < BX_COUNTOF(m_rect); ++ii) { - m_rect[ii].m_width = 1; + m_rect[ii].m_width = 1; m_rect[ii].m_height = 1; } @@ -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); @@ -1446,6 +1450,10 @@ again: { _type = RendererType::OpenGLES; } + else if (s_rendererCreator[RendererType::Vulkan].supported) + { + _type = RendererType::Vulkan; + } } else if (BX_ENABLED(0 || BX_PLATFORM_ANDROID diff --git a/3rdparty/bgfx/src/bgfx_compute.sh b/3rdparty/bgfx/src/bgfx_compute.sh index d042293d91e..0db15d93488 100644 --- a/3rdparty/bgfx/src/bgfx_compute.sh +++ b/3rdparty/bgfx/src/bgfx_compute.sh @@ -44,9 +44,17 @@ vec2 unpackHalf2x16(uint _x) #define SHARED groupshared -#define IMAGE2D_RO(_name, _reg) Texture2D _name : register(t[_reg]) -#define IMAGE2D_RW(_name, _reg) RWTexture2D _name : register(u[_reg]) -#define IMAGE2D_WR(_name, _reg) IMAGE2D_RW(_name, _reg) +#define r32ui uint +#define r32f float +#define rg16f float2 +#define rgba8 float4 + +#define IMAGE2D_RO( _name, _format, _reg) Texture2D<_format> _name : register(t[_reg]) +#define UIMAGE2D_RO(_name, _format, _reg) Texture2D<_format> _name : register(t[_reg]) +#define IMAGE2D_WR( _name, _format, _reg) RWTexture2D<_format> _name : register(u[_reg]) +#define UIMAGE2D_WR(_name, _format, _reg) RWTexture2D<_format> _name : register(u[_reg]) +#define IMAGE2D_RW( _name, _reg) RWTexture2D _name : register(u[_reg]) +#define UIMAGE2D_RW(_name, _reg) RWTexture2D _name : register(u[_reg]) #define BUFFER_RO(_name, _struct, _reg) Buffer<_struct> _name : register(b[_reg]) #define BUFFER_RW(_name, _struct, _reg) RWBuffer<_struct> _name : register(u[_reg]) @@ -153,13 +161,16 @@ uint atomicCompSwap(uint _mem, uint _compare, uint _data) #define SHARED shared -#define __IMAGE2D_XX(_name, _reg, _access) \ - layout(rgba8, binding=_reg) _access uniform highp image2D _name +#define __IMAGE_XX(_name, _format, _reg, _image, _access) \ + layout(_format, binding=_reg) _access uniform highp _image _name #define readwrite -#define IMAGE2D_RO(_name, _reg) __IMAGE2D_XX(_name, _reg, readonly) -#define IMAGE2D_RW(_name, _reg) __IMAGE2D_XX(_name, _reg, readwrite) -#define IMAGE2D_WR(_name, _reg) __IMAGE2D_XX(_name, _reg, writeonly) +#define IMAGE2D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, readonly) +#define UIMAGE2D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, readonly) +#define IMAGE2D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, writeonly) +#define UIMAGE2D_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, writeonly) +#define IMAGE2D_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2D, readwrite) +#define UIMAGE2D_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2D, readwrite) #define __BUFFER_XX(_name, _type, _reg, _access) \ layout(std430, binding=_reg) _access buffer _name ## Buffer \ diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index eaa5c1c53e7..11ccfa7b85c 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -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 @@ -3260,6 +3261,9 @@ namespace bgfx BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) ) { _format = TextureFormat::Count == _format ? TextureFormat::Enum(m_textureRef[_handle.idx].m_format) : _format; + BX_CHECK(_format != TextureFormat::BGRA8 + , "Can't use TextureFormat::BGRA8 with compute, use TextureFormat::RGBA8 instead." + ); m_submit->setImage(_stage, _sampler, _handle, _mip, _access, _format); } diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h index 396e6506372..07fde5584d9 100644 --- a/3rdparty/bgfx/src/config.h +++ b/3rdparty/bgfx/src/config.h @@ -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 diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp index 6091a466af0..53e3acbcd8d 100644 --- a/3rdparty/bgfx/src/image.cpp +++ b/3rdparty/bgfx/src/image.cpp @@ -49,6 +49,7 @@ namespace bgfx { 64, 1, 1, 8, 1, 1 }, // RG32 { 64, 1, 1, 8, 1, 1 }, // RG32F { 32, 1, 1, 4, 1, 1 }, // BGRA8 + { 32, 1, 1, 4, 1, 1 }, // RGBA8 { 64, 1, 1, 8, 1, 1 }, // RGBA16 { 64, 1, 1, 8, 1, 1 }, // RGBA16F { 128, 1, 1, 16, 1, 1 }, // RGBA32 @@ -102,6 +103,7 @@ namespace bgfx "RG32", // RG32 "RG32F", // RG32F "BGRA8", // BGRA8 + "RGBA8", // RGBA8 "RGBA16", // RGBA16 "RGBA16F", // RGBA16F "RGBA32", // RGBA32 diff --git a/3rdparty/bgfx/src/renderer_d3d.h b/3rdparty/bgfx/src/renderer_d3d.h index 1df0e3a7a9a..eed410263dd 100644 --- a/3rdparty/bgfx/src/renderer_d3d.h +++ b/3rdparty/bgfx/src/renderer_d3d.h @@ -138,6 +138,50 @@ namespace bgfx HashMap m_hashMap; }; + class StateCache + { + public: + void add(uint64_t _id, uint16_t _item) + { + invalidate(_id); + m_hashMap.insert(stl::make_pair(_id, _item)); + } + + uint16_t find(uint64_t _id) + { + HashMap::iterator it = m_hashMap.find(_id); + if (it != m_hashMap.end()) + { + return it->second; + } + + return UINT16_MAX; + } + + void invalidate(uint64_t _id) + { + HashMap::iterator it = m_hashMap.find(_id); + if (it != m_hashMap.end()) + { + m_hashMap.erase(it); + } + } + + void invalidate() + { + m_hashMap.clear(); + } + + uint32_t getCount() const + { + return uint32_t(m_hashMap.size()); + } + + private: + typedef stl::unordered_map HashMap; + HashMap m_hashMap; + }; + } // namespace bgfx #endif // BGFX_RENDERER_D3D_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 81831b514d2..d49987e2fdf 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -213,6 +213,7 @@ namespace bgfx { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN }, // RG32 { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN }, // RG32F { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN }, // BGRA8 + { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN }, // RGBA8 { DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_UNKNOWN }, // RGBA16 { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN }, // RGBA16F { DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN }, // RGBA32 diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index 78ff0dce834..8d4e362176a 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -219,6 +219,7 @@ namespace bgfx { D3DFMT_UNKNOWN }, // RG32 { D3DFMT_G32R32F }, // RG32F { D3DFMT_A8R8G8B8 }, // BGRA8 + { D3DFMT_A8R8G8B8 }, // RGBA8 { D3DFMT_A16B16G16R16 }, // RGBA16 { D3DFMT_A16B16G16R16F }, // RGBA16F { D3DFMT_UNKNOWN }, // RGBA32 diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index d01f41b075f..c6cffc511fd 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -215,6 +215,7 @@ namespace bgfx { GL_RG32UI, GL_RG, GL_UNSIGNED_INT, true }, // RG32 { GL_RG32F, GL_RG, GL_FLOAT, true }, // RG32F { GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, true }, // BGRA8 + { GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, true }, // RGBA8 { GL_RGBA16, GL_RGBA, GL_UNSIGNED_BYTE, true }, // RGBA16 { GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, true }, // RGBA16F { GL_RGBA32UI, GL_RGBA, GL_UNSIGNED_INT, true }, // RGBA32 @@ -268,6 +269,7 @@ namespace bgfx GL_RG32UI, // RG32 GL_RG32F, // RG32F GL_RGBA8, // BGRA8 + GL_RGBA8, // RGBA8 GL_RGBA16, // RGBA16 GL_RGBA16F, // RGBA16F GL_RGBA32UI, // RGBA32 @@ -321,6 +323,7 @@ namespace bgfx GL_RG32UI, // RG32 GL_RG32F, // RG32F GL_RGBA8, // BGRA8 + GL_RGBA8, // RGBA8 GL_RGBA16, // RGBA16 GL_RGBA16F, // RGBA16F GL_RGBA32UI, // RGBA32 diff --git a/3rdparty/bgfx/src/renderer_vk.cpp b/3rdparty/bgfx/src/renderer_vk.cpp new file mode 100644 index 00000000000..809a0c8ec1e --- /dev/null +++ b/3rdparty/bgfx/src/renderer_vk.cpp @@ -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_VULKAN +# include "../../vk/src/renderer_vk.cpp" +#else + +namespace bgfx +{ + RendererContextI* rendererCreateVK() + { + return NULL; + } + + void rendererDestroyVK() + { + } +} // namespace bgfx + +#endif // BGFX_CONFIG_RENDERER_VULKAN diff --git a/3rdparty/bgfx/src/vertexdecl.cpp b/3rdparty/bgfx/src/vertexdecl.cpp index ed5059a7aa2..c0c4edeef1d 100644 --- a/3rdparty/bgfx/src/vertexdecl.cpp +++ b/3rdparty/bgfx/src/vertexdecl.cpp @@ -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", diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h index 54a68e6a34e..373c991769a 100644 --- a/3rdparty/bx/include/bx/platform.h +++ b/3rdparty/bx/include/bx/platform.h @@ -125,9 +125,10 @@ # ifndef NOMINMAX # define NOMINMAX # endif // NOMINMAX -# if defined(_MSC_VER) && (_MSC_VER >= 1700) +// If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. +# if defined(_MSC_VER) && (_MSC_VER >= 1700) && (!_USING_V110_SDK71_) # include -# endif // defined(_MSC_VER) && (_MSC_VER >= 1700) +# endif // defined(_MSC_VER) && (_MSC_VER >= 1700) && (!_USING_V110_SDK71_) # if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) # undef BX_PLATFORM_WINDOWS # if !defined(WINVER) && !defined(_WIN32_WINNT) diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index 3d761911276..5c2cf4c86e9 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -40,6 +40,8 @@ function toolchain(_buildDir, _libDir) allowed = { { "vs2012-clang", "Clang 3.6" }, { "vs2013-clang", "Clang 3.6" }, + { "vs2012-xp", "Visual Studio 2012 targeting XP" }, + { "vs2013-xp", "Visual Studio 2013 targeting XP" }, { "winphone8", "Windows Phone 8.0" }, { "winphone81", "Windows Phone 8.1" }, }, @@ -291,6 +293,17 @@ function toolchain(_buildDir, _libDir) platforms { "ARM" } location (path.join(_buildDir, "projects", _ACTION .. "-winphone81")) end + + if ("vs2012-xp") == _OPTIONS["vs"] then + premake.vstudio.toolset = ("v110_xp") + location (path.join(_buildDir, "projects", _ACTION .. "-xp")) + end + + if ("vs2013-xp") == _OPTIONS["vs"] then + premake.vstudio.toolset = ("v120_xp") + location (path.join(_buildDir, "projects", _ACTION .. "-xp")) + end + elseif _ACTION == "xcode4" then if "osx" == _OPTIONS["xcode"] then diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie index 06223fe5d47..5480af740cc 100644 Binary files a/3rdparty/bx/tools/bin/darwin/genie and b/3rdparty/bx/tools/bin/darwin/genie differ diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie index 2be4634fac3..752d1894fbc 100644 Binary files a/3rdparty/bx/tools/bin/linux/genie and b/3rdparty/bx/tools/bin/linux/genie differ diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe index f14714e3760..0cc72817afc 100644 Binary files a/3rdparty/bx/tools/bin/windows/genie.exe and b/3rdparty/bx/tools/bin/windows/genie.exe differ diff --git a/src/lib/lib.mak b/src/lib/lib.mak index d71f0611d8f..1b5dbffe923 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -616,6 +616,7 @@ BGFXOBJS = \ $(LIBOBJ)/bgfx/renderer_d3d9.o \ $(LIBOBJ)/bgfx/renderer_gl.o \ $(LIBOBJ)/bgfx/renderer_null.o \ + $(LIBOBJ)/bgfx/renderer_vk.o \ $(LIBOBJ)/bgfx/renderdoc.o \ $(LIBOBJ)/bgfx/vertexdecl.o \ $(LIBOBJ)/bgfx/common/bgfx_utils.o \