Browse Source

Merge pull request #133 from dariomanesku/master

Imgui updates + setWindowTitle() fix.
Branimir Karadžić 11 years ago
parent
commit
172ae20f85

+ 1 - 1
examples/common/entry/entry.h

@@ -161,7 +161,7 @@ namespace entry
 	bx::FileWriterI* getFileWriter();
 
 	void setWindowSize(uint32_t _width, uint32_t _height);
-	bool setWindowTitle(const char* _title);
+	void setWindowTitle(const char* _title);
 	void toggleWindowFrame();
 	void setMouseLock(bool _lock);
 

+ 1 - 1
examples/common/entry/entry_android.cpp

@@ -207,7 +207,7 @@ namespace entry
 		BX_UNUSED(_width, _height);
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 1 - 1
examples/common/entry/entry_asmjs.cpp

@@ -24,7 +24,7 @@ namespace entry
 	{
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 1 - 1
examples/common/entry/entry_ios.mm

@@ -86,7 +86,7 @@ namespace entry
 		BX_UNUSED(_width, _height);
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 1 - 1
examples/common/entry/entry_linux.cpp

@@ -328,7 +328,7 @@ namespace entry
 		XSendEvent(s_ctx.m_display, s_ctx.m_window, false, ResizeRedirectMask, (XEvent*)&ev);
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 1 - 1
examples/common/entry/entry_nacl.cpp

@@ -61,7 +61,7 @@ namespace entry
 		BX_UNUSED(_width, _height);
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 1 - 1
examples/common/entry/entry_osx.mm

@@ -281,7 +281,7 @@ namespace entry
 		BX_UNUSED(_width, _height);
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 1 - 1
examples/common/entry/entry_qnx.cpp

@@ -25,7 +25,7 @@ namespace entry
 	{
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		BX_UNUSED(_title);
 	}

+ 2 - 2
examples/common/entry/entry_sdl.cpp

@@ -304,7 +304,7 @@ namespace entry
 			}
 		}
 
-		bool setWindowTitle(const char* _title)
+		void setWindowTitle(const char* _title)
 		{
 			SDL_WM_SetCaption(_title, NULL);
 		}
@@ -347,7 +347,7 @@ namespace entry
 		SDL_PushEvent(&event);
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
 		s_ctx.setWindowTitle(_title);
 	}

+ 9 - 7
examples/common/entry/entry_windows.cpp

@@ -17,6 +17,7 @@
 #define WM_USER_SET_WINDOW_SIZE     (WM_USER+0)
 #define WM_USER_TOGGLE_WINDOW_FRAME (WM_USER+1)
 #define WM_USER_MOUSE_LOCK          (WM_USER+2)
+#define WM_USER_SET_WINDOW_TITLE    (WM_USER+3)
 
 namespace entry
 {
@@ -259,6 +260,12 @@ namespace entry
 					}
 					break;
 
+				case WM_USER_SET_WINDOW_TITLE:
+					{
+						SetWindowText(_hwnd, (const char*)_lparam);
+					}
+					break;
+
 				case WM_USER_TOGGLE_WINDOW_FRAME:
 					{
 						if (m_frame)
@@ -586,11 +593,6 @@ namespace entry
 			}
 		}
 
-		bool setWindowTitle(const char* _title)
-		{
-			return (1 == SetWindowText(m_hwnd, _title));
-		}
-
 		static LRESULT CALLBACK wndProc(HWND _hwnd, UINT _id, WPARAM _wparam, LPARAM _lparam);
 
 		EventQueue m_eventQueue;
@@ -639,9 +641,9 @@ namespace entry
 		PostMessage(s_ctx.m_hwnd, WM_USER_SET_WINDOW_SIZE, 0, (_height<<16) | (_width&0xffff) );
 	}
 
-	bool setWindowTitle(const char* _title)
+	void setWindowTitle(const char* _title)
 	{
-		return s_ctx.setWindowTitle(_title);
+		PostMessage(s_ctx.m_hwnd, WM_USER_SET_WINDOW_TITLE, 0, (LPARAM)_title);
 	}
 
 	void toggleWindowFrame()

+ 33 - 34
examples/common/imgui/fs_imgui_image.bin.h

@@ -46,46 +46,45 @@ static const uint8_t fs_imgui_image_dx9[342] =
 	0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x01, 0x00, 0x00, // ................
 	0xa0, 0xff, 0xff, 0x00, 0x00, 0x00,                                                             // ......
 };
-static const uint8_t fs_imgui_image_dx11[1335] =
+static const uint8_t fs_imgui_image_dx11[1319] =
 {
 	0x46, 0x53, 0x48, 0x02, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
-	0x67, 0x65, 0x4c, 0x6f, 0x64, 0x14, 0x00, 0x24, 0x0a, 0x01, 0x00, 0x08, 0x05, 0x44, 0x58, 0x42, // geLod..$.....DXB
-	0x43, 0x75, 0xb5, 0x78, 0x5b, 0xc0, 0x89, 0x74, 0xe3, 0xd1, 0x10, 0xe5, 0x87, 0x5e, 0x12, 0xcb, // Cu.x[..t.....^..
-	0x02, 0x01, 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // .............4..
-	0x00, 0x48, 0x03, 0x00, 0x00, 0xa0, 0x03, 0x00, 0x00, 0xd4, 0x03, 0x00, 0x00, 0x8c, 0x04, 0x00, // .H..............
-	0x00, 0x52, 0x44, 0x45, 0x46, 0x0c, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, // .RDEF...........
+	0x67, 0x65, 0x4c, 0x6f, 0x64, 0x14, 0x00, 0x24, 0x0a, 0x01, 0x00, 0xf8, 0x04, 0x44, 0x58, 0x42, // geLod..$.....DXB
+	0x43, 0x81, 0x72, 0x6a, 0x6b, 0x91, 0x2b, 0xbb, 0x35, 0x1d, 0xd7, 0x8a, 0xc7, 0x03, 0xf3, 0x8b, // C.rjk.+.5.......
+	0x88, 0x01, 0x00, 0x00, 0x00, 0xf8, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // .............4..
+	0x00, 0x38, 0x03, 0x00, 0x00, 0x90, 0x03, 0x00, 0x00, 0xc4, 0x03, 0x00, 0x00, 0x7c, 0x04, 0x00, // .8...........|..
+	0x00, 0x52, 0x44, 0x45, 0x46, 0xfc, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, // .RDEF...........
 	0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, // ................
-	0x00, 0xdb, 0x02, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....|..........
+	0x00, 0xcb, 0x02, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....|..........
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
-	0x00, 0x01, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // ................
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // ................
 	0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
-	0x00, 0x0d, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x0d, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x75, // .....u_texColoru
-	0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // _texColorampler.
-	0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, // u_texColoru_texC
-	0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, // olorexture.$Glob
-	0x61, 0x6c, 0x73, 0x00, 0xab, 0xb2, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, // als.............
-	0x00, 0x30, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, // .0..............
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, // ................
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .....(..........
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x02, 0x00, // .............4..
-	0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, // . ...@.......<..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....L...`...@..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x02, 0x00, // .....<.......V..
-	0x00, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, // .....@.......<..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x02, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....].......@..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x02, 0x00, // .....<.......g..
-	0x00, 0x20, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, // . ...@.......<..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, // .....r...`...@..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, // .....<..........
-	0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, // ................
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x02, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, // .............@..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, // .....<..........
-	0x00, 0xe0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, // .....@.......<..
-	0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x02, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // ......... ......
-	0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x02, 0x00, // ................
-	0x00, 0x24, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, // .$..............
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....u_texColorS
+	0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, // ampler.u_texColo
+	0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // rTexture.$Global
+	0x73, 0x00, 0xab, 0xab, 0xab, 0xa0, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, // s...............
+	0x00, 0x30, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // .0..............
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x02, 0x00, // .............$..
+	0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, // . ...@.......,..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....<...`...@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x00, // .....,.......F..
+	0x00, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, // .....@.......,..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x02, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....M.......@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x02, 0x00, // .....,.......W..
+	0x00, 0x20, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, // . ...@.......,..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x02, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, // .....b...`...@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, // .....,.......p..
+	0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x02, 0x00, // .............x..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, // .............@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, // .....,..........
+	0x00, 0xe0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, // .....@.......,..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // ......... ......
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, // ................
+	0x00, 0x24, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb0, 0x02, 0x00, // .$..............
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, // .....u_viewRect.
 	0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
 	0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x75, 0x5f, 0x76, // .u_viewTexel.u_v

+ 146 - 0
examples/common/imgui/fs_imgui_image_swizz.bin.h

@@ -0,0 +1,146 @@
+static const uint8_t fs_imgui_image_swizz_glsl[377] =
+{
+	0x46, 0x53, 0x48, 0x02, 0x6f, 0x1e, 0x3e, 0x3c, 0x03, 0x00, 0x0a, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
+	0x67, 0x65, 0x4c, 0x6f, 0x64, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, // geLod.......u_sw
+	0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x74, 0x65, // izzle.......u_te
+	0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x38, 0x01, 0x00, 0x00, // xColor......8...
+	0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, // varying mediump
+	0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // vec2 v_texcoord0
+	0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, // ;.uniform medium
+	0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, // p float u_imageL
+	0x6f, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x65, 0x64, 0x69, // od;.uniform medi
+	0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, // ump vec4 u_swizz
+	0x6c, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, // le;.uniform samp
+	0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ler2D u_texColor
+	0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, // ;.void main ().{
+	0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // .  lowp vec4 tmp
+	0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_1;.  tmpvar_
+	0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 1.w = 1.0;.  tmp
+	0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x33, // var_1.xyz = vec3
+	0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, // (dot (texture2DL
+	0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, // od    (u_texColo
+	0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2c, 0x20, // r, v_texcoord0,
+	0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x73, // u_imageLod), u_s
+	0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // wizzle));.  gl_F
+	0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva
+	0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                           // r_1;.}...
+};
+static const uint8_t fs_imgui_image_swizz_dx9[410] =
+{
+	0x46, 0x53, 0x48, 0x02, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
+	0x67, 0x65, 0x4c, 0x6f, 0x64, 0x14, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, // geLod.......u_sw
+	0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x15, 0x01, 0x01, 0x00, 0x01, 0x00, 0x6c, 0x01, 0x00, 0x03, 0xff, // izzle......l....
+	0xff, 0xfe, 0xff, 0x3a, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, // ...:.CTAB.......
+	0x00, 0x00, 0x03, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, // ................
+	0x00, 0xac, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....X..........
+	0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, // .d.......t......
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, // ................
+	0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x00, 0xab, 0x00, 0x00, 0x03, // .u_imageLod.....
+	0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, // .............u_s
+	0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x00, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, // wizzle..........
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .........u_texCo
+	0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor.............
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr
+	0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S
+	0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9
+	0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q..
+	0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........?.......
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, // ................
+	0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, // ................
+	0x03, 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, // ................
+	0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ........._......
+	0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x09, 0x00, 0x00, 0x03, 0x00, 0x08, 0x07, // ................
+	0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, // ................
+	0x80, 0x02, 0x00, 0x00, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00,                                     // ..........
+};
+static const uint8_t fs_imgui_image_swizz_dx11[1383] =
+{
+	0x46, 0x53, 0x48, 0x02, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
+	0x67, 0x65, 0x4c, 0x6f, 0x64, 0x14, 0x00, 0x24, 0x0a, 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, // geLod..$....u_sw
+	0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x15, 0x00, 0x30, 0x0a, 0x01, 0x00, 0x28, 0x05, 0x44, 0x58, 0x42, // izzle..0...(.DXB
+	0x43, 0x41, 0xc5, 0x55, 0xf9, 0x51, 0xc7, 0x7f, 0x80, 0x35, 0xb0, 0x72, 0x98, 0x69, 0xc6, 0x28, // CA.U.Q...5.r.i.(
+	0x1c, 0x01, 0x00, 0x00, 0x00, 0x28, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // .....(.......4..
+	0x00, 0x5c, 0x03, 0x00, 0x00, 0xb4, 0x03, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0xac, 0x04, 0x00, // ................
+	0x00, 0x52, 0x44, 0x45, 0x46, 0x20, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, // .RDEF ..........
+	0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, // ................
+	0x00, 0xed, 0x02, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....|..........
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // ................
+	0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
+	0x00, 0x0d, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....u_texColorS
+	0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, // ampler.u_texColo
+	0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // rTexture.$Global
+	0x73, 0x00, 0xab, 0xab, 0xab, 0xa0, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, // s...............
+	0x00, 0x40, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x02, 0x00, // .@..............
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, // ............. ..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .....0..........
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x00, // ..... .......<..
+	0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, // . [email protected]..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....T...`...@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x02, 0x00, // .....D.......^..
+	0x00, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, // [email protected]..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x02, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....e.......@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x02, 0x00, // .....D.......o..
+	0x00, 0x20, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, // . [email protected]..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x02, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, // .....z...`...@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, // .....D..........
+	0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, // .............@..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x02, 0x00, // .....D..........
+	0x00, 0xe0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, // [email protected]..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x02, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // ......... ......
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x02, 0x00, // ................
+	0x00, 0x24, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x00, // .$..............
+	0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x02, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x10, 0x00, 0x00, // .........0......
+	0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // ..... .......u_v
+	0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, // iewRect.........
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, // .........u_viewT
+	0x65, 0x78, 0x65, 0x6c, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0xab, 0x03, 0x00, 0x03, // exel.u_view.....
+	0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i
+	0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, // nvView.u_proj.u_
+	0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // invProj.u_viewPr
+	0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // oj.u_invViewProj
+	0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, // .u_model........
+	0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // . .......u_model
+	0x56, 0x69, 0x65, 0x77, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // View.u_modelView
+	0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x00, // Proj.u_alphaRef.
+	0xab, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x00, 0x75, 0x5f, 0x73, 0x77, // .u_imageLod.u_sw
+	0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, // izzle.Microsoft
+	0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, // (R) HLSL Shader
+	0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, // Compiler 9.29.95
+	0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, // 2.3111...ISGNP..
+	0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........8......
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................
+	0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .D..............
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, // .........SV_POSI
+	0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, // TION.TEXCOORD...
+	0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .OSGN,..........
+	0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // . ..............
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, // .........SV_TARG
+	0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xbc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // ET...SHDR....@..
+	0x00, 0x2f, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // ./...Y...F. ....
+	0x00, 0xa4, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, // .....Z....`.....
+	0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, // .X....p......UU.
+	0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .b...2.......e..
+	0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // .. ......h......
+	0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, // .H...........F..
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, // .....F~.......`.
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, // ....... ........
+	0x00, 0x11, 0x00, 0x00, 0x08, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, // .....r ......F..
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, // .....F. ........
+	0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, // .6.... .......@.
+	0x00, 0x00, 0x00, 0x80, 0x3f, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, // ....?>...STATt..
+	0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, // ................
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x0a,                                                       // .....@.
+};

+ 18 - 0
examples/common/imgui/fs_imgui_image_swizz.sc

@@ -0,0 +1,18 @@
+$input v_texcoord0
+
+/*
+ * Copyright 2014 Dario Manesku. All rights reserved.
+ * License: http://www.opensource.org/licenses/BSD-2-Clause
+ */
+
+#include <bgfx_shader.sh>
+
+uniform float u_imageLod;
+uniform vec4 u_swizzle;
+SAMPLER2D(u_texColor, 0);
+
+void main()
+{
+	float color = dot(texture2DLod(u_texColor, v_texcoord0, u_imageLod), u_swizzle);
+	gl_FragColor = vec4(vec3_splat(color), 1.0);
+}

+ 14 - 15
examples/common/imgui/fs_imgui_texture.bin.h

@@ -39,25 +39,24 @@ static const uint8_t fs_imgui_texture_dx9[241] =
 	0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, // ................
 	0x00,                                                                                           // .
 };
-static const uint8_t fs_imgui_texture_dx11[754] =
+static const uint8_t fs_imgui_texture_dx11[738] =
 {
-	0x46, 0x53, 0x48, 0x02, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xd4, 0x02, 0x44, 0x58, 0x42, 0x43, // FSH.........DXBC
-	0x75, 0xa2, 0xbf, 0x18, 0x85, 0xa7, 0x57, 0xfd, 0x14, 0xc3, 0x19, 0x21, 0xf6, 0x74, 0x34, 0x77, // u.....W....!.t4w
-	0x01, 0x00, 0x00, 0x00, 0xd4, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ............4...
-	0x00, 0x01, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, // ....t.......X...
-	0x52, 0x44, 0x45, 0x46, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEF............
+	0x46, 0x53, 0x48, 0x02, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xc4, 0x02, 0x44, 0x58, 0x42, 0x43, // FSH.........DXBC
+	0x8f, 0x77, 0x55, 0xdc, 0xbb, 0x5d, 0x37, 0x2c, 0xed, 0xde, 0x24, 0x6d, 0xe4, 0xbc, 0xf1, 0x76, // .wU..]7,..$m...v
+	0x01, 0x00, 0x00, 0x00, 0xc4, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ............4...
+	0xf0, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, // ....d.......H...
+	0x52, 0x44, 0x45, 0x46, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEF............
 	0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
-	0x92, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
+	0x80, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
-	0x01, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....w...........
+	0x01, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....n...........
 	0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
-	0x0d, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x75, 0x5f, // ....u_texColoru_
-	0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x75, // texColorampler.u
-	0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // _texColoru_texCo
-	0x6c, 0x6f, 0x72, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // lorexture.Micros
-	0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha
-	0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, // der Compiler 9.2
-	0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x49, 0x53, 0x47, 0x4e, // 9.952.3111..ISGN
+	0x0d, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, // ....u_texColorSa
+	0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // mpler.u_texColor
+	0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, // Texture.Microsof
+	0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, // t (R) HLSL Shade
+	0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, // r Compiler 9.29.
+	0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, // 952.3111....ISGN
 	0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // l...........P...
 	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
 	0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................

+ 326 - 41
examples/common/imgui/imgui.cpp

@@ -39,6 +39,7 @@
 #include "fs_imgui_texture.bin.h"
 #include "vs_imgui_image.bin.h"
 #include "fs_imgui_image.bin.h"
+#include "fs_imgui_image_swizz.bin.h"
 #include "dds_imgui_x_texture.h"
 
 #define USE_NANOVG_FONT 0
@@ -298,18 +299,22 @@ struct Imgui
 		, m_halfTexel(0.0f)
 		, m_nvg(NULL)
 		, m_view(31)
+		, m_viewWidth(0)
+		, m_viewHeight(0)
 		, m_currentFontIdx(0)
 	{
 		m_invTextureWidth  = 1.0f/m_textureWidth;
 		m_invTextureHeight = 1.0f/m_textureHeight;
 
 		u_imageLod.idx       = bgfx::invalidHandle;
+		u_imageSwizzle.idx   = bgfx::invalidHandle;
 		u_texColor.idx       = bgfx::invalidHandle;
 		m_missingTexture.idx = bgfx::invalidHandle;
 
 		m_colorProgram.idx   = bgfx::invalidHandle;
 		m_textureProgram.idx = bgfx::invalidHandle;
 		m_imageProgram.idx   = bgfx::invalidHandle;
+		m_imageSwizzProgram.idx = bgfx::invalidHandle;
 	}
 
 	ImguiFontHandle createFont(const void* _data, float _fontSize)
@@ -319,6 +324,7 @@ struct Imgui
 		const bgfx::Memory* mem = bgfx::alloc(m_textureWidth * m_textureHeight);
 		stbtt_BakeFontBitmap( (uint8_t*)_data, 0, _fontSize, mem->data, m_textureWidth, m_textureHeight, 32, 96, m_fonts[handle.idx].m_cdata);
 		m_fonts[handle.idx].m_texture = bgfx::createTexture2D(m_textureWidth, m_textureHeight, 1, bgfx::TextureFormat::R8, BGFX_TEXTURE_NONE, mem);
+		m_fonts[handle.idx].m_size = _fontSize;
 #else
 		const ImguiFontHandle handle = { bgfx::invalidHandle };
 #endif // !USE_NANOVG_FONT
@@ -352,6 +358,7 @@ struct Imgui
 		PosUvVertex::init();
 
 		u_imageLod = bgfx::createUniform("u_imageLod", bgfx::UniformType::Uniform1f);
+		u_imageSwizzle = bgfx::createUniform("u_swizzle",  bgfx::UniformType::Uniform4fv);
 		u_texColor = bgfx::createUniform("u_texColor", bgfx::UniformType::Uniform1i);
 
 		const bgfx::Memory* vs_imgui_color;
@@ -360,35 +367,39 @@ struct Imgui
 		const bgfx::Memory* fs_imgui_texture;
 		const bgfx::Memory* vs_imgui_image;
 		const bgfx::Memory* fs_imgui_image;
+		const bgfx::Memory* fs_imgui_image_swizz;
 
 		switch (bgfx::getRendererType() )
 		{
 		case bgfx::RendererType::Direct3D9:
-			vs_imgui_color   = bgfx::makeRef(vs_imgui_color_dx9, sizeof(vs_imgui_color_dx9) );
-			fs_imgui_color   = bgfx::makeRef(fs_imgui_color_dx9, sizeof(fs_imgui_color_dx9) );
-			vs_imgui_texture = bgfx::makeRef(vs_imgui_texture_dx9, sizeof(vs_imgui_texture_dx9) );
-			fs_imgui_texture = bgfx::makeRef(fs_imgui_texture_dx9, sizeof(fs_imgui_texture_dx9) );
-			vs_imgui_image   = bgfx::makeRef(vs_imgui_image_dx9, sizeof(vs_imgui_image_dx9) );
-			fs_imgui_image   = bgfx::makeRef(fs_imgui_image_dx9, sizeof(fs_imgui_image_dx9) );
+			vs_imgui_color       = bgfx::makeRef(vs_imgui_color_dx9, sizeof(vs_imgui_color_dx9) );
+			fs_imgui_color       = bgfx::makeRef(fs_imgui_color_dx9, sizeof(fs_imgui_color_dx9) );
+			vs_imgui_texture     = bgfx::makeRef(vs_imgui_texture_dx9, sizeof(vs_imgui_texture_dx9) );
+			fs_imgui_texture     = bgfx::makeRef(fs_imgui_texture_dx9, sizeof(fs_imgui_texture_dx9) );
+			vs_imgui_image       = bgfx::makeRef(vs_imgui_image_dx9, sizeof(vs_imgui_image_dx9) );
+			fs_imgui_image       = bgfx::makeRef(fs_imgui_image_dx9, sizeof(fs_imgui_image_dx9) );
+			fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_dx9, sizeof(fs_imgui_image_swizz_dx9) );
 			m_halfTexel = 0.5f;
 			break;
 
 		case bgfx::RendererType::Direct3D11:
-			vs_imgui_color   = bgfx::makeRef(vs_imgui_color_dx11, sizeof(vs_imgui_color_dx11) );
-			fs_imgui_color   = bgfx::makeRef(fs_imgui_color_dx11, sizeof(fs_imgui_color_dx11) );
-			vs_imgui_texture = bgfx::makeRef(vs_imgui_texture_dx11, sizeof(vs_imgui_texture_dx11) );
-			fs_imgui_texture = bgfx::makeRef(fs_imgui_texture_dx11, sizeof(fs_imgui_texture_dx11) );
-			vs_imgui_image   = bgfx::makeRef(vs_imgui_image_dx11, sizeof(vs_imgui_image_dx11) );
-			fs_imgui_image   = bgfx::makeRef(fs_imgui_image_dx11, sizeof(fs_imgui_image_dx11) );
+			vs_imgui_color       = bgfx::makeRef(vs_imgui_color_dx11, sizeof(vs_imgui_color_dx11) );
+			fs_imgui_color       = bgfx::makeRef(fs_imgui_color_dx11, sizeof(fs_imgui_color_dx11) );
+			vs_imgui_texture     = bgfx::makeRef(vs_imgui_texture_dx11, sizeof(vs_imgui_texture_dx11) );
+			fs_imgui_texture     = bgfx::makeRef(fs_imgui_texture_dx11, sizeof(fs_imgui_texture_dx11) );
+			vs_imgui_image       = bgfx::makeRef(vs_imgui_image_dx11, sizeof(vs_imgui_image_dx11) );
+			fs_imgui_image       = bgfx::makeRef(fs_imgui_image_dx11, sizeof(fs_imgui_image_dx11) );
+			fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_dx11, sizeof(fs_imgui_image_swizz_dx11) );
 			break;
 
 		default:
-			vs_imgui_color   = bgfx::makeRef(vs_imgui_color_glsl, sizeof(vs_imgui_color_glsl) );
-			fs_imgui_color   = bgfx::makeRef(fs_imgui_color_glsl, sizeof(fs_imgui_color_glsl) );
-			vs_imgui_texture = bgfx::makeRef(vs_imgui_texture_glsl, sizeof(vs_imgui_texture_glsl) );
-			fs_imgui_texture = bgfx::makeRef(fs_imgui_texture_glsl, sizeof(fs_imgui_texture_glsl) );
-			vs_imgui_image   = bgfx::makeRef(vs_imgui_image_glsl, sizeof(vs_imgui_image_glsl) );
-			fs_imgui_image   = bgfx::makeRef(fs_imgui_image_glsl, sizeof(fs_imgui_image_glsl) );
+			vs_imgui_color       = bgfx::makeRef(vs_imgui_color_glsl, sizeof(vs_imgui_color_glsl) );
+			fs_imgui_color       = bgfx::makeRef(fs_imgui_color_glsl, sizeof(fs_imgui_color_glsl) );
+			vs_imgui_texture     = bgfx::makeRef(vs_imgui_texture_glsl, sizeof(vs_imgui_texture_glsl) );
+			fs_imgui_texture     = bgfx::makeRef(fs_imgui_texture_glsl, sizeof(fs_imgui_texture_glsl) );
+			vs_imgui_image       = bgfx::makeRef(vs_imgui_image_glsl, sizeof(vs_imgui_image_glsl) );
+			fs_imgui_image       = bgfx::makeRef(fs_imgui_image_glsl, sizeof(fs_imgui_image_glsl) );
+			fs_imgui_image_swizz = bgfx::makeRef(fs_imgui_image_swizz_glsl, sizeof(fs_imgui_image_swizz_glsl) );
 			break;
 		}
 
@@ -410,9 +421,14 @@ struct Imgui
 		vsh = bgfx::createShader(vs_imgui_image);
 		fsh = bgfx::createShader(fs_imgui_image);
 		m_imageProgram = bgfx::createProgram(vsh, fsh);
-		bgfx::destroyShader(vsh);
 		bgfx::destroyShader(fsh);
 
+		// Notice: using the same vsh.
+		fsh = bgfx::createShader(fs_imgui_image_swizz);
+		m_imageSwizzProgram = bgfx::createProgram(vsh, fsh);
+		bgfx::destroyShader(fsh);
+		bgfx::destroyShader(vsh);
+
 		const bgfx::Memory* texMem = bgfx::makeRef(s_xTexture, sizeof(s_xTexture));
 		m_missingTexture = bgfx::createTexture(texMem);
 
@@ -428,6 +444,7 @@ struct Imgui
 	void destroy()
 	{
 		bgfx::destroyUniform(u_imageLod);
+		bgfx::destroyUniform(u_imageSwizzle);
 		bgfx::destroyUniform(u_texColor);
 #if !USE_NANOVG_FONT
 		for (uint16_t ii = 0; ii < IMGUI_CONFIG_MAX_FONTS; ++ii)
@@ -442,6 +459,7 @@ struct Imgui
 		bgfx::destroyProgram(m_colorProgram);
 		bgfx::destroyProgram(m_textureProgram);
 		bgfx::destroyProgram(m_imageProgram);
+		bgfx::destroyProgram(m_imageSwizzProgram);
 		nvgDelete(m_nvg);
 	}
 
@@ -621,6 +639,8 @@ struct Imgui
 		nvgBeginFrame(m_nvg, _width, _height, 1.0f, NVG_STRAIGHT_ALPHA);
 
 		m_view = _view;
+		m_viewWidth = _width;
+		m_viewHeight = _height;
 		bgfx::setViewSeq(_view, true);
 		bgfx::setViewRect(_view, 0, 0, _width, _height);
 
@@ -665,7 +685,7 @@ struct Imgui
 
 		m_widgetX = _x + SCROLL_AREA_PADDING;
 		m_widgetY = _y + AREA_HEADER + (*_scroll);
-		m_widgetW = _width - SCROLL_AREA_PADDING * 4;
+		m_widgetW = _width - SCROLL_AREA_PADDING * 4 - 2;
 
 		m_scrollTop    = _y + AREA_HEADER;
 		m_scrollBottom = _y + _height;
@@ -700,14 +720,14 @@ struct Imgui
 
 		nvgScissor(m_nvg
 				 , float(_x + SCROLL_AREA_PADDING)
-				 , float(_y + AREA_HEADER)
-				 , float(_width - SCROLL_AREA_PADDING * 4)
+				 , float(_y + AREA_HEADER - 1)
+				 , float(_width - SCROLL_AREA_PADDING * 3)
 				 , float(_height - AREA_HEADER - SCROLL_AREA_PADDING)
 				 );
 
 		m_scissor = bgfx::setScissor(uint16_t(_x + SCROLL_AREA_PADDING)
-								   , uint16_t(_y + AREA_HEADER)
-								   , uint16_t(_width - SCROLL_AREA_PADDING * 4)
+								   , uint16_t(_y + AREA_HEADER - 1)
+								   , uint16_t(_width - SCROLL_AREA_PADDING * 3)
 								   , uint16_t(_height - AREA_HEADER - SCROLL_AREA_PADDING)
 								   );
 
@@ -1041,6 +1061,79 @@ struct Imgui
 			);
 	}
 
+	uint8_t tabs(uint8_t _selected, bool _enabled, va_list _argList)
+	{
+		uint8_t count;
+		const char* titles[16];
+		const char* str = va_arg(_argList, const char*);
+		for (count = 0; str != NULL || count >= 16; ++count, str = va_arg(_argList, const char*) )
+		{
+			titles[count] = str;
+		}
+
+		const int32_t yy = m_widgetY;
+		const int32_t height = BUTTON_HEIGHT;
+		m_widgetY += height + DEFAULT_SPACING;
+
+		uint8_t selected = _selected;
+		const int32_t tabWidth     = m_scrollAreaInnerWidth / count;
+		const int32_t tabWidthHalf = m_scrollAreaInnerWidth / (count*2);
+		const int32_t textY = yy + height/2 + int32_t(m_fonts[m_currentFontIdx].m_size)/2 - 1;
+
+		drawRoundedRect( (float)m_widgetX
+					   , (float)yy-1
+					   , (float)m_scrollAreaInnerWidth
+					   , (float)height+2
+					   , (float)BUTTON_HEIGHT / 2 - 1
+					   , imguiRGBA(128, 128, 128, 96)
+					   );
+
+		for (uint8_t ii = 0; ii < count; ++ii)
+		{
+			m_widgetId++;
+			const uint16_t id = (m_areaId << 8) | m_widgetId;
+
+			int32_t xx = m_widgetX + ii*tabWidth;
+			int32_t textX = xx + tabWidthHalf;
+
+			const bool enabled = _enabled && isEnabled(m_areaId);
+			const bool over = enabled && inRect(xx, yy, tabWidth, height);
+			const bool res = buttonLogic(id, over);
+
+			if (res)
+			{
+				selected = ii;
+			}
+
+			uint32_t textColor;
+			if (ii == selected)
+			{
+				textColor = enabled?imguiRGBA(0,0,0,255):imguiRGBA(255,255,255,100);
+
+				drawRoundedRect( (float)xx
+							   , (float)yy-1
+							   , (float)tabWidth
+							   , (float)height+2
+							   , (float)BUTTON_HEIGHT / 2 - 1
+							   , enabled?imguiRGBA(255,196,0,200):imguiRGBA(128,128,128,96)
+							   );
+			}
+			else
+			{
+				textColor = isHot(id) ? imguiRGBA(255, 196, 0, enabled?255:100) : imguiRGBA(255, 255, 255, enabled?200:100);
+			}
+
+			drawText(textX
+				   , textY
+				   , ImguiTextAlign::Center
+				   , titles[ii]
+				   , textColor
+				   );
+		}
+
+		return selected;
+	}
+
 	void image(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiImageAlign::Enum _align)
 	{
 		int32_t xx;
@@ -1085,6 +1178,51 @@ struct Imgui
 		image(_image, _lod, int32_t(width), int32_t(height), _align);
 	}
 
+	void imageSwizzle(bgfx::TextureHandle _image, const float _swizzle[4], float _lod, int32_t _width, int32_t _height, ImguiImageAlign::Enum _align)
+	{
+		int32_t xx;
+		if (ImguiImageAlign::Left == _align)
+		{
+			xx = m_scrollAreaX + SCROLL_AREA_PADDING;
+		}
+		else if (ImguiImageAlign::LeftIndented == _align)
+		{
+			xx = m_widgetX;
+		}
+		else if (ImguiImageAlign::Center == _align)
+		{
+			xx = m_scrollAreaX + (m_scrollAreaInnerWidth-_width)/2;
+		}
+		else if (ImguiImageAlign::CenterIndented == _align)
+		{
+			xx = (m_widgetX + m_scrollAreaInnerWidth + m_scrollAreaX - _width)/2;
+		}
+		else //if (ImguiImageAlign::Right == _align).
+		{
+			xx = m_scrollAreaX + m_scrollAreaInnerWidth - _width;
+		}
+
+		const int32_t yy = m_widgetY;
+		m_widgetY += _height + DEFAULT_SPACING;
+
+		screenQuad(xx, yy, _width, _height);
+		bgfx::setUniform(u_imageLod, &_lod);
+		bgfx::setUniform(u_imageSwizzle, _swizzle);
+		bgfx::setTexture(0, u_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
+		bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE);
+		bgfx::setProgram(m_imageSwizzProgram);
+		bgfx::setScissor(m_scissor);
+		bgfx::submit(m_view);
+	}
+
+	void imageSwizzle(bgfx::TextureHandle _image, const float _swizzle[4], float _lod, float _width, float _aspect, ImguiImageAlign::Enum _align)
+	{
+		const float width = _width*float(m_scrollAreaInnerWidth);
+		const float height = width/_aspect;
+
+		imageSwizzle(_image, _swizzle, _lod, int32_t(width), int32_t(height), _align);
+	}
+
 	bool collapse(const char* _text, const char* _subtext, bool _checked, bool _enabled)
 	{
 		m_widgetId++;
@@ -1109,7 +1247,7 @@ struct Imgui
 				, cy
 				, CHECK_SIZE
 				, CHECK_SIZE
-				, 2
+				, TriangleOrientation::Up
 				, imguiRGBA(255, 255, 255, isActive(id) ? 255 : 200)
 				);
 		}
@@ -1119,7 +1257,7 @@ struct Imgui
 				, cy
 				, CHECK_SIZE
 				, CHECK_SIZE
-				, 1
+				, TriangleOrientation::Right
 				, imguiRGBA(255, 255, 255, isActive(id) ? 255 : 200)
 				);
 		}
@@ -1156,6 +1294,85 @@ struct Imgui
 		return res;
 	}
 
+	bool borderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled)
+	{
+		m_widgetId++;
+		uint16_t id = (m_areaId << 8) | m_widgetId;
+
+		const int32_t triSize = 12;
+		const int32_t borderSize = 15;
+
+		int32_t xx;
+		int32_t yy;
+		int32_t width;
+		int32_t height;
+		int32_t triX;
+		int32_t triY;
+		TriangleOrientation::Enum orientation;
+
+		if (ImguiBorder::Left == _border)
+		{
+			xx = -borderSize;
+			yy = 0;
+			width = 2*borderSize;
+			height = m_viewHeight;
+			triX = 0;
+			triY = (m_viewHeight-triSize)/2;
+			orientation = _checked ? TriangleOrientation::Left : TriangleOrientation::Right;
+		}
+		else if (ImguiBorder::Right == _border)
+		{
+			xx = m_viewWidth - borderSize;
+			yy = 0;
+			width = 2*borderSize;
+			height = m_viewHeight;
+			triX = m_viewWidth - triSize - 2;
+			triY = (m_viewHeight-width)/2;
+			orientation = _checked ? TriangleOrientation::Right : TriangleOrientation::Left;
+		}
+		else if (ImguiBorder::Top == _border)
+		{
+			xx = 0;
+			yy = -borderSize;
+			width = m_viewWidth;
+			height = 2*borderSize;
+			triX = (m_viewWidth-triSize)/2;
+			triY = 0;
+			orientation = _checked ? TriangleOrientation::Up : TriangleOrientation::Down;
+		}
+		else //if (ImguiBorder::Bottom == _border).
+		{
+			xx = 0;
+			yy = m_viewHeight - borderSize;
+			width = m_viewWidth;
+			height = 2*borderSize;
+			triX = (m_viewWidth-triSize)/2;
+			triY = m_viewHeight-triSize;
+			orientation = _checked ? TriangleOrientation::Down : TriangleOrientation::Up;
+		}
+
+		const bool over = _enabled && inRect(xx, yy, width, height, false);
+		const bool res = buttonLogic(id, over);
+
+		drawRoundedRect( (float)xx
+					   , (float)yy
+					   , (float)width
+					   , (float)height
+					   , 0.0f
+					   , isActive(id) ? imguiRGBA(23, 23, 23, 192) : imguiRGBA(0, 0, 0, 222)
+					   );
+
+		drawTriangle( triX
+					, triY
+					, triSize
+					, triSize
+					, orientation
+					, isHot(id) ? imguiRGBA(255, 196, 0, 222) : imguiRGBA(255, 255, 255, 192)
+					);
+
+		return res;
+	}
+
 	void labelVargs(const char* _format, va_list _argList)
 	{
 		char temp[8192];
@@ -1312,18 +1529,18 @@ struct Imgui
 		m_widgetW += INDENT_SIZE;
 	}
 
-	void separator()
+	void separator(uint16_t _height)
 	{
-		m_widgetY += DEFAULT_SPACING * 3;
+		m_widgetY += _height;
 	}
 
-	void separatorLine()
+	void separatorLine(uint16_t _height)
 	{
 		int32_t xx = m_widgetX;
-		int32_t yy = m_widgetY + DEFAULT_SPACING*2;
+		int32_t yy = m_widgetY + _height/2;
 		int32_t width = m_widgetW;
 		int32_t height = 1;
-		m_widgetY += DEFAULT_SPACING * 4;
+		m_widgetY += _height;
 
 		drawRect( (float)xx
 			, (float)yy
@@ -1543,9 +1760,31 @@ struct Imgui
 		drawPolygon(verts, 4, _fth, _abgr);
 	}
 
-	void drawTriangle(int32_t _x, int32_t _y, int32_t _width, int32_t _height, int32_t _flags, uint32_t _abgr)
+	struct TriangleOrientation
 	{
-		if (1 == _flags)
+		enum Enum
+		{
+			Left,
+			Right,
+			Up,
+			Down,
+		};
+	};
+
+	void drawTriangle(int32_t _x, int32_t _y, int32_t _width, int32_t _height, TriangleOrientation::Enum _orientation, uint32_t _abgr)
+	{
+		if (TriangleOrientation::Left == _orientation)
+		{
+			const float verts[3 * 2] =
+			{
+				(float)_x + 0.5f + (float)_width * 1.0f, (float)_y + 0.5f,
+				(float)_x + 0.5f,                        (float)_y + 0.5f + (float)_height / 2.0f - 0.5f,
+				(float)_x + 0.5f + (float)_width * 1.0f, (float)_y + 0.5f + (float)_height - 1.0f,
+			};
+
+			drawPolygon(verts, 3, 1.0f, _abgr);
+		}
+		else if (TriangleOrientation::Right == _orientation)
 		{
 			const float verts[3 * 2] =
 			{
@@ -1556,7 +1795,7 @@ struct Imgui
 
 			drawPolygon(verts, 3, 1.0f, _abgr);
 		}
-		else
+		else if (TriangleOrientation::Up == _orientation)
 		{
 			const float verts[3 * 2] =
 			{
@@ -1565,6 +1804,17 @@ struct Imgui
 				(float)_x + 0.5f + (float)_width - 1.0f,        (float)_y + 0.5f + (float)_height - 1.0f,
 			};
 
+			drawPolygon(verts, 3, 1.0f, _abgr);
+		}
+		else //if (TriangleOrientation::Down == _orientation).
+		{
+			const float verts[3 * 2] =
+			{
+				(float)_x + 0.5f,                               (float)_y + 0.5f,
+				(float)_x + 0.5f + (float)_width / 2.0f - 0.5f, (float)_y + 0.5f + (float)_height - 1.0f,
+				(float)_x + 0.5f + (float)_width - 1.0f,        (float)_y + 0.5f,
+			};
+
 			drawPolygon(verts, 3, 1.0f, _abgr);
 		}
 	}
@@ -1635,6 +1885,12 @@ struct Imgui
 
 	void drawText(float _x, float _y, const char* _text, ImguiTextAlign::Enum _align, uint32_t _abgr)
 	{
+		if (NULL == _text
+		||  '\0' == _text[0])
+		{
+			return;
+		}
+
 #if USE_NANOVG_FONT
 		static uint32_t textAlign[ImguiTextAlign::Count] =
 		{
@@ -2109,12 +2365,15 @@ struct Imgui
 	NVGcontext* m_nvg;
 
 	uint8_t m_view;
+	uint16_t m_viewWidth;
+	uint16_t m_viewHeight;
 
 #if !USE_NANOVG_FONT
 	struct Font
 	{
 		stbtt_bakedchar m_cdata[96]; // ASCII 32..126 is 95 glyphs
 		bgfx::TextureHandle m_texture;
+		float m_size;
 	};
 
 	uint16_t m_currentFontIdx;
@@ -2123,10 +2382,12 @@ struct Imgui
 #endif // !USE_NANOVG_FONT
 
 	bgfx::UniformHandle u_imageLod;
+	bgfx::UniformHandle u_imageSwizzle;
 	bgfx::UniformHandle u_texColor;
 	bgfx::ProgramHandle m_colorProgram;
 	bgfx::ProgramHandle m_textureProgram;
 	bgfx::ProgramHandle m_imageProgram;
+	bgfx::ProgramHandle m_imageSwizzProgram;
 	bgfx::TextureHandle m_missingTexture;
 };
 
@@ -2162,6 +2423,11 @@ void imguiEndFrame()
 	s_imgui.endFrame();
 }
 
+bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled)
+{
+	return s_imgui.borderButton(_border, _checked, _enabled);
+}
+
 bool imguiBeginScrollArea(const char* _name, int32_t _x, int32_t _y, int32_t _width, int32_t _height, int32_t* _scroll, bool _enabled)
 {
 	return s_imgui.beginScrollArea(_name, _x, _y, _width, _height, _scroll, _enabled);
@@ -2182,14 +2448,14 @@ void imguiUnindent()
 	s_imgui.unindent();
 }
 
-void imguiSeparator()
+void imguiSeparator(uint16_t _height)
 {
-	s_imgui.separator();
+	s_imgui.separator(_height);
 }
 
-void imguiSeparatorLine()
+void imguiSeparatorLine(uint16_t _height)
 {
-	s_imgui.separatorLine();
+	s_imgui.separatorLine(_height);
 }
 
 bool imguiButton(const char* _text, bool _enabled)
@@ -2243,6 +2509,16 @@ void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled)
 	s_imgui.input(_label, _str, _len, _enabled);
 }
 
+uint8_t imguiTabsUseMacroInstead(uint8_t _selected, bool _enabled, ...)
+{
+	va_list argList;
+	va_start(argList, _enabled);
+	const uint8_t result = s_imgui.tabs(_selected, _enabled, argList);
+	va_end(argList);
+
+	return result;
+}
+
 uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...)
 {
 	va_list argList;
@@ -2298,14 +2574,13 @@ void imguiColorWheel(float _rgb[3], bool _respectIndentation, bool _enabled)
 void imguiColorWheel(const char* _text, float _rgb[3], bool& _activated, bool _enabled)
 {
 	char buf[128];
-	bx::snprintf(buf, sizeof(buf), "%s [RGB %-2.2f %-2.2f %-2.2f]"
-		, _text
+	bx::snprintf(buf, sizeof(buf), "[RGB %-2.2f %-2.2f %-2.2f]"
 		, _rgb[0]
 		, _rgb[1]
 		, _rgb[2]
 		);
 
-	if (imguiButton(buf, true) )
+	if (imguiCollapse(_text, buf, _activated, _enabled) )
 	{
 		_activated = !_activated;
 	}
@@ -2325,3 +2600,13 @@ void imguiImage(bgfx::TextureHandle _image, float _lod, float _width, float _asp
 {
 	s_imgui.image(_image, _lod, _width, _aspect, _align);
 }
+
+void imguiImageSwizzle(bgfx::TextureHandle _image, const float _swizzle[4], float _lod, int32_t _width, int32_t _height, ImguiImageAlign::Enum _align)
+{
+	s_imgui.imageSwizzle(_image, _swizzle, _lod, _width, _height, _align);
+}
+
+void imguiImageSwizzle(bgfx::TextureHandle _image, const float _swizzle[4], float _lod, float _width, float _aspect, ImguiImageAlign::Enum _align)
+{
+	s_imgui.imageSwizzle(_image, _swizzle, _lod, _width, _aspect, _align);
+}

+ 22 - 3
examples/common/imgui/imgui.h

@@ -55,6 +55,17 @@ struct ImguiImageAlign
 	};
 };
 
+struct ImguiBorder
+{
+	enum Enum
+	{
+		Left,
+		Right,
+		Top,
+		Bottom
+	};
+};
+
 inline uint32_t imguiRGBA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255)
 {
 	return 0
@@ -76,13 +87,16 @@ void imguiDestroy();
 void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar = 0, uint8_t _view = 31);
 void imguiEndFrame();
 
+/// Notice: this function is not to be called between imguiBeginScrollArea() and imguiEndScrollArea().
+bool imguiBorderButton(ImguiBorder::Enum _border, bool _checked, bool _enabled = true);
+
 bool imguiBeginScrollArea(const char* _name, int _x, int _y, int _width, int _height, int* _scroll, bool _enabled = true);
 void imguiEndScrollArea();
 
 void imguiIndent();
 void imguiUnindent();
-void imguiSeparator();
-void imguiSeparatorLine();
+void imguiSeparator(uint16_t _height = 12);
+void imguiSeparatorLine(uint16_t _height = 12);
 
 bool imguiButton(const char* _text, bool _enabled = true);
 bool imguiItem(const char* _text, bool _enabled = true);
@@ -94,6 +108,9 @@ bool imguiSlider(const char* _text, float& _val, float _vmin, float _vmax, float
 bool imguiSlider(const char* _text, int32_t& _val, int32_t _vmin, int32_t _vmax, bool _enabled = true);
 void imguiInput(const char* _label, char* _str, uint32_t _len, bool _enabled = true);
 
+uint8_t imguiTabsUseMacroInstead(uint8_t _selected, bool _enabled, ...);
+#define imguiTabs(_selected, _enabled, ...) imguiTabsUseMacroInstead(_selected, _enabled, __VA_ARGS__, NULL)
+
 uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...);
 #define imguiChoose(...) imguiChooseUseMacroInstead(__VA_ARGS__, NULL)
 
@@ -107,6 +124,8 @@ void imguiColorWheel(float _rgb[3], bool _respectIndentation = false, bool _enab
 void imguiColorWheel(const char* _str, float _rgb[3], bool& _activated, bool _enabled = true);
 
 void imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiImageAlign::Enum _align = ImguiImageAlign::LeftIndented);
-void imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _aspect, ImguiImageAlign::Enum _align = ImguiImageAlign::LeftIndented); //_scale is in [0.0-1.0] range.
+void imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _aspect, ImguiImageAlign::Enum _align = ImguiImageAlign::LeftIndented);
+void imguiImageSwizzle(bgfx::TextureHandle _image, const float _swizzle[4], float _lod, int32_t _width, int32_t _height, ImguiImageAlign::Enum _align = ImguiImageAlign::LeftIndented);
+void imguiImageSwizzle(bgfx::TextureHandle _image, const float _swizzle[4], float _lod, float _scale, float _aspect, ImguiImageAlign::Enum _align = ImguiImageAlign::LeftIndented);
 
 #endif // IMGUI_H_HEADER_GUARD