浏览代码

Merge branch 'master' of github.com:bkaradzic/bgfx

Branimir Karadžić 7 年之前
父节点
当前提交
b02ed54a17

文件差异内容过多而无法显示
+ 175 - 146
3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.c


+ 7 - 7
3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out

@@ -2,7 +2,7 @@ hlsl.partialFlattenLocal.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Generated by (magic number): 80004
-// Id's are bound by 165
+// Id's are bound by 169
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -52,22 +52,22 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
                               Store 137 38
                               Branch 100
              100:             Label
-             164:     21(int) Phi 25 5 119 106
-             105:    54(bool) SLessThan 164 31
+             168:     21(int) Phi 25 5 119 106
+             105:    54(bool) SLessThan 168 31
                               LoopMerge 101 106 None
                               BranchConditional 105 106 101
              106:               Label
-             138:     39(ptr)   AccessChain 133 164
+             138:     39(ptr)   AccessChain 133 168
              110:   18(fvec2)   Load 138
-             139:     34(ptr)   AccessChain 131 164
+             139:     34(ptr)   AccessChain 131 168
              112:   14(fvec3)   Load 139
              113:   18(fvec2)   VectorShuffle 112 112 0 1
              114:   18(fvec2)   FAdd 113 110
-             140:     34(ptr)   AccessChain 131 164
+             140:     34(ptr)   AccessChain 131 168
              116:   14(fvec3)   Load 140
              117:   14(fvec3)   VectorShuffle 116 114 3 4 2
                                 Store 140 117
-             119:     21(int)   IAdd 164 31
+             119:     21(int)   IAdd 168 31
                                 Branch 100
              101:             Label
              142:          17 Load 131

+ 6 - 0
3rdparty/glslang/Test/baseResults/matrix2.frag.out

@@ -158,6 +158,9 @@ Shader version: 150
 0:49            'FragColor' ( out 4-component vector of float)
 0:49            Constant:
 0:49              3 (const int)
+0:50      matrix mult second child into first child ( temp 3X4 matrix of float)
+0:50        'm34' ( temp 3X4 matrix of float)
+0:50        'colorTransform' ( uniform 3X3 matrix of float)
 0:?   Linker Objects
 0:?     'colorTransform' ( uniform 3X3 matrix of float)
 0:?     'Color' ( smooth in 3-component vector of float)
@@ -331,6 +334,9 @@ Shader version: 150
 0:49            'FragColor' ( out 4-component vector of float)
 0:49            Constant:
 0:49              3 (const int)
+0:50      matrix mult second child into first child ( temp 3X4 matrix of float)
+0:50        'm34' ( temp 3X4 matrix of float)
+0:50        'colorTransform' ( uniform 3X3 matrix of float)
 0:?   Linker Objects
 0:?     'colorTransform' ( uniform 3X3 matrix of float)
 0:?     'Color' ( smooth in 3-component vector of float)

+ 7 - 1
3rdparty/glslang/Test/baseResults/matrixError.vert.out

@@ -6,7 +6,9 @@ ERROR: 0:18: 'assign' :  cannot convert from ' temp 2-component vector of float'
 ERROR: 0:19: 'xy' : does not apply to this type:  temp 2X3 matrix of float
 ERROR: 0:21: '[' :  matrix index out of range '2'
 ERROR: 0:21: '[' :  vector index out of range '4'
-ERROR: 7 compilation errors.  No code generated.
+ERROR: 0:22: 'assign' :  cannot convert from ' temp 2X3 matrix of float' to ' temp 2X3 matrix of float'
+ERROR: 0:23: 'assign' :  cannot convert from ' uniform 3X2 matrix of float' to ' temp 2X3 matrix of float'
+ERROR: 9 compilation errors.  No code generated.
 
 
 Shader version: 120
@@ -32,6 +34,8 @@ ERROR: node is still EOpNull!
 0:21                2 (const int)
 0:21            Constant:
 0:21              4 (const int)
+0:22      'm23' ( temp 2X3 matrix of float)
+0:23      'm23' ( temp 2X3 matrix of float)
 0:?   Linker Objects
 0:?     'v3' ( in 3-component vector of float)
 0:?     'm32' ( uniform 3X2 matrix of float)
@@ -64,6 +68,8 @@ ERROR: node is still EOpNull!
 0:21                2 (const int)
 0:21            Constant:
 0:21              4 (const int)
+0:22      'm23' ( temp 2X3 matrix of float)
+0:23      'm23' ( temp 2X3 matrix of float)
 0:?   Linker Objects
 0:?     'v3' ( in 3-component vector of float)
 0:?     'm32' ( uniform 3X2 matrix of float)

+ 2 - 0
3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.err

@@ -0,0 +1,2 @@
+WARNING: 0:10: '#pragma once' : not implemented 
+

+ 2 - 0
3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.out

@@ -7,6 +7,8 @@
 
 #pragma undefined_pragma(x,4)
 
+#pragma once
+
 int main(){
 }
 

+ 1 - 0
3rdparty/glslang/Test/matrix2.frag

@@ -47,4 +47,5 @@ void main()
     FragColor *= inv4;
 
     FragColor = vec4(FragColor * matrixCompMult(un34, un34), FragColor.w);
+    m34 *= colorTransform;
 }

+ 2 - 0
3rdparty/glslang/Test/matrixError.vert

@@ -19,4 +19,6 @@ void main()
     m23.xy;            // ERROR, can't use .
 
     gl_Position = vec4(m23 * m32 * v3, m24[2][4]);  // ERROR, 2 and 4 are out of range
+    m23 *= m23;        // ERROR, right side needs to be square
+    m23 *= m32;        // ERROR, left columns must match right rows
 }

+ 2 - 0
3rdparty/glslang/Test/preprocessor.pragma.vert

@@ -7,5 +7,7 @@
 
 #pragma undefined_pragma(x, 4)
 
+#pragma once
+
 int main() {
 }

+ 1 - 1
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp

@@ -2706,7 +2706,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
                 node.setOp(op = EOpMatrixTimesScalarAssign);
             }
         } else if (left->isMatrix() && right->isMatrix()) {
-            if (left->getMatrixCols() != left->getMatrixRows() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows())
+            if (left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows())
                 return false;
             node.setOp(op = EOpMatrixTimesMatrixAssign);
         } else if (!left->isMatrix() && !right->isMatrix()) {

+ 5 - 0
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -266,6 +266,8 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
         if (tokens.size() != 1)
             error(loc, "extra tokens", "#pragma", "");
         intermediate.setUseStorageBuffer();
+    } else if (tokens[0].compare("once") == 0) {
+        warn(loc, "not implemented", "#pragma once", "");
     }
 }
 
@@ -1583,6 +1585,9 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
     case EOpInterpolateAtCentroid:
     case EOpInterpolateAtSample:
     case EOpInterpolateAtOffset:
+#ifdef AMD_EXTENSIONS
+    case EOpInterpolateAtVertex:
+#endif
         // Make sure the first argument is an interpolant, or an array element of an interpolant
         if (arg0->getType().getQualifier().storage != EvqVaryingIn) {
             // It might still be an array element.

+ 7 - 0
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -550,6 +550,13 @@ void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString
             warn(loc, "unknown pack_matrix pragma value", tokens[2].c_str(), "");
             globalUniformDefaults.layoutMatrix = globalBufferDefaults.layoutMatrix = ElmRowMajor;
         }
+        return;
+    }
+
+    // Handle once
+    if (lowerTokens[0] == "once") {
+        warn(loc, "not implemented", "#pragma once", "");
+        return;
     }
 }
 

+ 1 - 1
3rdparty/glslang/known_good.json

@@ -5,7 +5,7 @@
       "site" : "github",
       "subrepo" : "KhronosGroup/SPIRV-Tools",
       "subdir" : "External/spirv-tools",
-      "commit" : "9e19fc0f31ceaf1f6bc907dbf17dcfded85f2ce8"
+      "commit" : "4e4a254bc85ea41af93a048f1713ef27e04c01ab"
     },
     {
       "name" : "spirv-tools/external/spirv-headers",

+ 13 - 9
3rdparty/glslang/update_glslang_sources.py

@@ -28,8 +28,12 @@ import sys
 
 KNOWN_GOOD_FILE = 'known_good.json'
 
+SITE_TO_KNOWN_GOOD_FILE = { 'github' : 'known_good.json',
+                            'gitlab' : 'known_good_khr.json' }
+
 # Maps a site name to its hostname.
-SITE_TO_HOST = { 'github' : 'github.com' }
+SITE_TO_HOST = { 'github' : 'https://github.com/',
+                 'gitlab' : '[email protected]:' }
 
 VERBOSE = True
 
@@ -82,14 +86,11 @@ class GoodCommit(object):
         self.subdir = json['subdir'] if ('subdir' in json) else '.'
         self.commit = json['commit']
 
-    def GetUrl(self, style='https'):
+    def GetUrl(self):
         """Returns the URL for the repository."""
         host = SITE_TO_HOST[self.site]
-        sep = '/' if (style is 'https') else ':'
-        return '{style}://{host}{sep}{subrepo}'.format(
-                    style=style,
+        return '{host}{subrepo}'.format(
                     host=host,
-                    sep=sep,
                     subrepo=self.subrepo)
 
     def AddRemote(self):
@@ -120,9 +121,10 @@ class GoodCommit(object):
         command_output(['git', 'checkout', self.commit], self.subdir)
 
 
-def GetGoodCommits():
+def GetGoodCommits(site):
     """Returns the latest list of GoodCommit objects."""
-    with open(KNOWN_GOOD_FILE) as known_good:
+    known_good_file = SITE_TO_KNOWN_GOOD_FILE[site]
+    with open(known_good_file) as known_good:
         return [GoodCommit(c) for c in json.loads(known_good.read())['commits']]
 
 
@@ -130,10 +132,12 @@ def main():
     parser = argparse.ArgumentParser(description='Get Glslang source dependencies at a known-good commit')
     parser.add_argument('--dir', dest='dir', default='.',
                         help="Set target directory for Glslang source root. Default is \'.\'.")
+    parser.add_argument('--site', dest='site', default='github',
+                        help="Set git server site. Default is github.")
 
     args = parser.parse_args()
 
-    commits = GetGoodCommits()
+    commits = GetGoodCommits(args.site)
 
     distutils.dir_util.mkpath(args.dir)
     print('Change directory to {d}'.format(d=args.dir))

+ 24 - 11
3rdparty/ocornut-imgui/imgui.cpp

@@ -131,7 +131,6 @@
      ImGuiIO& io = ImGui::GetIO();
      io.DisplaySize.x = 1920.0f;
      io.DisplaySize.y = 1280.0f;
-     io.RenderDrawListsFn = MyRenderFunction;  // Setup a render function, or set to NULL and call GetDrawData() after Render() to access render data.
      // TODO: Fill others settings of the io structure later.
 
      // Load texture atlas (there is a default font so you don't need to care about choosing a font yet)
@@ -162,6 +161,7 @@
      
         // Render & swap video buffers
         ImGui::Render();
+        MyImGuiRenderFunction(ImGui::GetDrawData());
         SwapBuffers();
      }
 
@@ -250,6 +250,7 @@
  Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
  Also read releases logs https://github.com/ocornut/imgui/releases for more details.
 
+ - 2018/02/16 (1.60) - obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.
  - 2018/02/07 (1.60) - reorganized context handling to be more explicit,
                        - YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END.
                        - removed Shutdown() function, as DestroyContext() serve this purpose.
@@ -684,6 +685,7 @@
 #pragma GCC diagnostic ignored "-Wconversion"               // warning: conversion to 'xxxx' from 'xxxx' may alter its value
 #pragma GCC diagnostic ignored "-Wcast-qual"                // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"        // warning: format not a string literal, format string not checked
+#pragma GCC diagnostic ignored "-Wstrict-overflow"          // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
 #endif
 
 // Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall
@@ -884,15 +886,18 @@ ImGuiIO::ImGuiIO()
     OptMacOSXBehaviors = false;
 #endif
     OptCursorBlink = true;
-                                
+
     // Settings (User Functions)
-    RenderDrawListsFn = NULL;
     GetClipboardTextFn = GetClipboardTextFn_DefaultImpl;   // Platform dependent default implementations
     SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
     ClipboardUserData = NULL;
     ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl;
     ImeWindowHandle = NULL;
 
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
+    RenderDrawListsFn = NULL;
+#endif
+
     // Input (NB: we already have memset zero the entire structure)
     MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
     MousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX);
@@ -2659,7 +2664,7 @@ ImGuiStyle& ImGui::GetStyle()
     return GImGui->Style;
 }
 
-// Same value as passed to your RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame()
+// Same value as passed to the old io.RenderDrawListsFn function. Valid after Render() and until the next call to NewFrame()
 ImDrawData* ImGui::GetDrawData()
 {
     return GImGui->DrawData.Valid ? &GImGui->DrawData : NULL;
@@ -4081,8 +4086,10 @@ void ImGui::Render()
         g.IO.MetricsRenderIndices = g.DrawData.TotalIdxCount;
 
         // Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData()
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
         if (g.DrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL)
             g.IO.RenderDrawListsFn(&g.DrawData);
+#endif
     }
 }
 
@@ -4879,6 +4886,7 @@ static ImGuiWindow* GetFrontMostModalRootWindow()
 
 static void ClosePopupToLevel(int remaining)
 {
+    IM_ASSERT(remaining >= 0);
     ImGuiContext& g = *GImGui;
     ImGuiWindow* focus_window = (remaining > 0) ? g.OpenPopupStack[remaining-1].Window : g.OpenPopupStack[0].ParentWindow;
     if (g.NavLayer == 0)
@@ -5994,11 +6002,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
         // Draw navigation selection/windowing rectangle border
         if (g.NavWindowingTarget == window)
         {
+            float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
             ImRect bb = window->Rect();
             bb.Expand(g.FontSize);
-            if (bb.Contains(viewport_rect))
-                bb.Expand(-g.FontSize - 2.0f);
-            window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), g.Style.WindowRounding, ~0, 3.0f);
+            if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward
+            {
+                bb.Expand(-g.FontSize - 1.0f);
+                rounding = window->WindowRounding;
+            }
+            window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, ~0, 3.0f);
         }
 
         // Store a backup of SizeFull which we will use next frame to decide if we need scrollbars. 
@@ -9291,11 +9303,12 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
         }
 
         const float t_step = 1.0f / (float)res_w;
+        const float inv_scale = (scale_min == scale_max) ? 0.0f : (1.0f / (scale_max - scale_min));
 
         float v0 = values_getter(data, (0 + values_offset) % values_count);
         float t0 = 0.0f;
-        ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)) );                       // Point in the normalized space of our target rectangle
-        float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min / (scale_max - scale_min)) : (scale_min < 0.0f ? 0.0f : 1.0f);   // Where does the zero line stands
+        ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) * inv_scale) );                       // Point in the normalized space of our target rectangle
+        float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f);   // Where does the zero line stands
 
         const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram);
         const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered);
@@ -9306,7 +9319,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
             const int v1_idx = (int)(t0 * item_count + 0.5f);
             IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);
             const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);
-            const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)) );
+            const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) * inv_scale) );
 
             // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU.
             ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0);
@@ -11218,7 +11231,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
     if (!enabled) // explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu("options", has_object)) { ..use object.. }'
         want_close = true;
     if (want_close && IsPopupOpen(id))
-        ClosePopupToLevel(GImGui->CurrentPopupStack.Size);
+        ClosePopupToLevel(g.CurrentPopupStack.Size);
 
     if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.CurrentPopupStack.Size)
     {

+ 9 - 8
3rdparty/ocornut-imgui/imgui.h

@@ -147,9 +147,9 @@ namespace ImGui
     // Main
     IMGUI_API ImGuiIO&      GetIO();
     IMGUI_API ImGuiStyle&   GetStyle();
-    IMGUI_API ImDrawData*   GetDrawData();                              // same value as passed to your io.RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame()
     IMGUI_API void          NewFrame();                                 // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame().
-    IMGUI_API void          Render();                                   // ends the ImGui frame, finalize the draw data, then call your io.RenderDrawListsFn() function if set.
+    IMGUI_API void          Render();                                   // ends the ImGui frame, finalize the draw data. (Obsolete: optionally call io.RenderDrawListsFn if set. Nowadays, prefer calling your render function yourself.)
+    IMGUI_API ImDrawData*   GetDrawData();                              // valid after Render() and until the next call to NewFrame(). this is what you have to render. (Obsolete: this used to be passed to your io.RenderDrawListsFn() function.)
     IMGUI_API void          EndFrame();                                 // ends the ImGui frame. automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead!
 
     // Demo, Debug, Informations
@@ -882,7 +882,7 @@ enum ImGuiMouseCursor_
     ImGuiMouseCursor_None = -1,
     ImGuiMouseCursor_Arrow = 0,
     ImGuiMouseCursor_TextInput,         // When hovering over InputText, etc.
-    ImGuiMouseCursor_Move,              // Unused
+    ImGuiMouseCursor_ResizeAll,         // Unused
     ImGuiMouseCursor_ResizeNS,          // When hovering over an horizontal border
     ImGuiMouseCursor_ResizeEW,          // When hovering over a vertical border or a column
     ImGuiMouseCursor_ResizeNESW,        // When hovering over the bottom-left corner of a window
@@ -983,11 +983,6 @@ struct ImGuiIO
     // Settings (User Functions)
     //------------------------------------------------------------------
 
-    // Rendering function, will be called in Render().
-    // Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer.
-    // See example applications if you are unsure of how to implement this.
-    void        (*RenderDrawListsFn)(ImDrawData* data);
-
     // Optional: access OS clipboard
     // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
     const char* (*GetClipboardTextFn)(void* user_data);
@@ -999,6 +994,12 @@ struct ImGuiIO
     void        (*ImeSetInputScreenPosFn)(int x, int y);
     void*       ImeWindowHandle;            // (Windows) Set this to your HWND to get automatic IME cursor positioning.
 
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
+    // [OBSOLETE] Rendering function, will be automatically called in Render(). Please call your rendering function yourself now! You can obtain the ImDrawData* by calling ImGui::GetDrawData() after Render().
+    // See example applications if you are unsure of how to implement this.
+    void        (*RenderDrawListsFn)(ImDrawData* data);
+#endif
+
     //------------------------------------------------------------------
     // Input - Fill before calling NewFrame()
     //------------------------------------------------------------------

+ 1 - 1
3rdparty/ocornut-imgui/imgui_draw.cpp

@@ -1353,7 +1353,7 @@ static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_Count_][
     // Pos ........ Size ......... Offset ......
     { ImVec2(0,3),  ImVec2(12,19), ImVec2( 0, 0) }, // ImGuiMouseCursor_Arrow
     { ImVec2(13,0), ImVec2(7,16),  ImVec2( 4, 8) }, // ImGuiMouseCursor_TextInput
-    { ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_Move
+    { ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_ResizeAll
     { ImVec2(21,0), ImVec2( 9,23), ImVec2( 5,11) }, // ImGuiMouseCursor_ResizeNS
     { ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 5) }, // ImGuiMouseCursor_ResizeEW
     { ImVec2(73,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNESW

+ 1 - 8
examples/common/imgui/imgui.cpp

@@ -70,8 +70,6 @@ static void memFree(void* _ptr, void* _userData);
 
 struct OcornutImguiContext
 {
-	static void renderDrawLists(ImDrawData* _drawData);
-
 	void render(ImDrawData* _drawData)
 	{
 		const ImGuiIO& io = ImGui::GetIO();
@@ -212,7 +210,6 @@ struct OcornutImguiContext
 		m_imgui = ImGui::CreateContext();
 
 		ImGuiIO& io = ImGui::GetIO();
-		io.RenderDrawListsFn = renderDrawLists;
 
 		io.DisplaySize = ImVec2(1280.0f, 720.0f);
 		io.DeltaTime   = 1.0f / 60.0f;
@@ -420,6 +417,7 @@ struct OcornutImguiContext
 	{
 		ImGui::PopStyleVar(1);
 		ImGui::Render();
+		render(ImGui::GetDrawData() );
 	}
 
 	ImGuiContext*       m_imgui;
@@ -450,11 +448,6 @@ static void memFree(void* _ptr, void* _userData)
 	BX_FREE(s_ctx.m_allocator, _ptr);
 }
 
-void OcornutImguiContext::renderDrawLists(ImDrawData* _drawData)
-{
-	s_ctx.render(_drawData);
-}
-
 void imguiCreate(float _fontSize, bx::AllocatorI* _allocator)
 {
 	s_ctx.create(_fontSize, _allocator);

+ 5 - 10
src/bgfx_p.h

@@ -2371,8 +2371,7 @@ namespace bgfx
 				}
 			}
 
-			VertexDeclHandle invalid = BGFX_INVALID_HANDLE;
-			return invalid;
+			return BGFX_INVALID_HANDLE;
 		}
 
 		VertexDeclHandle release(VertexBufferHandle _handle)
@@ -3612,8 +3611,7 @@ namespace bgfx
 			||  !isValid(_fsh) )
 			{
 				BX_TRACE("Vertex/fragment shader is invalid (vsh %d, fsh %d).", _vsh.idx, _fsh.idx);
-				ProgramHandle invalid = BGFX_INVALID_HANDLE;
-				return invalid;
+				return BGFX_INVALID_HANDLE;
 			}
 
 			ProgramHandle handle = { m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx) };
@@ -3631,8 +3629,7 @@ namespace bgfx
 				if (vsr.m_hash != fsr.m_hash)
 				{
 					BX_TRACE("Vertex shader output doesn't match fragment shader input.");
-					ProgramHandle invalid = BGFX_INVALID_HANDLE;
-					return invalid;
+					return BGFX_INVALID_HANDLE;
 				}
 
 				handle.idx = m_programHandle.alloc();
@@ -3674,8 +3671,7 @@ namespace bgfx
 			if (!isValid(_vsh) )
 			{
 				BX_WARN(false, "Compute shader is invalid (vsh %d).", _vsh.idx);
-				ProgramHandle invalid = BGFX_INVALID_HANDLE;
-				return invalid;
+				return BGFX_INVALID_HANDLE;
 			}
 
 			ProgramHandle handle = { m_programHashMap.find(_vsh.idx) };
@@ -4055,8 +4051,7 @@ namespace bgfx
 				return ref.un.m_th[attachment];
 			}
 
-			TextureHandle invalid = BGFX_INVALID_HANDLE;
-			return invalid;
+			return BGFX_INVALID_HANDLE;
 		}
 
 		BGFX_API_FUNC(void destroyFrameBuffer(FrameBufferHandle _handle) )

部分文件因为文件数量过多而无法显示