mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
update bgfx (nw)
This commit is contained in:
parent
55aaf4b742
commit
0d9be2925b
1
3rdparty/bgfx/README.md
vendored
1
3rdparty/bgfx/README.md
vendored
@ -593,6 +593,7 @@ Todo
|
||||
- Animated mesh example.
|
||||
- Direct3D 12 renderer backend.
|
||||
- Metal renderer backend.
|
||||
- Vulkan renderer backend.
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
@ -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;
|
||||
|
89
3rdparty/bgfx/examples/common/entry/entry_osx.mm
vendored
89
3rdparty/bgfx/examples/common/entry/entry_osx.mm
vendored
@ -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<ENTRY_CONFIG_MAX_WINDOWS> 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;
|
||||
|
@ -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';
|
||||
}
|
||||
|
5
3rdparty/bgfx/include/bgfx.c99.h
vendored
5
3rdparty/bgfx/include/bgfx.c99.h
vendored
@ -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,
|
||||
|
2
3rdparty/bgfx/include/bgfx.h
vendored
2
3rdparty/bgfx/include/bgfx.h
vendored
@ -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,
|
||||
|
7
3rdparty/bgfx/scripts/bgfx.lua
vendored
7
3rdparty/bgfx/scripts/bgfx.lua
vendored
@ -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
|
||||
|
7
3rdparty/bgfx/scripts/example-common.lua
vendored
7
3rdparty/bgfx/scripts/example-common.lua
vendored
@ -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 {
|
||||
|
18
3rdparty/bgfx/src/bgfx.cpp
vendored
18
3rdparty/bgfx/src/bgfx.cpp
vendored
@ -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
|
||||
|
27
3rdparty/bgfx/src/bgfx_compute.sh
vendored
27
3rdparty/bgfx/src/bgfx_compute.sh
vendored
@ -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<float4> _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<float> _name : register(u[_reg])
|
||||
#define UIMAGE2D_RW(_name, _reg) RWTexture2D<uint> _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 \
|
||||
|
4
3rdparty/bgfx/src/bgfx_p.h
vendored
4
3rdparty/bgfx/src/bgfx_p.h
vendored
@ -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);
|
||||
}
|
||||
|
||||
|
9
3rdparty/bgfx/src/config.h
vendored
9
3rdparty/bgfx/src/config.h
vendored
@ -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
|
||||
|
2
3rdparty/bgfx/src/image.cpp
vendored
2
3rdparty/bgfx/src/image.cpp
vendored
@ -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
|
||||
|
44
3rdparty/bgfx/src/renderer_d3d.h
vendored
44
3rdparty/bgfx/src/renderer_d3d.h
vendored
@ -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<uint64_t, uint16_t> HashMap;
|
||||
HashMap m_hashMap;
|
||||
};
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
#endif // BGFX_RENDERER_D3D_H_HEADER_GUARD
|
||||
|
1
3rdparty/bgfx/src/renderer_d3d11.cpp
vendored
1
3rdparty/bgfx/src/renderer_d3d11.cpp
vendored
@ -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
|
||||
|
1
3rdparty/bgfx/src/renderer_d3d9.cpp
vendored
1
3rdparty/bgfx/src/renderer_d3d9.cpp
vendored
@ -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
|
||||
|
3
3rdparty/bgfx/src/renderer_gl.cpp
vendored
3
3rdparty/bgfx/src/renderer_gl.cpp
vendored
@ -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
|
||||
|
23
3rdparty/bgfx/src/renderer_vk.cpp
vendored
Normal file
23
3rdparty/bgfx/src/renderer_vk.cpp
vendored
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_VULKAN
|
||||
# include "../../vk/src/renderer_vk.cpp"
|
||||
#else
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
RendererContextI* rendererCreateVK()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void rendererDestroyVK()
|
||||
{
|
||||
}
|
||||
} // namespace bgfx
|
||||
|
||||
#endif // BGFX_CONFIG_RENDERER_VULKAN
|
5
3rdparty/bgfx/src/vertexdecl.cpp
vendored
5
3rdparty/bgfx/src/vertexdecl.cpp
vendored
@ -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",
|
||||
|
5
3rdparty/bx/include/bx/platform.h
vendored
5
3rdparty/bx/include/bx/platform.h
vendored
@ -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 <winapifamily.h>
|
||||
# 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)
|
||||
|
13
3rdparty/bx/scripts/toolchain.lua
vendored
13
3rdparty/bx/scripts/toolchain.lua
vendored
@ -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
|
||||
|
BIN
3rdparty/bx/tools/bin/darwin/genie
vendored
BIN
3rdparty/bx/tools/bin/darwin/genie
vendored
Binary file not shown.
BIN
3rdparty/bx/tools/bin/linux/genie
vendored
BIN
3rdparty/bx/tools/bin/linux/genie
vendored
Binary file not shown.
BIN
3rdparty/bx/tools/bin/windows/genie.exe
vendored
BIN
3rdparty/bx/tools/bin/windows/genie.exe
vendored
Binary file not shown.
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user