summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-04-01 12:45:19 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2015-04-01 12:45:19 +0200
commit26214cc6ec6f95c9a8c7caa44b90bbbf0bc3bf05 (patch)
tree1ea90d52f0a09b2b7bbd9a913cd8f8e6142a37c6 /3rdparty
parent33387befdb83b2fee006d7f785ce86d3ac24bae6 (diff)
Update to latest bgfx and fix for latest mingw releases (nw)
Diffstat (limited to '3rdparty')
-rw-r--r--3rdparty/bgfx/3rdparty/stb/stb_image.c2
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg.cpp18
-rw-r--r--3rdparty/bgfx/makefile15
-rw-r--r--3rdparty/bgfx/src/renderer_d3d11.cpp29
-rw-r--r--3rdparty/bgfx/src/renderer_d3d11.h52
-rw-r--r--3rdparty/bgfx/src/renderer_d3d9.cpp26
-rw-r--r--3rdparty/bgfx/src/renderer_gl.cpp20
-rw-r--r--3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp13
-rw-r--r--3rdparty/bx/scripts/toolchain.lua30
9 files changed, 140 insertions, 65 deletions
diff --git a/3rdparty/bgfx/3rdparty/stb/stb_image.c b/3rdparty/bgfx/3rdparty/stb/stb_image.c
index faa463732e8..9431567ec2a 100644
--- a/3rdparty/bgfx/3rdparty/stb/stb_image.c
+++ b/3rdparty/bgfx/3rdparty/stb/stb_image.c
@@ -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;
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
index bb0e6bb3571..7c472f2664b 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
@@ -412,7 +412,7 @@ NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u)
{
cint.rgba[i] = c0.rgba[i] * oneminu + c1.rgba[i] * u;
}
-
+
return cint;
}
@@ -934,7 +934,7 @@ void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h)
}
// Transform the current scissor rect into current transform space.
- // If there is difference in rotation, this will be approximation.
+ // If there is difference in rotation, this will be approximation.
memcpy(pxform, state->scissor.xform, sizeof(float)*6);
ex = state->scissor.extent[0];
ey = state->scissor.extent[1];
@@ -1194,7 +1194,7 @@ static void nvg__tesselateBezier(NVGcontext* ctx,
{
float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234;
float dx,dy,d2,d3;
-
+
if (level > 10) return;
x12 = (x1+x2)*0.5f;
@@ -1226,8 +1226,8 @@ static void nvg__tesselateBezier(NVGcontext* ctx,
x1234 = (x123+x234)*0.5f;
y1234 = (y123+y234)*0.5f;
- nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
- nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
+ nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
+ nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
}
static void nvg__flattenPaths(NVGcontext* ctx)
@@ -1625,7 +1625,7 @@ static void nvg__calculateJoins(NVGcontext* ctx, float w, int lineJoin, float mi
static int nvg__expandStroke(NVGcontext* ctx, float w, int lineCap, int lineJoin, float miterLimit)
-{
+{
NVGpathCache* cache = ctx->cache;
NVGvertex* verts;
NVGvertex* dst;
@@ -1889,7 +1889,7 @@ void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y)
{
float x0 = ctx->commandx;
float y0 = ctx->commandy;
- float vals[] = { NVG_BEZIERTO,
+ float vals[] = { NVG_BEZIERTO,
x0 + 2.0f/3.0f*(cx - x0), y0 + 2.0f/3.0f*(cy - y0),
x + 2.0f/3.0f*(cx - x), y + 2.0f/3.0f*(cy - y),
x, y };
@@ -1971,7 +1971,7 @@ void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, in
float px = 0, py = 0, ptanx = 0, ptany = 0;
float vals[3 + 5*7 + 100];
int i, ndivs, nvals;
- int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
+ int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
// Clamp angles
da = a1 - a0;
@@ -2364,7 +2364,7 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char*
}
}
- // TODO: add back-end bit to do this just once per frame.
+ // TODO: add back-end bit to do this just once per frame.
nvg__flushTextTexture(ctx);
nvg__renderText(ctx, verts, nverts);
diff --git a/3rdparty/bgfx/makefile b/3rdparty/bgfx/makefile
index 46848cd3dbf..4b51342bab2 100644
--- a/3rdparty/bgfx/makefile
+++ b/3rdparty/bgfx/makefile
@@ -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)
diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp
index 75311778424..c69424ca7ab 100644
--- a/3rdparty/bgfx/src/renderer_d3d11.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d11.cpp
@@ -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)
diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h
index 296121ce30a..e3a6b7d9bc8 100644
--- a/3rdparty/bgfx/src/renderer_d3d11.h
+++ b/3rdparty/bgfx/src/renderer_d3d11.h
@@ -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_APPEND_ALIGNED_ELEMENT
+# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
+# endif // D3D11_APPEND_ALIGNED_ELEMENT
-#ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
-# define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
-#endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
+# ifndef D3D11_REQ_MAXANISOTROPY
+# define D3D11_REQ_MAXANISOTROPY 16
+# endif // D3D11_REQ_MAXANISOTROPY
-#ifndef D3D11_APPEND_ALIGNED_ELEMENT
-# define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
-#endif // D3D11_APPEND_ALIGNED_ELEMENT
+# 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
{
diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp
index a6370f08f28..b31e25d6f45 100644
--- a/3rdparty/bgfx/src/renderer_d3d9.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d9.cpp
@@ -365,7 +365,7 @@ namespace bgfx { namespace d3d9
D3DADAPTER_IDENTIFIER9 desc;
HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &desc);
if (SUCCEEDED(hr) )
- {
+ {
BX_TRACE("Adapter #%d", ii);
BX_TRACE("\tDriver: %s", desc.Driver);
BX_TRACE("\tDescription: %s", desc.Description);
@@ -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
}
}
diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp
index 453b8d9b9e0..c35e9c5a30f 100644
--- a/3rdparty/bgfx/src/renderer_gl.cpp
+++ b/3rdparty/bgfx/src/renderer_gl.cpp
@@ -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 },
diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
index d9ffab61102..e1f0d90ec10 100644
--- a/3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
+++ b/3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
@@ -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) )
@@ -370,7 +377,7 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
ID3DBlob* stripped;
hr = D3DStripShader(code->GetBufferPointer()
, code->GetBufferSize()
- , D3DCOMPILER_STRIP_REFLECTION_DATA
+ , D3DCOMPILER_STRIP_REFLECTION_DATA
| D3DCOMPILER_STRIP_TEST_BLOBS
, &stripped
);
@@ -437,4 +444,4 @@ bool compileHLSLShaderDx11(bx::CommandLine& _cmdLine, const std::string& _code,
return false;
}
-#endif // SHADERC_CONFIG_DIRECT3D11 \ No newline at end of file
+#endif // SHADERC_CONFIG_DIRECT3D11
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua
index 8221d94a641..2d3f0817c7b 100644
--- a/3rdparty/bx/scripts/toolchain.lua
+++ b/3rdparty/bx/scripts/toolchain.lua
@@ -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,12 +472,25 @@ function toolchain(_buildDir, _libDir)
}
buildoptions { "-m64" }
- configuration { "linux-gcc and not linux-clang" }
+ configuration { "linux-clang" }
+
+ configuration { "linux-gcc-5" }
buildoptions {
- "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
+-- "-fno-omit-frame-pointer",
+-- "-fsanitize=address",
+-- "-fsanitize=undefined",
+-- "-fsanitize=float-divide-by-zero",
+-- "-fsanitize=float-cast-overflow",
+ }
+ links {
+-- "asan",
+-- "ubsan",
}
- configuration { "linux-clang" }
+ configuration { "linux-g*" }
+ buildoptions {
+ "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
+ }
configuration { "linux-*" }
buildoptions {
@@ -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") }