Forráskód Böngészése

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

Branimir Karadžić 11 éve
szülő
commit
f6594b1bab

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 237 - 147
3rdparty/ocornut-imgui/imgui.cpp


+ 95 - 42
3rdparty/ocornut-imgui/imgui.h

@@ -1,4 +1,4 @@
-// ImGui library v1.30 wip
+// ImGui library v1.30
 // See .cpp file for commentary.
 // See ImGui::ShowTestWindow() for sample code.
 // Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
@@ -6,6 +6,7 @@
 
 #pragma once
 
+struct ImDrawCmd;
 struct ImDrawList;
 struct ImFont;
 struct ImFontAtlas;
@@ -42,7 +43,7 @@ typedef int ImGuiColorEditMode;     // enum ImGuiColorEditMode_
 typedef int ImGuiWindowFlags;       // enum ImGuiWindowFlags_
 typedef int ImGuiSetCondition;      // enum ImGuiSetCondition_
 typedef int ImGuiInputTextFlags;    // enum ImGuiInputTextFlags_
-struct ImGuiTextEditCallbackData;   // for advanced uses of InputText()
+struct ImGuiTextEditCallbackData;   // for advanced uses of InputText() 
 
 struct ImVec2
 {
@@ -74,7 +75,7 @@ namespace ImGui
     IMGUI_API void*       MemRealloc(void* ptr, size_t sz);
 }
 
-// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
+// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). 
 // Use '#define ImVector std::vector' if you want to use the STL type or your own type.
 // Our implementation does NOT call c++ constructors! because the data types we use don't need them (but that could be added as well). Only provide the minimum functionalities we need.
 #ifndef ImVector
@@ -237,14 +238,15 @@ namespace ImGui
     IMGUI_API void          TextWrapped(const char* fmt, ...);                                  // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
     IMGUI_API void          TextWrappedV(const char* fmt, va_list args);
     IMGUI_API void          TextUnformatted(const char* text, const char* text_end = NULL);     // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text.
-    IMGUI_API void          LabelText(const char* label, const char* fmt, ...);                 // display text+label aligned the same way as value+label widgets
+    IMGUI_API void          LabelText(const char* label, const char* fmt, ...);                 // display text+label aligned the same way as value+label widgets 
     IMGUI_API void          LabelTextV(const char* label, const char* fmt, va_list args);
     IMGUI_API void          BulletText(const char* fmt, ...);
     IMGUI_API void          BulletTextV(const char* fmt, va_list args);
     IMGUI_API bool          Button(const char* label, const ImVec2& size = ImVec2(0,0), bool repeat_when_held = false);
     IMGUI_API bool          SmallButton(const char* label);
     IMGUI_API bool          InvisibleButton(const char* str_id, const ImVec2& size);
-    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), ImU32 tint_col = 0xFFFFFFFF, ImU32 border_col = 0x00000000);
+    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
+    IMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0),  const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1));    // <0 frame_padding uses default frame padding settings. 0 for no paddnig.
     IMGUI_API bool          CollapsingHeader(const char* label, const char* str_id = NULL, const bool display_frame = true, const bool default_open = false);
     IMGUI_API bool          SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);     // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders.
     IMGUI_API bool          SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
@@ -321,6 +323,10 @@ namespace ImGui
     IMGUI_API const char*   GetStyleColName(ImGuiCol idx);
     IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
 
+    IMGUI_API ImU32         ColorConvertFloat4ToU32(const ImVec4& in);
+    IMGUI_API void          ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
+    IMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
+
     // Obsolete (will be removed)
     IMGUI_API void          GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
 
@@ -501,14 +507,16 @@ struct ImGuiIO
     ImFontAtlas*  Fonts;                    // <auto>               // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
     float         FontGlobalScale;          // = 1.0f               // Global scale all fonts
     bool          FontAllowUserScaling;     // = false              // Allow user scaling text of individual window with CTRL+Wheel.
+    ImVec2        DisplayVisibleMin;        // <unset> (0.0f,0.0f)  // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.
+    ImVec2        DisplayVisibleMax;        // <unset> (0.0f,0.0f)  // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
 
     //------------------------------------------------------------------
     // User Functions
     //------------------------------------------------------------------
 
-    // REQUIRED: rendering function.
+    // REQUIRED: rendering function. 
     // See example code if you are unsure of how to implement this.
-    void        (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);
+    void        (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);      
 
     // Optional: access OS clipboard (default to use native Win32 clipboard on Windows, otherwise use a ImGui private clipboard)
     // Override to access OS clipboard on other architectures.
@@ -529,7 +537,8 @@ struct ImGuiIO
 
     ImVec2      MousePos;                   // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
     bool        MouseDown[5];               // Mouse buttons. ImGui itself only uses button 0 (left button) but you can use others as storage for convenience.
-    float       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text.
+    float       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text. 
+    bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
     bool        KeyCtrl;                    // Keyboard modifier pressed: Control
     bool        KeyShift;                   // Keyboard modifier pressed: Shift
     bool        KeysDown[512];              // Keyboard keys that are pressed (in whatever order user naturally has access to keyboard data)
@@ -638,35 +647,43 @@ struct ImGuiTextBuffer
 // - You want to store custom debug data easily without adding or editing structures in your code.
 struct ImGuiStorage
 {
-    struct Pair
-    {
-        ImGuiID key;
-        union { int val_i; float val_f; };
-        Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; }
-        Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }
+    struct Pair 
+    { 
+        ImGuiID key; 
+        union { int val_i; float val_f; void* val_p; };        
+        Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } 
+        Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } 
+        Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } 
     };
     ImVector<Pair>    Data;
 
     // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)
     // - Set***() functions find pair, insertion on demand if missing.
-    // - Get***Ptr() functions find pair, insertion on demand if missing, return pointer. Useful if you intend to do Get+Set.
-    //   A typical use case where this is very convenient:
-    //      float* pvar = ImGui::GetIntPtr(key); ImGui::SliderInt("var", pvar, 0, 100); some_var += *pvar;
     // - Sorted insertion is costly but should amortize. A typical frame shouldn't need to insert any new pair.
     IMGUI_API void    Clear();
     IMGUI_API int     GetInt(ImGuiID key, int default_val = 0) const;
     IMGUI_API void    SetInt(ImGuiID key, int val);
-    IMGUI_API int*    GetIntPtr(ImGuiID key, int default_val = 0);
     IMGUI_API float   GetFloat(ImGuiID key, float default_val = 0.0f) const;
     IMGUI_API void    SetFloat(ImGuiID key, float val);
-    IMGUI_API float*  GetFloatPtr(ImGuiID key, float default_val = 0);
-    IMGUI_API void    SetAllInt(int val);    // Use on your own storage if you know only integer are being stored.
+    IMGUI_API void*   GetVoidPtr(ImGuiID key) const; // default_val is NULL
+    IMGUI_API void    SetVoidPtr(ImGuiID key, void* val);
+
+    // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. 
+    // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
+    // - A typical use case where this is convenient:
+    //      float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
+    // - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
+    IMGUI_API int*    GetIntRef(ImGuiID key, int default_val = 0);
+    IMGUI_API float*  GetFloatRef(ImGuiID key, float default_val = 0);
+
+    // Use on your own storage if you know only integer are being stored (open/close all tree nodes)
+    IMGUI_API void    SetAllInt(int val);
 };
 
 // Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used.
 struct ImGuiTextEditCallbackData
 {
-    ImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)        // Read-only
+    ImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)        // Read-only    
     char*               Buf;            // Current text                     // Read-write (pointed data only)
     size_t              BufSize;        //                                  // Read-only
     bool                BufDirty;       // Set if you modify Buf directly   // Write
@@ -681,20 +698,50 @@ struct ImGuiTextEditCallbackData
     void InsertChars(int pos, const char* text, const char* text_end = NULL);
 };
 
+// ImColor() is just a helper that implicity converts to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float)
+// None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either formats.
+struct ImColor
+{
+    ImVec4              Value;
+
+    ImColor(int r, int g, int b, int a = 255)                       { Value.x = r / 255.0f; Value.y = g / 255.0f; Value.z = b / 255.0f; Value.w = a / 255.0f; }
+    ImColor(float r, float g, float b, float a = 1.0f)              { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
+    ImColor(const ImVec4& col)                                      { Value = col; }
+
+    operator ImU32() const                                          { return ImGui::ColorConvertFloat4ToU32(Value); }
+    operator ImVec4() const                                         { return Value; }
+
+    static ImColor HSV(float h, float s, float v, float a = 1.0f)   { float r,g,b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r,g,b,a); }
+};
+
 //-----------------------------------------------------------------------------
 // Draw List
-// Hold a series of drawing commands. The user provides a renderer for ImDrawList
+// Hold a series of drawing commands. The user provides a renderer for ImDrawList.
 //-----------------------------------------------------------------------------
 
+// Draw callbacks for advanced uses.
+// NB- You most likely DO NOT need to care about draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that)
+// Draw callback are useful for example if you want to render a complex 3D scene inside a UI element.
+// The expected behavior from your rendering loop is:
+//   if (cmd.user_callback != NULL)
+//       cmd.user_callback(parent_list, cmd);
+//   else
+//       RenderTriangles()
+// It is up to you to decide if your rendering loop or the callback should be responsible for backup/restoring rendering state.
+typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);
+
+// Typically, 1 command = 1 gpu draw call
 struct ImDrawCmd
 {
-    unsigned int    vtx_count;
-    ImVec4          clip_rect;
-    ImTextureID     texture_id;     // Copy of user-provided 'TexID' from ImFont or passed to Image*() functions. Ignore if not using images or multiple fonts.
+    unsigned int    vtx_count;                  // Number of vertices (multiple of 3) to be drawn as triangles. The vertices are stored in the callee ImDrawList's vtx_buffer[] array.
+    ImVec4          clip_rect;                  // Clipping rectangle (x1, y1, x2, y2)
+    ImTextureID     texture_id;                 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
+    ImDrawCallback  user_callback;              // If != NULL, call the function instead of rendering the vertices. vtx_count will be 0. clip_rect and texture_id will be set normally.
+    void*           user_callback_data;         // The draw callback code can access this.
 };
 
+// Vertex layout
 #ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
-// Default vertex layout
 struct ImDrawVert
 {
     ImVec2  pos;
@@ -709,37 +756,30 @@ IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
 #endif
 
 // Draw command list
-// This is the low-level list of polygon that ImGui:: functions are creating. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
-// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged.
+// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
+// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future.
 // If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
 // You can interleave normal ImGui:: calls and adding primitives to the current draw list.
 // Note that this only gives you access to rendering polygons. If your intent is to create custom widgets and the publicly exposed functions/data aren't sufficient, you can add code in imgui_user.inl
 struct ImDrawList
 {
     // This is what you have to render
-    ImVector<ImDrawCmd>     commands;           // commands
-    ImVector<ImDrawVert>    vtx_buffer;         // each command consume ImDrawCmd::vtx_count of those
+    ImVector<ImDrawCmd>     commands;           // Commands. Typically 1 command = 1 gpu draw call.
+    ImVector<ImDrawVert>    vtx_buffer;         // Vertex buffer. Each command consume ImDrawCmd::vtx_count of those
 
     // [Internal to ImGui]
-    ImVector<ImVec4>        clip_rect_stack;    // [internal]
-    ImVector<ImTextureID>   texture_id_stack;   // [internal]
-    ImDrawVert*             vtx_write;          // [internal] point within vtx_buffer after each add command (to avoid using the ImVector<> operators too much)
+    ImVector<ImVec4>        clip_rect_stack;    // [Internal]
+    ImVector<ImTextureID>   texture_id_stack;   // [Internal] 
+    ImDrawVert*             vtx_write;          // [Internal] point within vtx_buffer after each add command (to avoid using the ImVector<> operators too much)
 
     ImDrawList() { Clear(); }
-
     IMGUI_API void  Clear();
-    IMGUI_API void  SetClipRect(const ImVec4& clip_rect);
     IMGUI_API void  PushClipRect(const ImVec4& clip_rect);
     IMGUI_API void  PopClipRect();
-    IMGUI_API void  SetTextureID(const ImTextureID& texture_id);
     IMGUI_API void  PushTextureID(const ImTextureID& texture_id);
     IMGUI_API void  PopTextureID();
-    IMGUI_API void  ReserveVertices(unsigned int vtx_count);
-    IMGUI_API void  AddVtx(const ImVec2& pos, ImU32 col);
-    IMGUI_API void  AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
-    IMGUI_API void  AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
 
-    // Primitives
+    // Primitives   
     IMGUI_API void  AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
     IMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
     IMGUI_API void  AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
@@ -748,7 +788,19 @@ struct ImDrawList
     IMGUI_API void  AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
     IMGUI_API void  AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
     IMGUI_API void  AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f);
-    IMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col);
+    IMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
+
+    // Advanced
+    IMGUI_API void  AddCallback(ImDrawCallback callback, void* callback_data);   // Your rendering function must check for 'user_callback' in ImDrawCmd and call the function instead of rendering triangles.
+    IMGUI_API void  AddDrawCmd();               // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible
+
+    // Internal helpers
+    IMGUI_API void  ReserveVertices(unsigned int vtx_count);
+    IMGUI_API void  AddVtx(const ImVec2& pos, ImU32 col);
+    IMGUI_API void  AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
+    IMGUI_API void  AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
+    IMGUI_API void  UpdateClipRect();
+    IMGUI_API void  UpdateTextureID();
 };
 
 // Load and rasterize multiple TTF fonts into a same texture.
@@ -800,6 +852,7 @@ struct ImFontAtlas
     ImVector<ImFontAtlasData*>  InputData;          // Internal data
     IMGUI_API bool              Build();            // Build pixels data. This is automatically for you by the GetTexData*** functions.
     IMGUI_API void              ClearInputData();   // Clear the input TTF data.
+    IMGUI_API void              RenderCustomTexData();
 };
 
 // TTF font loading and rendering

+ 1 - 0
3rdparty/ocornut-imgui/stb_rect_pack.h

@@ -0,0 +1 @@
+#include <stb/stb_rect_pack.h>

+ 1 - 0
3rdparty/ocornut-imgui/stb_textedit.h

@@ -0,0 +1 @@
+#include <stb/stb_textedit.h>

+ 1 - 0
3rdparty/ocornut-imgui/stb_truetype.h

@@ -0,0 +1 @@
+#include <stb/stb_truetype.h>

+ 2 - 4
README.md

@@ -52,11 +52,9 @@ Who is using it?
 http://airmech.com/ AirMech is a free-to-play futuristic action real-time
 strategy video game developed and published by Carbon Games.
 
-http://theengine.co/ Loom Game Engine developed by The Engine Company. Loom
+http://loomsdk.com/ Loom Game Engine developed by The Engine Company. Loom
 is a powerful 2D game engine with live reloading of code and assets, a friendly
-scripting language, and an efficient command-line workflow. Here is video where
-they explain why they choose bgfx over alternatives:  
-<a href="https://www.youtube.com/watch?feature=player_embedded&v=PHY_XHkMGIM&t=1m53s" target="_blank"><img src="https://img.youtube.com/vi/PHY_XHkMGIM/0.jpg" alt="Why did you choose bgfx?" width="240" height="180" border="10" /></a>
+scripting language, and an efficient command-line workflow.
 
 https://github.com/dariomanesku/cmftStudio cmftStudio - cubemap filtering tool.  
 ![cmftStudio](https://github.com/dariomanesku/cmftStudio/raw/master/screenshots/cmftStudio_small.jpg)

+ 1 - 1
examples/18-ibl/ibl.cpp

@@ -303,7 +303,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 	settings.m_specular = true;
 	settings.m_diffuseIbl = true;
 	settings.m_specularIbl = true;
-	settings.m_showDiffColorWheel = false;
+	settings.m_showDiffColorWheel = true;
 	settings.m_showSpecColorWheel = false;
 	settings.m_crossCubemapPreview = false;
 

+ 7 - 2
examples/common/imgui/ocornut_imgui.cpp

@@ -125,9 +125,9 @@ struct OcornutImguiContext
 		uint8_t* data;
 		int32_t width;
 		int32_t height;
-		void* font = malloc(_size);
+		void* font = ImGui::MemAlloc(_size);
 		memcpy(font, _data, _size);
-		io.Fonts->AddFontFromMemoryTTF(const_cast<void*>(font), _size, _fontSize);
+		io.Fonts->AddFontFromMemoryTTF(font, _size, _fontSize);
 
 		io.Fonts->GetTexDataAsRGBA32(&data, &width, &height);
 
@@ -139,6 +139,9 @@ struct OcornutImguiContext
 			, bgfx::copy(data, width*height*4)
 			);
 
+		ImGuiStyle& style = ImGui::GetStyle();
+		style.FrameRounding = 4.0f;
+
 		io.RenderDrawListsFn = imguiRender;
 	}
 
@@ -160,6 +163,8 @@ struct OcornutImguiContext
 		io.MouseDown[0] = 0 != (_button & IMGUI_MBUT_LEFT);
 
 		ImGui::NewFrame();
+
+//		ImGui::ShowTestWindow();
 	}
 
 	void endFrame()

+ 2 - 2
makefile

@@ -26,7 +26,7 @@ all:
 	$(GENIE) --with-tools --with-shared-lib --gcc=osx gmake
 	$(GENIE) --with-tools --with-shared-lib --xcode=osx xcode4
 	$(GENIE) --with-tools --with-shared-lib --xcode=ios xcode4
-	
+
 	$(GENIE) --gcc=android-arm gmake
 	$(GENIE) --gcc=android-mips gmake
 	$(GENIE) --gcc=android-x86 gmake
@@ -95,7 +95,7 @@ mingw-gcc-release64: .build/projects/gmake-mingw-gcc
 mingw-gcc: mingw-gcc-debug32 mingw-gcc-release32 mingw-gcc-debug64 mingw-gcc-release64
 
 .build/projects/gmake-mingw-clang:
-	$(GENIE) --clang=mingw-clang gmake
+	$(GENIE) --gcc=mingw-clang gmake
 mingw-clang-debug32: .build/projects/gmake-mingw-clang
 	make -R -C .build/projects/gmake-mingw-clang config=debug32
 mingw-clang-release32: .build/projects/gmake-mingw-clang

+ 29 - 7
src/bgfx.cpp

@@ -21,17 +21,27 @@ namespace bgfx
 
 #if BX_PLATFORM_ANDROID
 	::ANativeWindow* g_bgfxAndroidWindow = NULL;
+
 	void androidSetWindow(::ANativeWindow* _window)
 	{
 		g_bgfxAndroidWindow = _window;
 	}
 #elif BX_PLATFORM_IOS
 	void* g_bgfxEaglLayer = NULL;
+
 	void iosSetEaglLayer(void* _layer)
 	{
 		g_bgfxEaglLayer = _layer;
 	}
+#elif BX_PLATFORM_LINUX
+	::Display* g_bgfxX11Display;
+	::Window   g_bgfxX11Window;
 
+	void x11SetDisplayWindow(::Display* _display, ::Window _window)
+	{
+		g_bgfxX11Display = _display;
+		g_bgfxX11Window  = _window;
+	}
 #elif BX_PLATFORM_OSX
 	void* g_bgfxNSWindow = NULL;
 
@@ -1425,7 +1435,14 @@ again:
 			}
 			else
 			{
-				_type = RendererType::OpenGL;
+				if (s_rendererCreator[RendererType::OpenGL].supported)
+				{
+					_type = RendererType::OpenGL;
+				}
+				else if (s_rendererCreator[RendererType::OpenGLES].supported)
+				{
+					_type = RendererType::OpenGLES;
+				}
 			}
 
 			if (!s_rendererCreator[_type].supported)
@@ -2294,22 +2311,27 @@ again:
 
 	void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format)
 	{
-		_width   = bx::uint32_max(1, _width);
-		_height  = bx::uint32_max(1, _height);
+		const ImageBlockInfo& blockInfo = getBlockInfo(_format);
+		const uint8_t  bpp         = blockInfo.bitsPerPixel;
+		const uint32_t blockWidth  = blockInfo.blockWidth;
+		const uint32_t blockHeight = blockInfo.blockHeight;
+		const uint32_t minBlockX   = blockInfo.minBlockX;
+		const uint32_t minBlockY   = blockInfo.minBlockY;
+
+		_width   = bx::uint32_max(blockWidth  * minBlockX, ( (_width  + blockWidth  - 1) / blockWidth)*blockWidth);
+		_height  = bx::uint32_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
 		_depth   = bx::uint32_max(1, _depth);
 		_numMips = bx::uint32_max(1, _numMips);
 
 		uint32_t width  = _width;
 		uint32_t height = _height;
 		uint32_t depth  = _depth;
-
-		uint32_t bpp = getBitsPerPixel(_format);
 		uint32_t size = 0;
 
 		for (uint32_t lod = 0; lod < _numMips; ++lod)
 		{
-			width  = bx::uint32_max(1, width);
-			height = bx::uint32_max(1, height);
+			width  = bx::uint32_max(blockWidth  * minBlockX, ( (width  + blockWidth  - 1) / blockWidth )*blockWidth);
+			height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight);
 			depth  = bx::uint32_max(1, depth);
 
 			size += width*height*depth*bpp/8;

+ 3 - 0
src/bgfx_p.h

@@ -200,6 +200,9 @@ namespace bgfx
 	extern ::ANativeWindow* g_bgfxAndroidWindow;
 #elif BX_PLATFORM_IOS
 	extern void* g_bgfxEaglLayer;
+#elif BX_PLATFORM_LINUX
+	extern ::Display* g_bgfxX11Display;
+	extern ::Window   g_bgfxX11Window;
 #elif BX_PLATFORM_OSX
 	extern void* g_bgfxNSWindow;
 #elif BX_PLATFORM_WINDOWS

+ 7 - 3
src/glcontext_egl.cpp

@@ -63,7 +63,7 @@ EGL_IMPORT
 
 	void* eglOpen()
 	{
-		void* handle = bx::dlopen("libEGL.dll");
+		void* handle = bx::dlopen("libEGL." BX_DL_EXT);
 		BGFX_FATAL(NULL != handle, Fatal::UnableToInitialize, "Failed to load libEGL dynamic library.");
 
 #define EGL_IMPORT_FUNC(_proto, _func) \
@@ -184,6 +184,9 @@ EGL_IMPORT
 #	if BX_PLATFORM_WINDOWS
 		ndt = GetDC(g_bgfxHwnd);
 		nwh = g_bgfxHwnd;
+#	elif BX_PLATFORM_LINUX
+		ndt = g_bgfxX11Display;
+		nwh = g_bgfxX11Window;
 #	endif // BX_PLATFORM_
 		m_display = eglGetDisplay(ndt);
 		BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
@@ -278,6 +281,7 @@ EGL_IMPORT
 
 	void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
 	{
+		BX_UNUSED(_width, _height);
 #	if BX_PLATFORM_ANDROID
 		EGLint format;
 		eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format);
@@ -334,8 +338,8 @@ EGL_IMPORT
 	void GlContext::import()
 	{
 		BX_TRACE("Import:");
-#	if BX_PLATFORM_WINDOWS
-		void* glesv2 = bx::dlopen("libGLESv2.dll");
+#	if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX
+		void* glesv2 = bx::dlopen("libGLESv2." BX_DL_EXT);
 #		define GL_EXTENSION(_optional, _proto, _func, _import) \
 					{ \
 						if (NULL == _func) \

+ 31 - 36
src/glcontext_glx.cpp

@@ -7,8 +7,10 @@
 
 #if (BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX) && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
 #	include "renderer_gl.h"
-#	define GLX_GLXEXT_PROTOTYPES
-#	include <glx/glxext.h>
+
+#	if BGFX_USE_GLX
+#		define GLX_GLXEXT_PROTOTYPES
+#		include <glx/glxext.h>
 
 namespace bgfx
 {
@@ -22,50 +24,41 @@ namespace bgfx
 #	define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
 #	include "glimports.h"
 
-	static ::Display* s_display;
-	static ::Window   s_window;
-
 	struct SwapChainGL
 	{
 		SwapChainGL(::Window _window, XVisualInfo* _visualInfo, GLXContext _context)
 			: m_window(_window)
 		{
-			m_context = glXCreateContext(s_display, _visualInfo, _context, GL_TRUE);
+			m_context = glXCreateContext(g_bgfxX11Display, _visualInfo, _context, GL_TRUE);
 		}
 
 		~SwapChainGL()
 		{
-			glXMakeCurrent(s_display, 0, 0);
-			glXDestroyContext(s_display, m_context);
+			glXMakeCurrent(g_bgfxX11Display, 0, 0);
+			glXDestroyContext(g_bgfxX11Display, m_context);
 		}
 
 		void makeCurrent()
 		{
-			glXMakeCurrent(s_display, m_window, m_context);
+			glXMakeCurrent(g_bgfxX11Display, m_window, m_context);
 		}
 
 		void swapBuffers()
 		{
-			glXSwapBuffers(s_display, m_window);
+			glXSwapBuffers(g_bgfxX11Display, m_window);
 		}
 
 		Window m_window;
 		GLXContext m_context;
 	};
 
-	void x11SetDisplayWindow(::Display* _display, ::Window _window)
-	{
-		s_display = _display;
-		s_window  = _window;
-	}
-
 	void GlContext::create(uint32_t _width, uint32_t _height)
 	{
 		BX_UNUSED(_width, _height);
-		XLockDisplay(s_display);
+		XLockDisplay(g_bgfxX11Display);
 
 		int major, minor;
-		bool version = glXQueryVersion(s_display, &major, &minor);
+		bool version = glXQueryVersion(g_bgfxX11Display, &major, &minor);
 		BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
 		BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
 				, Fatal::UnableToInitialize
@@ -74,9 +67,9 @@ namespace bgfx
 				, minor
 				);
 
-		int32_t screen = DefaultScreen(s_display);
+		int32_t screen = DefaultScreen(g_bgfxX11Display);
 
-		const char* extensions = glXQueryExtensionsString(s_display, screen);
+		const char* extensions = glXQueryExtensionsString(g_bgfxX11Display, screen);
 		BX_TRACE("GLX extensions:");
 		dumpExtensions(extensions);
 
@@ -98,13 +91,13 @@ namespace bgfx
 		GLXFBConfig bestConfig = NULL;
 
 		int numConfigs;
-		GLXFBConfig* configs = glXChooseFBConfig(s_display, screen, attrsGlx, &numConfigs);
+		GLXFBConfig* configs = glXChooseFBConfig(g_bgfxX11Display, screen, attrsGlx, &numConfigs);
 
 		BX_TRACE("glX num configs %d", numConfigs);
 
 		for (int ii = 0; ii < numConfigs; ++ii)
 		{
-			m_visualInfo = glXGetVisualFromFBConfig(s_display, configs[ii]);
+			m_visualInfo = glXGetVisualFromFBConfig(g_bgfxX11Display, configs[ii]);
 			if (NULL != m_visualInfo)
 			{
 				BX_TRACE("---");
@@ -112,7 +105,7 @@ namespace bgfx
 				for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
 				{
 					int value;
-					glXGetFBConfigAttrib(s_display, configs[ii], attrsGlx[attr], &value);
+					glXGetFBConfigAttrib(g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
 					BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
 							, ii
 							, numConfigs
@@ -148,7 +141,7 @@ namespace bgfx
 		BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
 
 		BX_TRACE("Create GL 2.1 context.");
-		m_context = glXCreateContext(s_display, m_visualInfo, 0, GL_TRUE);
+		m_context = glXCreateContext(g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
 		BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
 
 #if BGFX_CONFIG_RENDERER_OPENGL >= 31
@@ -165,11 +158,11 @@ namespace bgfx
 				0,
 			};
 
-			GLXContext context = glXCreateContextAttribsARB(s_display, bestConfig, 0, true, contextAttrs);
+			GLXContext context = glXCreateContextAttribsARB(g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
 
 			if (NULL != context)
 			{
-				glXDestroyContext(s_display, m_context);
+				glXDestroyContext(g_bgfxX11Display, m_context);
 				m_context = context;
 			}
 		}
@@ -177,17 +170,17 @@ namespace bgfx
 		BX_UNUSED(bestConfig);
 #endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
 
-		XUnlockDisplay(s_display);
+		XUnlockDisplay(g_bgfxX11Display);
 
 		import();
 
-		glXMakeCurrent(s_display, s_window, m_context);
+		glXMakeCurrent(g_bgfxX11Display, g_bgfxX11Window, m_context);
 
 		glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalEXT");
 		if (NULL != glXSwapIntervalEXT)
 		{
 			BX_TRACE("Using glXSwapIntervalEXT.");
-			glXSwapIntervalEXT(s_display, s_window, 0);
+			glXSwapIntervalEXT(g_bgfxX11Display, g_bgfxX11Window, 0);
 		}
 		else
 		{
@@ -210,13 +203,13 @@ namespace bgfx
 
 		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 		glClear(GL_COLOR_BUFFER_BIT);
-		glXSwapBuffers(s_display, s_window);
+		glXSwapBuffers(g_bgfxX11Display, g_bgfxX11Window);
 	}
 
 	void GlContext::destroy()
 	{
-		glXMakeCurrent(s_display, 0, 0);
-		glXDestroyContext(s_display, m_context);
+		glXMakeCurrent(g_bgfxX11Display, 0, 0);
+		glXDestroyContext(g_bgfxX11Display, m_context);
 		XFree(m_visualInfo);
 	}
 
@@ -226,7 +219,7 @@ namespace bgfx
 
 		if (NULL != glXSwapIntervalEXT)
 		{
-			glXSwapIntervalEXT(s_display, s_window, interval);
+			glXSwapIntervalEXT(g_bgfxX11Display, g_bgfxX11Window, interval);
 		}
 		else if (NULL != glXSwapIntervalMESA)
 		{
@@ -257,8 +250,8 @@ namespace bgfx
 	{
 		if (NULL == _swapChain)
 		{
-			glXMakeCurrent(s_display, s_window, m_context);
-			glXSwapBuffers(s_display, s_window);
+			glXMakeCurrent(g_bgfxX11Display, g_bgfxX11Window, m_context);
+			glXSwapBuffers(g_bgfxX11Display, g_bgfxX11Window);
 		}
 		else
 		{
@@ -271,7 +264,7 @@ namespace bgfx
 	{
 		if (NULL == _swapChain)
 		{
-			glXMakeCurrent(s_display, s_window, m_context);
+			glXMakeCurrent(g_bgfxX11Display, g_bgfxX11Window, m_context);
 		}
 		else
 		{
@@ -295,4 +288,6 @@ namespace bgfx
 
 } // namespace bgfx
 
+#	endif // BGFX_USE_GLX
+
 #endif // (BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX) && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

+ 2 - 2
src/glcontext_glx.h

@@ -6,7 +6,7 @@
 #ifndef BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
 #define BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
 
-#if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
+#if BGFX_USE_GLX
 
 #	include <X11/Xlib.h>
 #	include <GL/glx.h>
@@ -45,6 +45,6 @@ namespace bgfx
 	};
 } // namespace bgfx
 
-#endif // BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
+#endif // BGFX_USE_GLX
 
 #endif // BGFX_GLCONTEXT_GLX_H_HEADER_GUARD

+ 52 - 50
src/image.cpp

@@ -12,54 +12,54 @@ namespace bgfx
 {
 	static const ImageBlockInfo s_imageBlockInfo[] =
 	{
-		{   4, 4, 4,  8 }, // BC1
-		{   8, 4, 4, 16 }, // BC2
-		{   8, 4, 4, 16 }, // BC3
-		{   4, 4, 4,  8 }, // BC4
-		{   8, 4, 4, 16 }, // BC5
-		{   8, 4, 4, 16 }, // BC6H
-		{   8, 4, 4, 16 }, // BC7
-		{   4, 4, 4,  8 }, // ETC1
-		{   4, 4, 4,  8 }, // ETC2
-		{   8, 4, 4, 16 }, // ETC2A
-		{   4, 4, 4,  8 }, // ETC2A1
-		{   2, 8, 4,  8 }, // PTC12
-		{   4, 4, 4,  8 }, // PTC14
-		{   2, 8, 4,  8 }, // PTC12A
-		{   4, 4, 4,  8 }, // PTC14A
-		{   2, 8, 4,  8 }, // PTC22
-		{   4, 4, 4,  8 }, // PTC24
-		{   0, 0, 0,  0 }, // Unknown
-		{   1, 8, 1,  1 }, // R1
-		{   8, 1, 1,  1 }, // R8
-		{  16, 1, 1,  2 }, // R16
-		{  16, 1, 1,  2 }, // R16F
-		{  32, 1, 1,  4 }, // R32
-		{  32, 1, 1,  4 }, // R32F
-		{  16, 1, 1,  2 }, // RG8
-		{  32, 1, 1,  4 }, // RG16
-		{  32, 1, 1,  4 }, // RG16F
-		{  64, 1, 1,  8 }, // RG32
-		{  64, 1, 1,  8 }, // RG32F
-		{  32, 1, 1,  4 }, // BGRA8
-		{  64, 1, 1,  8 }, // RGBA16
-		{  64, 1, 1,  8 }, // RGBA16F
-		{ 128, 1, 1, 16 }, // RGBA32
-		{ 128, 1, 1, 16 }, // RGBA32F
-		{  16, 1, 1,  2 }, // R5G6B5
-		{  16, 1, 1,  2 }, // RGBA4
-		{  16, 1, 1,  2 }, // RGB5A1
-		{  32, 1, 1,  4 }, // RGB10A2
-		{  32, 1, 1,  4 }, // R11G11B10F
-		{   0, 0, 0,  0 }, // UnknownDepth
-		{  16, 1, 1,  2 }, // D16
-		{  24, 1, 1,  3 }, // D24
-		{  32, 1, 1,  4 }, // D24S8
-		{  32, 1, 1,  4 }, // D32
-		{  16, 1, 1,  2 }, // D16F
-		{  24, 1, 1,  3 }, // D24F
-		{  32, 1, 1,  4 }, // D32F
-		{   8, 1, 1,  1 }, // D0S8
+		{   4, 4, 4,  8, 1, 1 }, // BC1
+		{   8, 4, 4, 16, 1, 1 }, // BC2
+		{   8, 4, 4, 16, 1, 1 }, // BC3
+		{   4, 4, 4,  8, 1, 1 }, // BC4
+		{   8, 4, 4, 16, 1, 1 }, // BC5
+		{   8, 4, 4, 16, 1, 1 }, // BC6H
+		{   8, 4, 4, 16, 1, 1 }, // BC7
+		{   4, 4, 4,  8, 1, 1 }, // ETC1
+		{   4, 4, 4,  8, 1, 1 }, // ETC2
+		{   8, 4, 4, 16, 1, 1 }, // ETC2A
+		{   4, 4, 4,  8, 1, 1 }, // ETC2A1
+		{   2, 8, 4,  8, 2, 2 }, // PTC12
+		{   4, 4, 4,  8, 2, 2 }, // PTC14
+		{   2, 8, 4,  8, 2, 2 }, // PTC12A
+		{   4, 4, 4,  8, 2, 2 }, // PTC14A
+		{   2, 8, 4,  8, 2, 2 }, // PTC22
+		{   4, 4, 4,  8, 2, 2 }, // PTC24
+		{   0, 0, 0,  0, 1, 1 }, // Unknown
+		{   1, 8, 1,  1, 1, 1 }, // R1
+		{   8, 1, 1,  1, 1, 1 }, // R8
+		{  16, 1, 1,  2, 1, 1 }, // R16
+		{  16, 1, 1,  2, 1, 1 }, // R16F
+		{  32, 1, 1,  4, 1, 1 }, // R32
+		{  32, 1, 1,  4, 1, 1 }, // R32F
+		{  16, 1, 1,  2, 1, 1 }, // RG8
+		{  32, 1, 1,  4, 1, 1 }, // RG16
+		{  32, 1, 1,  4, 1, 1 }, // RG16F
+		{  64, 1, 1,  8, 1, 1 }, // RG32
+		{  64, 1, 1,  8, 1, 1 }, // RG32F
+		{  32, 1, 1,  4, 1, 1 }, // BGRA8
+		{  64, 1, 1,  8, 1, 1 }, // RGBA16
+		{  64, 1, 1,  8, 1, 1 }, // RGBA16F
+		{ 128, 1, 1, 16, 1, 1 }, // RGBA32
+		{ 128, 1, 1, 16, 1, 1 }, // RGBA32F
+		{  16, 1, 1,  2, 1, 1 }, // R5G6B5
+		{  16, 1, 1,  2, 1, 1 }, // RGBA4
+		{  16, 1, 1,  2, 1, 1 }, // RGB5A1
+		{  32, 1, 1,  4, 1, 1 }, // RGB10A2
+		{  32, 1, 1,  4, 1, 1 }, // R11G11B10F
+		{   0, 0, 0,  0, 1, 1 }, // UnknownDepth
+		{  16, 1, 1,  2, 1, 1 }, // D16
+		{  24, 1, 1,  3, 1, 1 }, // D24
+		{  32, 1, 1,  4, 1, 1 }, // D24S8
+		{  32, 1, 1,  4, 1, 1 }, // D32
+		{  16, 1, 1,  2, 1, 1 }, // D16F
+		{  24, 1, 1,  3, 1, 1 }, // D24F
+		{  32, 1, 1,  4, 1, 1 }, // D32F
+		{   8, 1, 1,  1, 1, 1 }, // D0S8
 	};
 	BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) );
 
@@ -2103,6 +2103,8 @@ namespace bgfx
 		const uint32_t blockSize   = blockInfo.blockSize;
 		const uint32_t blockWidth  = blockInfo.blockWidth;
 		const uint32_t blockHeight = blockInfo.blockHeight;
+		const uint32_t minBlockX   = blockInfo.minBlockX;
+		const uint32_t minBlockY   = blockInfo.minBlockY;
 
 		if (UINT32_MAX == _imageContainer.m_offset)
 		{
@@ -2127,8 +2129,8 @@ namespace bgfx
 				// skip imageSize in KTX format.
 				offset += _imageContainer.m_ktx ? sizeof(uint32_t) : 0;
 
-				width  = bx::uint32_max(blockWidth,  ( (width +blockWidth -1)/blockWidth )*blockWidth);
-				height = bx::uint32_max(blockHeight, ( (height+blockHeight-1)/blockHeight)*blockHeight);
+				width  = bx::uint32_max(blockWidth  * minBlockX, ( (width  + blockWidth  - 1) / blockWidth )*blockWidth);
+				height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight);
 				depth  = bx::uint32_max(1, depth);
 
 				uint32_t size = width*height*depth*bpp/8;

+ 2 - 0
src/image.h

@@ -43,6 +43,8 @@ namespace bgfx
 		uint8_t blockWidth;
 		uint8_t blockHeight;
 		uint8_t blockSize;
+		uint8_t minBlockX;
+		uint8_t minBlockY;
 	};
 
 	///

+ 19 - 2
src/renderer_gl.h

@@ -6,9 +6,26 @@
 #ifndef BGFX_RENDERER_GL_H_HEADER_GUARD
 #define BGFX_RENDERER_GL_H_HEADER_GUARD
 
-#define BGFX_USE_EGL (BGFX_CONFIG_RENDERER_OPENGLES && (BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_QNX || BX_PLATFORM_RPI || BX_PLATFORM_WINDOWS) )
+#define BGFX_USE_EGL (BGFX_CONFIG_RENDERER_OPENGLES && (0 \
+			|| BX_PLATFORM_ANDROID \
+			|| BX_PLATFORM_EMSCRIPTEN \
+			|| BX_PLATFORM_LINUX \
+			|| BX_PLATFORM_QNX \
+			|| BX_PLATFORM_RPI \
+			|| BX_PLATFORM_WINDOWS \
+			) )
+
 #define BGFX_USE_WGL (BGFX_CONFIG_RENDERER_OPENGL && BX_PLATFORM_WINDOWS)
-#define BGFX_USE_GL_DYNAMIC_LIB (BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_WINDOWS)
+#define BGFX_USE_GLX (BGFX_CONFIG_RENDERER_OPENGL && (0 \
+			|| BX_PLATFORM_LINUX \
+			|| BX_PLATFORM_FREEBSD \
+			) )
+
+#define BGFX_USE_GL_DYNAMIC_LIB (0 \
+			|| BX_PLATFORM_LINUX \
+			|| BX_PLATFORM_OSX \
+			|| BX_PLATFORM_WINDOWS \
+			)
 
 #if BGFX_CONFIG_RENDERER_OPENGL
 #	if BGFX_CONFIG_RENDERER_OPENGL >= 31

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott