Previous 199869 Revisions Next

r36653 Thursday 26th March, 2015 at 07:14:29 UTC by Miodrag Milanović
updated to latest 3rdparty
[3rdparty/bgfx]README.md
[3rdparty/bgfx/3rdparty/ocornut-imgui]imgui.cpp
[3rdparty/bgfx/examples/common/entry]entry_glfw.cpp* entry_osx.mm entry_p.h
[3rdparty/bgfx/examples/runtime].gitignore
[3rdparty/bgfx/include]bgfxdefines.h bgfxplatform.h
[3rdparty/bgfx/scripts]bgfx.lua example-common.lua genie.lua
[3rdparty/bgfx/src]amalgamated.cpp* bgfx.cpp bgfx_p.h glcontext_eagl.h glcontext_eagl.mm glcontext_egl.cpp glcontext_egl.h glcontext_glx.cpp glcontext_glx.h glcontext_nsgl.h glcontext_nsgl.mm glcontext_ppapi.cpp glcontext_ppapi.h glcontext_wgl.cpp glcontext_wgl.h image.cpp ovr.h renderdoc.h renderer.h renderer_d3d11.cpp renderer_d3d11.h renderer_d3d12.cpp renderer_d3d9.cpp renderer_d3d9.h renderer_gl.cpp renderer_gl.h renderer_null.cpp renderer_vk.cpp
[3rdparty/bgfx/tools/geometryc]geometryc.cpp
[3rdparty/bgfx/tools/shaderc]shaderc.cpp
[3rdparty/bx/include/bx]handlealloc.h
[3rdparty/bx/tests]unordered_map_nonpod.cpp
[3rdparty/bx/tools/bin/darwin]genie
[3rdparty/bx/tools/bin/linux]genie
[3rdparty/bx/tools/bin/windows]genie.exe
[3rdparty/genie].gitignore README.md
[3rdparty/genie/scripts]genie.lua
[3rdparty/genie/src/actions/make]make_cpp.lua
[3rdparty/genie/src/actions/vstudio]vs2010_vcxproj.lua
[3rdparty/genie/src/base]api.lua bake.lua inspect.lua table.lua
[3rdparty/genie/src/host]scripts.c

trunk/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
r245164r245165
350350#pragma clang diagnostic ignored "-Wexit-time-destructors"  // warning : declaration requires an exit-time destructor       // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
351351#pragma clang diagnostic ignored "-Wglobal-constructors"    // warning : declaration requires a global destructor           // similar to above, not sure what the exact difference it.
352352#pragma clang diagnostic ignored "-Wsign-conversion"        // warning : implicit conversion changes signedness             //
353#endif
354#ifdef __GNUC__
353#pragma clang diagnostic ignored "-Wunused-parameter"         // warning: unused parameter ‘xxxx’
354#elif defined(__GNUC__)
355355#pragma GCC diagnostic ignored "-Wunused-function"          // warning: 'xxxx' defined but not used
356356#pragma GCC diagnostic ignored "-Wunused-parameter"         // warning: unused parameter ‘xxxx’
357357#pragma GCC diagnostic ignored "-Wtype-limits"              // warning: comparison is always true due to limited range of data type
trunk/3rdparty/bgfx/README.md
r245164r245165
432432   linux-release32, nacl-debug64, nacl-arm-debug, pnacl-release,
433433   android-release, etc.
434434
435Amalgamated build
436-----------------
437
438For ease of integration to other build system bgfx library can be built with
439single .cpp file. It's only necessary to build [src/amalgamated.cpp](https://github.com/bkaradzic/bgfx/blob/master/src/amalgamated.cpp)
440inside different build system.
441
435442OculusVR integration
436443--------------------
437444
r245164r245165
568575
569576   genie --with-sdl vs2012
570577
578**NOTE** Special care is necessary to make custom windowing to work with
579multithreaded renderer. Each platform has rules about where renderer can be and
580how multithreading interacts with context/device. To disable multithreaded
581render use `BGFX_CONFIG_MULTITHREDED=0` preprocessor define.
582
571583Tools
572584-----
573585
trunk/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
r0r245165
1/*
2 * Copyright 2011-2015 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "entry_p.h"
7
8#if ENTRY_CONFIG_USE_GLFW
9
10#define GLFW_DLL
11#include <GLFW/glfw3.h>
12#include <bgfxplatform.h>
13#include "dbg.h"
14
15// This is just trivial implementation of GLFW3 integration.
16// It's here just for testing purpose.
17
18namespace entry
19{
20   static void errorCb(int _error, const char* _description)
21   {
22      DBG("GLFW error %d: %s", _error, _description);
23   }
24
25   struct Context
26   {
27      Context()
28      {
29      }
30
31      int run(int _argc, char** _argv)
32      {
33         glfwSetErrorCallback(errorCb);
34
35         glfwInit();
36         m_window = glfwCreateWindow(1280, 720, "bgfx", NULL, NULL);
37         glfwMakeContextCurrent(m_window);
38
39         glfwSetKeyCallback(m_window, keyCb);
40
41         bgfx::glfwSetWindow(m_window);
42         int result = main(_argc, _argv);
43
44         glfwDestroyWindow(m_window);
45         glfwTerminate();
46         return result;
47      }
48
49      static void keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods);
50
51      EventQueue m_eventQueue;
52
53      GLFWwindow* m_window;
54   };
55
56   Context s_ctx;
57
58   void Context::keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods)
59   {
60      BX_UNUSED(_window, _scancode, _mods);
61      if (_key    == GLFW_KEY_Q
62      &&  _action == GLFW_PRESS
63      &&  _mods   == GLFW_MOD_CONTROL)
64      {
65         s_ctx.m_eventQueue.postExitEvent();
66      }
67   }
68
69   const Event* poll()
70   {
71      glfwPollEvents();
72
73      if (glfwWindowShouldClose(s_ctx.m_window) )
74      {
75         s_ctx.m_eventQueue.postExitEvent();
76      }
77      return s_ctx.m_eventQueue.poll();
78   }
79
80   const Event* poll(WindowHandle _handle)
81   {
82      return s_ctx.m_eventQueue.poll(_handle);
83   }
84
85   void release(const Event* _event)
86   {
87      s_ctx.m_eventQueue.release(_event);
88   }
89
90   WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title)
91   {
92      BX_UNUSED(_x, _y, _width, _height, _flags, _title);
93      WindowHandle handle = { UINT16_MAX };
94      return handle;
95   }
96
97   void destroyWindow(WindowHandle _handle)
98   {
99      BX_UNUSED(_handle);
100   }
101
102   void setWindowPos(WindowHandle _handle, int32_t _x, int32_t _y)
103   {
104      BX_UNUSED(_handle, _x, _y);
105   }
106
107   void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height)
108   {
109      BX_UNUSED(_handle, _width, _height);
110   }
111
112   void setWindowTitle(WindowHandle _handle, const char* _title)
113   {
114      BX_UNUSED(_handle, _title);
115   }
116
117   void toggleWindowFrame(WindowHandle _handle)
118   {
119      BX_UNUSED(_handle);
120   }
121
122   void toggleFullscreen(WindowHandle _handle)
123   {
124      BX_UNUSED(_handle);
125   }
126
127   void setMouseLock(WindowHandle _handle, bool _lock)
128   {
129      BX_UNUSED(_handle, _lock);
130   }
131}
132
133int main(int _argc, char** _argv)
134{
135   using namespace entry;
136   return s_ctx.run(_argc, _argv);
137}
138
139#endif // ENTRY_CONFIG_USE_GLFW
trunk/3rdparty/bgfx/examples/common/entry/entry_osx.mm
r245164r245165
311311                     else
312312                     {
313313                        enum { ShiftMask = Modifier::LeftShift|Modifier::RightShift };
314                        const bool nonShiftModifiers = (0 != (modifiers&(~ShiftMask) ) );
315                        const bool isCharPressed = (Key::Key0 <= key && key <= Key::KeyZ) || (Key::Esc <= key && key <= Key::Minus);
316                        const bool isText = isCharPressed && !nonShiftModifiers;
317                        if (isText)
318                        {
319                           m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar);
320                           return false;
321                        }
322                        else
323                        {
324                           m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true);
325                           return false;
326                        }
314                        m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar);
315                        m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true);
316                        return false;
327317                     }
328318                  }
329319
trunk/3rdparty/bgfx/examples/common/entry/entry_p.h
r245164r245165
1717#   define ENTRY_CONFIG_USE_SDL 0
1818#endif // ENTRY_CONFIG_USE_SDL
1919
20#if !ENTRY_CONFIG_USE_SDL && \
21   !defined(ENTRY_CONFIG_USE_NATIVE)
20#ifndef ENTRY_CONFIG_USE_GLFW
21#   define ENTRY_CONFIG_USE_GLFW 0
22#endif // ENTRY_CONFIG_USE_GLFW
23
24#if !defined(ENTRY_CONFIG_USE_NATIVE) \
25   && !ENTRY_CONFIG_USE_SDL \
26   && !ENTRY_CONFIG_USE_GLFW
2227#   define ENTRY_CONFIG_USE_NATIVE 1
2328#else
2429#   define ENTRY_CONFIG_USE_NATIVE 0
trunk/3rdparty/bgfx/examples/runtime/.gitignore
r245164r245165
11*.dll
2*.so
23*.pdb
34imgui*
trunk/3rdparty/bgfx/include/bgfxdefines.h
r245164r245165
8181               | BGFX_STATE_MSAA \
8282               )
8383
84#define BGFX_STATE_ALPHA_REF(_ref) ( (uint64_t(_ref)<<BGFX_STATE_ALPHA_REF_SHIFT)&BGFX_STATE_ALPHA_REF_MASK)
85#define BGFX_STATE_POINT_SIZE(_size) ( (uint64_t(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
84#define BGFX_STATE_ALPHA_REF(_ref)   ( ( (uint64_t)(_ref )<<BGFX_STATE_ALPHA_REF_SHIFT )&BGFX_STATE_ALPHA_REF_MASK)
85#define BGFX_STATE_POINT_SIZE(_size) ( ( (uint64_t)(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
8686
8787///
88#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (0 \
89               | ( (uint64_t(_srcRGB)|(uint64_t(_dstRGB)<<4) )   ) \
90               | ( (uint64_t(_srcA  )|(uint64_t(_dstA  )<<4) )<<8) \
88#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (UINT64_C(0) \
89               | ( ( (uint64_t)(_srcRGB)|( (uint64_t)(_dstRGB)<<4) )   ) \
90               | ( ( (uint64_t)(_srcA  )|( (uint64_t)(_dstA  )<<4) )<<8) \
9191               )
9292
93#define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) (uint64_t(_rgb)|(uint64_t(_a)<<3) )
93#define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) ( (uint64_t)(_rgb)|( (uint64_t)(_a)<<3) )
9494
9595///
9696#define BGFX_STATE_BLEND_FUNC(_src, _dst)    BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst)
trunk/3rdparty/bgfx/include/bgfxplatform.h
r245164r245165
5555namespace bgfx
5656{
5757   ///
58   void x11SetDisplayWindow(void* _display, uint32_t _window);
58   void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL);
5959
6060} // namespace bgfx
6161
r245164r245165
7676namespace bgfx
7777{
7878   ///
79   void osxSetNSWindow(void* _window);
79   void osxSetNSWindow(void* _window, void* _nsgl = NULL);
8080
8181} // namespace bgfx
8282
r245164r245165
155155   {
156156#   if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
157157      ::Display* display = glfwGetX11Display();
158      ::Window window = glfwGetX11Window(_window);
159      x11SetDisplayWindow(display, window);
158      ::Window   window  = glfwGetX11Window(_window);
159      void* glx          = glfwGetGLXContext(_window);
160      x11SetDisplayWindow(display, window, glx);
160161#   elif BX_PLATFORM_OSX
161      void* id = glfwGetCocoaWindow(_window);
162      osxSetNSWindow(id);
162      void* window = glfwGetCocoaWindow(_window);
163      void* nsgl   = glfwGetNSGLContext(_window);
164      osxSetNSWindow(window, nsgl);
163165#   elif BX_PLATFORM_WINDOWS
164166      HWND hwnd = glfwGetWin32Window(_window);
165167      winSetHwnd(hwnd);
166#   endif BX_PLATFORM_WINDOWS
168#   endif // BX_PLATFORM_WINDOWS
167169   }
168170
169171} // namespace bgfx
trunk/3rdparty/bgfx/scripts/bgfx.lua
r245164r245165
2626            }
2727
2828         configuration { "linux-*" }
29            buildoptions {
29            buildoptions {
3030               "-fPIC",
3131            }
3232
r245164r245165
4242         _defines,
4343      }
4444
45      if _OPTIONS["with-glfw"] then
46         defines {
47            "BGFX_CONFIG_MULTITHREADED=0",
48         }
49      end
50
4551      if _OPTIONS["with-ovr"] then
4652         defines {
4753            "BGFX_CONFIG_USE_OVR=1",
r245164r245165
113119         path.join(BGFX_DIR, "src/**.h"),
114120      }
115121
116      excludes {
122      removefiles {
117123         path.join(BGFX_DIR, "src/**.bin.h"),
118124      }
119125
126      if _OPTIONS["with-amalgamated"] then
127         excludes {
128            path.join(BGFX_DIR, "src/bgfx.cpp"),
129            path.join(BGFX_DIR, "src/glcontext_egl.cpp"),
130            path.join(BGFX_DIR, "src/glcontext_glx.cpp"),
131            path.join(BGFX_DIR, "src/glcontext_ppapi.cpp"),
132            path.join(BGFX_DIR, "src/glcontext_wgl.cpp"),
133            path.join(BGFX_DIR, "src/image.cpp"),
134            path.join(BGFX_DIR, "src/ovr.cpp"),
135            path.join(BGFX_DIR, "src/renderdoc.cpp"),
136            path.join(BGFX_DIR, "src/renderer_d3d9.cpp"),
137            path.join(BGFX_DIR, "src/renderer_d3d11.cpp"),
138            path.join(BGFX_DIR, "src/renderer_d3d12.cpp"),
139            path.join(BGFX_DIR, "src/renderer_null.cpp"),
140            path.join(BGFX_DIR, "src/renderer_gl.cpp"),
141            path.join(BGFX_DIR, "src/renderer_vk.cpp"),
142            path.join(BGFX_DIR, "src/vertexdecl.cpp"),
143         }
144      else
145         excludes {
146            path.join(BGFX_DIR, "src/amalgamated.cpp"),
147         }
148      end
149
120150      configuration {}
121151
122152      copyLib()
trunk/3rdparty/bgfx/scripts/example-common.lua
r245164r245165
3131      }
3232   end
3333
34   if _OPTIONS["with-glfw"] then
35      defines {
36         "ENTRY_CONFIG_USE_GLFW=1",
37      }
38   end
39
3440   configuration { "mingw* or vs2008" }
3541      includedirs {
3642         "$(DXSDK_DIR)/include",
trunk/3rdparty/bgfx/scripts/genie.lua
r245164r245165
44--
55
66newoption {
7   trigger = "with-tools",
8   description = "Enable building tools.",
7   trigger = "with-amalgamated",
8   description = "Enable amalgamated build.",
99}
1010
1111newoption {
12   trigger = "with-shared-lib",
13   description = "Enable building shared library.",
12   trigger = "with-ovr",
13   description = "Enable OculusVR integration.",
1414}
1515
1616newoption {
r245164r245165
1919}
2020
2121newoption {
22   trigger = "with-ovr",
23   description = "Enable OculusVR integration.",
22   trigger = "with-glfw",
23   description = "Enable GLFW entry.",
2424}
2525
26newoption {
27   trigger = "with-shared-lib",
28   description = "Enable building shared library.",
29}
30
31newoption {
32   trigger = "with-tools",
33   description = "Enable building tools.",
34}
35
2636solution "bgfx"
2737   configurations {
2838      "Debug",
r245164r245165
3242   if _ACTION == "xcode4" then
3343      platforms {
3444         "Universal",
35   }
45      }
3646   else
3747      platforms {
3848         "x32",
3949         "x64",
4050--         "Xbox360",
4151         "Native", -- for targets where bitness is not specified
42   }
52      }
4353   end
4454
4555   language "C++"
r245164r245165
96106      path.join(BGFX_DIR, "examples", _name, "**.h"),
97107   }
98108
109   removefiles {
110      path.join(BGFX_DIR, "examples", _name, "**.bin.h"),
111   }
112
99113   links {
100114      "bgfx",
101115      "example-common",
r245164r245165
114128      configuration {}
115129   end
116130
131   if _OPTIONS["with-glfw"] then
132      defines { "ENTRY_CONFIG_USE_GLFW=1" }
133      links   {
134         "glfw3"
135      }
136
137      configuration { "linux" }
138         links {
139            "Xrandr",
140            "Xinerama",
141            "Xi",
142            "Xxf86vm",
143            "Xcursor",
144         }
145
146      configuration { "osx" }
147         linkoptions {
148            "-framework CoreVideo",
149            "-framework IOKit",
150         }
151
152      configuration {}
153   end
154
117155   if _OPTIONS["with-ovr"] then
118156      links   {
119157         "winmm",
trunk/3rdparty/bgfx/src/amalgamated.cpp
r0r245165
1/*
2 * Copyright 2011-2015 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx.cpp"
7#include "glcontext_egl.cpp"
8#include "glcontext_glx.cpp"
9#include "glcontext_ppapi.cpp"
10#include "glcontext_wgl.cpp"
11#include "image.cpp"
12#include "ovr.cpp"
13#include "renderdoc.cpp"
14#include "renderer_d3d9.cpp"
15#include "renderer_d3d11.cpp"
16#include "renderer_d3d12.cpp"
17#include "renderer_null.cpp"
18#include "renderer_gl.cpp"
19#include "renderer_vk.cpp"
20#include "vertexdecl.cpp"
trunk/3rdparty/bgfx/src/bgfx.cpp
r245164r245165
1919#   define BGFX_CHECK_RENDER_THREAD()
2020#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
2121
22#define BGFX_CHECK_HANDLE(_handle, _max) \
23         BX_CHECK(isValid(_handle) \
24            && _handle.idx < _max \
25            , "Invalid handle. %d (< %d " #_max ")" \
26            , _handle.idx \
27            , _max \
28            );
29
3022#if BX_PLATFORM_ANDROID
3123   ::ANativeWindow* g_bgfxAndroidWindow = NULL;
3224
r245164r245165
4436#elif BX_PLATFORM_LINUX
4537   void*    g_bgfxX11Display;
4638   uint32_t g_bgfxX11Window;
39   void*    g_bgfxGLX;
4740
48   void x11SetDisplayWindow(void* _display, uint32_t _window)
41   void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx)
4942   {
5043      g_bgfxX11Display = _display;
5144      g_bgfxX11Window  = _window;
45      g_bgfxGLX        = _glx;
5246   }
5347#elif BX_PLATFORM_OSX
5448   void* g_bgfxNSWindow = NULL;
49   void* g_bgfxNSGL = NULL;
5550
56   void osxSetNSWindow(void* _window)
51   void osxSetNSWindow(void* _window, void* _nsgl)
5752   {
5853      g_bgfxNSWindow = _window;
54      g_bgfxNSGL     = _nsgl;
5955   }
6056#elif BX_PLATFORM_WINDOWS
6157   ::HWND g_bgfxHwnd = NULL;
r245164r245165
13321328   typedef RendererContextI* (*RendererCreateFn)();
13331329   typedef void (*RendererDestroyFn)();
13341330
1335   extern RendererContextI* rendererCreateNULL();
1336   extern void rendererDestroyNULL();
1331#define BGFX_RENDERER_CONTEXT(_namespace) \
1332         namespace _namespace \
1333         { \
1334            extern RendererContextI* rendererCreate(); \
1335            extern void rendererDestroy(); \
1336         }
13371337
1338   extern RendererContextI* rendererCreateGL();
1339   extern void rendererDestroyGL();
1338   BGFX_RENDERER_CONTEXT(noop);
1339   BGFX_RENDERER_CONTEXT(d3d9);
1340   BGFX_RENDERER_CONTEXT(d3d11);
1341   BGFX_RENDERER_CONTEXT(d3d12);
1342   BGFX_RENDERER_CONTEXT(gl);
1343   BGFX_RENDERER_CONTEXT(vk);
13401344
1341   extern RendererContextI* rendererCreateD3D9();
1342   extern void rendererDestroyD3D9();
1345#undef BGFX_RENDERER_CONTEXT
13431346
1344   extern RendererContextI* rendererCreateD3D11();
1345   extern void rendererDestroyD3D11();
1346
1347   extern RendererContextI* rendererCreateD3D12();
1348   extern void rendererDestroyD3D12();
1349
1350   extern RendererContextI* rendererCreateVK();
1351   extern void rendererDestroyVK();
1352
13531347   struct RendererCreator
13541348   {
13551349      RendererCreateFn  createFn;
r245164r245165
13601354
13611355   static const RendererCreator s_rendererCreator[] =
13621356   {
1363      { rendererCreateNULL,  rendererDestroyNULL,  BGFX_RENDERER_NULL_NAME,       !!BGFX_CONFIG_RENDERER_NULL       }, // Null
1364      { rendererCreateD3D9,  rendererDestroyD3D9,  BGFX_RENDERER_DIRECT3D9_NAME,  !!BGFX_CONFIG_RENDERER_DIRECT3D9  }, // Direct3D9
1365      { rendererCreateD3D11, rendererDestroyD3D11, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
1366      { rendererCreateD3D12, rendererDestroyD3D12, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
1367      { rendererCreateGL,    rendererDestroyGL,    BGFX_RENDERER_OPENGL_NAME,     !!BGFX_CONFIG_RENDERER_OPENGLES   }, // OpenGLES
1368      { rendererCreateGL,    rendererDestroyGL,    BGFX_RENDERER_OPENGL_NAME,     !!BGFX_CONFIG_RENDERER_OPENGL     }, // OpenGL
1369      { rendererCreateVK,    rendererDestroyVK,    BGFX_RENDERER_VULKAN_NAME,     !!BGFX_CONFIG_RENDERER_VULKAN     }, // Vulkan
1357      { noop::rendererCreate,  noop::rendererDestroy,  BGFX_RENDERER_NULL_NAME,       !!BGFX_CONFIG_RENDERER_NULL       }, // Null
1358      { d3d9::rendererCreate,  d3d9::rendererDestroy,  BGFX_RENDERER_DIRECT3D9_NAME,  !!BGFX_CONFIG_RENDERER_DIRECT3D9  }, // Direct3D9
1359      { d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
1360      { d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12
1361      { gl::rendererCreate,    gl::rendererDestroy,    BGFX_RENDERER_OPENGL_NAME,     !!BGFX_CONFIG_RENDERER_OPENGLES   }, // OpenGLES
1362      { gl::rendererCreate,    gl::rendererDestroy,    BGFX_RENDERER_OPENGL_NAME,     !!BGFX_CONFIG_RENDERER_OPENGL     }, // OpenGL
1363      { vk::rendererCreate,    vk::rendererDestroy,    BGFX_RENDERER_VULKAN_NAME,     !!BGFX_CONFIG_RENDERER_VULKAN     }, // Vulkan
13701364   };
13711365   BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count);
13721366
r245164r245165
27702764   void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
27712765   {
27722766      BGFX_CHECK_MAIN_THREAD();
2773      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_UNIFORMS);
27742767      s_ctx->setUniform(_handle, _value, _num);
27752768   }
27762769
27772770   void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
27782771   {
27792772      BGFX_CHECK_MAIN_THREAD();
2780      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
27812773      s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
27822774   }
27832775
27842776   void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
27852777   {
27862778      BGFX_CHECK_MAIN_THREAD();
2787      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
27882779      s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
27892780   }
27902781
r245164r245165
28092800   void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
28102801   {
28112802      BGFX_CHECK_MAIN_THREAD();
2812      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
28132803      s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
28142804   }
28152805
28162806   void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
28172807   {
28182808      BGFX_CHECK_MAIN_THREAD();
2819      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
28202809      s_ctx->setVertexBuffer(_handle, _numVertices);
28212810   }
28222811
r245164r245165
28422831   void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
28432832   {
28442833      BGFX_CHECK_MAIN_THREAD();
2845      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
28462834      s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
28472835   }
28482836
28492837   void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
28502838   {
28512839      BGFX_CHECK_MAIN_THREAD();
2852      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
28532840      s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
28542841   }
28552842
28562843   void setProgram(ProgramHandle _handle)
28572844   {
28582845      BGFX_CHECK_MAIN_THREAD();
2859      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_PROGRAMS);
28602846      s_ctx->setProgram(_handle);
28612847   }
28622848
r245164r245165
28812867   void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)
28822868   {
28832869      BGFX_CHECK_MAIN_THREAD();
2884      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
28852870      s_ctx->setBuffer(_stage, _handle, _access);
28862871   }
28872872
28882873   void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access)
28892874   {
28902875      BGFX_CHECK_MAIN_THREAD();
2891      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
28922876      s_ctx->setBuffer(_stage, _handle, _access);
28932877   }
28942878
28952879   void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access)
28962880   {
28972881      BGFX_CHECK_MAIN_THREAD();
2898      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
28992882      s_ctx->setBuffer(_stage, _handle, _access);
29002883   }
29012884
29022885   void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access)
29032886   {
29042887      BGFX_CHECK_MAIN_THREAD();
2905      BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
29062888      s_ctx->setBuffer(_stage, _handle, _access);
29072889   }
29082890
trunk/3rdparty/bgfx/src/bgfx_p.h
r245164r245165
2929#include <string.h>
3030#include <alloca.h>
3131
32#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \
33         BX_CHECK(isValid(_handle) \
34            && _handleAlloc.isValid(_handle.idx) \
35            , "Invalid handle. %s handle: %d (max %d)" \
36            , _desc \
37            , _handle.idx \
38            , _handleAlloc.getMaxHandles() \
39            );
40
3241namespace bgfx
3342{
3443#if BX_COMPILER_CLANG_ANALYZER
r245164r245165
204213#elif BX_PLATFORM_LINUX
205214   extern void*    g_bgfxX11Display;
206215   extern uint32_t g_bgfxX11Window;
216   extern void*    g_bgfxGLX;
207217#elif BX_PLATFORM_OSX
208218   extern void* g_bgfxNSWindow;
219   extern void* g_bgfxNSGL;
209220#elif BX_PLATFORM_WINDOWS
210221   extern ::HWND g_bgfxHwnd;
211222#elif BX_PLATFORM_WINRT
r245164r245165
14181429      {
14191430         Binding& sampler = m_draw.m_bind[_stage];
14201431         sampler.m_idx    = _handle.idx;
1421         sampler.m_un.m_draw.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS) ? BGFX_SAMPLER_DEFAULT_FLAGS : _flags;
1432         sampler.m_un.m_draw.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS)
1433            ? BGFX_SAMPLER_DEFAULT_FLAGS
1434            : _flags
1435            ;
14221436
14231437         if (isValid(_sampler)
14241438         && (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) )
r245164r245165
19892003
19902004      BGFX_API_FUNC(void destroyIndexBuffer(IndexBufferHandle _handle) )
19912005      {
2006         BGFX_CHECK_HANDLE("destroyIndexBuffer", m_indexBufferHandle, _handle);
2007
19922008         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyIndexBuffer);
19932009         cmdbuf.write(_handle);
19942010         m_submit->free(_handle);
r245164r245165
20342050
20352051      BGFX_API_FUNC(void destroyVertexBuffer(VertexBufferHandle _handle) )
20362052      {
2053         BGFX_CHECK_HANDLE("destroyVertexBuffer", m_vertexBufferHandle, _handle);
2054
20372055         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexBuffer);
20382056         cmdbuf.write(_handle);
20392057         m_submit->free(_handle);
r245164r245165
21352153
21362154      BGFX_API_FUNC(void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, const Memory* _mem) )
21372155      {
2156         BGFX_CHECK_HANDLE("updateDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle);
2157
21382158         DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx];
21392159         BX_CHECK(0 == (dib.m_flags &  BGFX_BUFFER_COMPUTE_READ_WRITE), "Can't update GPU buffer from CPU.");
21402160
r245164r245165
21662186
21672187      BGFX_API_FUNC(void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle) )
21682188      {
2189         BGFX_CHECK_HANDLE("destroyDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle);
2190
21692191         m_freeDynamicIndexBufferHandle[m_numFreeDynamicIndexBufferHandles++] = _handle;
21702192      }
21712193
r245164r245165
22792301
22802302      BGFX_API_FUNC(void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem) )
22812303      {
2304         BGFX_CHECK_HANDLE("updateDynamicVertexBuffer", m_dynamicVertexBufferHandle, _handle);
2305
22822306         DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
22832307         BX_CHECK(0 == (dvb.m_flags &  BGFX_BUFFER_COMPUTE_READ_WRITE), "Can't update GPU buffer from CPU.");
22842308
r245164r245165
23112335
23122336      BGFX_API_FUNC(void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle) )
23132337      {
2338         BGFX_CHECK_HANDLE("destroyDynamicVertexBuffer", m_dynamicVertexBufferHandle, _handle);
2339
23142340         m_freeDynamicVertexBufferHandle[m_numFreeDynamicVertexBufferHandles++] = _handle;
23152341      }
23162342
r245164r245165
25932619
25942620      BGFX_API_FUNC(void destroyShader(ShaderHandle _handle) )
25952621      {
2622         BGFX_CHECK_HANDLE("destroyShader", m_shaderHandle, _handle);
2623
25962624         if (!isValid(_handle) )
25972625         {
25982626            BX_WARN(false, "Passing invalid shader handle to bgfx::destroyShader.");
r245164r245165
27042732
27052733      BGFX_API_FUNC(void destroyProgram(ProgramHandle _handle) )
27062734      {
2735         BGFX_CHECK_HANDLE("destroyProgram", m_programHandle, _handle);
2736
27072737         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyProgram);
27082738         cmdbuf.write(_handle);
27092739         m_submit->free(_handle);
r245164r245165
27692799
27702800      BGFX_API_FUNC(void destroyTexture(TextureHandle _handle) )
27712801      {
2802         BGFX_CHECK_HANDLE("destroyTexture", m_textureHandle, _handle);
2803
27722804         if (!isValid(_handle) )
27732805         {
27742806            BX_WARN(false, "Passing invalid texture handle to bgfx::destroyTexture");
r245164r245165
28322864            for (uint32_t ii = 0; ii < _num; ++ii)
28332865            {
28342866               TextureHandle texHandle = _handles[ii];
2867               BGFX_CHECK_HANDLE("createFrameBuffer texture handle", m_textureHandle, texHandle);
28352868
28362869               cmdbuf.write(texHandle);
28372870
r245164r245165
28682901
28692902      BGFX_API_FUNC(void destroyFrameBuffer(FrameBufferHandle _handle) )
28702903      {
2904         BGFX_CHECK_HANDLE("destroyFrameBuffer", m_frameBufferHandle, _handle);
2905
28712906         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyFrameBuffer);
28722907         cmdbuf.write(_handle);
28732908         m_submit->free(_handle);
r245164r245165
29512986
29522987      BGFX_API_FUNC(void destroyUniform(UniformHandle _handle) )
29532988      {
2989         BGFX_CHECK_HANDLE("destroyUniform", m_uniformHandle, _handle);
2990
29542991         UniformRef& uniform = m_uniformRef[_handle.idx];
29552992         BX_CHECK(uniform.m_refCount > 0, "Destroying already destroyed uniform %d.", _handle.idx);
29562993         int32_t refs = --uniform.m_refCount;
r245164r245165
30543091
30553092      BGFX_API_FUNC(void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) )
30563093      {
3094         BGFX_CHECK_HANDLE("setViewFrameBuffer", m_frameBufferHandle, _handle);
30573095         m_fb[_id] = _handle;
30583096      }
30593097
r245164r245165
30913129
30923130      BGFX_API_FUNC(void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap) )
30933131      {
3094         const uint32_t num = bx::uint32_min( (BGFX_CONFIG_MAX_VIEWS - _id) + _num, BGFX_CONFIG_MAX_VIEWS) - _id;
3132         const uint32_t num = bx::uint32_min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id;
30953133         if (NULL == _remap)
30963134         {
30973135            for (uint32_t ii = 0; ii < num; ++ii)
r245164r245165
31483186
31493187      BGFX_API_FUNC(void setUniform(UniformHandle _handle, const void* _value, uint16_t _num) )
31503188      {
3189         BGFX_CHECK_HANDLE("setUniform", m_uniformHandle, _handle);
31513190         UniformRef& uniform = m_uniformRef[_handle.idx];
31523191         BX_CHECK(uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num);
31533192         m_submit->writeUniform(uniform.m_type, _handle, _value, bx::uint16_min(uniform.m_num, _num) );
r245164r245165
31553194
31563195      BGFX_API_FUNC(void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) )
31573196      {
3197         BGFX_CHECK_HANDLE("setIndexBuffer", m_indexBufferHandle, _handle);
31583198         m_submit->setIndexBuffer(_handle, _firstIndex, _numIndices);
31593199      }
31603200
31613201      BGFX_API_FUNC(void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) )
31623202      {
3203         BGFX_CHECK_HANDLE("setIndexBuffer", m_dynamicIndexBufferHandle, _handle);
31633204         m_submit->setIndexBuffer(m_dynamicIndexBuffers[_handle.idx], _firstIndex, _numIndices);
31643205      }
31653206
r245164r245165
31703211
31713212      BGFX_API_FUNC(void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) )
31723213      {
3214         BGFX_CHECK_HANDLE("setVertexBuffer", m_vertexBufferHandle, _handle);
31733215         m_submit->setVertexBuffer(_handle, _startVertex, _numVertices);
31743216      }
31753217
31763218      BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) )
31773219      {
3220         BGFX_CHECK_HANDLE("setVertexBuffer", m_dynamicVertexBufferHandle, _handle);
31783221         m_submit->setVertexBuffer(m_dynamicVertexBuffers[_handle.idx], _numVertices);
31793222      }
31803223
r245164r245165
31923235
31933236      BGFX_API_FUNC(void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) )
31943237      {
3238         BGFX_CHECK_HANDLE("setInstanceDataBuffer", m_vertexBufferHandle, _handle);
31953239         const VertexBuffer& vb = m_vertexBuffers[_handle.idx];
31963240         m_submit->setInstanceDataBuffer(_handle, _startVertex, _num, vb.m_stride);
31973241      }
31983242
31993243      BGFX_API_FUNC(void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) )
32003244      {
3245         BGFX_CHECK_HANDLE("setInstanceDataBuffer", m_dynamicVertexBufferHandle, _handle);
32013246         const DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
32023247         m_submit->setInstanceDataBuffer(dvb.m_handle
32033248            , dvb.m_startVertex + _startVertex
r245164r245165
32083253
32093254      BGFX_API_FUNC(void setProgram(ProgramHandle _handle) )
32103255      {
3256         BGFX_CHECK_HANDLE("setProgram", m_programHandle, _handle);
32113257         m_submit->setProgram(_handle);
32123258      }
32133259
32143260      BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) )
32153261      {
3262         BGFX_CHECK_HANDLE("setTexture", m_textureHandle, _handle);
32163263         m_submit->setTexture(_stage, _sampler, _handle, _flags);
32173264      }
32183265
r245164r245165
32383285
32393286      BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) )
32403287      {
3288         BGFX_CHECK_HANDLE("setBuffer", m_indexBufferHandle, _handle);
32413289         m_submit->setBuffer(_stage, _handle, _access);
32423290      }
32433291
32443292      BGFX_API_FUNC(void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) )
32453293      {
3294         BGFX_CHECK_HANDLE("setBuffer", m_vertexBufferHandle, _handle);
32463295         m_submit->setBuffer(_stage, _handle, _access);
32473296      }
32483297
32493298      BGFX_API_FUNC(void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) )
32503299      {
3300         BGFX_CHECK_HANDLE("setBuffer", m_dynamicIndexBufferHandle, _handle);
32513301         const DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx];
32523302         m_submit->setBuffer(_stage, dib.m_handle, _access);
32533303      }
32543304
32553305      BGFX_API_FUNC(void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) )
32563306      {
3307         BGFX_CHECK_HANDLE("setBuffer", m_dynamicVertexBufferHandle, _handle);
32573308         const DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
32583309         m_submit->setBuffer(_stage, dvb.m_handle, _access);
32593310      }
trunk/3rdparty/bgfx/src/glcontext_eagl.h
r245164r245165
88
99#if BX_PLATFORM_IOS
1010
11namespace bgfx
11namespace bgfx { namespace gl
1212{
1313   struct SwapChainGL;
1414
r245164r245165
4848      GLuint m_colorRbo;
4949      GLuint m_depthStencilRbo;
5050   };
51} // namespace bgfx
51} /* namespace gl */ } // namespace bgfx
5252
5353#endif // BX_PLATFORM_IOS
5454
trunk/3rdparty/bgfx/src/glcontext_eagl.mm
r245164r245165
1010#   include <QuartzCore/CAEAGLLayer.h>
1111#   include "renderer_gl.h"
1212
13namespace bgfx
13namespace bgfx { namespace gl
1414{
1515#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
1616#   include "glimports.h"
r245164r245165
123123   {
124124   }
125125
126} // namespace bgfx
126} /* namespace gl */ } // namespace bgfx
127127
128128#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
trunk/3rdparty/bgfx/src/glcontext_egl.cpp
r245164r245165
2222#   define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
2323#endif // EGL_CONTEXT_MINOR_VERSION_KHR
2424
25namespace bgfx
25namespace bgfx { namespace gl
2626{
2727#if BGFX_USE_GL_DYNAMIC_LIB
2828
r245164r245165
369369#   include "glimports.h"
370370   }
371371
372} // namespace bgfx
372} /* namespace gl */ } // namespace bgfx
373373
374374#   endif // BGFX_USE_EGL
375375#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
trunk/3rdparty/bgfx/src/glcontext_egl.h
r245164r245165
1010
1111#include <EGL/egl.h>
1212
13namespace bgfx
13namespace bgfx { namespace gl
1414{
1515   struct SwapChainGL;
1616
r245164r245165
4848      EGLDisplay m_display;
4949      EGLSurface m_surface;
5050   };
51} // namespace bgfx
51} /* namespace gl */ } // namespace bgfx
5252
5353#endif // BGFX_USE_EGL
5454
trunk/3rdparty/bgfx/src/glcontext_glx.cpp
r245164r245165
1212#      define GLX_GLXEXT_PROTOTYPES
1313#      include <glx/glxext.h>
1414
15namespace bgfx
15namespace bgfx { namespace gl
1616{
1717   typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval);
1818
r245164r245165
5555   void GlContext::create(uint32_t _width, uint32_t _height)
5656   {
5757      BX_UNUSED(_width, _height);
58      XLockDisplay( (::Display*)g_bgfxX11Display);
5958
60      int major, minor;
61      bool version = glXQueryVersion( (::Display*)g_bgfxX11Display, &major, &minor);
62      BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
63      BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
64            , Fatal::UnableToInitialize
65            , "GLX version is not >=1.2 (%d.%d)."
66            , major
67            , minor
68            );
59      m_context = (GLXContext)g_bgfxGLX;
6960
70      int32_t screen = DefaultScreen( (::Display*)g_bgfxX11Display);
61      if (NULL == g_bgfxGLX)
62      {
63         XLockDisplay( (::Display*)g_bgfxX11Display);
7164
72      const char* extensions = glXQueryExtensionsString( (::Display*)g_bgfxX11Display, screen);
73      BX_TRACE("GLX extensions:");
74      dumpExtensions(extensions);
65         int major, minor;
66         bool version = glXQueryVersion( (::Display*)g_bgfxX11Display, &major, &minor);
67         BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
68         BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
69               , Fatal::UnableToInitialize
70               , "GLX version is not >=1.2 (%d.%d)."
71               , major
72               , minor
73               );
7574
76      const int attrsGlx[] =
77      {
78         GLX_RENDER_TYPE, GLX_RGBA_BIT,
79         GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
80         GLX_DOUBLEBUFFER, true,
81         GLX_RED_SIZE, 8,
82         GLX_BLUE_SIZE, 8,
83         GLX_GREEN_SIZE, 8,
84//         GLX_ALPHA_SIZE, 8,
85         GLX_DEPTH_SIZE, 24,
86         GLX_STENCIL_SIZE, 8,
87         0,
88      };
75         int32_t screen = DefaultScreen( (::Display*)g_bgfxX11Display);
8976
90      // Find suitable config
91      GLXFBConfig bestConfig = NULL;
77         const char* extensions = glXQueryExtensionsString( (::Display*)g_bgfxX11Display, screen);
78         BX_TRACE("GLX extensions:");
79         dumpExtensions(extensions);
9280
93      int numConfigs;
94      GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_bgfxX11Display, screen, attrsGlx, &numConfigs);
81         const int attrsGlx[] =
82         {
83            GLX_RENDER_TYPE, GLX_RGBA_BIT,
84            GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
85            GLX_DOUBLEBUFFER, true,
86            GLX_RED_SIZE, 8,
87            GLX_BLUE_SIZE, 8,
88            GLX_GREEN_SIZE, 8,
89            //         GLX_ALPHA_SIZE, 8,
90            GLX_DEPTH_SIZE, 24,
91            GLX_STENCIL_SIZE, 8,
92            0,
93         };
9594
96      BX_TRACE("glX num configs %d", numConfigs);
95         // Find suitable config
96         GLXFBConfig bestConfig = NULL;
9797
98      for (int ii = 0; ii < numConfigs; ++ii)
99      {
100         m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_bgfxX11Display, configs[ii]);
101         if (NULL != m_visualInfo)
98         int numConfigs;
99         GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_bgfxX11Display, screen, attrsGlx, &numConfigs);
100
101         BX_TRACE("glX num configs %d", numConfigs);
102
103         for (int ii = 0; ii < numConfigs; ++ii)
102104         {
103            BX_TRACE("---");
104            bool valid = true;
105            for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
105            m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_bgfxX11Display, configs[ii]);
106            if (NULL != m_visualInfo)
106107            {
107               int value;
108               glXGetFBConfigAttrib( (::Display*)g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
109               BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
110                     , ii
111                     , numConfigs
112                     , attr/2
113                     , attrsGlx[attr]
114                     , value
115                     , attrsGlx[attr + 1]
116                     , value < attrsGlx[attr + 1] ? " *" : ""
117                     );
108               BX_TRACE("---");
109               bool valid = true;
110               for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
111               {
112                  int value;
113                  glXGetFBConfigAttrib( (::Display*)g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
114                  BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
115                        , ii
116                        , numConfigs
117                        , attr/2
118                        , attrsGlx[attr]
119                        , value
120                        , attrsGlx[attr + 1]
121                        , value < attrsGlx[attr + 1] ? " *" : ""
122                        );
118123
119               if (value < attrsGlx[attr + 1])
120               {
121                  valid = false;
124                  if (value < attrsGlx[attr + 1])
125                  {
126                     valid = false;
122127#if !BGFX_CONFIG_DEBUG
123                  break;
128                     break;
124129#endif // BGFX_CONFIG_DEBUG
130                  }
125131               }
132
133               if (valid)
134               {
135                  bestConfig = configs[ii];
136                  BX_TRACE("Best config %d.", ii);
137                  break;
138               }
126139            }
127140
128            if (valid)
129            {
130               bestConfig = configs[ii];
131               BX_TRACE("Best config %d.", ii);
132               break;
133            }
141            XFree(m_visualInfo);
142            m_visualInfo = NULL;
134143         }
135144
136         XFree(m_visualInfo);
137         m_visualInfo = NULL;
138      }
145         XFree(configs);
146         BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
139147
140      XFree(configs);
141      BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
148         BX_TRACE("Create GL 2.1 context.");
149         m_context = glXCreateContext( (::Display*)g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
150         BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
142151
143      BX_TRACE("Create GL 2.1 context.");
144      m_context = glXCreateContext( (::Display*)g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
145      BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
146
147152#if BGFX_CONFIG_RENDERER_OPENGL >= 31
148      glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress( (const GLubyte*)"glXCreateContextAttribsARB");
153         glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress( (const GLubyte*)"glXCreateContextAttribsARB");
149154
150      if (NULL != glXCreateContextAttribsARB)
151      {
152         BX_TRACE("Create GL 3.1 context.");
153         const int contextAttrs[] =
155         if (NULL != glXCreateContextAttribsARB)
154156         {
155            GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
156            GLX_CONTEXT_MINOR_VERSION_ARB, 1,
157            GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
158            0,
159         };
157            BX_TRACE("Create GL 3.1 context.");
158            const int contextAttrs[] =
159            {
160               GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
161               GLX_CONTEXT_MINOR_VERSION_ARB, 1,
162               GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
163               0,
164            };
160165
161         GLXContext context = glXCreateContextAttribsARB( (::Display*)g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
166            GLXContext context = glXCreateContextAttribsARB( (::Display*)g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
162167
163         if (NULL != context)
164         {
165            glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
166            m_context = context;
168            if (NULL != context)
169            {
170               glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
171               m_context = context;
172            }
167173         }
168      }
169174#else
170      BX_UNUSED(bestConfig);
175         BX_UNUSED(bestConfig);
171176#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
172177
173      XUnlockDisplay( (::Display*)g_bgfxX11Display);
178         XUnlockDisplay( (::Display*)g_bgfxX11Display);
179      }
174180
175181      import();
176182
r245164r245165
210216   void GlContext::destroy()
211217   {
212218      glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0);
213      glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
214      XFree(m_visualInfo);
219      if (NULL == g_bgfxGLX)
220      {
221         glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
222         XFree(m_visualInfo);
223      }
224      m_context    = NULL;
225      m_visualInfo = NULL;
215226   }
216227
217228   void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync)
r245164r245165
292303#   include "glimports.h"
293304   }
294305
295} // namespace bgfx
306} /* namespace gl */ } // namespace bgfx
296307
297308#   endif // BGFX_USE_GLX
298309
trunk/3rdparty/bgfx/src/glcontext_glx.h
r245164r245165
1111#   include <X11/Xlib.h>
1212#   include <GL/glx.h>
1313
14namespace bgfx
14namespace bgfx { namespace gl
1515{
1616   struct SwapChainGL;
1717
r245164r245165
4545      GLXContext m_context;
4646      XVisualInfo* m_visualInfo;
4747   };
48} // namespace bgfx
48} /* namespace gl */ } // namespace bgfx
4949
5050#endif // BGFX_USE_GLX
5151
trunk/3rdparty/bgfx/src/glcontext_nsgl.h
r245164r245165
88
99#if BX_PLATFORM_OSX
1010
11namespace bgfx
11namespace bgfx { namespace gl
1212{
1313   struct SwapChainGL;
1414
r245164r245165
3939      void* m_view;
4040      void* m_context;
4141   };
42} // namespace bgfx
42} /* namespace gl */ } // namespace bgfx
4343
4444#endif // BX_PLATFORM_OSX
4545
trunk/3rdparty/bgfx/src/glcontext_nsgl.mm
r245164r245165
1010#   include <Cocoa/Cocoa.h>
1111#   include <bx/os.h>
1212
13namespace bgfx
13namespace bgfx { namespace gl
1414{
1515
1616#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
r245164r245165
3535      {
3636      }
3737   };
38   
38
3939   static void* s_opengl = NULL;
4040
4141   void GlContext::create(uint32_t _width, uint32_t _height)
r245164r245165
4646      BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");
4747
4848      NSWindow* nsWindow = (NSWindow*)g_bgfxNSWindow;
49      m_context = g_bgfxNSGL;
4950
50      NSOpenGLPixelFormatAttribute profile =
51      if (NULL == g_bgfxNSGL)
52      {
53         NSOpenGLPixelFormatAttribute profile =
5154#if BGFX_CONFIG_RENDERER_OPENGL >= 31
52         NSOpenGLProfileVersion3_2Core
55            NSOpenGLProfileVersion3_2Core
5356#else
54         NSOpenGLProfileVersionLegacy
57            NSOpenGLProfileVersionLegacy
5558#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
56         ;
59            ;
5760
58      NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
59         NSOpenGLPFAOpenGLProfile, profile,
60         NSOpenGLPFAColorSize,     24,
61         NSOpenGLPFAAlphaSize,     8,
62         NSOpenGLPFADepthSize,     24,
63         NSOpenGLPFAStencilSize,   8,
64         NSOpenGLPFADoubleBuffer,  true,
65         NSOpenGLPFAAccelerated,   true,
66         NSOpenGLPFANoRecovery,    true,
67         0,                        0,
68      };
61         NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
62            NSOpenGLPFAOpenGLProfile, profile,
63            NSOpenGLPFAColorSize,     24,
64            NSOpenGLPFAAlphaSize,     8,
65            NSOpenGLPFADepthSize,     24,
66            NSOpenGLPFAStencilSize,   8,
67            NSOpenGLPFADoubleBuffer,  true,
68            NSOpenGLPFAAccelerated,   true,
69            NSOpenGLPFANoRecovery,    true,
70            0,                        0,
71         };
6972
70      NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
71      BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
73         NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
74         BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
7275
73      NSRect glViewRect = [[nsWindow contentView] bounds];
74      NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
75     
76      [pixelFormat release];
77      [nsWindow setContentView:glView];
78     
79      NSOpenGLContext* glContext = [glView openGLContext];
80      BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
76         NSRect glViewRect = [[nsWindow contentView] bounds];
77         NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
8178
82      [glContext makeCurrentContext];
83      GLint interval = 0;
84      [glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
85     
86      m_view    = glView;
87      m_context = glContext;
79         [pixelFormat release];
80         [nsWindow setContentView:glView];
8881
82         NSOpenGLContext* glContext = [glView openGLContext];
83         BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
84
85         [glContext makeCurrentContext];
86         GLint interval = 0;
87         [glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
88
89         m_view    = glView;
90         m_context = glContext;
91      }
92
8993      import();
9094   }
9195
9296   void GlContext::destroy()
9397   {
94      NSOpenGLView* glView = (NSOpenGLView*)m_view;
95      m_view = 0;
98      if (NULL == g_bgfxNSGL)
99      {
100         NSOpenGLView* glView = (NSOpenGLView*)m_view;
101         [glView release];
102      }
103
104      m_view    = 0;
96105      m_context = 0;
97      [glView release];
98
99106      bx::dlclose(s_opengl);
100107   }
101108
r245164r245165
165172#   include "glimports.h"
166173   }
167174
168} // namespace bgfx
175} /* namespace gl */ } // namespace bgfx
169176
170177#endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
trunk/3rdparty/bgfx/src/glcontext_ppapi.cpp
r245164r245165
99#   include <bgfxplatform.h>
1010#   include "renderer_gl.h"
1111
12namespace bgfx
12namespace bgfx { namespace gl
1313{
1414#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
1515#   include "glimports.h"
1616
1717   void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/);
1818
19   PP_CompletionCallback naclSwapComplete =
19   PP_CompletionCallback naclSwapComplete =
2020   {
2121      naclSwapCompleteCb,
2222      NULL,
r245164r245165
6262      PostSwapBuffersFn m_postSwapBuffers;
6363      bool m_forceSwap;
6464   };
65   
65
6666   static Ppapi s_ppapi;
6767
6868   void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/)
r245164r245165
9595      s_ppapi.m_instancedArrays->DrawElementsInstancedANGLE(s_ppapi.m_context, _mode, _count, _type, _indices, _primcount);
9696   }
9797
98   bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
99   {
100      return s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers);
101   }
102
10398   bool Ppapi::setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
10499   {
105100      BX_TRACE("PPAPI Interfaces");
r245164r245165
192187      return s_ppapi.isValid();
193188   }
194189
190} /* namespace gl */ } // namespace bgfx
191
192namespace bgfx
193{
194   bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
195   {
196      return gl::s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers);
197   }
195198} // namespace bgfx
196199
197200#endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
trunk/3rdparty/bgfx/src/glcontext_ppapi.h
r245164r245165
1313#   include <ppapi/c/ppb_instance.h>
1414#   include <ppapi/c/ppb_graphics_3d.h>
1515
16namespace bgfx
16namespace bgfx { namespace gl
1717{
1818   struct SwapChainGL;
1919
r245164r245165
3636      void import();
3737      bool isValid() const;
3838   };
39} // namespace bgfx
39} /* namespace gl */ } // namespace bgfx
4040
4141#endif // BX_PLATFORM_NACL
4242
trunk/3rdparty/bgfx/src/glcontext_wgl.cpp
r245164r245165
1010
1111#   if BGFX_USE_WGL
1212
13namespace bgfx
13namespace bgfx { namespace gl
1414{
1515   PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
1616   PFNWGLMAKECURRENTPROC wglMakeCurrent;
r245164r245165
376376#   include "glimports.h"
377377   }
378378
379} // namespace bgfx
379} } // namespace bgfx
380380
381381#   endif // BGFX_USE_WGL
382382#endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
trunk/3rdparty/bgfx/src/glcontext_wgl.h
r245164r245165
1010
1111#include <wgl/wglext.h>
1212
13namespace bgfx
13namespace bgfx { namespace gl
1414{
1515typedef PROC (APIENTRYP PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc);
1616typedef BOOL (APIENTRYP PFNWGLMAKECURRENTPROC) (HDC hdc, HGLRC hglrc);
r245164r245165
9393      HGLRC m_context;
9494      HDC m_hdc;
9595   };
96} // namespace bgfx
96} /* namespace gl */ } // namespace bgfx
9797
9898#endif // BGFX_USE_WGL
9999
trunk/3rdparty/bgfx/src/image.cpp
r245164r245165
12351235#define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U')
12361236#define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0')
12371237
1238#define D3DFMT_A8R8G8B8       21
1239#define D3DFMT_R5G6B5         23
1240#define D3DFMT_A1R5G5B5       25
1241#define D3DFMT_A4R4G4B4       26
1242#define D3DFMT_A2B10G10R10    31
1243#define D3DFMT_G16R16         34
1244#define D3DFMT_A2R10G10B10    35
1245#define D3DFMT_A16B16G16R16   36
1246#define D3DFMT_A8L8           51
1247#define D3DFMT_R16F           111
1248#define D3DFMT_G16R16F        112
1249#define D3DFMT_A16B16G16R16F  113
1250#define D3DFMT_R32F           114
1251#define D3DFMT_G32R32F        115
1252#define D3DFMT_A32B32G32R32F  116
1238#define DDS_A8R8G8B8       21
1239#define DDS_R5G6B5         23
1240#define DDS_A1R5G5B5       25
1241#define DDS_A4R4G4B4       26
1242#define DDS_A2B10G10R10    31
1243#define DDS_G16R16         34
1244#define DDS_A2R10G10B10    35
1245#define DDS_A16B16G16R16   36
1246#define DDS_A8L8           51
1247#define DDS_R16F           111
1248#define DDS_G16R16F        112
1249#define DDS_A16B16G16R16F  113
1250#define DDS_R32F           114
1251#define DDS_G32R32F        115
1252#define DDS_A32B32G32R32F  116
12531253
1254#define DXGI_FORMAT_R32G32B32A32_FLOAT 2
1255#define DXGI_FORMAT_R32G32B32A32_UINT  3
1256#define DXGI_FORMAT_R16G16B16A16_FLOAT 10
1257#define DXGI_FORMAT_R16G16B16A16_UNORM 11
1258#define DXGI_FORMAT_R16G16B16A16_UINT  12
1259#define DXGI_FORMAT_R32G32_FLOAT       16
1260#define DXGI_FORMAT_R32G32_UINT        17
1261#define DXGI_FORMAT_R10G10B10A2_UNORM  24
1262#define DXGI_FORMAT_R16G16_FLOAT       34
1263#define DXGI_FORMAT_R16G16_UNORM       35
1264#define DXGI_FORMAT_R32_FLOAT          41
1265#define DXGI_FORMAT_R32_UINT           42
1266#define DXGI_FORMAT_R8G8_UNORM         49
1267#define DXGI_FORMAT_R16_FLOAT          54
1268#define DXGI_FORMAT_R16_UNORM          56
1269#define DXGI_FORMAT_R8_UNORM           61
1270#define DXGI_FORMAT_BC1_UNORM          71
1271#define DXGI_FORMAT_BC2_UNORM          74
1272#define DXGI_FORMAT_BC3_UNORM          77
1273#define DXGI_FORMAT_BC4_UNORM          80
1274#define DXGI_FORMAT_BC5_UNORM          83
1275#define DXGI_FORMAT_B5G6R5_UNORM       85
1276#define DXGI_FORMAT_B5G5R5A1_UNORM     86
1277#define DXGI_FORMAT_B8G8R8A8_UNORM     87
1278#define DXGI_FORMAT_BC6H_SF16          96
1279#define DXGI_FORMAT_BC7_UNORM          98
1280#define DXGI_FORMAT_B4G4R4A4_UNORM     115
1254#define DDS_FORMAT_R32G32B32A32_FLOAT 2
1255#define DDS_FORMAT_R32G32B32A32_UINT  3
1256#define DDS_FORMAT_R16G16B16A16_FLOAT 10
1257#define DDS_FORMAT_R16G16B16A16_UNORM 11
1258#define DDS_FORMAT_R16G16B16A16_UINT  12
1259#define DDS_FORMAT_R32G32_FLOAT       16
1260#define DDS_FORMAT_R32G32_UINT        17
1261#define DDS_FORMAT_R10G10B10A2_UNORM  24
1262#define DDS_FORMAT_R16G16_FLOAT       34
1263#define DDS_FORMAT_R16G16_UNORM       35
1264#define DDS_FORMAT_R32_FLOAT          41
1265#define DDS_FORMAT_R32_UINT           42
1266#define DDS_FORMAT_R8G8_UNORM         49
1267#define DDS_FORMAT_R16_FLOAT          54
1268#define DDS_FORMAT_R16_UNORM          56
1269#define DDS_FORMAT_R8_UNORM           61
1270#define DDS_FORMAT_BC1_UNORM          71
1271#define DDS_FORMAT_BC2_UNORM          74
1272#define DDS_FORMAT_BC3_UNORM          77
1273#define DDS_FORMAT_BC4_UNORM          80
1274#define DDS_FORMAT_BC5_UNORM          83
1275#define DDS_FORMAT_B5G6R5_UNORM       85
1276#define DDS_FORMAT_B5G5R5A1_UNORM     86
1277#define DDS_FORMAT_B8G8R8A8_UNORM     87
1278#define DDS_FORMAT_BC6H_SF16          96
1279#define DDS_FORMAT_BC7_UNORM          98
1280#define DDS_FORMAT_B4G4R4A4_UNORM     115
12811281
12821282#define DDSD_CAPS                   0x00000001
12831283#define DDSD_HEIGHT                 0x00000002
r245164r245165
13311331      { DDS_BC4U,                  TextureFormat::BC4     },
13321332      { DDS_ATI2,                  TextureFormat::BC5     },
13331333      { DDS_BC5U,                  TextureFormat::BC5     },
1334      { D3DFMT_A16B16G16R16,       TextureFormat::RGBA16  },
1335      { D3DFMT_A16B16G16R16F,      TextureFormat::RGBA16F },
1334      { DDS_A16B16G16R16,          TextureFormat::RGBA16  },
1335      { DDS_A16B16G16R16F,         TextureFormat::RGBA16F },
13361336      { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8   },
13371337      { DDPF_INDEXED,              TextureFormat::R8      },
13381338      { DDPF_LUMINANCE,            TextureFormat::R8      },
13391339      { DDPF_ALPHA,                TextureFormat::R8      },
1340      { D3DFMT_R16F,               TextureFormat::R16F    },
1341      { D3DFMT_R32F,               TextureFormat::R32F    },
1342      { D3DFMT_A8L8,               TextureFormat::RG8     },
1343      { D3DFMT_G16R16,             TextureFormat::RG16    },
1344      { D3DFMT_G16R16F,            TextureFormat::RG16F   },
1345      { D3DFMT_G32R32F,            TextureFormat::RG32F   },
1346      { D3DFMT_A8R8G8B8,           TextureFormat::BGRA8   },
1347      { D3DFMT_A16B16G16R16,       TextureFormat::RGBA16  },
1348      { D3DFMT_A16B16G16R16F,      TextureFormat::RGBA16F },
1349      { D3DFMT_A32B32G32R32F,      TextureFormat::RGBA32F },
1350      { D3DFMT_R5G6B5,             TextureFormat::R5G6B5  },
1351      { D3DFMT_A4R4G4B4,           TextureFormat::RGBA4   },
1352      { D3DFMT_A1R5G5B5,           TextureFormat::RGB5A1  },
1353      { D3DFMT_A2B10G10R10,        TextureFormat::RGB10A2 },
1340      { DDS_R16F,                  TextureFormat::R16F    },
1341      { DDS_R32F,                  TextureFormat::R32F    },
1342      { DDS_A8L8,                  TextureFormat::RG8     },
1343      { DDS_G16R16,                TextureFormat::RG16    },
1344      { DDS_G16R16F,               TextureFormat::RG16F   },
1345      { DDS_G32R32F,               TextureFormat::RG32F   },
1346      { DDS_A8R8G8B8,              TextureFormat::BGRA8   },
1347      { DDS_A16B16G16R16,          TextureFormat::RGBA16  },
1348      { DDS_A16B16G16R16F,         TextureFormat::RGBA16F },
1349      { DDS_A32B32G32R32F,         TextureFormat::RGBA32F },
1350      { DDS_R5G6B5,                TextureFormat::R5G6B5  },
1351      { DDS_A4R4G4B4,              TextureFormat::RGBA4   },
1352      { DDS_A1R5G5B5,              TextureFormat::RGB5A1  },
1353      { DDS_A2B10G10R10,           TextureFormat::RGB10A2 },
13541354   };
13551355
13561356   static TranslateDdsFormat s_translateDxgiFormat[] =
13571357   {
1358      { DXGI_FORMAT_BC1_UNORM,          TextureFormat::BC1     },
1359      { DXGI_FORMAT_BC2_UNORM,          TextureFormat::BC2     },
1360      { DXGI_FORMAT_BC3_UNORM,          TextureFormat::BC3     },
1361      { DXGI_FORMAT_BC4_UNORM,          TextureFormat::BC4     },
1362      { DXGI_FORMAT_BC5_UNORM,          TextureFormat::BC5     },
1363      { DXGI_FORMAT_BC6H_SF16,          TextureFormat::BC6H    },
1364      { DXGI_FORMAT_BC7_UNORM,          TextureFormat::BC7     },
1358      { DDS_FORMAT_BC1_UNORM,          TextureFormat::BC1     },
1359      { DDS_FORMAT_BC2_UNORM,          TextureFormat::BC2     },
1360      { DDS_FORMAT_BC3_UNORM,          TextureFormat::BC3     },
1361      { DDS_FORMAT_BC4_UNORM,          TextureFormat::BC4     },
1362      { DDS_FORMAT_BC5_UNORM,          TextureFormat::BC5     },
1363      { DDS_FORMAT_BC6H_SF16,          TextureFormat::BC6H    },
1364      { DDS_FORMAT_BC7_UNORM,          TextureFormat::BC7     },
13651365
1366      { DXGI_FORMAT_R8_UNORM,           TextureFormat::R8      },
1367      { DXGI_FORMAT_R16_UNORM,          TextureFormat::R16     },
1368      { DXGI_FORMAT_R16_FLOAT,          TextureFormat::R16F    },
1369      { DXGI_FORMAT_R32_UINT,           TextureFormat::R32     },
1370      { DXGI_FORMAT_R32_FLOAT,          TextureFormat::R32F    },
1371      { DXGI_FORMAT_R8G8_UNORM,         TextureFormat::RG8     },
1372      { DXGI_FORMAT_R16G16_UNORM,       TextureFormat::RG16    },
1373      { DXGI_FORMAT_R16G16_FLOAT,       TextureFormat::RG16F   },
1374      { DXGI_FORMAT_R32G32_UINT,        TextureFormat::RG32    },
1375      { DXGI_FORMAT_R32G32_FLOAT,       TextureFormat::RG32F   },
1376      { DXGI_FORMAT_B8G8R8A8_UNORM,     TextureFormat::BGRA8   },
1377      { DXGI_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16  },
1378      { DXGI_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
1379      { DXGI_FORMAT_R32G32B32A32_UINT,  TextureFormat::RGBA32  },
1380      { DXGI_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
1381      { DXGI_FORMAT_B5G6R5_UNORM,       TextureFormat::R5G6B5  },
1382      { DXGI_FORMAT_B4G4R4A4_UNORM,     TextureFormat::RGBA4   },
1383      { DXGI_FORMAT_B5G5R5A1_UNORM,     TextureFormat::RGB5A1  },
1384      { DXGI_FORMAT_R10G10B10A2_UNORM,  TextureFormat::RGB10A2 },
1366      { DDS_FORMAT_R8_UNORM,           TextureFormat::R8      },
1367      { DDS_FORMAT_R16_UNORM,          TextureFormat::R16     },
1368      { DDS_FORMAT_R16_FLOAT,          TextureFormat::R16F    },
1369      { DDS_FORMAT_R32_UINT,           TextureFormat::R32     },
1370      { DDS_FORMAT_R32_FLOAT,          TextureFormat::R32F    },
1371      { DDS_FORMAT_R8G8_UNORM,         TextureFormat::RG8     },
1372      { DDS_FORMAT_R16G16_UNORM,       TextureFormat::RG16    },
1373      { DDS_FORMAT_R16G16_FLOAT,       TextureFormat::RG16F   },
1374      { DDS_FORMAT_R32G32_UINT,        TextureFormat::RG32    },
1375      { DDS_FORMAT_R32G32_FLOAT,       TextureFormat::RG32F   },
1376      { DDS_FORMAT_B8G8R8A8_UNORM,     TextureFormat::BGRA8   },
1377      { DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16  },
1378      { DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
1379      { DDS_FORMAT_R32G32B32A32_UINT,  TextureFormat::RGBA32  },
1380      { DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
1381      { DDS_FORMAT_B5G6R5_UNORM,       TextureFormat::R5G6B5  },
1382      { DDS_FORMAT_B4G4R4A4_UNORM,     TextureFormat::RGBA4   },
1383      { DDS_FORMAT_B5G5R5A1_UNORM,     TextureFormat::RGB5A1  },
1384      { DDS_FORMAT_R10G10B10A2_UNORM,  TextureFormat::RGB10A2 },
13851385   };
13861386
13871387   struct TranslateDdsPixelFormat
trunk/3rdparty/bgfx/src/ovr.h
r245164r245165
33 * License: http://www.opensource.org/licenses/BSD-2-Clause
44 */
55
6#ifndef BGFX_OVR_H_HEADER_GUARD
7#define BGFX_OVR_H_HEADER_GUARD
8
69#include "bgfx_p.h"
710
811#if BGFX_CONFIG_USE_OVR
r245164r245165
146149} // namespace bgfx
147150
148151#endif // BGFX_CONFIG_USE_OVR
152
153#endif // BGFX_OVR_H_HEADER_GUARD
trunk/3rdparty/bgfx/src/renderdoc.h
r245164r245165
33 * License: http://www.opensource.org/licenses/BSD-2-Clause
44 */
55
6#ifndef BGFX_RENDERDOC_H_HEADER_GUARD
7#define BGFX_RENDERDOC_H_HEADER_GUARD
8
69namespace bgfx
710{
811   void* loadRenderDoc();
912   void unloadRenderDoc(void*);
1013
1114} // namespace bgfx
15
16#endif // BGFX_RENDERDOC_H_HEADER_GUARD
trunk/3rdparty/bgfx/src/renderer.h
r245164r245165
33 * License: http://www.opensource.org/licenses/BSD-2-Clause
44 */
55
6#ifndef BGFX_RENDERER_H_HEADER_GUARD
7#define BGFX_RENDERER_H_HEADER_GUARD
8
69#include "bgfx_p.h"
710
811namespace bgfx
r245164r245165
262265   };
263266
264267} // namespace bgfx
268
269#endif // BGFX_RENDERER_H_HEADER_GUARD
trunk/3rdparty/bgfx/src/renderer_d3d11.cpp
r245164r245165
88#if BGFX_CONFIG_RENDERER_DIRECT3D11
99#   include "renderer_d3d11.h"
1010
11namespace bgfx
11namespace bgfx { namespace d3d11
1212{
1313   static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
1414
r245164r245165
22992299
23002300   static RendererContextD3D11* s_renderD3D11;
23012301
2302   RendererContextI* rendererCreateD3D11()
2302   RendererContextI* rendererCreate()
23032303   {
23042304      s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11);
23052305      s_renderD3D11->init();
23062306      return s_renderD3D11;
23072307   }
23082308
2309   void rendererDestroyD3D11()
2309   void rendererDestroy()
23102310   {
23112311      s_renderD3D11->shutdown();
23122312      BX_DELETE(g_allocator, s_renderD3D11);
r245164r245165
38393839         PIX_ENDEVENT();
38403840      }
38413841   }
3842} // namespace bgfx
3842} /* namespace d3d11 */ } // namespace bgfx
38433843
38443844#else
38453845
3846namespace bgfx
3846namespace bgfx { namespace d3d11
38473847{
3848   RendererContextI* rendererCreateD3D11()
3848   RendererContextI* rendererCreate()
38493849   {
38503850      return NULL;
38513851   }
38523852
3853   void rendererDestroyD3D11()
3853   void rendererDestroy()
38543854   {
38553855   }
3856} // namespace bgfx
3856} /* namespace d3d11 */ } // namespace bgfx
38573857
38583858#endif // BGFX_CONFIG_RENDERER_DIRECT3D11
trunk/3rdparty/bgfx/src/renderer_d3d11.h
r245164r245165
7070#   define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX
7171#endif // D3D11_APPEND_ALIGNED_ELEMENT
7272
73namespace bgfx
73namespace bgfx { namespace d3d11
7474{
7575   struct BufferD3D11
7676   {
r245164r245165
280280      uint8_t m_num;
281281   };
282282
283} // namespace bgfx
283} /*  namespace d3d11 */ } // namespace bgfx
284284
285285#endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD
trunk/3rdparty/bgfx/src/renderer_d3d12.cpp
r245164r245165
99#   include "../../d3d12/src/renderer_d3d12.cpp"
1010#else
1111
12namespace bgfx
12namespace bgfx { namespace d3d12
1313{
14   RendererContextI* rendererCreateD3D12()
14   RendererContextI* rendererCreate()
1515   {
1616      return NULL;
1717   }
1818
19   void rendererDestroyD3D12()
19   void rendererDestroy()
2020   {
2121   }
22} // namespace bgfx
22} /* namespace d3d12 */ } // namespace bgfx
2323
2424#endif // BGFX_CONFIG_RENDERER_DIRECT3D12
trunk/3rdparty/bgfx/src/renderer_d3d9.cpp
r245164r245165
88#if BGFX_CONFIG_RENDERER_DIRECT3D9
99#   include "renderer_d3d9.h"
1010
11namespace bgfx
11namespace bgfx { namespace d3d9
1212{
1313   static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
1414
r245164r245165
17311731
17321732   static RendererContextD3D9* s_renderD3D9;
17331733
1734   RendererContextI* rendererCreateD3D9()
1734   RendererContextI* rendererCreate()
17351735   {
17361736      s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9);
17371737      s_renderD3D9->init();
17381738      return s_renderD3D9;
17391739   }
17401740
1741   void rendererDestroyD3D9()
1741   void rendererDestroy()
17421742   {
17431743      s_renderD3D9->shutdown();
17441744      BX_DELETE(g_allocator, s_renderD3D9);
r245164r245165
34603460
34613461      device->EndScene();
34623462   }
3463} // namespace bgfx
3463} /* namespace d3d9 */ } // namespace bgfx
34643464
34653465#else
34663466
3467namespace bgfx
3467namespace bgfx { namespace d3d9
34683468{
3469   RendererContextI* rendererCreateD3D9()
3469   RendererContextI* rendererCreate()
34703470   {
34713471      return NULL;
34723472   }
34733473
3474   void rendererDestroyD3D9()
3474   void rendererDestroy()
34753475   {
34763476   }
3477} // namespace bgfx
3477} /* namespace d3d9 */ } // namespace bgfx
34783478
34793479#endif // BGFX_CONFIG_RENDERER_DIRECT3D9
trunk/3rdparty/bgfx/src/renderer_d3d9.h
r245164r245165
4141#include "renderer.h"
4242#include "renderer_d3d.h"
4343
44namespace bgfx
44namespace bgfx { namespace d3d9
4545{
4646#   if defined(D3D_DISABLE_9EX)
4747#      define D3DFMT_S8_LOCKABLE D3DFORMAT( 85)
r245164r245165
386386      bool m_needResolve;
387387   };
388388
389} // namespace bgfx
389} /* namespace d3d9 */ } // namespace bgfx
390390
391391#endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD
trunk/3rdparty/bgfx/src/renderer_gl.cpp
r245164r245165
1010#   include <bx/timer.h>
1111#   include <bx/uint32_t.h>
1212
13namespace bgfx
13namespace bgfx { namespace gl
1414{
1515   static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
1616
r245164r245165
417417         EXT_blend_color,
418418         EXT_blend_minmax,
419419         EXT_blend_subtract,
420         EXT_color_buffer_half_float,
420421         EXT_compressed_ETC1_RGB8_sub_texture,
421422         EXT_debug_label,
422423         EXT_debug_marker,
r245164r245165
491492         OES_vertex_half_float,
492493         OES_vertex_type_10_10_10_2,
493494
495         WEBGL_color_buffer_float,
494496         WEBGL_compressed_texture_etc1,
495497         WEBGL_compressed_texture_s3tc,
496498         WEBGL_compressed_texture_pvrtc,
497499         WEBGL_depth_texture,
500         WEBGL_draw_buffers,
498501
499502         WEBKIT_EXT_texture_filter_anisotropic,
500503         WEBKIT_WEBGL_compressed_texture_s3tc,
r245164r245165
578581      { "EXT_blend_color",                       BGFX_CONFIG_RENDERER_OPENGL >= 31, true  },
579582      { "EXT_blend_minmax",                      BGFX_CONFIG_RENDERER_OPENGL >= 14, true  },
580583      { "EXT_blend_subtract",                    BGFX_CONFIG_RENDERER_OPENGL >= 14, true  },
584      { "EXT_color_buffer_half_float",           false,                             true  }, // GLES2 extension.
581585      { "EXT_compressed_ETC1_RGB8_sub_texture",  false,                             true  }, // GLES2 extension.
582586      { "EXT_debug_label",                       false,                             true  },
583587      { "EXT_debug_marker",                      false,                             true  },
r245164r245165
652656      { "OES_vertex_half_float",                 false,                             true  },
653657      { "OES_vertex_type_10_10_10_2",            false,                             true  },
654658
659      { "WEBGL_color_buffer_float",              false,                             true  },
655660      { "WEBGL_compressed_texture_etc1",         false,                             true  },
656661      { "WEBGL_compressed_texture_s3tc",         false,                             true  },
657662      { "WEBGL_compressed_texture_pvrtc",        false,                             true  },
658663      { "WEBGL_depth_texture",                   false,                             true  },
664      { "WEBGL_draw_buffers",                    false,                             true  },
659665
660666      { "WEBKIT_EXT_texture_filter_anisotropic", false,                             true  },
661667      { "WEBKIT_WEBGL_compressed_texture_s3tc",  false,                             true  },
r245164r245165
12941300
12951301         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
12961302         ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1297         ||  s_extension[Extension::EXT_draw_buffers].m_supported)
1303         ||  s_extension[Extension::EXT_draw_buffers  ].m_supported
1304         ||  s_extension[Extension::WEBGL_draw_buffers].m_supported)
12981305         {
12991306            g_caps.maxFBAttachments = bx::uint32_min(glGet(GL_MAX_COLOR_ATTACHMENTS), BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
13001307         }
r245164r245165
25792586
25802587   RendererContextGL* s_renderGL;
25812588
2582   RendererContextI* rendererCreateGL()
2589   RendererContextI* rendererCreate()
25832590   {
25842591      s_renderGL = BX_NEW(g_allocator, RendererContextGL);
25852592      s_renderGL->init();
25862593      return s_renderGL;
25872594   }
25882595
2589   void rendererDestroyGL()
2596   void rendererDestroy()
25902597   {
25912598      s_renderGL->shutdown();
25922599      BX_DELETE(g_allocator, s_renderGL);
r245164r245165
26622669         GLENUM(GL_RENDERBUFFER);
26632670
26642671         GLENUM(GL_INVALID_ENUM);
2672         GLENUM(GL_INVALID_FRAMEBUFFER_OPERATION);
26652673         GLENUM(GL_INVALID_VALUE);
26662674         GLENUM(GL_INVALID_OPERATION);
26672675         GLENUM(GL_OUT_OF_MEMORY);
r245164r245165
37943802
37953803               if (usesFragData)
37963804               {
3797                  BX_WARN(s_extension[Extension::EXT_draw_buffers].m_supported, "EXT_draw_buffers is used but not supported by GLES2 driver.");
3805                  BX_WARN(s_extension[Extension::EXT_draw_buffers  ].m_supported
3806                     ||  s_extension[Extension::WEBGL_draw_buffers].m_supported
3807                     , "EXT_draw_buffers is used but not supported by GLES2 driver."
3808                     );
37983809                  writeString(&writer
37993810                     , "#extension GL_EXT_draw_buffers : enable\n"
38003811                     );
r245164r245165
53545365
53555366      GL_CHECK(glFrameTerminatorGREMEDY() );
53565367   }
5357} // namespace bgfx
5368} } // namespace bgfx
53585369
53595370#else
53605371
5361namespace bgfx
5372namespace bgfx { namespace gl
53625373{
5363   RendererContextI* rendererCreateGL()
5374   RendererContextI* rendererCreate()
53645375   {
53655376      return NULL;
53665377   }
53675378
5368   void rendererDestroyGL()
5379   void rendererDestroy()
53695380   {
53705381   }
5371} // namespace bgfx
5382} /* namespace gl */ } // namespace bgfx
53725383
53735384#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
53745385
trunk/3rdparty/bgfx/src/renderer_gl.h
r245164r245165
611611namespace bgfx
612612{
613613   class ConstantBuffer;
614} // namespace bgfx
615
616namespace bgfx { namespace gl
617{
614618   void dumpExtensions(const char* _extensions);
615619
616620   const char* glEnumName(GLenum _enum);
r245164r245165
10011005      GLuint m_queries[64];
10021006   };
10031007
1004} // namespace bgfx
1008} /* namespace gl */ } // namespace bgfx
10051009
10061010#endif // BGFX_RENDERER_GL_H_HEADER_GUARD
trunk/3rdparty/bgfx/src/renderer_null.cpp
r245164r245165
77
88#if BGFX_CONFIG_RENDERER_NULL
99
10namespace bgfx
10namespace bgfx { namespace noop
1111{
1212   struct RendererContextNULL : public RendererContextI
1313   {
r245164r245165
168168
169169   static RendererContextNULL* s_renderNULL;
170170
171   RendererContextI* rendererCreateNULL()
171   RendererContextI* rendererCreate()
172172   {
173173      s_renderNULL = BX_NEW(g_allocator, RendererContextNULL);
174174      return s_renderNULL;
175175   }
176176
177   void rendererDestroyNULL()
177   void rendererDestroy()
178178   {
179179      BX_DELETE(g_allocator, s_renderNULL);
180180      s_renderNULL = NULL;
181181   }
182} // namespace bgfx
182} /* namespace noop */ } // namespace bgfx
183183
184184#else
185185
186namespace bgfx
186namespace bgfx { namespace noop
187187{
188   RendererContextI* rendererCreateNULL()
188   RendererContextI* rendererCreate()
189189   {
190190      return NULL;
191191   }
192192
193   void rendererDestroyNULL()
193   void rendererDestroy()
194194   {
195195   }
196} // namespace bgfx
196} /* namespace noop */ } // namespace bgfx
197197
198198#endif // BGFX_CONFIG_RENDERER_NULL
trunk/3rdparty/bgfx/src/renderer_vk.cpp
r245164r245165
88#   include "../../vk/src/renderer_vk.cpp"
99#else
1010
11namespace bgfx
11namespace bgfx { namespace vk
1212{
13   RendererContextI* rendererCreateVK()
13   RendererContextI* rendererCreate()
1414   {
1515      return NULL;
1616   }
1717
18   void rendererDestroyVK()
18   void rendererDestroy()
1919   {
2020   }
21} // namespace bgfx
21} /* namespace vk */ } // namespace bgfx
2222
2323#endif // BGFX_CONFIG_RENDERER_VULKAN
trunk/3rdparty/bgfx/tools/geometryc/geometryc.cpp
r245164r245165
504504            Triangle triangle;
505505            memset(&triangle, 0, sizeof(Triangle) );
506506
507            const int numNormals   = (int)normals.size();
508            const int numTexcoords = (int)texcoords.size();
509            const int numPositions = (int)positions.size();
507510            for (uint32_t edge = 0, numEdges = argc-1; edge < numEdges; ++edge)
508511            {
509512               Index3 index;
510               index.m_texcoord = -1;
511               index.m_normal = -1;
513               index.m_texcoord = 0;
514               index.m_normal = 0;
512515               index.m_vertexIndex = -1;
513516
514517               char* vertex = argv[edge+1];
r245164r245165
521524                  if (NULL != normal)
522525                  {
523526                     *normal++ = '\0';
524                     index.m_normal = atoi(normal)-1;
527                     const int nn = atoi(normal);
528                     index.m_normal = (nn < 0) ? nn+numNormals : nn-1;
525529                  }
526530
527                  index.m_texcoord = atoi(texcoord)-1;
531                  const int tex = atoi(texcoord);
532                  index.m_texcoord = (tex < 0) ? tex+numTexcoords : tex-1;
528533               }
529534
530               index.m_position = atoi(vertex)-1;
535               const int pos = atoi(vertex);
536               index.m_position = (pos < 0) ? pos+numPositions : pos-1;
531537
532538               uint64_t hash0 = index.m_position;
533539               uint64_t hash1 = uint64_t(index.m_texcoord)<<20;
r245164r245165
710716   bool hasTexcoord;
711717   {
712718      Index3Map::const_iterator it = indexMap.begin();
713      hasNormal = -1 != it->second.m_normal;
714      hasTexcoord = -1 != it->second.m_texcoord;
719      hasNormal   = 0 != it->second.m_normal;
720      hasTexcoord = 0 != it->second.m_texcoord;
715721
716722      if (!hasTexcoord
717723      &&  texcoords.size() == positions.size() )
trunk/3rdparty/bgfx/tools/shaderc/shaderc.cpp
r245164r245165
845845   preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX");
846846
847847   char glslDefine[128];
848   bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", glsl);
848   bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl);
849849
850850   if (0 == bx::stricmp(platform, "android") )
851851   {
r245164r245165
972972
973973            const char* name      = parse = bx::strws(bx::strword(parse) );
974974            const char* column    = parse = bx::strws(bx::strword(parse) );
975            const char* semantics = parse = bx::strws(bx::strnws (parse) );
975            const char* semantics = parse = bx::strws((*parse == ':' ? ++parse : parse));
976976            const char* assign    = parse = bx::strws(bx::strword(parse) );
977            const char* init      = parse = bx::strws(bx::strnws (parse) );
977            const char* init      = parse = bx::strws((*parse == '=' ? ++parse : parse));
978978
979979            if (type < eol
980980            &&  name < eol
r245164r245165
11551155         }
11561156         else
11571157         {
1158            if (0 != glsl)
1158            if (0 != glsl
1159            ||  0 != essl)
11591160            {
11601161            }
11611162            else
r245164r245165
12691270                  bx::write(writer, BGFX_CHUNK_MAGIC_CSH);
12701271                  bx::write(writer, outputHash);
12711272
1272                  if (0 != glsl)
1273                  if (0 != glsl
1274                  ||  0 != essl)
12731275                  {
12741276                     std::string code;
12751277
r245164r245165
13381340         }
13391341         else
13401342         {
1341            if (0 != glsl)
1343            if (0 != glsl
1344            ||  0 != essl)
13421345            {
13431346               if (120 == glsl
1344               ||  essl)
1347               ||  0   != essl)
13451348               {
13461349                  preprocessor.writef(
13471350                     "#define ivec2 vec2\n"
r245164r245165
17001703                     bx::write(writer, outputHash);
17011704                  }
17021705
1703                  if (0 != glsl)
1706                  if (0 != glsl
1707                  ||  0 != essl)
17041708                  {
17051709                     std::string code;
17061710
trunk/3rdparty/bx/include/bx/handlealloc.h
r245164r245165
7171         uint16_t* sparse = &m_handles[MaxHandlesT];
7272         uint16_t index = sparse[_handle];
7373
74         return (index < m_numHandles && m_handles[index] == _handle);
74         return index < m_numHandles
75            && m_handles[index] == _handle
76            ;
7577      }
7678
7779      void free(uint16_t _handle)
trunk/3rdparty/bx/tests/unordered_map_nonpod.cpp
r245164r245165
2929#include <tinystl/allocator.h>
3030#include <tinystl/unordered_map.h>
3131
32struct Foo { int bar; };
33
3234TEST(uomap_nonpod_compiles) {
33   struct Foo { int bar; };
3435
3536   // verify this compiles
3637   typedef tinystl::unordered_map<int, Foo> map;
3738   map m;
38}
No newline at end of file
39}
trunk/3rdparty/bx/tools/bin/darwin/genie
r245164r245165
Previous 199869 Revisions Next


© 1997-2024 The MAME Team