mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
Update to latest bgfx and fix for latest mingw releases (nw)
This commit is contained in:
parent
33387befdb
commit
26214cc6ec
2
3rdparty/bgfx/3rdparty/stb/stb_image.c
vendored
2
3rdparty/bgfx/3rdparty/stb/stb_image.c
vendored
@ -3254,7 +3254,7 @@ static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int
|
||||
unsigned char *tga_data;
|
||||
unsigned char *tga_palette = NULL;
|
||||
int i, j;
|
||||
unsigned char raw_data[4];
|
||||
unsigned char raw_data[4] = {};
|
||||
int RLE_count = 0;
|
||||
int RLE_repeating = 0;
|
||||
int read_next_pixel = 1;
|
||||
|
15
3rdparty/bgfx/makefile
vendored
15
3rdparty/bgfx/makefile
vendored
@ -217,12 +217,14 @@ OS=darwin
|
||||
BUILD_PROJECT_DIR=gmake-osx
|
||||
BUILD_OUTPUT_DIR=osx64_clang
|
||||
BUILD_TOOLS_CONFIG=release64
|
||||
BUILD_TOOLS_SUFFIX=Release
|
||||
EXE=
|
||||
else
|
||||
OS=linux
|
||||
BUILD_PROJECT_DIR=gmake-linux
|
||||
BUILD_OUTPUT_DIR=linux64_gcc
|
||||
BUILD_TOOLS_CONFIG=release64
|
||||
BUILD_TOOLS_SUFFIX=Release
|
||||
EXE=
|
||||
endif
|
||||
else
|
||||
@ -230,19 +232,16 @@ OS=windows
|
||||
BUILD_PROJECT_DIR=gmake-mingw-gcc
|
||||
BUILD_OUTPUT_DIR=win32_mingw-gcc
|
||||
BUILD_TOOLS_CONFIG=release32
|
||||
BUILD_TOOLS_SUFFIX=Release
|
||||
EXE=.exe
|
||||
endif
|
||||
|
||||
.build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
|
||||
tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
|
||||
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
|
||||
$(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
|
||||
|
||||
tools/bin/$(OS)/shaderc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE)
|
||||
$(SILENT) cp $(<) $(@)
|
||||
|
||||
.build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
|
||||
tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
|
||||
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG)
|
||||
|
||||
tools/bin/$(OS)/geometryc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE)
|
||||
$(SILENT) cp $(<) $(@)
|
||||
$(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
|
||||
|
||||
tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE)
|
||||
|
29
3rdparty/bgfx/src/renderer_d3d11.cpp
vendored
29
3rdparty/bgfx/src/renderer_d3d11.cpp
vendored
@ -543,20 +543,23 @@ namespace bgfx { namespace d3d11
|
||||
g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId;
|
||||
++g_caps.numGPUs;
|
||||
|
||||
if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId)
|
||||
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
|
||||
&& ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
|
||||
if (NULL == m_adapter)
|
||||
{
|
||||
m_adapter = adapter;
|
||||
m_adapter->AddRef();
|
||||
m_driverType = D3D_DRIVER_TYPE_UNKNOWN;
|
||||
}
|
||||
if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId)
|
||||
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
|
||||
&& ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
|
||||
{
|
||||
m_adapter = adapter;
|
||||
m_adapter->AddRef();
|
||||
m_driverType = D3D_DRIVER_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
|
||||
&& 0 != strstr(description, "PerfHUD") )
|
||||
{
|
||||
m_adapter = adapter;
|
||||
m_driverType = D3D_DRIVER_TYPE_REFERENCE;
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
|
||||
&& 0 != strstr(description, "PerfHUD") )
|
||||
{
|
||||
m_adapter = adapter;
|
||||
m_driverType = D3D_DRIVER_TYPE_REFERENCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,6 +699,7 @@ namespace bgfx { namespace d3d11
|
||||
|
||||
m_numWindows = 1;
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
|
||||
{
|
||||
ID3D11InfoQueue* infoQueue;
|
||||
@ -727,6 +731,7 @@ namespace bgfx { namespace d3d11
|
||||
setGraphicsDebuggerPresent(true);
|
||||
}
|
||||
}
|
||||
#endif // __MINGW__
|
||||
|
||||
UniformHandle handle = BGFX_INVALID_HANDLE;
|
||||
for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii)
|
||||
|
52
3rdparty/bgfx/src/renderer_d3d11.h
vendored
52
3rdparty/bgfx/src/renderer_d3d11.h
vendored
@ -49,26 +49,48 @@ BX_PRAGMA_DIAGNOSTIC_POP()
|
||||
# define D3D_FEATURE_LEVEL_11_1 D3D_FEATURE_LEVEL(0xb100)
|
||||
#endif // D3D_FEATURE_LEVEL_11_1
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
// MinGW Linux/Wine missing defines...
|
||||
#ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
|
||||
# define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8
|
||||
#endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
|
||||
# ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
|
||||
# define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8
|
||||
# endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
|
||||
|
||||
#ifndef D3D11_PS_CS_UAV_REGISTER_COUNT
|
||||
# define D3D11_PS_CS_UAV_REGISTER_COUNT 8
|
||||
#endif // D3D11_PS_CS_UAV_REGISTER_COUNT
|
||||
# ifndef D3D11_PS_CS_UAV_REGISTER_COUNT
|
||||
# define D3D11_PS_CS_UAV_REGISTER_COUNT 8
|
||||
# endif // D3D11_PS_CS_UAV_REGISTER_COUNT
|
||||
|
||||
#ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
|
||||
# define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8
|
||||
#endif
|
||||
# ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
|
||||
# define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8
|
||||
# endif
|
||||
|
||||
#ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
|
||||
# define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
|
||||
#endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
|
||||
# ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
|
||||
# define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
|
||||
# endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
|
||||
|
||||
#ifndef D3D11_APPEND_ALIGNED_ELEMENT
|
||||
# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
|
||||
#endif // D3D11_APPEND_ALIGNED_ELEMENT
|
||||
# ifndef D3D11_APPEND_ALIGNED_ELEMENT
|
||||
# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
|
||||
# endif // D3D11_APPEND_ALIGNED_ELEMENT
|
||||
|
||||
# ifndef D3D11_REQ_MAXANISOTROPY
|
||||
# define D3D11_REQ_MAXANISOTROPY 16
|
||||
# endif // D3D11_REQ_MAXANISOTROPY
|
||||
|
||||
# ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT
|
||||
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT
|
||||
{
|
||||
DXGI_FORMAT InFormat;
|
||||
UINT OutFormatSupport;
|
||||
} D3D11_FEATURE_DATA_FORMAT_SUPPORT;
|
||||
# endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT
|
||||
|
||||
# ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT2
|
||||
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2
|
||||
{
|
||||
DXGI_FORMAT InFormat;
|
||||
UINT OutFormatSupport2;
|
||||
} D3D11_FEATURE_DATA_FORMAT_SUPPORT2;
|
||||
# endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT2
|
||||
#endif // __MINGW32__
|
||||
|
||||
namespace bgfx { namespace d3d11
|
||||
{
|
||||
|
24
3rdparty/bgfx/src/renderer_d3d9.cpp
vendored
24
3rdparty/bgfx/src/renderer_d3d9.cpp
vendored
@ -380,20 +380,22 @@ namespace bgfx { namespace d3d9
|
||||
g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId;
|
||||
g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId;
|
||||
|
||||
if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId)
|
||||
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
|
||||
&& ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
|
||||
if (D3DADAPTER_DEFAULT == m_adapter)
|
||||
{
|
||||
m_adapter = ii;
|
||||
}
|
||||
if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId)
|
||||
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
|
||||
&& ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
|
||||
{
|
||||
m_adapter = ii;
|
||||
}
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_PERFHUD
|
||||
if (0 != strstr(desc.Description, "PerfHUD") )
|
||||
{
|
||||
m_adapter = ii;
|
||||
m_deviceType = D3DDEVTYPE_REF;
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
|
||||
&& 0 != strstr(desc.Description, "PerfHUD"))
|
||||
{
|
||||
m_adapter = ii;
|
||||
m_deviceType = D3DDEVTYPE_REF;
|
||||
}
|
||||
}
|
||||
#endif // BGFX_CONFIG_DEBUG_PERFHUD
|
||||
}
|
||||
}
|
||||
|
||||
|
20
3rdparty/bgfx/src/renderer_gl.cpp
vendored
20
3rdparty/bgfx/src/renderer_gl.cpp
vendored
@ -516,6 +516,26 @@ namespace bgfx { namespace gl
|
||||
bool m_initialize;
|
||||
};
|
||||
|
||||
// Extension registry
|
||||
//
|
||||
// ANGLE:
|
||||
// https://github.com/google/angle/tree/master/extensions
|
||||
//
|
||||
// CHROMIUM:
|
||||
// https://chromium.googlesource.com/chromium/src.git/+/refs/heads/git-svn/gpu/GLES2/extensions/CHROMIUM
|
||||
//
|
||||
// EGL:
|
||||
// https://www.khronos.org/registry/egl/extensions/
|
||||
//
|
||||
// GL:
|
||||
// https://www.opengl.org/registry/
|
||||
//
|
||||
// GLES:
|
||||
// https://www.khronos.org/registry/gles/extensions/
|
||||
//
|
||||
// WEBGL:
|
||||
// https://www.khronos.org/registry/webgl/extensions/
|
||||
//
|
||||
static Extension s_extension[] =
|
||||
{
|
||||
{ "AMD_conservative_depth", false, true },
|
||||
|
9
3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
vendored
9
3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
vendored
@ -8,6 +8,13 @@
|
||||
#if SHADERC_CONFIG_DIRECT3D11
|
||||
|
||||
#include <d3dcompiler.h>
|
||||
#include <d3d11shader.h>
|
||||
|
||||
#ifndef D3D_SVF_USED
|
||||
# define D3D_SVF_USED 2
|
||||
#endif // D3D_SVF_USED
|
||||
|
||||
static const GUID GUID_ID3D11ShaderReflection = { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } };
|
||||
|
||||
struct RemapInputSemantic
|
||||
{
|
||||
@ -202,7 +209,7 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
|
||||
ID3D11ShaderReflection* reflect = NULL;
|
||||
hr = D3DReflect(code->GetBufferPointer()
|
||||
, code->GetBufferSize()
|
||||
, IID_ID3D11ShaderReflection
|
||||
, GUID_ID3D11ShaderReflection
|
||||
, (void**)&reflect
|
||||
);
|
||||
if (FAILED(hr) )
|
||||
|
30
3rdparty/bx/scripts/toolchain.lua
vendored
30
3rdparty/bx/scripts/toolchain.lua
vendored
@ -19,6 +19,7 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "asmjs", "Emscripten/asm.js" },
|
||||
{ "freebsd", "FreeBSD" },
|
||||
{ "linux-gcc", "Linux (GCC compiler)" },
|
||||
{ "linux-gcc-5", "Linux (GCC-5 compiler)" },
|
||||
{ "linux-clang", "Linux (Clang compiler)" },
|
||||
{ "ios-arm", "iOS - ARM" },
|
||||
{ "ios-simulator", "iOS - Simulator" },
|
||||
@ -164,6 +165,12 @@ function toolchain(_buildDir, _libDir)
|
||||
elseif "linux-gcc" == _OPTIONS["gcc"] then
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
|
||||
|
||||
elseif "linux-gcc-5" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "gcc-5"
|
||||
premake.gcc.cxx = "g++-5"
|
||||
premake.gcc.ar = "ar"
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
|
||||
|
||||
elseif "linux-clang" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "clang"
|
||||
premake.gcc.cxx = "clang++"
|
||||
@ -465,13 +472,26 @@ function toolchain(_buildDir, _libDir)
|
||||
}
|
||||
buildoptions { "-m64" }
|
||||
|
||||
configuration { "linux-gcc and not linux-clang" }
|
||||
configuration { "linux-clang" }
|
||||
|
||||
configuration { "linux-gcc-5" }
|
||||
buildoptions {
|
||||
-- "-fno-omit-frame-pointer",
|
||||
-- "-fsanitize=address",
|
||||
-- "-fsanitize=undefined",
|
||||
-- "-fsanitize=float-divide-by-zero",
|
||||
-- "-fsanitize=float-cast-overflow",
|
||||
}
|
||||
links {
|
||||
-- "asan",
|
||||
-- "ubsan",
|
||||
}
|
||||
|
||||
configuration { "linux-g*" }
|
||||
buildoptions {
|
||||
"-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
|
||||
}
|
||||
|
||||
configuration { "linux-clang" }
|
||||
|
||||
configuration { "linux-*" }
|
||||
buildoptions {
|
||||
"-msse2",
|
||||
@ -489,7 +509,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wl,--gc-sections",
|
||||
}
|
||||
|
||||
configuration { "linux-gcc", "x32" }
|
||||
configuration { "linux-g*", "x32" }
|
||||
targetdir (path.join(_buildDir, "linux32_gcc/bin"))
|
||||
objdir (path.join(_buildDir, "linux32_gcc/obj"))
|
||||
libdirs { path.join(_libDir, "lib/linux32_gcc") }
|
||||
@ -497,7 +517,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-m32",
|
||||
}
|
||||
|
||||
configuration { "linux-gcc", "x64" }
|
||||
configuration { "linux-g*", "x64" }
|
||||
targetdir (path.join(_buildDir, "linux64_gcc/bin"))
|
||||
objdir (path.join(_buildDir, "linux64_gcc/obj"))
|
||||
libdirs { path.join(_libDir, "lib/linux64_gcc") }
|
||||
|
@ -449,13 +449,13 @@ project "bgfx"
|
||||
MAME_DIR .. "3rdparty/bgfx/3rdparty",
|
||||
MAME_DIR .. "3rdparty/bx/include",
|
||||
MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
|
||||
MAME_DIR .. "3rdparty/dxsdk/Include",
|
||||
}
|
||||
|
||||
includeosd()
|
||||
|
||||
configuration { "vs*" }
|
||||
includedirs {
|
||||
MAME_DIR .. "3rdparty/dxsdk/Include",
|
||||
MAME_DIR .. "3rdparty/bx/include/compat/msvc",
|
||||
}
|
||||
configuration { "mingw*" }
|
||||
|
Loading…
Reference in New Issue
Block a user