Previous 199869 Revisions Next

r36875 Wednesday 1st April, 2015 at 10:45:19 UTC by Miodrag Milanović
Update to latest bgfx and fix for latest mingw releases (nw)
[3rdparty/bgfx]makefile
[3rdparty/bgfx/3rdparty/stb]stb_image.c
[3rdparty/bgfx/examples/common/nanovg]nanovg.cpp
[3rdparty/bgfx/src]renderer_d3d11.cpp renderer_d3d11.h renderer_d3d9.cpp renderer_gl.cpp
[3rdparty/bgfx/tools/shaderc]shaderc_dx11.cpp
[3rdparty/bx/scripts]toolchain.lua
[scripts/src]3rdparty.lua

trunk/3rdparty/bgfx/3rdparty/stb/stb_image.c
r245386r245387
32543254   unsigned char *tga_data;
32553255   unsigned char *tga_palette = NULL;
32563256   int i, j;
3257   unsigned char raw_data[4];
3257   unsigned char raw_data[4] = {};
32583258   int RLE_count = 0;
32593259   int RLE_repeating = 0;
32603260   int read_next_pixel = 1;
trunk/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
r245386r245387
412412   {
413413      cint.rgba[i] = c0.rgba[i] * oneminu + c1.rgba[i] * u;
414414   }
415   
415
416416   return cint;
417417}
418418
r245386r245387
934934   }
935935
936936   // Transform the current scissor rect into current transform space.
937   // If there is difference in rotation, this will be approximation.
937   // If there is difference in rotation, this will be approximation.
938938   memcpy(pxform, state->scissor.xform, sizeof(float)*6);
939939   ex = state->scissor.extent[0];
940940   ey = state->scissor.extent[1];
r245386r245387
11941194{
11951195   float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234;
11961196   float dx,dy,d2,d3;
1197   
1197
11981198   if (level > 10) return;
11991199
12001200   x12 = (x1+x2)*0.5f;
r245386r245387
12261226   x1234 = (x123+x234)*0.5f;
12271227   y1234 = (y123+y234)*0.5f;
12281228
1229   nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
1230   nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
1229   nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
1230   nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
12311231}
12321232
12331233static void nvg__flattenPaths(NVGcontext* ctx)
r245386r245387
16251625
16261626
16271627static int nvg__expandStroke(NVGcontext* ctx, float w, int lineCap, int lineJoin, float miterLimit)
1628{   
1628{
16291629   NVGpathCache* cache = ctx->cache;
16301630   NVGvertex* verts;
16311631   NVGvertex* dst;
r245386r245387
18891889{
18901890    float x0 = ctx->commandx;
18911891    float y0 = ctx->commandy;
1892    float vals[] = { NVG_BEZIERTO,
1892    float vals[] = { NVG_BEZIERTO,
18931893        x0 + 2.0f/3.0f*(cx - x0), y0 + 2.0f/3.0f*(cy - y0),
18941894        x + 2.0f/3.0f*(cx - x), y + 2.0f/3.0f*(cy - y),
18951895        x, y };
r245386r245387
19711971   float px = 0, py = 0, ptanx = 0, ptany = 0;
19721972   float vals[3 + 5*7 + 100];
19731973   int i, ndivs, nvals;
1974   int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
1974   int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
19751975
19761976   // Clamp angles
19771977   da = a1 - a0;
r245386r245387
23642364      }
23652365   }
23662366
2367   // TODO: add back-end bit to do this just once per frame.
2367   // TODO: add back-end bit to do this just once per frame.
23682368   nvg__flushTextTexture(ctx);
23692369
23702370   nvg__renderText(ctx, verts, nverts);
trunk/3rdparty/bgfx/makefile
r245386r245387
217217BUILD_PROJECT_DIR=gmake-osx
218218BUILD_OUTPUT_DIR=osx64_clang
219219BUILD_TOOLS_CONFIG=release64
220BUILD_TOOLS_SUFFIX=Release
220221EXE=
221222else
222223OS=linux
223224BUILD_PROJECT_DIR=gmake-linux
224225BUILD_OUTPUT_DIR=linux64_gcc
225226BUILD_TOOLS_CONFIG=release64
227BUILD_TOOLS_SUFFIX=Release
226228EXE=
227229endif
228230else
r245386r245387
230232BUILD_PROJECT_DIR=gmake-mingw-gcc
231233BUILD_OUTPUT_DIR=win32_mingw-gcc
232234BUILD_TOOLS_CONFIG=release32
235BUILD_TOOLS_SUFFIX=Release
233236EXE=.exe
234237endif
235238
236.build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
239tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
237240   $(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG)
241   $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
238242
239tools/bin/$(OS)/shaderc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE)
240   $(SILENT) cp $(<) $(@)
241
242.build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
243tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
243244   $(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG)
245   $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@)
244246
245tools/bin/$(OS)/geometryc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE)
246   $(SILENT) cp $(<) $(@)
247
248247tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE)
trunk/3rdparty/bgfx/src/renderer_d3d11.cpp
r245386r245387
543543               g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId;
544544               ++g_caps.numGPUs;
545545
546               if ( (BGFX_PCI_ID_NONE != g_caps.vendorId ||             0 != g_caps.deviceId)
547               &&   (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
548               &&   (               0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
546               if (NULL == m_adapter)
549547               {
550                  m_adapter = adapter;
551                  m_adapter->AddRef();
552                  m_driverType = D3D_DRIVER_TYPE_UNKNOWN;
553               }
548                  if ( (BGFX_PCI_ID_NONE != g_caps.vendorId ||             0 != g_caps.deviceId)
549                  &&   (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
550                  &&   (               0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
551                  {
552                     m_adapter = adapter;
553                     m_adapter->AddRef();
554                     m_driverType = D3D_DRIVER_TYPE_UNKNOWN;
555                  }
554556
555               if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
556               &&  0 != strstr(description, "PerfHUD") )
557               {
558                  m_adapter = adapter;
559                  m_driverType = D3D_DRIVER_TYPE_REFERENCE;
557                  if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
558                  &&  0 != strstr(description, "PerfHUD") )
559                  {
560                     m_adapter = adapter;
561                     m_driverType = D3D_DRIVER_TYPE_REFERENCE;
562                  }
560563               }
561564            }
562565
r245386r245387
696699
697700         m_numWindows = 1;
698701
702#if !defined(__MINGW32__)
699703         if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
700704         {
701705            ID3D11InfoQueue* infoQueue;
r245386r245387
727731               setGraphicsDebuggerPresent(true);
728732            }
729733         }
734#endif // __MINGW__
730735
731736         UniformHandle handle = BGFX_INVALID_HANDLE;
732737         for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii)
trunk/3rdparty/bgfx/src/renderer_d3d11.h
r245386r245387
4949#   define D3D_FEATURE_LEVEL_11_1 D3D_FEATURE_LEVEL(0xb100)
5050#endif // D3D_FEATURE_LEVEL_11_1
5151
52#if defined(__MINGW32__)
5253// MinGW Linux/Wine missing defines...
53#ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
54#   define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8
55#endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
54#   ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
55#      define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8
56#   endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
5657
57#ifndef D3D11_PS_CS_UAV_REGISTER_COUNT
58#   define D3D11_PS_CS_UAV_REGISTER_COUNT 8
59#endif // D3D11_PS_CS_UAV_REGISTER_COUNT
58#   ifndef D3D11_PS_CS_UAV_REGISTER_COUNT
59#      define D3D11_PS_CS_UAV_REGISTER_COUNT 8
60#   endif // D3D11_PS_CS_UAV_REGISTER_COUNT
6061
61#ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
62#   define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8
63#endif
62#   ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT
63#      define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8
64#   endif
6465
65#ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
66#   define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
67#endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
66#   ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
67#      define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8
68#   endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
6869
69#ifndef D3D11_APPEND_ALIGNED_ELEMENT
70#   define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
71#endif // D3D11_APPEND_ALIGNED_ELEMENT
70#   ifndef D3D11_APPEND_ALIGNED_ELEMENT
71#      define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
72#   endif // D3D11_APPEND_ALIGNED_ELEMENT
7273
74#   ifndef D3D11_REQ_MAXANISOTROPY
75#      define   D3D11_REQ_MAXANISOTROPY   16
76#   endif // D3D11_REQ_MAXANISOTROPY
77
78#   ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT
79typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT
80{
81   DXGI_FORMAT InFormat;
82   UINT OutFormatSupport;
83} D3D11_FEATURE_DATA_FORMAT_SUPPORT;
84#   endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT
85
86#   ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT2
87typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2
88{
89   DXGI_FORMAT InFormat;
90   UINT OutFormatSupport2;
91} D3D11_FEATURE_DATA_FORMAT_SUPPORT2;
92#   endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT2
93#endif // __MINGW32__
94
7395namespace bgfx { namespace d3d11
7496{
7597   struct BufferD3D11
trunk/3rdparty/bgfx/src/renderer_d3d9.cpp
r245386r245387
365365            D3DADAPTER_IDENTIFIER9 desc;
366366            HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &desc);
367367            if (SUCCEEDED(hr) )
368            {
368            {         
369369               BX_TRACE("Adapter #%d", ii);
370370               BX_TRACE("\tDriver: %s", desc.Driver);
371371               BX_TRACE("\tDescription: %s", desc.Description);
r245386r245387
380380               g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId;
381381               g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId;
382382
383               if ( (BGFX_PCI_ID_NONE != g_caps.vendorId ||             0 != g_caps.deviceId)
384               &&   (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
385               &&   (               0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
383               if (D3DADAPTER_DEFAULT == m_adapter)
386384               {
387                  m_adapter = ii;
388               }
385                  if ( (BGFX_PCI_ID_NONE != g_caps.vendorId ||             0 != g_caps.deviceId)
386                  &&   (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId)
387                  &&   (               0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) )
388                  {
389                     m_adapter = ii;
390                  }
389391
390#if BGFX_CONFIG_DEBUG_PERFHUD
391               if (0 != strstr(desc.Description, "PerfHUD") )
392               {
393                  m_adapter = ii;
394                  m_deviceType = D3DDEVTYPE_REF;
392                  if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
393                  &&  0 != strstr(desc.Description, "PerfHUD"))
394                  {
395                     m_adapter = ii;
396                     m_deviceType = D3DDEVTYPE_REF;
397                  }
395398               }
396#endif // BGFX_CONFIG_DEBUG_PERFHUD
397399            }
398400         }
399401
trunk/3rdparty/bgfx/src/renderer_gl.cpp
r245386r245387
516516      bool m_initialize;
517517   };
518518
519   // Extension registry
520   //
521   // ANGLE:
522   // https://github.com/google/angle/tree/master/extensions
523   //
524   // CHROMIUM:
525   // https://chromium.googlesource.com/chromium/src.git/+/refs/heads/git-svn/gpu/GLES2/extensions/CHROMIUM
526   //
527   // EGL:
528   // https://www.khronos.org/registry/egl/extensions/
529   //
530   // GL:
531   // https://www.opengl.org/registry/
532   //
533   // GLES:
534   // https://www.khronos.org/registry/gles/extensions/
535   //
536   // WEBGL:
537   // https://www.khronos.org/registry/webgl/extensions/
538   //
519539   static Extension s_extension[] =
520540   {
521541      { "AMD_conservative_depth",                false,                             true  },
trunk/3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
r245386r245387
88#if SHADERC_CONFIG_DIRECT3D11
99
1010#include <d3dcompiler.h>
11#include <d3d11shader.h>
1112
13#ifndef D3D_SVF_USED
14#   define D3D_SVF_USED 2
15#endif // D3D_SVF_USED
16
17static const GUID GUID_ID3D11ShaderReflection = { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } };
18
1219struct RemapInputSemantic
1320{
1421   bgfx::Attrib::Enum m_attr;
r245386r245387
202209   ID3D11ShaderReflection* reflect = NULL;
203210   hr = D3DReflect(code->GetBufferPointer()
204211      , code->GetBufferSize()
205      , IID_ID3D11ShaderReflection
212      , GUID_ID3D11ShaderReflection
206213      , (void**)&reflect
207214      );
208215   if (FAILED(hr) )
r245386r245387
370377      ID3DBlob* stripped;
371378      hr = D3DStripShader(code->GetBufferPointer()
372379         , code->GetBufferSize()
373         , D3DCOMPILER_STRIP_REFLECTION_DATA   
380         , D3DCOMPILER_STRIP_REFLECTION_DATA
374381         | D3DCOMPILER_STRIP_TEST_BLOBS
375382         , &stripped
376383         );
r245386r245387
437444   return false;
438445}
439446
440#endif // SHADERC_CONFIG_DIRECT3D11
No newline at end of file
447#endif // SHADERC_CONFIG_DIRECT3D11
trunk/3rdparty/bx/scripts/toolchain.lua
r245386r245387
1919         { "asmjs",         "Emscripten/asm.js"      },
2020         { "freebsd",       "FreeBSD"                },
2121         { "linux-gcc",     "Linux (GCC compiler)"   },
22         { "linux-gcc-5",   "Linux (GCC-5 compiler)" },
2223         { "linux-clang",   "Linux (Clang compiler)" },
2324         { "ios-arm",       "iOS - ARM"              },
2425         { "ios-simulator", "iOS - Simulator"        },
r245386r245387
164165      elseif "linux-gcc" == _OPTIONS["gcc"] then
165166         location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
166167
168      elseif "linux-gcc-5" == _OPTIONS["gcc"] then
169         premake.gcc.cc  = "gcc-5"
170         premake.gcc.cxx = "g++-5"
171         premake.gcc.ar  = "ar"
172         location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
173
167174      elseif "linux-clang" == _OPTIONS["gcc"] then
168175         premake.gcc.cc  = "clang"
169176         premake.gcc.cxx = "clang++"
r245386r245387
465472      }
466473      buildoptions { "-m64" }
467474
468   configuration { "linux-gcc and not linux-clang" }
475   configuration { "linux-clang" }
476
477   configuration { "linux-gcc-5" }
469478      buildoptions {
479--         "-fno-omit-frame-pointer",
480--         "-fsanitize=address",
481--         "-fsanitize=undefined",
482--         "-fsanitize=float-divide-by-zero",
483--         "-fsanitize=float-cast-overflow",
484      }
485      links {
486--         "asan",
487--         "ubsan",
488      }
489
490   configuration { "linux-g*" }
491      buildoptions {
470492         "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
471493      }
472494
473   configuration { "linux-clang" }
474
475495   configuration { "linux-*" }
476496      buildoptions {
477497         "-msse2",
r245386r245387
489509         "-Wl,--gc-sections",
490510      }
491511
492   configuration { "linux-gcc", "x32" }
512   configuration { "linux-g*", "x32" }
493513      targetdir (path.join(_buildDir, "linux32_gcc/bin"))
494514      objdir (path.join(_buildDir, "linux32_gcc/obj"))
495515      libdirs { path.join(_libDir, "lib/linux32_gcc") }
r245386r245387
497517         "-m32",
498518      }
499519
500   configuration { "linux-gcc", "x64" }
520   configuration { "linux-g*", "x64" }
501521      targetdir (path.join(_buildDir, "linux64_gcc/bin"))
502522      objdir (path.join(_buildDir, "linux64_gcc/obj"))
503523      libdirs { path.join(_libDir, "lib/linux64_gcc") }
trunk/scripts/src/3rdparty.lua
r245386r245387
449449      MAME_DIR .. "3rdparty/bgfx/3rdparty",
450450      MAME_DIR .. "3rdparty/bx/include",
451451      MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
452      MAME_DIR .. "3rdparty/dxsdk/Include",
453452   }
454453
455454   includeosd()
456455
457456   configuration { "vs*" }
458457      includedirs {
458         MAME_DIR .. "3rdparty/dxsdk/Include",
459459         MAME_DIR .. "3rdparty/bx/include/compat/msvc",
460460      }
461461   configuration { "mingw*" }


Previous 199869 Revisions Next


© 1997-2024 The MAME Team