summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h8
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp23
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp2
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h1
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl1
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl5
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h123
-rw-r--r--3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl1293
-rw-r--r--3rdparty/bgfx/README.md9
-rw-r--r--3rdparty/bgfx/examples/08-update/update.cpp52
-rw-r--r--3rdparty/bgfx/examples/09-hdr/hdr.cpp10
-rw-r--r--3rdparty/bgfx/examples/12-lod/lod.cpp2
-rw-r--r--3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp8
-rw-r--r--3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp6
-rw-r--r--3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp12
-rw-r--r--3rdparty/bgfx/examples/18-ibl/ibl.cpp47
-rw-r--r--3rdparty/bgfx/examples/19-oit/oit.cpp6
-rw-r--r--3rdparty/bgfx/examples/21-deferred/deferred.cpp6
-rw-r--r--3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp2
-rw-r--r--3rdparty/bgfx/examples/27-terrain/terrain.cpp4
-rw-r--r--3rdparty/bgfx/examples/30-picking/picking.cpp6
-rw-r--r--3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp14
-rw-r--r--3rdparty/bgfx/examples/common/bgfx_utils.cpp5
-rw-r--r--3rdparty/bgfx/examples/common/cube_atlas.cpp4
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_android.cpp15
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_glfw.cpp36
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_osx.mm14
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_sdl.cpp39
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_windows.cpp18
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_winrt.cx15
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_x11.cpp14
-rw-r--r--3rdparty/bgfx/examples/common/font/font_manager.cpp20
-rw-r--r--3rdparty/bgfx/examples/common/font/font_manager.h14
-rw-r--r--3rdparty/bgfx/examples/common/imgui/imgui.cpp20
-rw-r--r--3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp5
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h743
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.sc14
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg.cpp105
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg.h78
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp151
-rw-r--r--3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h1
-rw-r--r--3rdparty/bgfx/examples/common/packrect.h2
-rw-r--r--3rdparty/bgfx/include/bgfx/bgfx.h79
-rw-r--r--3rdparty/bgfx/include/bgfx/bgfxdefines.h4
-rw-r--r--3rdparty/bgfx/include/bgfx/bgfxplatform.h194
-rw-r--r--3rdparty/bgfx/include/bgfx/c99/bgfx.h21
-rw-r--r--3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h15
-rw-r--r--3rdparty/bgfx/src/bgfx.cpp176
-rw-r--r--3rdparty/bgfx/src/bgfx_p.h27
-rw-r--r--3rdparty/bgfx/src/bgfx_shader.sh72
-rw-r--r--3rdparty/bgfx/src/glcontext_nsgl.mm25
-rw-r--r--3rdparty/bgfx/src/hmd_openvr.cpp2
-rw-r--r--3rdparty/bgfx/src/image.cpp168
-rw-r--r--3rdparty/bgfx/src/image.h31
-rw-r--r--3rdparty/bgfx/src/renderer_d3d.h8
-rw-r--r--3rdparty/bgfx/src/renderer_d3d11.cpp122
-rw-r--r--3rdparty/bgfx/src/renderer_d3d12.cpp122
-rw-r--r--3rdparty/bgfx/src/renderer_d3d9.cpp38
-rw-r--r--3rdparty/bgfx/src/renderer_gl.cpp773
-rw-r--r--3rdparty/bgfx/src/renderer_gl.h40
-rw-r--r--3rdparty/bgfx/src/renderer_mtl.h2
-rw-r--r--3rdparty/bgfx/src/renderer_mtl.mm128
-rw-r--r--3rdparty/bgfx/src/shader_dxbc.cpp4
-rw-r--r--3rdparty/bgfx/tools/shaderc/shaderc.cpp74
-rw-r--r--3rdparty/bgfx/tools/texturec/texturec.cpp6
-rw-r--r--3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h112
-rw-r--r--3rdparty/bgfx/tools/texturev/fs_texture_array.sc20
-rw-r--r--3rdparty/bgfx/tools/texturev/texturev.cpp105
-rw-r--r--3rdparty/bx/include/bx/macros.h36
-rw-r--r--3rdparty/bx/include/bx/os.h12
-rw-r--r--3rdparty/bx/include/bx/platform.h7
-rw-r--r--3rdparty/bx/include/bx/simd256_avx.inl36
-rw-r--r--3rdparty/bx/include/bx/simd256_ref.inl42
-rw-r--r--3rdparty/bx/include/bx/simd_t.h58
-rw-r--r--3rdparty/bx/scripts/toolchain.lua81
-rw-r--r--3rdparty/bx/tests/simd_t.cpp154
-rwxr-xr-x3rdparty/bx/tools/bin/darwin/geniebin487712 -> 528640 bytes
-rwxr-xr-x3rdparty/bx/tools/bin/linux/geniebin462504 -> 507616 bytes
-rw-r--r--3rdparty/bx/tools/bin/windows/genie.exebin467456 -> 512512 bytes
-rw-r--r--bgfx/shaders/dx11/chains/crt/fs_crt-caligari.binbin0 -> 2478 bytes
-rw-r--r--bgfx/shaders/dx11/chains/crt/vs_crt-caligari.binbin0 -> 707 bytes
-rw-r--r--bgfx/shaders/dx9/chains/crt/fs_crt-caligari.binbin0 -> 1887 bytes
-rw-r--r--bgfx/shaders/dx9/chains/crt/vs_crt-caligari.binbin0 -> 462 bytes
-rw-r--r--bgfx/shaders/gles/chains/crt/fs_crt-caligari.binbin0 -> 3678 bytes
-rw-r--r--bgfx/shaders/gles/chains/crt/vs_crt-caligari.binbin0 -> 729 bytes
-rw-r--r--bgfx/shaders/glsl/chains/crt/fs_crt-caligari.binbin0 -> 3448 bytes
-rw-r--r--bgfx/shaders/glsl/chains/crt/vs_crt-caligari.binbin0 -> 663 bytes
-rw-r--r--bgfx/shaders/metal/chains/crt/fs_crt-caligari.binbin0 -> 4402 bytes
-rw-r--r--bgfx/shaders/metal/chains/crt/vs_crt-caligari.binbin0 -> 1047 bytes
-rw-r--r--src/osd/modules/render/bgfx/target.cpp2
-rw-r--r--src/osd/modules/render/bgfx/texture.cpp12
-rw-r--r--src/osd/modules/render/drawbgfx.cpp54
92 files changed, 4252 insertions, 1563 deletions
diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h
index c13f964a1bf..a4ca7913046 100644
--- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h
+++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h
@@ -303,9 +303,9 @@ D3DReflect(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
HRESULT WINAPI
D3DReflectLibrary(__in_bcount(SrcDataSize) LPCVOID pSrcData,
- __in SIZE_T SrcDataSize,
- __in REFIID riid,
- __out LPVOID * ppReflector);
+ SIZE_T SrcDataSize,
+ REFIID riid,
+ LPVOID * ppReflector);
//----------------------------------------------------------------------------
// D3DDisassemble:
@@ -350,7 +350,7 @@ D3DDisassembleRegion(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
// Shader linking and Function Linking Graph (FLG) APIs
//----------------------------------------------------------------------------
HRESULT WINAPI
-D3DCreateLinker(__out interface ID3D11Linker ** ppLinker);
+D3DCreateLinker(interface ID3D11Linker ** ppLinker);
HRESULT WINAPI
D3DLoadModule(_In_ LPCVOID pSrcData,
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
index 623ac90a4c9..1939cc3578a 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
@@ -80,7 +80,7 @@
- read the FAQ below this section!
- your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs.
- call and read ImGui::ShowTestWindow() for demo code demonstrating most features.
- - see examples/ folder for standalone sample applications. Prefer reading examples/opengl_example/ first as it is the simplest.
+ - see examples/ folder for standalone sample applications. Prefer reading examples/opengl2_example/ first as it is the simplest.
you may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
- customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
@@ -949,21 +949,30 @@ const char* ImStristr(const char* haystack, const char* haystack_end, const char
return NULL;
}
+
+// MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size).
+// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.
int ImFormatString(char* buf, int buf_size, const char* fmt, ...)
{
+ IM_ASSERT(buf_size > 0);
va_list args;
va_start(args, fmt);
int w = vsnprintf(buf, buf_size, fmt, args);
va_end(args);
- buf[buf_size-1] = 0;
- return (w == -1) ? buf_size : w;
+ if (w == -1 || w >= buf_size)
+ w = buf_size - 1;
+ buf[w] = 0;
+ return w;
}
int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args)
{
+ IM_ASSERT(buf_size > 0);
int w = vsnprintf(buf, buf_size, fmt, args);
- buf[buf_size-1] = 0;
- return (w == -1) ? buf_size : w;
+ if (w == -1 || w >= buf_size)
+ w = buf_size - 1;
+ buf[w] = 0;
+ return w;
}
// Pass data_size==0 for zero-terminated strings
@@ -4258,10 +4267,9 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window->DC.AllowKeyboardFocus = true;
window->DC.ButtonRepeat = false;
window->DC.ItemWidthStack.resize(0);
- window->DC.TextWrapPosStack.resize(0);
window->DC.AllowKeyboardFocusStack.resize(0);
window->DC.ButtonRepeatStack.resize(0);
- window->DC.ColorEditMode = ImGuiColorEditMode_UserSelect;
+ window->DC.TextWrapPosStack.resize(0);
window->DC.ColumnsCurrent = 0;
window->DC.ColumnsCount = 1;
window->DC.ColumnsStartPosY = window->DC.CursorPos.y;
@@ -4269,6 +4277,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window->DC.TreeDepth = 0;
window->DC.StateStorage = &window->StateStorage;
window->DC.GroupStack.resize(0);
+ window->DC.ColorEditMode = ImGuiColorEditMode_UserSelect;
window->MenuColumns.Update(3, style.ItemSpacing.x, !window_was_active);
if (window->AutoFitFramesX > 0)
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
index b6582a88a69..814ee8998ac 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
@@ -1670,7 +1670,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
}
ImGui::LogFinish();
}
- ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY"); ImGui::PopItemWidth();
+ ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0"); ImGui::PopItemWidth();
ImGui::SameLine(); ImGui::Checkbox("Only Modified Fields", &output_only_modified);
static ImGuiColorEditMode edit_mode = ImGuiColorEditMode_RGB;
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h
index 5d90624d3bd..60b8df40c9f 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h
@@ -44,3 +44,4 @@ namespace ImGui
#include "widgets/file_list.h"
#include "widgets/memory_editor.h"
+#include "widgets/gizmo.h"
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl
index b064a6d4d68..c03955f1887 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl
@@ -74,3 +74,4 @@ namespace ImGui
#include "widgets/file_list.inl"
#include "widgets/memory_editor.inl"
+#include "widgets/gizmo.inl"
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl
index ceb6b29af4b..d7b89103c1f 100644
--- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl
@@ -1,3 +1,4 @@
+#include <bx/bx.h>
#include <dirent.h>
#include <sys/stat.h>
@@ -15,6 +16,9 @@ namespace ImGui
void ImFileList::ChDir(const char* path)
{
+#if BX_PLATFORM_NACL
+ BX_UNUSED(path);
+#else
DIR* dir = opendir(path);
if (NULL != dir)
{
@@ -43,6 +47,7 @@ namespace ImGui
closedir(dir);
}
+#endif // BX_PLATFORM_NACL
}
void ImFileList::Draw()
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h
new file mode 100644
index 00000000000..2263dd5a071
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h
@@ -0,0 +1,123 @@
+// https://github.com/CedricGuillemet/ImGuizmo
+// v 1.0 WIP
+//
+// The MIT License(MIT)
+//
+// Copyright(c) 2016 Cedric Guillemet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files(the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions :
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+// -------------------------------------------------------------------------------------------
+// History :
+// 2016/09/01 Mogwai changed to Manipulate. Draw debug cube. Fixed inverted scale. Mixing scale and translation/rotation gives bad results.
+// 2016/08/31 First version
+//
+// -------------------------------------------------------------------------------------------
+// Example
+//
+// static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::TRANSLATE);
+// static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::LOCAL);
+//
+// // Maya shortcut keys
+// if (ImGui::IsKeyPressed(90)) // w Key
+// mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
+// if (ImGui::IsKeyPressed(69)) // e Key
+// mCurrentGizmoOperation = ImGuizmo::ROTATE;
+// if (ImGui::IsKeyPressed(82)) // r Key
+// mCurrentGizmoOperation = ImGuizmo::SCALE;
+//
+// if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE))
+// mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
+// ImGui::SameLine();
+// if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE))
+// mCurrentGizmoOperation = ImGuizmo::ROTATE;
+// ImGui::SameLine();
+// if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE))
+// mCurrentGizmoOperation = ImGuizmo::SCALE;
+//
+// float matrixTranslation[3], matrixRotation[3], matrixScale[3];
+// ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
+// ImGui::InputFloat3("Tr", matrixTranslation, 3);
+// ImGui::InputFloat3("Rt", matrixRotation, 3);
+// ImGui::InputFloat3("Sc", matrixScale, 3);
+// ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
+//
+// if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL))
+// mCurrentGizmoMode = ImGuizmo::LOCAL;
+// ImGui::SameLine();
+// if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD))
+// mCurrentGizmoMode = ImGuizmo::WORLD;
+//
+// ImGuizmo::Mogwai(gCurrentCamera->mView.m16, gCurrentCamera->mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, gizmoMatrix.m16);
+//
+
+#pragma once
+
+namespace ImGuizmo
+{
+ // call BeginFrame right after ImGui_XXXX_NewFrame();
+ void BeginFrame();
+
+ // return true if mouse cursor is over any gizmo control (axis, plan or screen component)
+ bool IsOver();
+
+ // return true if mouse IsOver or if the gizmo is in moving state
+ bool IsUsing();
+
+ // enable/disable the gizmo. Stay in the state until next call to Enable.
+ // gizmo is rendered with gray half transparent color when disabled
+ void Enable(bool enable);
+
+ // helper functions for manualy editing translation/rotation/scale with an input float
+ // translation, rotation and scale float points to 3 floats each
+ // Angles are in degrees (more suitable for human editing)
+ // example:
+ // float matrixTranslation[3], matrixRotation[3], matrixScale[3];
+ // ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
+ // ImGui::InputFloat3("Tr", matrixTranslation, 3);
+ // ImGui::InputFloat3("Rt", matrixRotation, 3);
+ // ImGui::InputFloat3("Sc", matrixScale, 3);
+ // ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
+ //
+ // These functions have some numerical stability issues for now. Use with caution.
+ void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale);
+ void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix);
+
+ // Render a cube with face color corresponding to face normal. Usefull for debug/tests
+ void DrawCube(const float *view, const float *projection, float *matrix);
+
+ // call it when you want a gizmo
+ // Needs view and projection matrices.
+ // matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional
+ // translation is applied in world space
+ enum OPERATION
+ {
+ TRANSLATE,
+ ROTATE,
+ SCALE
+ };
+
+ enum MODE
+ {
+ LOCAL,
+ WORLD
+ };
+
+ void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0);
+};
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl
new file mode 100644
index 00000000000..dc416fdeb8a
--- /dev/null
+++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl
@@ -0,0 +1,1293 @@
+// The MIT License(MIT)
+//
+// Copyright(c) 2016 Cedric Guillemet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files(the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions :
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+namespace ImGuizmo
+{
+ static const float ZPI = 3.14159265358979323846f;
+ static const float RAD2DEG = (180.f / ZPI);
+ static const float DEG2RAD = (ZPI / 180.f);
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // utility and math
+
+ void FPU_MatrixF_x_MatrixF(const float *a, const float *b, float *r)
+ {
+ r[0] = a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12];
+ r[1] = a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13];
+ r[2] = a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14];
+ r[3] = a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15];
+
+ r[4] = a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12];
+ r[5] = a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13];
+ r[6] = a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14];
+ r[7] = a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15];
+
+ r[8] = a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12];
+ r[9] = a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13];
+ r[10] = a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14];
+ r[11] = a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15];
+
+ r[12] = a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12];
+ r[13] = a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13];
+ r[14] = a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14];
+ r[15] = a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15];
+ }
+
+ template <typename T> T LERP(T x, T y, float z) { return (x + (y - x)*z); }
+ template <typename T> T Clamp(T x, T y, T z) { return ((x<y) ? y : ((x>z) ? z : x)); }
+
+ struct matrix_t;
+ struct vec_t
+ {
+ public:
+ float x, y, z, w;
+
+ void Lerp(const vec_t& v, float t)
+ {
+ x += (v.x - x) * t;
+ y += (v.y - y) * t;
+ z += (v.z - z) * t;
+ w += (v.w - w) * t;
+ }
+
+ void Set(float v) { x = y = z = w = v; }
+ void Set(float _x, float _y, float _z = 0.f, float _w = 0.f) { x = _x; y = _y; z = _z; w = _w; }
+
+ vec_t& operator -= (const vec_t& v) { x -= v.x; y -= v.y; z -= v.z; w -= v.w; return *this; }
+ vec_t& operator += (const vec_t& v) { x += v.x; y += v.y; z += v.z; w += v.w; return *this; }
+ vec_t& operator *= (const vec_t& v) { x *= v.x; y *= v.y; z *= v.z; w *= v.w; return *this; }
+ vec_t& operator *= (float v) { x *= v; y *= v; z *= v; w *= v; return *this; }
+
+ vec_t operator * (float f) const;
+ vec_t operator - () const;
+ vec_t operator - (const vec_t& v) const;
+ vec_t operator + (const vec_t& v) const;
+ vec_t operator * (const vec_t& v) const;
+
+ const vec_t& operator + () const { return (*this); }
+ float Length() const { return sqrtf(x*x + y*y + z*z); };
+ float LengthSq() const { return (x*x + y*y + z*z); };
+ vec_t Normalize() { (*this) *= (1.f / Length()); return (*this); }
+ vec_t Normalize(const vec_t& v) { this->Set(v.x, v.y, v.z, v.w); this->Normalize(); return (*this); }
+
+ void Cross(const vec_t& v)
+ {
+ vec_t res;
+ res.x = y * v.z - z * v.y;
+ res.y = z * v.x - x * v.z;
+ res.z = x * v.y - y * v.x;
+
+ x = res.x;
+ y = res.y;
+ z = res.z;
+ w = 0.f;
+ }
+ void Cross(const vec_t& v1, const vec_t& v2)
+ {
+ x = v1.y * v2.z - v1.z * v2.y;
+ y = v1.z * v2.x - v1.x * v2.z;
+ z = v1.x * v2.y - v1.y * v2.x;
+ w = 0.f;
+ }
+ float Dot(const vec_t &v) const
+ {
+ return (x * v.x) + (y * v.y) + (z * v.z) + (w * v.w);
+ }
+ float Dot3(const vec_t &v) const
+ {
+ return (x * v.x) + (y * v.y) + (z * v.z);
+ }
+
+ void Transform(const matrix_t& matrix);
+ void Transform(const vec_t & s, const matrix_t& matrix);
+
+ void TransformVector(const matrix_t& matrix);
+ void TransformPoint(const matrix_t& matrix);
+ void TransformVector(const vec_t& v, const matrix_t& matrix) { (*this) = v; this->TransformVector(matrix); }
+ void TransformPoint(const vec_t& v, const matrix_t& matrix) { (*this) = v; this->TransformPoint(matrix); }
+
+ float& operator [] (size_t index) { return ((float*)&x)[index]; }
+ const float& operator [] (size_t index) const { return ((float*)&x)[index]; }
+ };
+
+ vec_t makeVect(float _x, float _y, float _z = 0.f, float _w = 0.f) { vec_t res; res.x = _x; res.y = _y; res.z = _z; res.w = _w; return res; }
+ vec_t vec_t::operator * (float f) const { return makeVect(x * f, y * f, z * f, w *f); }
+ vec_t vec_t::operator - () const { return makeVect(-x, -y, -z, -w); }
+ vec_t vec_t::operator - (const vec_t& v) const { return makeVect(x - v.x, y - v.y, z - v.z, w - v.w); }
+ vec_t vec_t::operator + (const vec_t& v) const { return makeVect(x + v.x, y + v.y, z + v.z, w + v.w); }
+ vec_t vec_t::operator * (const vec_t& v) const { return makeVect(x * v.x, y * v.y, z * v.z, w * v.w); }
+
+ ImVec2 operator+ (const ImVec2& a, const ImVec2& b) { return ImVec2(a.x + b.x, a.y + b.y); }
+
+ vec_t Normalized(const vec_t& v) { vec_t res; res = v; res.Normalize(); return res; }
+ vec_t Cross(const vec_t& v1, const vec_t& v2)
+ {
+ vec_t res;
+ res.x = v1.y * v2.z - v1.z * v2.y;
+ res.y = v1.z * v2.x - v1.x * v2.z;
+ res.z = v1.x * v2.y - v1.y * v2.x;
+ res.w = 0.f;
+ return res;
+ }
+
+ float Dot(const vec_t &v1, const vec_t &v2)
+ {
+ return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
+ }
+
+ vec_t BuildPlan(const vec_t & p_point1, const vec_t & p_normal)
+ {
+ vec_t normal, res;
+ normal.Normalize(p_normal);
+ res.w = normal.Dot(p_point1);
+ res.x = normal.x;
+ res.y = normal.y;
+ res.z = normal.z;
+ return res;
+ }
+
+ struct matrix_t
+ {
+ public:
+
+ union
+ {
+ float m[4][4];
+ float m16[16];
+ struct
+ {
+ vec_t right, up, dir, position;
+ } v;
+ };
+
+ matrix_t(const matrix_t& other) { memcpy(&m16[0], &other.m16[0], sizeof(float) * 16); }
+ matrix_t() {}
+
+ operator float * () { return m16; }
+ operator const float* () const { return m16; }
+ void Translation(float _x, float _y, float _z) { this->Translation(makeVect(_x, _y, _z)); }
+
+ void Translation(const vec_t& vt)
+ {
+ v.right.Set(1.f, 0.f, 0.f, 0.f);
+ v.up.Set(0.f, 1.f, 0.f, 0.f);
+ v.dir.Set(0.f, 0.f, 1.f, 0.f);
+ v.position.Set(vt.x, vt.y, vt.z, 1.f);
+ }
+
+ void Scale(float _x, float _y, float _z)
+ {
+ v.right.Set(_x, 0.f, 0.f, 0.f);
+ v.up.Set(0.f, _y, 0.f, 0.f);
+ v.dir.Set(0.f, 0.f, _z, 0.f);
+ v.position.Set(0.f, 0.f, 0.f, 1.f);
+ }
+ void Scale(const vec_t& s) { Scale(s.x, s.y, s.z); }
+
+ matrix_t& operator *= (const matrix_t& mat)
+ {
+ matrix_t tmpMat;
+ tmpMat = *this;
+ tmpMat.Multiply(mat);
+ *this = tmpMat;
+ return *this;
+ }
+ matrix_t operator * (const matrix_t& mat) const
+ {
+ matrix_t matT;
+ matT.Multiply(*this, mat);
+ return matT;
+ }
+
+ void Multiply(const matrix_t &matrix)
+ {
+ matrix_t tmp;
+ tmp = *this;
+
+ FPU_MatrixF_x_MatrixF((float*)&tmp, (float*)&matrix, (float*)this);
+ }
+
+ void Multiply(const matrix_t &m1, const matrix_t &m2)
+ {
+ FPU_MatrixF_x_MatrixF((float*)&m1, (float*)&m2, (float*)this);
+ }
+
+ float GetDeterminant() const
+ {
+ return m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[0][2] * m[1][0] * m[2][1] -
+ m[0][2] * m[1][1] * m[2][0] - m[0][1] * m[1][0] * m[2][2] - m[0][0] * m[1][2] * m[2][1];
+ }
+
+ float Inverse(const matrix_t &srcMatrix, bool affine = false);
+ float Inverse(bool affine = false);
+ void SetToIdentity()
+ {
+ v.right.Set(1.f, 0.f, 0.f, 0.f);
+ v.up.Set(0.f, 1.f, 0.f, 0.f);
+ v.dir.Set(0.f, 0.f, 1.f, 0.f);
+ v.position.Set(0.f, 0.f, 0.f, 1.f);
+ }
+ void Transpose()
+ {
+ matrix_t tmpm;
+ for (int l = 0; l < 4; l++)
+ {
+ for (int c = 0; c < 4; c++)
+ {
+ tmpm.m[l][c] = m[c][l];
+ }
+ }
+ (*this) = tmpm;
+ }
+
+ void RotationAxis(const vec_t & axis, float angle);
+
+ void OrthoNormalize()
+ {
+ v.right.Normalize();
+ v.up.Normalize();
+ v.dir.Normalize();
+ }
+ };
+
+ void vec_t::Transform(const matrix_t& matrix)
+ {
+ vec_t out;
+
+ out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0] + w * matrix.m[3][0];
+ out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1] + w * matrix.m[3][1];
+ out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2] + w * matrix.m[3][2];
+ out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3] + w * matrix.m[3][3];
+
+ x = out.x;
+ y = out.y;
+ z = out.z;
+ w = out.w;
+ }
+
+ void vec_t::Transform(const vec_t & s, const matrix_t& matrix)
+ {
+ *this = s;
+ Transform(matrix);
+ }
+
+ void vec_t::TransformPoint(const matrix_t& matrix)
+ {
+ vec_t out;
+
+ out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0] + matrix.m[3][0];
+ out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1] + matrix.m[3][1];
+ out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2] + matrix.m[3][2];
+ out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3] + matrix.m[3][3];
+
+ x = out.x;
+ y = out.y;
+ z = out.z;
+ w = out.w;
+ }
+
+
+ void vec_t::TransformVector(const matrix_t& matrix)
+ {
+ vec_t out;
+
+ out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0];
+ out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1];
+ out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2];
+ out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3];
+
+ x = out.x;
+ y = out.y;
+ z = out.z;
+ w = out.w;
+ }
+
+ float matrix_t::Inverse(const matrix_t &srcMatrix, bool affine)
+ {
+ float det = 0;
+
+ if (affine)
+ {
+ det = GetDeterminant();
+ float s = 1 / det;
+ m[0][0] = (srcMatrix.m[1][1] * srcMatrix.m[2][2] - srcMatrix.m[1][2] * srcMatrix.m[2][1]) * s;
+ m[0][1] = (srcMatrix.m[2][1] * srcMatrix.m[0][2] - srcMatrix.m[2][2] * srcMatrix.m[0][1]) * s;
+ m[0][2] = (srcMatrix.m[0][1] * srcMatrix.m[1][2] - srcMatrix.m[0][2] * srcMatrix.m[1][1]) * s;
+ m[1][0] = (srcMatrix.m[1][2] * srcMatrix.m[2][0] - srcMatrix.m[1][0] * srcMatrix.m[2][2]) * s;
+ m[1][1] = (srcMatrix.m[2][2] * srcMatrix.m[0][0] - srcMatrix.m[2][0] * srcMatrix.m[0][2]) * s;
+ m[1][2] = (srcMatrix.m[0][2] * srcMatrix.m[1][0] - srcMatrix.m[0][0] * srcMatrix.m[1][2]) * s;
+ m[2][0] = (srcMatrix.m[1][0] * srcMatrix.m[2][1] - srcMatrix.m[1][1] * srcMatrix.m[2][0]) * s;
+ m[2][1] = (srcMatrix.m[2][0] * srcMatrix.m[0][1] - srcMatrix.m[2][1] * srcMatrix.m[0][0]) * s;
+ m[2][2] = (srcMatrix.m[0][0] * srcMatrix.m[1][1] - srcMatrix.m[0][1] * srcMatrix.m[1][0]) * s;
+ m[3][0] = -(m[0][0] * srcMatrix.m[3][0] + m[1][0] * srcMatrix.m[3][1] + m[2][0] * srcMatrix.m[3][2]);
+ m[3][1] = -(m[0][1] * srcMatrix.m[3][0] + m[1][1] * srcMatrix.m[3][1] + m[2][1] * srcMatrix.m[3][2]);
+ m[3][2] = -(m[0][2] * srcMatrix.m[3][0] + m[1][2] * srcMatrix.m[3][1] + m[2][2] * srcMatrix.m[3][2]);
+ }
+ else
+ {
+ // transpose matrix
+ float src[16];
+ for (int i = 0; i < 4; ++i)
+ {
+ src[i] = srcMatrix.m16[i * 4];
+ src[i + 4] = srcMatrix.m16[i * 4 + 1];
+ src[i + 8] = srcMatrix.m16[i * 4 + 2];
+ src[i + 12] = srcMatrix.m16[i * 4 + 3];
+ }
+
+ // calculate pairs for first 8 elements (cofactors)
+ float tmp[12]; // temp array for pairs
+ tmp[0] = src[10] * src[15];
+ tmp[1] = src[11] * src[14];
+ tmp[2] = src[9] * src[15];
+ tmp[3] = src[11] * src[13];
+ tmp[4] = src[9] * src[14];
+ tmp[5] = src[10] * src[13];
+ tmp[6] = src[8] * src[15];
+ tmp[7] = src[11] * src[12];
+ tmp[8] = src[8] * src[14];
+ tmp[9] = src[10] * src[12];
+ tmp[10] = src[8] * src[13];
+ tmp[11] = src[9] * src[12];
+
+ // calculate first 8 elements (cofactors)
+ m16[0] = (tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7]) - (tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7]);
+ m16[1] = (tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7]) - (tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7]);
+ m16[2] = (tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7]) - (tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7]);
+ m16[3] = (tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6]) - (tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6]);
+ m16[4] = (tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3]) - (tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3]);
+ m16[5] = (tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3]) - (tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3]);
+ m16[6] = (tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3]) - (tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3]);
+ m16[7] = (tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2]) - (tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2]);
+
+ // calculate pairs for second 8 elements (cofactors)
+ tmp[0] = src[2] * src[7];
+ tmp[1] = src[3] * src[6];
+ tmp[2] = src[1] * src[7];
+ tmp[3] = src[3] * src[5];
+ tmp[4] = src[1] * src[6];
+ tmp[5] = src[2] * src[5];
+ tmp[6] = src[0] * src[7];
+ tmp[7] = src[3] * src[4];
+ tmp[8] = src[0] * src[6];
+ tmp[9] = src[2] * src[4];
+ tmp[10] = src[0] * src[5];
+ tmp[11] = src[1] * src[4];
+
+ // calculate second 8 elements (cofactors)
+ m16[8] = (tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15]) - (tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15]);
+ m16[9] = (tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15]) - (tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15]);
+ m16[10] = (tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15]) - (tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15]);
+ m16[11] = (tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14]) - (tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14]);
+ m16[12] = (tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9]) - (tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10]);
+ m16[13] = (tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10]) - (tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8]);
+ m16[14] = (tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8]) - (tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9]);
+ m16[15] = (tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9]) - (tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8]);
+
+ // calculate determinant
+ det = src[0] * m16[0] + src[1] * m16[1] + src[2] * m16[2] + src[3] * m16[3];
+
+ // calculate matrix inverse
+ float invdet = 1 / det;
+ for (int j = 0; j < 16; ++j)
+ {
+ m16[j] *= invdet;
+ }
+ }
+
+ return det;
+ }
+
+ void matrix_t::RotationAxis(const vec_t & axis, float angle)
+ {
+ float length2 = axis.LengthSq();
+ if (length2 < FLT_EPSILON)
+ {
+ SetToIdentity();
+ return;
+ }
+
+ vec_t n = axis * (1.f / sqrtf(length2));
+ float s = sinf(angle);
+ float c = cosf(angle);
+ float k = 1.f - c;
+
+ float xx = n.x * n.x * k + c;
+ float yy = n.y * n.y * k + c;
+ float zz = n.z * n.z * k + c;
+ float xy = n.x * n.y * k;
+ float yz = n.y * n.z * k;
+ float zx = n.z * n.x * k;
+ float xs = n.x * s;
+ float ys = n.y * s;
+ float zs = n.z * s;
+
+ m[0][0] = xx;
+ m[0][1] = xy + zs;
+ m[0][2] = zx - ys;
+ m[0][3] = 0.f;
+ m[1][0] = xy - zs;
+ m[1][1] = yy;
+ m[1][2] = yz + xs;
+ m[1][3] = 0.f;
+ m[2][0] = zx + ys;
+ m[2][1] = yz - xs;
+ m[2][2] = zz;
+ m[2][3] = 0.f;
+ m[3][0] = 0.f;
+ m[3][1] = 0.f;
+ m[3][2] = 0.f;
+ m[3][3] = 1.f;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+
+ enum MOVETYPE
+ {
+ NONE,
+ MOVE_X,
+ MOVE_Y,
+ MOVE_Z,
+ MOVE_XY,
+ MOVE_XZ,
+ MOVE_YZ,
+ MOVE_SCREEN,
+ ROTATE_X,
+ ROTATE_Y,
+ ROTATE_Z,
+ ROTATE_SCREEN,
+ SCALE_X,
+ SCALE_Y,
+ SCALE_Z,
+ SCALE_XYZ,
+ };
+
+ struct Context
+ {
+ Context() : mbUsing(false), mbEnable(true)
+ {
+ }
+
+ ImDrawList* mDrawList;
+
+ matrix_t mViewMat;
+ matrix_t mProjectionMat;
+ matrix_t mModel;
+ matrix_t mModelInverse;
+ matrix_t mModelSource;
+ matrix_t mMVP;
+ matrix_t mViewProjection;
+
+ vec_t mCameraEye;
+ vec_t mCameraRight;
+ vec_t mCameraDir;
+ vec_t mCameraUp;
+ vec_t mRayOrigin;
+ vec_t mRayVector;
+
+ vec_t mCameraToModel;
+
+ ImVec2 mScreenSquareCenter;
+ ImVec2 mScreenSquareMin;
+ ImVec2 mScreenSquareMax;
+
+ float mScreenFactor;
+ vec_t mRelativeOrigin;
+
+ bool mbUsing;
+ bool mbEnable;
+
+ // translation
+ vec_t mTranslationPlan;
+ vec_t mTranslationPlanOrigin;
+ vec_t mMatrixOrigin;
+
+ // rotation
+ vec_t mRotationVectorSource;
+ float mRotationAngle;
+ float mRotationAngleOrigin;
+
+ // scale
+ vec_t mScale;
+ ImVec2 mScaleMousePos;
+
+ int mCurrentOperation;
+ };
+
+ static Context gContext;
+
+ static const float angleLimit = 0.96f;
+ static const float planeLimit = 0.2f;
+
+ static const vec_t directionUnary[3] = { makeVect(1.f, 0.f, 0.f), makeVect(0.f, 1.f, 0.f), makeVect(0.f, 0.f, 1.f) };
+ static const ImU32 directionColor[3] = { 0xFF0000AA, 0xFF00AA00, 0xFFAA0000 };
+ static const ImU32 selectionColor = 0xFF1080FF;
+ static const ImU32 inactiveColor = 0x99999999;
+ static const ImU32 translationLineColor = 0xAAAAAAAA;
+ static const char *translationInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "X : %5.2f Y : %5.2f", "Y : %5.2f Z : %5.2f", "X : %5.2f Z : %5.2f", "X : %5.2f Y : %5.2f Z : %5.2f" };
+ static const char *scaleInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "XYZ : %5.2f" };
+ static const char *rotationInfoMask[] = { "X : %5.2f deg %5.2f rad", "Y : %5.2f deg %5.2f rad", "Z : %5.2f deg %5.2f rad", "Screen : %5.2f deg %5.2f rad" };
+ static const int translationInfoIndex[] = { 0,0,0, 1,0,0, 2,0,0, 0,1,0, 0,2,0, 1,2,0, 0,1,2 };
+ static const float quadMin = 0.5f;
+ static const float quadMax = 0.8f;
+ static const float quadUV[8] = { quadMin, quadMin, quadMin, quadMax, quadMax, quadMax, quadMax, quadMin };
+ static const int halfCircleSegmentCount = 64;
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ static int GetMoveType(vec_t *gizmoHitProportion);
+ static int GetRotateType();
+ static int GetScaleType();
+
+ static ImVec2 worldToPos(const vec_t& worldPos, const matrix_t& mat)
+ {
+ ImGuiIO& io = ImGui::GetIO();
+
+ vec_t trans;
+ trans.TransformPoint(worldPos, mat);
+ trans *= 0.5f / trans.w;
+ trans += makeVect(0.5f, 0.5f);
+ trans.y = 1.f - trans.y;
+ trans.x *= io.DisplaySize.x;
+ trans.y *= io.DisplaySize.y;
+ return ImVec2(trans.x, trans.y);
+ }
+
+ static void ComputeCameraRay(vec_t &rayOrigin, vec_t &rayDir)
+ {
+ ImGuiIO& io = ImGui::GetIO();
+
+ matrix_t mViewProjInverse;
+ mViewProjInverse.Inverse(gContext.mViewMat * gContext.mProjectionMat);
+
+ float mox = (io.MousePos.x / io.DisplaySize.x) * 2.f - 1.f;
+ float moy = (1.f - (io.MousePos.y / io.DisplaySize.y)) * 2.f - 1.f;
+
+ rayOrigin.Transform(makeVect(mox, moy, 0.f, 1.f), mViewProjInverse);
+ rayOrigin *= 1.f / rayOrigin.w;
+ vec_t rayEnd;
+ rayEnd.Transform(makeVect(mox, moy, 1.f, 1.f), mViewProjInverse);
+ rayEnd *= 1.f / rayEnd.w;
+ rayDir = Normalized(rayEnd - rayOrigin);
+ }
+
+ static float IntersectRayPlane(const vec_t & rOrigin, const vec_t& rVector, const vec_t& plan)
+ {
+ float numer = plan.Dot3(rOrigin) - plan.w;
+ float denom = plan.Dot3(rVector);
+
+ if (fabsf(denom) < FLT_EPSILON) // normal is orthogonal to vector, cant intersect
+ return -1.0f;
+
+ return -(numer / denom);
+ }
+
+ void BeginFrame()
+ {
+ ImGuiIO& io = ImGui::GetIO();
+
+ ImGui::Begin("gizmo", NULL, io.DisplaySize, 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus);
+ gContext.mDrawList = ImGui::GetWindowDrawList();
+
+ ImGui::End();
+ }
+
+ bool IsUsing()
+ {
+ return gContext.mbUsing;
+ }
+
+ bool IsOver()
+ {
+ return (GetMoveType(NULL) != NONE) || GetRotateType() != NONE || GetScaleType() != NONE || IsUsing();
+ }
+
+ void Enable(bool enable)
+ {
+ gContext.mbEnable = enable;
+ if (!enable)
+ gContext.mbUsing = false;
+ }
+
+ static float GetUniform(const vec_t& position, const matrix_t& mat)
+ {
+ vec_t trf = makeVect(position.x, position.y, position.z, 1.f);
+ trf.Transform(mat);
+ return trf.w;
+ }
+
+ static void ComputeContext(const float *view, const float *projection, float *matrix, MODE mode)
+ {
+ gContext.mViewMat = *(matrix_t*)view;
+ gContext.mProjectionMat = *(matrix_t*)projection;
+ if (mode == LOCAL)
+ {
+ gContext.mModel = *(matrix_t*)matrix;
+ gContext.mModel.OrthoNormalize();
+ }
+ else
+ {
+ gContext.mModel.Translation(((matrix_t*)matrix)->v.position);
+ }
+ gContext.mModelSource = *(matrix_t*)matrix;
+ gContext.mModelInverse.Inverse(gContext.mModel);
+ gContext.mViewProjection = gContext.mViewMat * gContext.mProjectionMat;
+ gContext.mMVP = gContext.mModel * gContext.mViewProjection;
+
+ matrix_t viewInverse;
+ viewInverse.Inverse(gContext.mViewMat);
+ gContext.mCameraDir = viewInverse.v.dir;
+ gContext.mCameraEye = viewInverse.v.position;
+ gContext.mCameraRight = viewInverse.v.right;
+ gContext.mCameraUp = viewInverse.v.up;
+ gContext.mCameraToModel = gContext.mModel.v.position - gContext.mCameraEye;
+ gContext.mScreenFactor = 0.1f * GetUniform(gContext.mModel.v.position, gContext.mViewProjection);
+
+ ImVec2 centerSSpace = worldToPos(makeVect(0.f, 0.f), gContext.mMVP);
+ gContext.mScreenSquareCenter = centerSSpace;
+ gContext.mScreenSquareMin = ImVec2(centerSSpace.x - 10.f, centerSSpace.y - 10.f);
+ gContext.mScreenSquareMax = ImVec2(centerSSpace.x + 10.f, centerSSpace.y + 10.f);
+
+ ComputeCameraRay(gContext.mRayOrigin, gContext.mRayVector);
+ }
+
+ static void ComputeColors(ImU32 *colors, int type, OPERATION operation)
+ {
+ if (gContext.mbEnable)
+ {
+ switch (operation)
+ {
+ case TRANSLATE:
+ colors[0] = (type == MOVE_SCREEN) ? selectionColor : 0xFFFFFFFF;
+ for (int i = 0; i < 3; i++)
+ {
+ int colorPlaneIndex = (i + 2) % 3;
+ colors[i + 1] = (type == (int)(MOVE_X + i)) ? selectionColor : directionColor[i];
+ colors[i + 4] = (type == (int)(MOVE_XY + i)) ? selectionColor : directionColor[colorPlaneIndex];
+ }
+ break;
+ case ROTATE:
+ colors[0] = (type == ROTATE_SCREEN) ? selectionColor : 0xFFFFFFFF;
+ for (int i = 0; i < 3; i++)
+ colors[i + 1] = (type == (int)(ROTATE_X + i)) ? selectionColor : directionColor[i];
+ break;
+ case SCALE:
+ colors[0] = (type == SCALE_XYZ) ? selectionColor : 0xFFFFFFFF;
+ for (int i = 0; i < 3; i++)
+ colors[i + 1] = (type == (int)(SCALE_X + i)) ? selectionColor : directionColor[i];
+ break;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < 7; i++)
+ colors[i] = inactiveColor;
+ }
+ }
+
+ static void DrawRotationGizmo(int type)
+ {
+ ImDrawList* drawList = gContext.mDrawList;
+ ImGuiIO& io = ImGui::GetIO();
+
+ // colors
+ ImU32 colors[7];
+ ComputeColors(colors, type, ROTATE);
+
+ vec_t cameraToModelNormalized = Normalized(gContext.mCameraToModel);
+ cameraToModelNormalized.TransformVector(gContext.mModelInverse);
+
+ for (int axis = 0; axis < 3; axis++)
+ {
+ ImVec2 circlePos[halfCircleSegmentCount];
+
+ float angleStart = atan2f(cameraToModelNormalized[(4-axis)%3], cameraToModelNormalized[(3 - axis) % 3]) + ZPI * 0.5f;
+
+ for (unsigned int i = 0; i < halfCircleSegmentCount; i++)
+ {
+ float ng = angleStart + ZPI * ((float)i / (float)halfCircleSegmentCount);
+ vec_t axisPos = makeVect(cosf(ng), sinf(ng), 0.f);
+ vec_t pos = makeVect(axisPos[axis], axisPos[(axis+1)%3], axisPos[(axis+2)%3]) * gContext.mScreenFactor;
+ circlePos[i] = worldToPos(pos, gContext.mMVP);
+ }
+ drawList->AddPolyline(circlePos, halfCircleSegmentCount, colors[3 - axis], false, 2, true);
+ }
+ drawList->AddCircle(worldToPos(gContext.mModel.v.position, gContext.mViewProjection), 0.06f * io.DisplaySize.x, colors[0], 64);
+
+ if (gContext.mbUsing)
+ {
+ ImVec2 circlePos[halfCircleSegmentCount +1];
+
+ circlePos[0] = worldToPos(gContext.mModel.v.position, gContext.mViewProjection);
+ for (unsigned int i = 1; i < halfCircleSegmentCount; i++)
+ {
+ float ng = gContext.mRotationAngle * ((float)(i-1) / (float)(halfCircleSegmentCount -1));
+ matrix_t rotateVectorMatrix;
+ rotateVectorMatrix.RotationAxis(gContext.mTranslationPlan, ng);
+ vec_t pos;
+ pos.TransformPoint(gContext.mRotationVectorSource, rotateVectorMatrix);
+ pos *= gContext.mScreenFactor;
+ circlePos[i] = worldToPos(pos + gContext.mModel.v.position, gContext.mViewProjection);
+ }
+ drawList->AddConvexPolyFilled(circlePos, halfCircleSegmentCount, 0x801080FF, true);
+ drawList->AddPolyline(circlePos, halfCircleSegmentCount, 0xFF1080FF, true, 2, true);
+
+ ImVec2 destinationPosOnScreen = circlePos[1];
+ char tmps[512];
+ ImFormatString(tmps, sizeof(tmps), rotationInfoMask[type - ROTATE_X], (gContext.mRotationAngle/ZPI)*180.f, gContext.mRotationAngle);
+ drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps);
+ drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps);
+ }
+ }
+
+ static void DrawScaleGizmo(int type)
+ {
+ ImDrawList* drawList = gContext.mDrawList;
+
+ // colors
+ ImU32 colors[7];
+ ComputeColors(colors, type, SCALE);
+
+ // draw screen cirle
+ drawList->AddCircleFilled(gContext.mScreenSquareCenter, 12.f, colors[0], 32);
+
+ // draw
+ vec_t scale = { 1.f, 1.f, 1.f, 1.f };
+
+ if (gContext.mbUsing)
+ scale = gContext.mScale;
+
+ for (unsigned int i = 0; i < 3; i++)
+ {
+ //const int planNormal = (i + 2) % 3;
+ const vec_t& dirPlaneX = directionUnary[i];
+ //const vec_t& dirPlaneY = directionUnary[(i + 1) % 3];
+ //const vec_t& dirPlaneNormal = directionUnary[planNormal];
+
+ //vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye);
+ //const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneX)) < angleLimit);
+ //const bool belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneNormal)) > planeLimit);
+
+ // draw axis
+ //if (belowAxisLimit)
+ {
+ ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP);
+ ImVec2 worldDirSSpaceNoScale = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP);
+ ImVec2 worldDirSSpace = worldToPos(dirPlaneX * (1.f / scale[i]) * gContext.mScreenFactor, gContext.mMVP);
+
+ if (gContext.mbUsing)
+ {
+ drawList->AddLine(baseSSpace, worldDirSSpaceNoScale, 0xFF404040, 6.f);
+ drawList->AddCircleFilled(worldDirSSpaceNoScale, 10.f, 0xFF404040);
+ }
+
+ drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f);
+ drawList->AddCircleFilled(worldDirSSpace, 10.f, colors[i + 1]);
+ }
+ }
+
+ if (gContext.mbUsing)
+ {
+// ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection);
+ ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection);
+ /*vec_t dif(destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y);
+ dif.Normalize();
+ dif *= 5.f;
+ drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor);
+ drawList->AddCircle(destinationPosOnScreen, 6.f, translationLineColor);
+ drawList->AddLine(ImVec2(sourcePosOnScreen.x + dif.x, sourcePosOnScreen.y + dif.y), ImVec2(destinationPosOnScreen.x - dif.x, destinationPosOnScreen.y - dif.y), translationLineColor, 2.f);
+ */
+ char tmps[512];
+ //vec_t deltaInfo = gContext.mModel.v.position - gContext.mMatrixOrigin;
+ int componentInfoIndex = (type - SCALE_X) * 3;
+ ImFormatString(tmps, sizeof(tmps), scaleInfoMask[type - SCALE_X], 1.f/gContext.mScale[translationInfoIndex[componentInfoIndex]]);
+ drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps);
+ drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps);
+ }
+
+ }
+
+ static void DrawTranslationGizmo(int type)
+ {
+ ImDrawList* drawList = gContext.mDrawList;
+
+ // colors
+ ImU32 colors[7];
+ ComputeColors(colors, type, TRANSLATE);
+
+ // draw screen quad
+ drawList->AddRectFilled(gContext.mScreenSquareMin, gContext.mScreenSquareMax, colors[0], 2.f);
+
+ // draw
+ for (unsigned int i = 0; i < 3; i++)
+ {
+ //const int planNormal = (i + 2) % 3;
+ const vec_t& dirPlaneX = directionUnary[i];
+ const vec_t& dirPlaneY = directionUnary[(i + 1) % 3];
+ //const vec_t& dirPlaneNormal = directionUnary[planNormal];
+
+ //vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye);
+ //const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneX)) < angleLimit);
+ //const bool belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneNormal)) > planeLimit);
+
+ // draw axis
+ //if (belowAxisLimit)
+ {
+ ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP);
+ ImVec2 worldDirSSpace = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP);
+
+ drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f);
+ }
+
+ // draw plane
+ //if (belowPlaneLimit)
+ {
+ ImVec2 screenQuadPts[4];
+ for (int j = 0; j < 4; j++)
+ {
+ vec_t cornerWorldPos = (dirPlaneX * quadUV[j * 2] + dirPlaneY * quadUV[j * 2 + 1]) * gContext.mScreenFactor;
+ screenQuadPts[j] = worldToPos(cornerWorldPos, gContext.mMVP);
+ }
+ drawList->AddConvexPolyFilled(screenQuadPts, 4, colors[i + 4], true);
+ }
+ }
+
+ if (gContext.mbUsing)
+ {
+ ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection);
+ ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection);
+ vec_t dif = { destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y, 0.0f, 0.0f };
+ dif.Normalize();
+ dif *= 5.f;
+ drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor);
+ drawList->AddCircle(destinationPosOnScreen, 6.f, translationLineColor);
+ drawList->AddLine(ImVec2(sourcePosOnScreen.x + dif.x, sourcePosOnScreen.y + dif.y), ImVec2(destinationPosOnScreen.x - dif.x, destinationPosOnScreen.y - dif.y), translationLineColor, 2.f);
+
+ char tmps[512];
+ vec_t deltaInfo = gContext.mModel.v.position - gContext.mMatrixOrigin;
+ int componentInfoIndex = (type - MOVE_X) * 3;
+ ImFormatString(tmps, sizeof(tmps), translationInfoMask[type - MOVE_X], deltaInfo[translationInfoIndex[componentInfoIndex]], deltaInfo[translationInfoIndex[componentInfoIndex + 1]], deltaInfo[translationInfoIndex[componentInfoIndex + 2]]);
+ drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps);
+ drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps);
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+
+ static int GetScaleType()
+ {
+ ImGuiIO& io = ImGui::GetIO();
+ int type = NONE;
+
+ // screen
+ if (io.MousePos.x >= gContext.mScreenSquareMin.x && io.MousePos.x <= gContext.mScreenSquareMax.x &&
+ io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y)
+ type = SCALE_XYZ;
+
+ const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir };
+ // compute
+ for (unsigned int i = 0; i < 3 && type == NONE; i++)
+ {
+ const int planNormal = (i + 2) % 3;
+ const int nextPlan = (i + 1) % 3;
+
+ vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye);
+ const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(direction[i])) < angleLimit);
+
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal]));
+ vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len;
+
+ const float dx = direction[i].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor));
+ const float dy = direction[nextPlan].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor));
+ if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f)
+ type = SCALE_X + i;
+ }
+ return type;
+ }
+
+ static int GetRotateType()
+ {
+ ImGuiIO& io = ImGui::GetIO();
+ int type = NONE;
+
+ vec_t deltaScreen = { io.MousePos.x - gContext.mScreenSquareCenter.x, io.MousePos.y - gContext.mScreenSquareCenter.y, 0.0f, 0.0f };
+ float dist = deltaScreen.Length();
+ if (dist >= 0.058f * io.DisplaySize.x && dist < 0.062f * io.DisplaySize.x)
+ type = ROTATE_SCREEN;
+
+ const vec_t planNormals[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir};
+
+ for (unsigned int i = 0; i < 3 && type == NONE; i++)
+ {
+ // pickup plan
+ vec_t pickupPlan = BuildPlan(gContext.mModel.v.position, planNormals[i]);
+
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, pickupPlan);
+ vec_t localPos = gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position;
+
+ if (Dot(Normalized(localPos), gContext.mRayVector) > FLT_EPSILON)
+ continue;
+
+ float distance = localPos.Length() / gContext.mScreenFactor;
+ if (distance > 0.9f && distance < 1.1f)
+ type = ROTATE_X + i;
+ }
+
+ return type;
+ }
+
+ static int GetMoveType(vec_t *gizmoHitProportion)
+ {
+ ImGuiIO& io = ImGui::GetIO();
+ int type = NONE;
+
+ // screen
+ if (io.MousePos.x >= gContext.mScreenSquareMin.x && io.MousePos.x <= gContext.mScreenSquareMax.x &&
+ io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y)
+ type = MOVE_SCREEN;
+
+ const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir };
+
+ // compute
+ for (unsigned int i = 0; i < 3 && type == NONE; i++)
+ {
+ const int planNormal = (i + 2) % 3;
+ const int nextPlan = (i + 1) % 3;
+
+ vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye);
+ const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(direction[i])) < angleLimit);
+ const bool belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(direction[planNormal])) > planeLimit);
+
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal]));
+ vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len;
+
+ const float dx = direction[i].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor));
+ const float dy = direction[nextPlan].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor));
+ if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f)
+ type = MOVE_X + i;
+
+ if (belowPlaneLimit && dx >= quadUV[0] && dx <= quadUV[4] && dy >= quadUV[1] && dy <= quadUV[3])
+ type = MOVE_XY + i;
+
+ if (gizmoHitProportion)
+ *gizmoHitProportion = makeVect(dx, dy, 0.f);
+ }
+ return type;
+ }
+
+ static void HandleTranslation(float *matrix, float *deltaMatrix, int& type)
+ {
+ ImGuiIO& io = ImGui::GetIO();
+
+ // move
+ if (gContext.mbUsing)
+ {
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan);
+ vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len;
+ vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor;
+ vec_t delta = newOrigin - gContext.mModel.v.position;
+
+ // 1 axis constraint
+ if (gContext.mCurrentOperation >= MOVE_X && gContext.mCurrentOperation <= MOVE_Z)
+ {
+ int axisIndex = gContext.mCurrentOperation - MOVE_X;
+ const vec_t& axisValue = *(vec_t*)&gContext.mModel.m[axisIndex];
+ float lengthOnAxis = Dot(axisValue, delta);
+ delta = axisValue * lengthOnAxis;
+ }
+
+ // compute matrix & delta
+ gContext.mTranslationPlanOrigin += delta;
+ matrix_t deltaMatrixTranslation;
+ deltaMatrixTranslation.Translation(delta);
+ if (deltaMatrix)
+ memcpy(deltaMatrix, deltaMatrixTranslation.m16, sizeof(float) * 16);
+ matrix_t res = gContext.mModelSource * deltaMatrixTranslation;
+ *(matrix_t*)matrix = res;
+
+ if (!io.MouseDown[0])
+ gContext.mbUsing = false;
+
+ type = gContext.mCurrentOperation;
+ }
+ else
+ {
+ // find new possible way to move
+ vec_t gizmoHitProportion;
+ type = GetMoveType(&gizmoHitProportion);
+ if (io.MouseDown[0] && type != NONE)
+ {
+ gContext.mbUsing = true;
+ gContext.mCurrentOperation = type;
+ const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.up, -gContext.mCameraDir };
+ // pickup plan
+ gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - MOVE_X]);
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan);
+ gContext.mTranslationPlanOrigin = gContext.mRayOrigin + gContext.mRayVector * len;
+ gContext.mMatrixOrigin = gContext.mModel.v.position;
+
+ gContext.mRelativeOrigin = (gContext.mTranslationPlanOrigin - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor);
+ }
+ }
+ }
+
+ static void HandleScale(float *matrix, float *deltaMatrix, int& type)
+ {
+ ImGuiIO& io = ImGui::GetIO();
+
+ if (!gContext.mbUsing)
+ {
+ // find new possible way to scale
+ //vec_t gizmoHitProportion;
+ type = GetScaleType();
+ if (io.MouseDown[0] && type != NONE)
+ {
+ gContext.mbUsing = true;
+ gContext.mCurrentOperation = type;
+ const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.up, gContext.mModel.v.right, -gContext.mCameraDir };
+ // pickup plan
+
+ gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - SCALE_X]);
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan);
+ gContext.mTranslationPlanOrigin = gContext.mRayOrigin + gContext.mRayVector * len;
+ gContext.mMatrixOrigin = gContext.mModel.v.position;
+ gContext.mScale.Set(1.f, 1.f, 1.f);
+ gContext.mRelativeOrigin = (gContext.mTranslationPlanOrigin - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor);
+ gContext.mScaleMousePos = io.MousePos;
+ }
+ }
+ // scale
+ if (gContext.mbUsing)
+ {
+ vec_t newScale = { 1.f, 1.f, 1.f, 0.0f };
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan);
+ vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len;
+ vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor;
+ vec_t delta = newOrigin - gContext.mModel.v.position;
+
+ // 1 axis constraint
+ if (gContext.mCurrentOperation >= SCALE_X && gContext.mCurrentOperation <= SCALE_Z)
+ {
+ int axisIndex = gContext.mCurrentOperation - SCALE_X;
+ const vec_t& axisValue = directionUnary[axisIndex];
+ float lengthOnAxis = 1.f - Dot(axisValue, delta) / gContext.mScreenFactor;
+
+ if (lengthOnAxis >= 0.f)
+ newScale[axisIndex] = lengthOnAxis;
+ else
+ newScale[axisIndex] = Clamp(lengthOnAxis, 0.001f, 1.f);
+ }
+ else
+ {
+ float newScaleUniform = 1.f + (io.MousePos.x - gContext.mScaleMousePos.x) * 0.01f;
+ newScale.Set(newScaleUniform, newScaleUniform, newScaleUniform, 0.f);
+ }
+
+ // compute matrix & delta
+ matrix_t deltaMatrixScale;
+ deltaMatrixScale.Scale(makeVect(1.f, 1.f, 1.f) - (newScale - gContext.mScale));
+ gContext.mScale = newScale;
+ if (deltaMatrix)
+ memcpy(deltaMatrix, deltaMatrixScale.m16, sizeof(float) * 16);
+ matrix_t res = deltaMatrixScale * gContext.mModelSource;
+ *(matrix_t*)matrix = res;
+
+ if (!io.MouseDown[0])
+ gContext.mbUsing = false;
+
+ type = gContext.mCurrentOperation;
+ }
+ }
+
+ static float ComputeAngleOnPlan()
+ {
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan);
+ vec_t localPos = Normalized(gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position);
+
+ vec_t perpendicularVector;
+ perpendicularVector.Cross(gContext.mRotationVectorSource, gContext.mTranslationPlan);
+ perpendicularVector.Normalize();
+ float acosAngle = Clamp(Dot(localPos, gContext.mRotationVectorSource), -0.9999f, 0.9999f);
+ float angle = acosf(acosAngle);
+ angle *= (Dot(localPos, perpendicularVector) < 0.f) ? 1.f : -1.f;
+ return angle;
+ }
+
+ static void HandleRotation(float *matrix, float *deltaMatrix, int& type)
+ {
+ ImGuiIO& io = ImGui::GetIO();
+
+ if (!gContext.mbUsing)
+ {
+ type = GetRotateType();
+ if (io.MouseDown[0] && type != NONE)
+ {
+ gContext.mbUsing = true;
+ gContext.mCurrentOperation = type;
+ const vec_t rotatePlanNormal[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir, -gContext.mCameraDir };
+ // pickup plan
+ gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, rotatePlanNormal[type - ROTATE_X]);
+
+ const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan);
+ vec_t localPos = gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position;
+ gContext.mRotationVectorSource = Normalized(localPos);
+ gContext.mRotationAngleOrigin = ComputeAngleOnPlan();
+ }
+ }
+
+ // rotation
+ if (gContext.mbUsing)
+ {
+ gContext.mRotationAngle = ComputeAngleOnPlan();
+
+ vec_t rotationAxisLocalSpace;
+ rotationAxisLocalSpace.TransformVector(makeVect(gContext.mTranslationPlan.x, gContext.mTranslationPlan.y, gContext.mTranslationPlan.z, 0.f), gContext.mModelInverse);
+
+ matrix_t deltaRotation;
+ deltaRotation.RotationAxis(rotationAxisLocalSpace, gContext.mRotationAngle - gContext.mRotationAngleOrigin);
+ gContext.mRotationAngleOrigin = gContext.mRotationAngle;
+
+ *(matrix_t*)matrix = deltaRotation * gContext.mModelSource;
+
+ if (deltaMatrix)
+ {
+ *(matrix_t*)deltaMatrix = gContext.mModelInverse * deltaRotation * gContext.mModel;
+ }
+
+ if (!io.MouseDown[0])
+ gContext.mbUsing = false;
+
+ type = gContext.mCurrentOperation;
+ }
+ }
+
+ void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale)
+ {
+ matrix_t& mat = *(matrix_t*)matrix;
+
+ rotation[0] = RAD2DEG * atan2f(mat.m[1][2], mat.m[2][2]);
+ rotation[1] = RAD2DEG * atan2f(-mat.m[0][2], sqrtf(mat.m[1][2] * mat.m[1][2] + mat.m[2][2]* mat.m[2][2]));
+ rotation[2] = RAD2DEG * atan2f(mat.m[0][1], mat.m[0][0]);
+
+ scale[0] = mat.v.right.Length();
+ scale[1] = mat.v.up.Length();
+ scale[2] = mat.v.dir.Length();
+
+ translation[0] = mat.v.position.x;
+ translation[1] = mat.v.position.y;
+ translation[2] = mat.v.position.z;
+ }
+
+ void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix)
+ {
+ matrix_t& mat = *(matrix_t*)matrix;
+
+ matrix_t rot[3];
+ for (int i = 0; i < 3;i++)
+ rot[i].RotationAxis(directionUnary[i], rotation[i] * DEG2RAD);
+
+ mat = rot[0] * rot[1] * rot[2];
+
+ mat.v.right *= scale[0];
+ mat.v.up *= scale[1];
+ mat.v.dir *= scale[2];
+ mat.v.position.Set(translation[0], translation[1], translation[2], 1.f);
+ }
+
+ void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix)
+ {
+ ComputeContext(view, projection, matrix, mode);
+
+ // set delta to identity
+ if (deltaMatrix)
+ ((matrix_t*)deltaMatrix)->SetToIdentity();
+ // --
+ int type = NONE;
+ if (gContext.mbEnable)
+ {
+ switch (operation)
+ {
+ case ROTATE:
+ HandleRotation(matrix, deltaMatrix, type);
+ break;
+ case TRANSLATE:
+ HandleTranslation(matrix, deltaMatrix, type);
+ break;
+ case SCALE:
+ HandleScale(matrix, deltaMatrix, type);
+ break;
+ }
+ }
+
+ switch (operation)
+ {
+ case ROTATE:
+ DrawRotationGizmo(type);
+ break;
+ case TRANSLATE:
+ DrawTranslationGizmo(type);
+ break;
+ case SCALE:
+ DrawScaleGizmo(type);
+ break;
+ }
+ }
+
+ void DrawCube(const float *view, const float *projection, float *matrix)
+ {
+ matrix_t viewInverse;
+ viewInverse.Inverse(*(matrix_t*)view);
+ const matrix_t& model = *(matrix_t*)matrix;
+ matrix_t res = *(matrix_t*)matrix * *(matrix_t*)view * *(matrix_t*)projection;
+
+ for (int iFace = 0; iFace < 6; iFace++)
+ {
+ const int normalIndex = (iFace % 3);
+ const int perpXIndex = (normalIndex + 1) % 3;
+ const int perpYIndex = (normalIndex + 2) % 3;
+ const float invert = (iFace > 2) ? -1.f : 1.f;
+
+ const vec_t faceCoords[4] = { directionUnary[normalIndex] + directionUnary[perpXIndex] + directionUnary[perpYIndex],
+ directionUnary[normalIndex] + directionUnary[perpXIndex] - directionUnary[perpYIndex],
+ directionUnary[normalIndex] - directionUnary[perpXIndex] - directionUnary[perpYIndex],
+ directionUnary[normalIndex] - directionUnary[perpXIndex] + directionUnary[perpYIndex],
+ };
+ ImVec2 faceCoordsScreen[4];
+ for (unsigned int iCoord = 0; iCoord < 4; iCoord++)
+ faceCoordsScreen[iCoord] = worldToPos(faceCoords[iCoord] * 0.5f * invert, res);
+
+ // back face culling
+ vec_t cullPos, cullNormal;
+ cullPos.TransformPoint(faceCoords[0] * 0.5f * invert, model);
+ cullNormal.TransformVector(directionUnary[normalIndex] * invert, model);
+ float dt = Dot(Normalized(cullPos - viewInverse.v.position), Normalized(cullNormal));
+ if (dt>0.f)
+ continue;
+
+ // draw face with lighter color
+ gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, directionColor[normalIndex] | 0x808080, true);
+ }
+ }
+};
+
diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md
index 9f5c27d2059..722430f1bb6 100644
--- a/3rdparty/bgfx/README.md
+++ b/3rdparty/bgfx/README.md
@@ -59,6 +59,7 @@ Languages:
* [Haskell language API bindings](https://github.com/haskell-game/bgfx)
* [Java language API bindings](https://github.com/enleeten/twilight-bgfx)
* [Lua language API bindings](https://github.com/excessive/lua-bgfx)
+ * [Nim language API bindings](https://github.com/Halsys/nim-bgfx)
* [Python language API bindings](https://github.com/jnadro/pybgfx#pybgf)
* [Rust language API bindings](https://github.com/rhoot/bgfx-rs)
* [Swift language API bindings](https://github.com/stuartcarnie/SwiftBGFX)
@@ -160,6 +161,14 @@ base on a far island.
alt="Dead Venture - Gameplay Teaser (iOS / Android)"
width="640" height="480" border="0" /></a>
+https://github.com/degenerated1123/REGoth - Open source reimplementation of the
+zEngine, used by the game "Gothic" and "Gothic II".
+
+<a href="http://www.youtube.com/watch?feature=player_embedded&v=8bLAGttYYpY
+" target="_blank"><img src="http://img.youtube.com/vi/8bLAGttYYpY/0.jpg"
+alt="REGoth Engine"
+width="640" height="480" border="0" /></a>
+
[License (BSD 2-clause)](https://bkaradzic.github.io/bgfx/license.html)
-----------------------------------------------------------------------
diff --git a/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp
index 3d2918d703f..e919fc6eafe 100644
--- a/3rdparty/bgfx/examples/08-update/update.cpp
+++ b/3rdparty/bgfx/examples/08-update/update.cpp
@@ -96,7 +96,7 @@ static const uint16_t s_m_cubeIndices[36] =
static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _side, uint32_t _x, uint32_t _y, uint32_t _width, uint32_t _height, uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff)
{
bgfx::TextureInfo ti;
- bgfx::calcTextureSize(ti, _width, _height, 1, 1, false, bgfx::TextureFormat::BGRA8);
+ bgfx::calcTextureSize(ti, _width, _height, 1, false, false, 1, bgfx::TextureFormat::BGRA8);
const bgfx::Memory* mem = bgfx::alloc(ti.storageSize);
uint8_t* data = (uint8_t*)mem->data;
@@ -109,17 +109,17 @@ static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _sid
data += 4;
}
- bgfx::updateTextureCube(_handle, _side, 0, _x, _y, _width, _height, mem);
+ bgfx::updateTextureCube(_handle, 0, _side, 0, _x, _y, _width, _height, mem);
}
-static const uint32_t m_textureside = 512;
-static const uint32_t m_texture2dSize = 256;
+static const uint16_t textureside = 512;
+static const uint32_t texture2dSize = 256;
class ExampleUpdate : public entry::AppI
{
public:
ExampleUpdate()
- : m_cube(m_textureside)
+ : m_cube(textureside)
{
}
@@ -186,17 +186,17 @@ public:
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R8]) )
{
- m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8);
+ m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8);
}
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R16F]) )
{
- m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f);
+ m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f);
}
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R32F]) )
{
- m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f);
+ m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f);
}
}
@@ -222,25 +222,35 @@ public:
// Create time uniform.
u_time = bgfx::createUniform("u_time", bgfx::UniformType::Vec4);
- m_textureCube[0] = bgfx::createTextureCube(m_textureside, 1
+ m_textureCube[0] = bgfx::createTextureCube(
+ textureside
+ , false
+ , 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
if (m_blitSupported)
{
- m_textureCube[1] = bgfx::createTextureCube(m_textureside, 1
+ m_textureCube[1] = bgfx::createTextureCube(
+ textureside
+ , false
+ , 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT|BGFX_TEXTURE_BLIT_DST
);
}
- m_texture2d = bgfx::createTexture2D(m_texture2dSize, m_texture2dSize, 1
+ m_texture2d = bgfx::createTexture2D(
+ texture2dSize
+ , texture2dSize
+ , false
+ , 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
- m_texture2dData = (uint8_t*)malloc(m_texture2dSize*m_texture2dSize*4);
+ m_texture2dData = (uint8_t*)malloc(texture2dSize*texture2dSize*4);
m_rr = rand()%255;
m_gg = rand()%255;
@@ -331,8 +341,8 @@ public:
{
PackCube face;
- uint32_t bw = bx::uint16_max(1, rand()%(m_textureside/4) );
- uint32_t bh = bx::uint16_max(1, rand()%(m_textureside/4) );
+ uint32_t bw = bx::uint16_max(1, rand()%(textureside/4) );
+ uint32_t bh = bx::uint16_max(1, rand()%(textureside/4) );
if (m_cube.find(bw, bh, face) )
{
@@ -373,14 +383,14 @@ public:
{
// Fill rect.
- const uint32_t pitch = m_texture2dSize*4;
+ const uint32_t pitch = texture2dSize*4;
- const uint16_t tw = rand()%m_texture2dSize;
- const uint16_t th = rand()%m_texture2dSize;
- const uint16_t tx = rand()%(m_texture2dSize-tw);
- const uint16_t ty = rand()%(m_texture2dSize-th);
+ const uint16_t tw = rand()% texture2dSize;
+ const uint16_t th = rand()% texture2dSize;
+ const uint16_t tx = rand()%(texture2dSize-tw);
+ const uint16_t ty = rand()%(texture2dSize-th);
- uint8_t* dst = &m_texture2dData[(ty*m_texture2dSize+tx)*4];
+ uint8_t* dst = &m_texture2dData[(ty*texture2dSize+tx)*4];
uint8_t* next = dst + pitch;
// Using makeRef to pass texture memory without copying.
@@ -399,7 +409,7 @@ public:
// Pitch here makes possible to pass data from source to destination
// without need for m_textures and allocated memory to be the same size.
- bgfx::updateTexture2D(m_texture2d, 0, tx, ty, tw, th, mem, pitch);
+ bgfx::updateTexture2D(m_texture2d, 0, 0, tx, ty, tw, th, mem, pitch);
}
}
diff --git a/3rdparty/bgfx/examples/09-hdr/hdr.cpp b/3rdparty/bgfx/examples/09-hdr/hdr.cpp
index 2c5f99e31c9..3b6d34bca7c 100644
--- a/3rdparty/bgfx/examples/09-hdr/hdr.cpp
+++ b/3rdparty/bgfx/examples/09-hdr/hdr.cpp
@@ -203,8 +203,8 @@ class ExampleHDR : public entry::AppI
m_mesh = meshLoad("meshes/bunny.bin");
- m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
- m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
+ m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
+ m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8);
@@ -219,7 +219,7 @@ class ExampleHDR : public entry::AppI
m_lumBgra8 = 0;
if ( (BGFX_CAPS_TEXTURE_BLIT|BGFX_CAPS_TEXTURE_READ_BACK) == (bgfx::getCaps()->supported & (BGFX_CAPS_TEXTURE_BLIT|BGFX_CAPS_TEXTURE_READ_BACK) ) )
{
- m_rb = bgfx::createTexture2D(1, 1, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_READ_BACK);
+ m_rb = bgfx::createTexture2D(1, 1, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_READ_BACK);
}
else
{
@@ -305,8 +305,8 @@ class ExampleHDR : public entry::AppI
bgfx::destroyFrameBuffer(m_fbh);
- m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
- m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
+ m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
+ m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
}
diff --git a/3rdparty/bgfx/examples/12-lod/lod.cpp b/3rdparty/bgfx/examples/12-lod/lod.cpp
index d19a9044d3c..117b39980be 100644
--- a/3rdparty/bgfx/examples/12-lod/lod.cpp
+++ b/3rdparty/bgfx/examples/12-lod/lod.cpp
@@ -65,7 +65,7 @@ class ExampleLod : public entry::AppI
stippleTex->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
}
- m_textureStipple = bgfx::createTexture2D(8, 4, 1
+ m_textureStipple = bgfx::createTexture2D(8, 4, false, 1
, bgfx::TextureFormat::R8
, BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT
, stippleTex
diff --git a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
index 3ebe122d776..3aae01fde82 100644
--- a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
+++ b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp
@@ -1884,8 +1884,8 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
- bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT),
- bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
+ bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
@@ -2078,8 +2078,8 @@ int _main_(int _argc, char** _argv)
bgfx::destroyFrameBuffer(s_stencilFb);
- fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT);
- fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
+ fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT);
+ fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp
index 3ef2e057d0e..10201030edb 100644
--- a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp
+++ b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp
@@ -140,7 +140,7 @@ int _main_(int _argc, char** _argv)
progShadow = loadProgram("vs_sms_shadow", "fs_sms_shadow");
progMesh = loadProgram("vs_sms_mesh", "fs_sms_mesh");
- shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT | BGFX_TEXTURE_COMPARE_LEQUAL);
+ shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT | BGFX_TEXTURE_COMPARE_LEQUAL);
bgfx::TextureHandle fbtextures[] = { shadowMapTexture };
shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@@ -151,11 +151,11 @@ int _main_(int _argc, char** _argv)
progShadow = loadProgram("vs_sms_shadow_pd", "fs_sms_shadow_pd");
progMesh = loadProgram("vs_sms_mesh", "fs_sms_mesh_pd");
- shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT);
+ shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT);
bgfx::TextureHandle fbtextures[] =
{
shadowMapTexture,
- bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
+ bgfx::createTexture2D(shadowMapSize, shadowMapSize, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
diff --git a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
index e782f3c8d22..e1cff676067 100644
--- a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
+++ b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp
@@ -1944,8 +1944,8 @@ int _main_(int _argc, char** _argv)
{
bgfx::TextureHandle fbtextures[] =
{
- bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
- bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
};
s_rtShadowMap[ii] = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@@ -3108,8 +3108,8 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
- bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
- bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
};
s_rtShadowMap[0] = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@@ -3123,8 +3123,8 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
- bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
- bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
+ bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
};
s_rtShadowMap[ii] = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
diff --git a/3rdparty/bgfx/examples/18-ibl/ibl.cpp b/3rdparty/bgfx/examples/18-ibl/ibl.cpp
index 06f280f1c64..39d814514d4 100644
--- a/3rdparty/bgfx/examples/18-ibl/ibl.cpp
+++ b/3rdparty/bgfx/examples/18-ibl/ibl.cpp
@@ -553,8 +553,8 @@ int _main_(int _argc, char** _argv)
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
, mouseState.m_mz
- , width
- , height
+ , uint16_t(width)
+ , uint16_t(height)
);
static int32_t rightScrollArea = 0;
@@ -564,10 +564,16 @@ int _main_(int _argc, char** _argv)
imguiIndent();
imguiBool("IBL Diffuse", settings.m_doDiffuseIbl);
imguiBool("IBL Specular", settings.m_doSpecularIbl);
- currentLightProbe = LightProbe::Enum(imguiTabs(currentLightProbe, true, ImguiAlign::LeftIndented, 16, 2, 2
- , "Bolonga"
- , "Kyoto"
- ) );
+ currentLightProbe = LightProbe::Enum(imguiTabs(
+ uint8_t(currentLightProbe)
+ , true
+ , ImguiAlign::LeftIndented
+ , 16
+ , 2
+ , 2
+ , "Bolonga"
+ , "Kyoto"
+ ) );
if (imguiCube(lightProbes[currentLightProbe].m_tex, settings.m_lod, settings.m_crossCubemapPreview, true) )
{
settings.m_crossCubemapPreview = ImguiCubemap::Enum( (settings.m_crossCubemapPreview+1) % ImguiCubemap::Count);
@@ -592,14 +598,21 @@ int _main_(int _argc, char** _argv)
imguiIndent();
{
int32_t selection;
- if (0.0f == settings.m_bgType) { selection = 0; }
- else if (7.0f == settings.m_bgType) { selection = 2; }
- else { selection = 1; }
- selection = imguiTabs(selection, true, ImguiAlign::LeftIndented, 16, 2, 3
- , "Skybox"
- , "Radiance"
- , "Irradiance"
- );
+ if (0.0f == settings.m_bgType) { selection = UINT8_C(0); }
+ else if (7.0f == settings.m_bgType) { selection = UINT8_C(2); }
+ else { selection = UINT8_C(1); }
+
+ selection = imguiTabs(
+ uint8_t(selection)
+ , true
+ , ImguiAlign::LeftIndented
+ , 16
+ , 2
+ , 3
+ , "Skybox"
+ , "Radiance"
+ , "Irradiance"
+ );
if (0 == selection) { settings.m_bgType = 0.0f; }
else if (2 == selection) { settings.m_bgType = 7.0f; }
else { settings.m_bgType = settings.m_radianceSlider; }
@@ -622,7 +635,7 @@ int _main_(int _argc, char** _argv)
imguiLabel("Mesh:");
imguiIndent();
- settings.m_meshSelection = imguiChoose(settings.m_meshSelection, "Bunny", "Orbs");
+ settings.m_meshSelection = uint8_t(imguiChoose(settings.m_meshSelection, "Bunny", "Orbs") );
imguiUnindent();
const bool isBunny = (0 == settings.m_meshSelection);
@@ -719,8 +732,8 @@ int _main_(int _argc, char** _argv)
bgfx::setViewTransform(1, view, proj);
// View rect.
- bgfx::setViewRect(0, 0, 0, width, height);
- bgfx::setViewRect(1, 0, 0, width, height);
+ bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
+ bgfx::setViewRect(1, 0, 0, uint16_t(width), uint16_t(height) );
// Env rotation.
const float amount = bx::fmin(deltaTimeSec/0.12f, 1.0f);
diff --git a/3rdparty/bgfx/examples/19-oit/oit.cpp b/3rdparty/bgfx/examples/19-oit/oit.cpp
index 78c600331dd..966f436eb18 100644
--- a/3rdparty/bgfx/examples/19-oit/oit.cpp
+++ b/3rdparty/bgfx/examples/19-oit/oit.cpp
@@ -264,8 +264,8 @@ class ExampleOIT : public entry::AppI
bgfx::destroyFrameBuffer(m_fbh);
}
- m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT);
- m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT);
+ m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT);
+ m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT);
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
}
@@ -417,7 +417,7 @@ class ExampleOIT : public entry::AppI
| BGFX_STATE_DEPTH_TEST_ALWAYS
| BGFX_STATE_MSAA
;
-
+
bgfx::ProgramHandle program = BGFX_INVALID_HANDLE;
switch (m_mode)
{
diff --git a/3rdparty/bgfx/examples/21-deferred/deferred.cpp b/3rdparty/bgfx/examples/21-deferred/deferred.cpp
index 5cb3d3951d3..47937f12a95 100644
--- a/3rdparty/bgfx/examples/21-deferred/deferred.cpp
+++ b/3rdparty/bgfx/examples/21-deferred/deferred.cpp
@@ -432,9 +432,9 @@ class ExampleDeferred : public entry::AppI
| BGFX_TEXTURE_U_CLAMP
| BGFX_TEXTURE_V_CLAMP
;
- m_gbufferTex[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
- m_gbufferTex[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
- m_gbufferTex[2] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D24, samplerFlags);
+ m_gbufferTex[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
+ m_gbufferTex[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
+ m_gbufferTex[2] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D24, samplerFlags);
m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true);
if (bgfx::isValid(m_lightBuffer) )
diff --git a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp
index 82d9dbd1c40..004b8c5eab6 100644
--- a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp
+++ b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp
@@ -857,7 +857,7 @@ void VectorDisplay::genLinetex() // generate
| BGFX_TEXTURE_MAG_POINT
;
- m_lineTexId = bgfx::createTexture2D(TEXTURE_SIZE, TEXTURE_SIZE, 1, bgfx::TextureFormat::BGRA8, flags, mem);
+ m_lineTexId = bgfx::createTexture2D(TEXTURE_SIZE, TEXTURE_SIZE, false, 1, bgfx::TextureFormat::BGRA8, flags, mem);
}
static const int8_t simplex[95][112] =
diff --git a/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp
index 0f50be2d4b3..c93dbe195c9 100644
--- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp
+++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp
@@ -274,11 +274,11 @@ class ExampleTerrain : public entry::AppI
if (!bgfx::isValid(m_heightTexture) )
{
- m_heightTexture = bgfx::createTexture2D(s_terrainSize, s_terrainSize, 1, bgfx::TextureFormat::R8);
+ m_heightTexture = bgfx::createTexture2D(s_terrainSize, s_terrainSize, false, 1, bgfx::TextureFormat::R8);
}
mem = bgfx::makeRef(&m_terrain.m_heightMap[0], sizeof(uint8_t) * s_terrainSize * s_terrainSize);
- bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
+ bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
break;
}
}
diff --git a/3rdparty/bgfx/examples/30-picking/picking.cpp b/3rdparty/bgfx/examples/30-picking/picking.cpp
index b6419a884bc..4ed99066cae 100644
--- a/3rdparty/bgfx/examples/30-picking/picking.cpp
+++ b/3rdparty/bgfx/examples/30-picking/picking.cpp
@@ -103,7 +103,7 @@ class ExamplePicking : public entry::AppI
m_timeOffset = bx::getHPCounter();
// Set up ID buffer, which has a color target and depth buffer
- m_pickingRT = bgfx::createTexture2D(ID_DIM, ID_DIM, 1, bgfx::TextureFormat::RGBA8, 0
+ m_pickingRT = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::RGBA8, 0
| BGFX_TEXTURE_RT
| BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
@@ -111,7 +111,7 @@ class ExamplePicking : public entry::AppI
| BGFX_TEXTURE_U_CLAMP
| BGFX_TEXTURE_V_CLAMP
);
- m_pickingRTDepth = bgfx::createTexture2D(ID_DIM, ID_DIM, 1, bgfx::TextureFormat::D24S8, 0
+ m_pickingRTDepth = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::D24S8, 0
| BGFX_TEXTURE_RT
| BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
@@ -124,7 +124,7 @@ class ExamplePicking : public entry::AppI
// Impossible to read directly from a render target, you *must* blit to a CPU texture
// first. Algorithm Overview: Render on GPU -> Blit to CPU texture -> Read from CPU
// texture.
- m_blitTex = bgfx::createTexture2D(ID_DIM, ID_DIM, 1, bgfx::TextureFormat::RGBA8, 0
+ m_blitTex = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::RGBA8, 0
| BGFX_TEXTURE_BLIT_DST
| BGFX_TEXTURE_READ_BACK
| BGFX_TEXTURE_MIN_POINT
diff --git a/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp b/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp
index a7bbb6078db..c3a2e938252 100644
--- a/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp
+++ b/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp
@@ -304,13 +304,13 @@ public:
;
// Make gbuffer and related textures
- m_gbufferTex[GBUFFER_RT_NORMAL] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
- m_gbufferTex[GBUFFER_RT_COLOR] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
- m_gbufferTex[GBUFFER_RT_DEPTH] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::D24, samplerFlags);
+ m_gbufferTex[GBUFFER_RT_NORMAL] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
+ m_gbufferTex[GBUFFER_RT_COLOR] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
+ m_gbufferTex[GBUFFER_RT_DEPTH] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::D24, samplerFlags);
m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true);
// Make light buffer
- m_lightBufferTex = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
+ m_lightBufferTex = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
bgfx::TextureHandle lightBufferRTs[] = {
m_lightBufferTex
};
@@ -328,8 +328,9 @@ public:
// Reflective shadow map
m_shadowBufferTex[SHADOW_RT_RSM] = bgfx::createTexture2D(
- SHADOW_MAP_DIM
+ SHADOW_MAP_DIM
, SHADOW_MAP_DIM
+ , false
, 1
, bgfx::TextureFormat::BGRA8,
rsmFlags
@@ -337,8 +338,9 @@ public:
// Typical shadow map
m_shadowBufferTex[SHADOW_RT_DEPTH] = bgfx::createTexture2D(
- SHADOW_MAP_DIM
+ SHADOW_MAP_DIM
, SHADOW_MAP_DIM
+ , false
, 1
, bgfx::TextureFormat::D16,
BGFX_TEXTURE_RT/* | BGFX_TEXTURE_COMPARE_LEQUAL*/
diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp
index 18db066f468..6f2d29f0fef 100644
--- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp
+++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp
@@ -240,6 +240,8 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
break;
case LCT_PALETTE:
+ format = bgfx::TextureFormat::R8;
+ bpp = 8;
break;
}
break;
@@ -304,7 +306,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
if (NULL != out)
{
- handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), 1
+ handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), false, 1
, format
, _flags
, bgfx::copy(out, width*height*bpp/8)
@@ -318,6 +320,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
, uint16_t(height)
, 0
, false
+ , false
, 1
, format
);
diff --git a/3rdparty/bgfx/examples/common/cube_atlas.cpp b/3rdparty/bgfx/examples/common/cube_atlas.cpp
index 9407363a37f..c63f0a022df 100644
--- a/3rdparty/bgfx/examples/common/cube_atlas.cpp
+++ b/3rdparty/bgfx/examples/common/cube_atlas.cpp
@@ -273,6 +273,7 @@ Atlas::Atlas(uint16_t _textureSize, uint16_t _maxRegionsCount)
memset(m_textureBuffer, 0, _textureSize * _textureSize * 6 * 4);
m_textureHandle = bgfx::createTextureCube(_textureSize
+ , false
, 1
, bgfx::TextureFormat::BGRA8
);
@@ -296,6 +297,7 @@ Atlas::Atlas(uint16_t _textureSize, const uint8_t* _textureBuffer, uint16_t _reg
memcpy(m_textureBuffer, _textureBuffer, getTextureBufferSize() );
m_textureHandle = bgfx::createTextureCube(_textureSize
+ , false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_NONE
@@ -441,7 +443,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
}
}
- bgfx::updateTextureCube(m_textureHandle, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
+ bgfx::updateTextureCube(m_textureHandle, 0, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
}
}
diff --git a/3rdparty/bgfx/examples/common/entry/entry_android.cpp b/3rdparty/bgfx/examples/common/entry/entry_android.cpp
index 90bfd131368..155fb894bce 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_android.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_android.cpp
@@ -17,6 +17,7 @@
#include <android/looper.h>
#include <android/window.h>
#include <android_native_app_glue.h>
+#include <android/native_window.h>
extern "C"
{
@@ -28,6 +29,18 @@ extern "C"
namespace entry
{
+ ///
+ inline void androidSetWindow(::ANativeWindow* _window)
+ {
+ bgfx::PlatformData pd;
+ pd.ndt = NULL;
+ pd.nwh = _window;
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+ }
+
struct GamepadRemap
{
uint16_t m_keyCode;
@@ -142,7 +155,7 @@ namespace entry
if (m_window != m_app->window)
{
m_window = m_app->window;
- bgfx::androidSetWindow(m_window);
+ androidSetWindow(m_window);
int32_t width = ANativeWindow_getWidth(m_window);
int32_t height = ANativeWindow_getHeight(m_window);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
index 0900e8347bf..37973b18e59 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp
@@ -7,8 +7,21 @@
#if ENTRY_CONFIG_USE_GLFW
+#if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+# define GLFW_EXPOSE_NATIVE_X11
+# define GLFW_EXPOSE_NATIVE_GLX
+#elif BX_PLATFORM_OSX
+# define GLFW_EXPOSE_NATIVE_COCOA
+# define GLFW_EXPOSE_NATIVE_NSGL
+#elif BX_PLATFORM_WINDOWS
+# define GLFW_EXPOSE_NATIVE_WIN32
+# define GLFW_EXPOSE_NATIVE_WGL
+#endif //
+
#define GLFW_DLL
#include <GLFW/glfw3.h>
+#include <GLFW/glfw3native.h>
+
#include <bgfx/bgfxplatform.h>
#include "dbg.h"
@@ -17,6 +30,27 @@
namespace entry
{
+ inline void glfwSetWindow(GLFWwindow* _window)
+ {
+ bgfx::PlatformData pd;
+# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+ pd.ndt = glfwGetX11Display();
+ pd.nwh = (void*)(uintptr_t)glfwGetGLXWindow(_window);
+ pd.context = glfwGetGLXContext(_window);
+# elif BX_PLATFORM_OSX
+ pd.ndt = NULL;
+ pd.nwh = glfwGetCocoaWindow(_window);
+ pd.context = glfwGetNSGLContext(_window);
+# elif BX_PLATFORM_WINDOWS
+ pd.ndt = NULL;
+ pd.nwh = glfwGetWin32Window(_window);
+ pd.context = NULL;
+# endif // BX_PLATFORM_WINDOWS
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+ }
+
static void errorCb(int _error, const char* _description)
{
DBG("GLFW error %d: %s", _error, _description);
@@ -38,7 +72,7 @@ namespace entry
glfwSetKeyCallback(m_window, keyCb);
- bgfx::glfwSetWindow(m_window);
+ glfwSetWindow(m_window);
int result = main(_argc, _argv);
glfwDestroyWindow(m_window);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_osx.mm b/3rdparty/bgfx/examples/common/entry/entry_osx.mm
index b5e722cfa74..b91e71ca3bf 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_osx.mm
+++ b/3rdparty/bgfx/examples/common/entry/entry_osx.mm
@@ -46,6 +46,18 @@
namespace entry
{
+ ///
+ inline void osxSetNSWindow(void* _window, void* _nsgl = NULL)
+ {
+ bgfx::PlatformData pd;
+ pd.ndt = NULL;
+ pd.nwh = _window;
+ pd.context = _nsgl;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+ }
+
static WindowHandle s_defaultWindow = { 0 }; // TODO: Add support for more windows
static uint8_t s_translateKey[256];
@@ -460,7 +472,7 @@ namespace entry
m_window[0] = window;
m_windowFrame = [window frame];
- bgfx::osxSetNSWindow(window);
+ osxSetNSWindow(window);
MainThreadEntry mte;
mte.m_argc = _argc;
diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
index 0e4f49424e2..1ff49264d93 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
@@ -15,10 +15,10 @@
#include <SDL2/SDL.h>
-BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG()
+BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wextern-c-compat")
#include <SDL2/SDL_syswm.h>
-BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
+BX_PRAGMA_DIAGNOSTIC_POP()
#include <bgfx/bgfxplatform.h>
#if defined(None) // X11 defines this...
@@ -35,6 +35,37 @@ BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
namespace entry
{
+ inline bool sdlSetWindow(SDL_Window* _window)
+ {
+ SDL_SysWMinfo wmi;
+ SDL_VERSION(&wmi.version);
+ if (!SDL_GetWindowWMInfo(_window, &wmi) )
+ {
+ return false;
+ }
+
+ bgfx::PlatformData pd;
+# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+ pd.ndt = wmi.info.x11.display;
+ pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
+# elif BX_PLATFORM_OSX
+ pd.ndt = NULL;
+ pd.nwh = wmi.info.cocoa.window;
+# elif BX_PLATFORM_WINDOWS
+ pd.ndt = NULL;
+ pd.nwh = wmi.info.win.window;
+# elif BX_PLATFORM_STEAMLINK
+ pd.ndt = wmi.info.vivante.display;
+ pd.nwh = wmi.info.vivante.window;
+# endif // BX_PLATFORM_
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+
+ return true;
+ }
+
static uint8_t translateKeyModifiers(uint16_t _sdl)
{
uint8_t modifiers = 0;
@@ -446,7 +477,7 @@ namespace entry
s_userEventStart = SDL_RegisterEvents(7);
- bgfx::sdlSetWindow(m_window[0]);
+ sdlSetWindow(m_window[0]);
bgfx::renderFrame();
m_thread.init(MainThreadEntry::threadFunc, &m_mte);
@@ -789,8 +820,8 @@ namespace entry
void* nwh = sdlNativeWindowHandle(m_window[handle.idx]);
if (NULL != nwh)
{
- m_eventQueue.postWindowEvent(handle, nwh);
m_eventQueue.postSizeEvent(handle, msg->m_width, msg->m_height);
+ m_eventQueue.postWindowEvent(handle, nwh);
}
delete msg;
diff --git a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
index 9d0308e9617..29f8c65e881 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp
@@ -30,6 +30,18 @@
namespace entry
{
+ ///
+ inline void winSetHwnd(::HWND _window)
+ {
+ bgfx::PlatformData pd;
+ pd.ndt = NULL;
+ pd.nwh = _window;
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+ }
+
typedef DWORD (WINAPI* PFN_XINPUT_GET_STATE)(DWORD dwUserIndex, XINPUT_STATE* pState);
typedef void (WINAPI* PFN_XINPUT_ENABLE)(BOOL enable); // 1.4+
@@ -434,13 +446,13 @@ namespace entry
int32_t run(int _argc, char** _argv)
{
- SetDllDirectory(".");
+ SetDllDirectoryA(".");
s_xinput.init();
HINSTANCE instance = (HINSTANCE)GetModuleHandle(NULL);
- WNDCLASSEX wnd;
+ WNDCLASSEXA wnd;
memset(&wnd, 0, sizeof(wnd) );
wnd.cbSize = sizeof(wnd);
wnd.style = CS_HREDRAW | CS_VREDRAW;
@@ -471,7 +483,7 @@ namespace entry
| ENTRY_WINDOW_FLAG_FRAME
;
- bgfx::winSetHwnd(m_hwnd[0]);
+ winSetHwnd(m_hwnd[0]);
adjust(m_hwnd[0], ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT, true);
clear(m_hwnd[0]);
diff --git a/3rdparty/bgfx/examples/common/entry/entry_winrt.cx b/3rdparty/bgfx/examples/common/entry/entry_winrt.cx
index 796d1f64f48..db90098cec0 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_winrt.cx
+++ b/3rdparty/bgfx/examples/common/entry/entry_winrt.cx
@@ -9,6 +9,7 @@
#include <bgfx/bgfxplatform.h>
#include <bx/thread.h>
+#include <Unknwn.h>
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
@@ -26,6 +27,18 @@ static char* g_emptyArgs[] = { "" };
static entry::WindowHandle g_defaultWindow = { 0 };
static entry::EventQueue g_eventQueue;
+///
+inline void winrtSetWindow(::IUnknown* _window)
+{
+ bgfx::PlatformData pd;
+ pd.ndt = NULL;
+ pd.nwh = _window;
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+}
+
ref class App sealed : public IFrameworkView
{
public:
@@ -56,7 +69,7 @@ public:
window->Closed += ref new
TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);
- bgfx::winrtSetWindow(reinterpret_cast<IUnknown*>(window) );
+ winrtSetWindow(reinterpret_cast<IUnknown*>(window) );
}
virtual void Load(String^ entryPoint)
diff --git a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
index 8ced748dcbe..811f7880f5a 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp
@@ -24,6 +24,18 @@
namespace entry
{
+ ///
+ inline void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL)
+ {
+ bgfx::PlatformData pd;
+ pd.ndt = _display;
+ pd.nwh = (void*)(uintptr_t)_window;
+ pd.context = _glx;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+ }
+
#define JS_EVENT_BUTTON 0x01 /* button pressed/released */
#define JS_EVENT_AXIS 0x02 /* joystick moved */
#define JS_EVENT_INIT 0x80 /* initial state of device */
@@ -387,7 +399,7 @@ namespace entry
);
//
- bgfx::x11SetDisplayWindow(m_display, m_window[0]);
+ x11SetDisplayWindow(m_display, m_window[0]);
MainThreadEntry mte;
mte.m_argc = _argc;
diff --git a/3rdparty/bgfx/examples/common/font/font_manager.cpp b/3rdparty/bgfx/examples/common/font/font_manager.cpp
index 1d688a81503..40fbe5a5ec5 100644
--- a/3rdparty/bgfx/examples/common/font/font_manager.cpp
+++ b/3rdparty/bgfx/examples/common/font/font_manager.cpp
@@ -466,7 +466,7 @@ FontManager::FontManager(Atlas* _atlas)
init();
}
-FontManager::FontManager(uint32_t _textureSideWidth)
+FontManager::FontManager(uint16_t _textureSideWidth)
: m_ownAtlas(true)
, m_atlas(new Atlas(_textureSideWidth) )
{
@@ -546,8 +546,8 @@ FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_
CachedFont& font = m_cachedFonts[fontIdx];
font.trueTypeFont = ttf;
font.fontInfo = ttf->getFontInfo();
- font.fontInfo.fontType = _fontType;
- font.fontInfo.pixelSize = _pixelSize;
+ font.fontInfo.fontType = int16_t(_fontType);
+ font.fontInfo.pixelSize = uint16_t(_pixelSize);
font.cachedGlyphs.clear();
font.masterFontHandle.idx = bx::HandleAlloc::invalid;
@@ -561,15 +561,15 @@ FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle,
CachedFont& baseFont = m_cachedFonts[_baseFontHandle.idx];
FontInfo& fontInfo = baseFont.fontInfo;
- FontInfo newFontInfo = fontInfo;
- newFontInfo.pixelSize = _pixelSize;
- newFontInfo.scale = (float)_pixelSize / (float) fontInfo.pixelSize;
- newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
+ FontInfo newFontInfo = fontInfo;
+ newFontInfo.pixelSize = uint16_t(_pixelSize);
+ newFontInfo.scale = (float)_pixelSize / (float) fontInfo.pixelSize;
+ newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
newFontInfo.descender = (newFontInfo.descender * newFontInfo.scale);
- newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
- newFontInfo.maxAdvanceWidth = (newFontInfo.maxAdvanceWidth * newFontInfo.scale);
+ newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
+ newFontInfo.maxAdvanceWidth = (newFontInfo.maxAdvanceWidth * newFontInfo.scale);
newFontInfo.underlineThickness = (newFontInfo.underlineThickness * newFontInfo.scale);
- newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
+ newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
uint16_t fontIdx = m_fontHandles.alloc();
BX_CHECK(fontIdx != bx::HandleAlloc::invalid, "Invalid handle used");
diff --git a/3rdparty/bgfx/examples/common/font/font_manager.h b/3rdparty/bgfx/examples/common/font/font_manager.h
index 886c5835093..d2d9e511970 100644
--- a/3rdparty/bgfx/examples/common/font/font_manager.h
+++ b/3rdparty/bgfx/examples/common/font/font_manager.h
@@ -33,7 +33,7 @@ struct FontInfo
float descender;
/// The spacing in pixels between one row's descent and the next row's ascent.
float lineGap;
- /// This field gives the maximum horizontal cursor advance for all glyphs in the font.
+ /// This field gives the maximum horizontal cursor advance for all glyphs in the font.
float maxAdvanceWidth;
/// The thickness of the under/hover/strike-trough line in pixels.
float underlineThickness;
@@ -100,12 +100,12 @@ struct GlyphInfo
float offset_y;
/// For horizontal text layouts, this is the unscaled horizontal
- /// distance in pixels used to increment the pen position when the
+ /// distance in pixels used to increment the pen position when the
/// glyph is drawn as part of a string of text.
float advance_x;
/// For vertical text layouts, this is the unscaled vertical distance
- /// in pixels used to increment the pen position when the glyph is
+ /// in pixels used to increment the pen position when the glyph is
/// drawn as part of a string of text.
float advance_y;
@@ -125,7 +125,7 @@ public:
/// Create the font manager and create the texture cube as BGRA8 with
/// linear filtering.
- FontManager(uint32_t _textureSideWidth = 512);
+ FontManager(uint16_t _textureSideWidth = 512);
~FontManager();
@@ -135,7 +135,7 @@ public:
return m_atlas;
}
- /// Load a TrueType font from a given buffer. The buffer is copied and
+ /// Load a TrueType font from a given buffer. The buffer is copied and
/// thus can be freed or reused after this call.
///
/// @return invalid handle if the loading fail
@@ -155,7 +155,7 @@ public:
/// Preload a set of glyphs from a TrueType file.
///
- /// @return True if every glyph could be preloaded, false otherwise if
+ /// @return True if every glyph could be preloaded, false otherwise if
/// the Font is a baked font, this only do validation on the characters.
bool preloadGlyph(FontHandle _handle, const wchar_t* _string);
@@ -167,7 +167,7 @@ public:
/// @remark the handle is required to be valid
const FontInfo& getFontInfo(FontHandle _handle) const;
- /// Return the rendering informations about the glyph region. Load the
+ /// Return the rendering informations about the glyph region. Load the
/// glyph from a TrueType font if possible
///
const GlyphInfo* getGlyphInfo(FontHandle _handle, CodePoint _codePoint);
diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp
index 6a80447a34b..c9a10b45484 100644
--- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp
+++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp
@@ -410,7 +410,15 @@ struct Imgui
const ImguiFontHandle handle = { m_fontHandle.alloc() };
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_texture = bgfx::createTexture2D(
+ m_textureWidth
+ , m_textureHeight
+ , false
+ , 1
+ , bgfx::TextureFormat::R8
+ , BGFX_TEXTURE_NONE
+ , mem
+ );
m_fonts[handle.idx].m_size = _fontSize;
#else
const ImguiFontHandle handle = { bgfx::invalidHandle };
@@ -448,7 +456,15 @@ struct Imgui
}
}
- return bgfx::createTexture2D(uint16_t(_width), uint16_t(_height), 0, bgfx::TextureFormat::BGRA8, 0, mem);
+ return bgfx::createTexture2D(
+ uint16_t(_width)
+ , uint16_t(_height)
+ , false
+ , 1
+ , bgfx::TextureFormat::BGRA8
+ , 0
+ , mem
+ );
}
ImguiFontHandle create(float _fontSize, bx::AllocatorI* _allocator)
diff --git a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
index 788a478e61d..f95ab4ef7b8 100644
--- a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
+++ b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp
@@ -473,8 +473,10 @@ struct OcornutImguiContext
io.Fonts->GetTexDataAsRGBA32(&data, &width, &height);
- m_texture = bgfx::createTexture2D( (uint16_t)width
+ m_texture = bgfx::createTexture2D(
+ (uint16_t)width
, (uint16_t)height
+ , false
, 1
, bgfx::TextureFormat::BGRA8
, 0
@@ -652,6 +654,7 @@ struct OcornutImguiContext
#endif // defined(SCI_NAMESPACE)
ImGui::NewFrame();
+ ImGuizmo::BeginFrame();
ImGui::PushStyleVar(ImGuiStyleVar_ViewId, (float)_viewId);
#if 0
diff --git a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h
index c7ed6294e86..f042dcfe700 100644
--- a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h
+++ b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h
@@ -1,4 +1,4 @@
-static const uint8_t fs_nanovg_fill_glsl[3095] =
+static const uint8_t fs_nanovg_fill_glsl[2928] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, // FSH........u_sci
0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, // ssorMat.......u_
@@ -9,7 +9,7 @@ static const uint8_t fs_nanovg_fill_glsl[3095] =
0x6c, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, // le.......u_exten
0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, // tRadius.......u_
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, 0x5f, 0x74, // params.......s_t
- 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, // ex......z...vary
+ 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd3, 0x0a, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, // ex..........vary
0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, // ing highp vec2 v
0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // _position;.varyi
0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, // ng highp vec2 v_
@@ -62,140 +62,129 @@ static const uint8_t fs_nanovg_fill_glsl[3095] =
0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, // coord0.y));. if
0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, // ((u_params.w ==
0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, // 0.0)) {. hig
- 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x3b, // hp vec4 color_6;
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, // . highp vec3
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // tmpvar_7;. tm
- 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, // pvar_7.z = 1.0;.
- 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x78, 0x79, 0x20, // tmpvar_7.xy
- 0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // = v_position;.
- 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, // highp vec2 tmp
- 0x76, 0x61, 0x72, 0x5f, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // var_8;. tmpva
- 0x72, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, // r_8 = (abs((u_pa
- 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // intMat * tmpvar_
- 0x37, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2d, 0x20, 0x28, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, // 7).xy) - (u_exte
- 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x20, 0x2d, 0x20, 0x75, 0x5f, // ntRadius.xy - u_
- 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x7a, 0x29, // extentRadius.zz)
- 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // );. highp vec
- 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 2 tmpvar_9;.
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, // tmpvar_9 = max (
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // tmpvar_8, 0.0);.
- 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, // highp vec4 t
- 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // mpvar_10;. tm
- 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x75, // pvar_10 = mix (u
- 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x75, 0x5f, 0x6f, 0x75, 0x74, // _innerCol, u_out
- 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x0a, // erCol, clamp ((.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x0a, 0x20, // (((min (.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, // max (tmpv
- 0x61, 0x72, 0x5f, 0x38, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // ar_8.x, tmpvar_8
- 0x2e, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, // .y). , 0.0)
- 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // + sqrt(.
- 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2c, 0x20, // dot (tmpvar_9,
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_9).
- 0x29, 0x29, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, // )) - u_extentRad
- 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ius.z) + (u_para
- 0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, // ms.x * 0.5)).
- 0x20, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x2c, // / u_params.x),
- 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 0.0, 1.0));.
- 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, // color_6.xyz = t
- 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, // mpvar_10.xyz;.
- 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x74, // color_6.w = (t
- 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, // mpvar_10.w * (tm
- 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // pvar_5 * tmpvar_
- 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // 2));. result_
- 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x7d, // 1 = color_6;. }
- 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, // else {. if (
- 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, // (u_params.w == 1
- 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, // .0)) {. low
- 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x3b, // p vec4 color_11;
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // . highp vec
- 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 3 tmpvar_12;.
- 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x7a, 0x20, 0x3d, // tmpvar_12.z =
- 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // 1.0;. tmpv
- 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, // ar_12.xy = v_pos
- 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, // ition;. low
- 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, // p vec4 tmpvar_13
- 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ;. tmpvar_1
- 0x33, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, // 3 = texture2D (s
- 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // _tex, ((u_paintM
- 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x2e, // at * tmpvar_12).
- 0x78, 0x79, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, // xy / u_extentRad
- 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ius.xy));.
- 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // color_11 = tmpva
- 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // r_13;. lowp
- 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, // vec4 tmpvar_14;
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, // . if ((u_pa
- 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, // rams.z == 0.0))
- 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // {. tmpvar
- 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, // _14 = tmpvar_13;
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // . } else {.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, // lowp vec
- 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 4 tmpvar_15;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, // tmpvar_15.x
- 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, // yz = vec3(1.0, 1
- 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0, 1.0);.
- 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x77, 0x20, 0x3d, 0x20, // tmpvar_15.w =
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, // tmpvar_13.x;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, // tmpvar_14 =
- 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_15;.
- 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // };. color
- 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _11.xyz = tmpvar
- 0x5f, 0x31, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, // _14.xyz;. c
- 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, // olor_11.w = (tmp
- 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, // var_14.w * (tmpv
- 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, // ar_5 * tmpvar_2)
- 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // );. result_
- 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, // 1 = color_11;.
- 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // } else {.
- 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // if ((u_params.w
- 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // == 2.0)) {.
- 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x76, // result_1 = v
- 0x65, 0x63, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, // ec4(1.0, 1.0, 1.
- 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, // 0, 1.0);. }
- 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // else {.
- 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, // if ((u_params.w
- 0x3d, 0x3d, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 3.0)) {.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, // lowp vec4 c
- 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // olor_16;.
+ 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, // hp vec3 tmpvar_6
+ 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x2e, 0x7a, // ;. tmpvar_6.z
+ 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // = 1.0;. tmpv
+ 0x61, 0x72, 0x5f, 0x36, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ar_6.xy = v_posi
+ 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // tion;. highp
+ 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x3b, 0x0a, 0x20, // vec2 tmpvar_7;.
+ 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x28, 0x61, // tmpvar_7 = (a
+ 0x62, 0x73, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, // bs((u_paintMat *
+ 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2d, // tmpvar_6).xy) -
+ 0x20, 0x28, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, // (u_extentRadius
+ 0x2e, 0x78, 0x79, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, // .xy - u_extentRa
+ 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x7a, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, // dius.zz));. h
+ 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ighp vec2 tmpvar
+ 0x5f, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // _8;. tmpvar_8
+ 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, // = max (tmpvar_7
+ 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, // , 0.0);. resu
+ 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x75, 0x5f, 0x69, // lt_1 = (mix (u_i
+ 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, // nnerCol, u_outer
+ 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, // Col, clamp (.
+ 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ((((.
+ 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // min (max (tmpvar
+ 0x5f, 0x37, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x79, // _7.x, tmpvar_7.y
+ 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2b, // ), 0.0). +
+ 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x64, // . sqrt(d
+ 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2c, 0x20, 0x74, 0x6d, // ot (tmpvar_8, tm
+ 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, // pvar_8)). )
+ 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, // - u_extentRadiu
+ 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // s.z) + (u_params
+ 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x70, // .x * 0.5)) / u_p
+ 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, // arams.x). , 0
+ 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, // .0, 1.0)) * (tmp
+ 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // var_5 * tmpvar_2
+ 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, // ));. } else {.
+ 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // if ((u_params
+ 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, // .w == 1.0)) {.
+ 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, // lowp vec4 co
+ 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, // lor_9;. hig
+ 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // hp vec3 tmpvar_1
+ 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 0;. tmpvar_
+ 0x31, 0x30, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 10.z = 1.0;.
+ 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x3d, // tmpvar_10.xy =
+ 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, // v_position;.
0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // lowp vec4 tmp
- 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // var_17;.
- 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x20, 0x3d, 0x20, 0x74, 0x65, // tmpvar_17 = te
- 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // xture2D (s_tex,
- 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, // v_texcoord0);.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, // color_16
- 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_17;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, // lowp vec
- 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 4 tmpvar_18;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, // if ((u_pa
- 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, // rams.z == 0.0))
- 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // {. tm
- 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_18 = tmpvar
- 0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, // _17;. }
- 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // else {.
+ 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // var_11;. tm
+ 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // pvar_11 = textur
+ 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x28, 0x75, 0x5f, // e2D (s_tex, ((u_
+ 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // paintMat * tmpva
+ 0x72, 0x5f, 0x31, 0x30, 0x29, 0x2e, 0x78, 0x79, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, // r_10).xy / u_ext
+ 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x3b, 0x0a, // entRadius.xy));.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, // color_9 =
+ 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_11;.
+ 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, // if ((u_params.z
+ 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // == 1.0)) {.
0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, // lowp vec4 tm
- 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_19;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x2e, 0x78, // tmpvar_19.x
- 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, // yz = vec3(1.0, 1
- 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0, 1.0);.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x2e, // tmpvar_19.
- 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x78, 0x3b, // w = tmpvar_17.x;
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // . tmp
- 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_18 = tmpvar_
- 0x31, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // 19;. };
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // . color
- 0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _16.xyz = tmpvar
- 0x5f, 0x31, 0x38, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _18.xyz;.
- 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, // color_16.w =
- 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x74, // (tmpvar_18.w * t
- 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_2);.
- 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, // result_1 = (
- 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6e, 0x6e, // color_16 * u_inn
- 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // erCol);.
- 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // };. };.
- 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // };. };. gl_Fra
- 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // gColor = result_
- 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}...
+ 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_12;.
+ 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_12.xyz =
+ 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, // (tmpvar_11.xyz
+ 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x29, 0x3b, 0x0a, // * tmpvar_11.w);.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // tmpvar_1
+ 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, // 2.w = tmpvar_11.
+ 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // w;. color
+ 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, // _9 = tmpvar_12;.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, // };. i
+ 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, // f ((u_params.z =
+ 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 2.0)) {.
+ 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // color_9 = colo
+ 0x72, 0x5f, 0x39, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_9.xxxx;.
+ 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, // };. color_9
+ 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x75, 0x5f, // = (color_9 * u_
+ 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // innerCol);.
+ 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, // color_9 = (colo
+ 0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, // r_9 * (tmpvar_5
+ 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // * tmpvar_2));.
+ 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, // result_1 = c
+ 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, // olor_9;. } el
+ 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, // se {. if ((
+ 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, // u_params.w == 2.
+ 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, // 0)) {. re
+ 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x31, 0x2e, // sult_1 = vec4(1.
+ 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // 0, 1.0, 1.0, 1.0
+ 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, // );. } else
+ 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, // {. if ((u
+ 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x33, 0x2e, 0x30, // _params.w == 3.0
+ 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, // )) {. l
+ 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // owp vec4 color_1
+ 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, // 3;. low
+ 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // p vec4 tmpvar_14
+ 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ;. tmpv
+ 0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // ar_14 = texture2
+ 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // D (s_tex, v_texc
+ 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // oord0);.
+ 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // color_13 = tmp
+ 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // var_14;.
+ 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // if ((u_params.
+ 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // z == 1.0)) {.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, // lowp ve
+ 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, // c4 tmpvar_15;.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // tmpvar
+ 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _15.xyz = (tmpva
+ 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // r_14.xyz * tmpva
+ 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_14.w);.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x77, // tmpvar_15.w
+ 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x3b, 0x0a, // = tmpvar_14.w;.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // colo
+ 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, // r_13 = tmpvar_15
+ 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, // ;. };.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, // if ((u_
+ 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, // params.z == 2.0)
+ 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ) {.
+ 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_13 = color
+ 0x5f, 0x31, 0x33, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _13.xxxx;.
+ 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // };.
+ 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, // color_13 = (col
+ 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // or_13 * tmpvar_2
+ 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, // );. res
+ 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // ult_1 = (color_1
+ 0x33, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, // 3 * u_innerCol);
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // . };.
+ 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, // };. };. };
+ 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor
+ 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = result_1;.}...
};
-static const uint8_t fs_nanovg_fill_dx9[1547] =
+static const uint8_t fs_nanovg_fill_dx9[1595] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // 0......u_extentR
@@ -206,7 +195,7 @@ static const uint8_t fs_nanovg_fill_dx9[1547] =
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, // _params.......u_
0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, // scissorExtScale.
0x01, 0x08, 0x00, 0x01, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, // ......u_scissorM
- 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0x70, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at......p.......
+ 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0xa0, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at..............
0x64, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x00, 0x03, // d.CTAB....W.....
0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x01, // ..............P.
0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xc4, 0x00, // ................
@@ -234,68 +223,71 @@ static const uint8_t fs_nanovg_fill_dx9[1547] =
0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384
0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // ..Q..........?..
0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, // .@.......?Q.....
- 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, // .........?..@@..
+ 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........@@......
0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, // ................
0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
- 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, // ................
- 0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U...........
- 0x01, 0x80, 0x00, 0x00, 0x00, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
- 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, // ........U.......
- 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
- 0x01, 0x80, 0x01, 0x00, 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U...........
- 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
- 0x06, 0x80, 0x04, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U.......
- 0x06, 0x80, 0x03, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
- 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xd0, 0xa0, 0x06, 0x00, // ................
- 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, // ................
- 0x02, 0x80, 0x09, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, // ....U...........
- 0xe9, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ................
- 0x44, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0c, 0x80, 0x00, 0x00, // D...U...........
- 0x44, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // D...............
- 0x0c, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x44, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ........D.......
- 0x0c, 0x80, 0x01, 0x00, 0xe4, 0x8b, 0x08, 0x00, 0x44, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, // ........D.......
- 0x07, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x1c, 0x80, 0x01, 0x00, // ................
- 0xe4, 0x80, 0x08, 0x00, 0xe4, 0xa1, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
- 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
- 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ................
- 0x04, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x23, 0x00, 0x00, 0x02, 0x02, 0x00, // ..........#.....
- 0x0c, 0x80, 0x0a, 0x00, 0xb4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x01, 0x00, // ......B.........
- 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0f, 0x80, 0x03, 0x00, // ................
- 0x00, 0x80, 0x0c, 0x00, 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x03, 0x00, // ....@.....X.....
- 0x0f, 0x80, 0x02, 0x00, 0xff, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, // ................
- 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x29, 0x00, // ..............).
- 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, // ........U.......
- 0x0f, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, // ......*.........
- 0x04, 0x80, 0x0c, 0x00, 0xaa, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, // ......).........
- 0xaa, 0x80, 0x42, 0x00, 0x00, 0x03, 0x05, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, // ..B.............
- 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x06, 0x00, 0x0f, 0x80, 0x05, 0x00, 0x00, 0x80, 0x0c, 0x00, // ................
- 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x05, 0x00, 0x0f, 0x80, 0x02, 0x00, // @.....X.........
- 0xff, 0x81, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, // ................
- 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x05, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, // ................
- 0x0f, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........*.....
- 0x00, 0x02, 0x04, 0x00, 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..........+...+.
- 0x00, 0x00, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, // ..X.............
- 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x09, 0x00, // ................
- 0xaa, 0xa1, 0x09, 0x00, 0x60, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, // ....`...........
- 0xe4, 0x8b, 0x02, 0x00, 0xf4, 0x81, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x00, 0x00, // ................
- 0xa4, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, // ......Z.........
- 0xed, 0x80, 0x02, 0x00, 0xed, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
- 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................
- 0xff, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, // ............U...
- 0xaa, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x55, 0x80, 0x0c, 0x00, // ............U...
- 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, // ................
- 0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x09, 0x00, // U...........U...
- 0xaa, 0xa1, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x02, 0x00, // ................
- 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, // ....U...........
- 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x12, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, // ................
- 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, // U...............
- 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ................
- 0x00, 0x04, 0x03, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x06, 0x00, // ........U.......
- 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, // ................
- 0xff, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xaa, 0x81, 0x03, 0x00, // ..X.............
+ 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x01, 0x00, // ................
+ 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, // ....U...........
+ 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x03, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x03, 0x80, 0x00, 0x00, 0xe4, 0x8b, 0x08, 0x00, 0xe4, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // ................
+ 0x0b, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x13, 0x80, 0x00, 0x00, // ................
+ 0xe4, 0x80, 0x08, 0x00, 0xee, 0xa1, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x01, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ....U...........
+ 0x02, 0x80, 0x01, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, // ........U.......
+ 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, // ........U.......
+ 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, // ........U...U...
+ 0x00, 0x03, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, // ........U.......
+ 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, // ........U.......
+ 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x23, 0x00, // ........U.....#.
+ 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
+ 0x03, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, // ........U.......
+ 0x03, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
+ 0x00, 0x03, 0x02, 0x00, 0x03, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xe4, 0xa0, 0x02, 0x00, // ................
+ 0x00, 0x03, 0x02, 0x00, 0x0c, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x09, 0x00, 0x44, 0xa0, 0x02, 0x00, // ............D...
+ 0x00, 0x03, 0x02, 0x00, 0x0c, 0x80, 0x02, 0x00, 0xe4, 0x81, 0x02, 0x00, 0x44, 0x8b, 0x0b, 0x00, // ............D...
+ 0x00, 0x03, 0x03, 0x00, 0x03, 0x80, 0x02, 0x00, 0xee, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, // ..............Z.
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x0c, 0x00, // ................
+ 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, // ................
+ 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x01, 0x00, // ................
+ 0x04, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0xff, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
+ 0x04, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
+ 0x08, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, // ................
+ 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x18, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
+ 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x03, 0x00, // ........U.......
+ 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x03, 0x00, 0x02, 0x80, 0x09, 0x00, // ................
+ 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x05, 0x80, 0x02, 0x00, 0xd4, 0x80, 0x03, 0x00, // U...............
+ 0xd4, 0x80, 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe8, 0x80, 0x00, 0x08, // ..B.............
+ 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0d, 0x80, 0x01, 0x00, 0x77, 0x81, 0x0a, 0x00, // ............w...
+ 0xa7, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xff, 0x80, 0x02, 0x00, // ................
+ 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, // ..X.............
+ 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x02, 0x00, 0x0e, 0x80, 0x01, 0x00, // ......X.........
+ 0xff, 0x8c, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
+ 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
+ 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, // ....U.....).....
+ 0xff, 0xa0, 0x01, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x0b, 0x00, // ....U...........
+ 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x0c, 0x00, // ..*.............
+ 0x55, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x55, 0x80, 0x42, 0x00, // U.).........U.B.
+ 0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, // ................
+ 0x00, 0x03, 0x05, 0x00, 0x07, 0x80, 0x04, 0x00, 0xff, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x58, 0x00, // ..............X.
+ 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x05, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................
+ 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0e, 0x80, 0x01, 0x00, 0xff, 0x8c, 0x04, 0x00, // ..X.............
+ 0x00, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x00, 0x00, // ................
+ 0x00, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x04, 0x00, // ................
+ 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, // ......*.........
+ 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x58, 0x00, // ......+...+...X.
+ 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x8c, 0x02, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
+ 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, // ................
+ 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ................
+ 0x00, 0x04, 0x02, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xff, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x06, 0x00, // ................
+ 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, // ............U...
+ 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xaa, 0x81, 0x02, 0x00, // ..X.............
0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...........
};
-static const uint8_t fs_nanovg_fill_dx11[2298] =
+static const uint8_t fs_nanovg_fill_dx11[2362] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, // FSH........u_sci
0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x13, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x75, 0x5f, // ssorMat.......u_
@@ -306,9 +298,9 @@ static const uint8_t fs_nanovg_fill_dx11[2298] =
0x6c, 0x65, 0x12, 0x00, 0x80, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, // le.......u_exten
0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x12, 0x00, 0x90, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, // tRadius.......u_
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x05, 0x73, 0x5f, 0x74, // params.......s_t
- 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x5c, 0x08, 0x44, 0x58, 0x42, 0x43, 0xd1, 0x0d, // ex0.......DXBC..
- 0x44, 0xc2, 0xc4, 0x7b, 0x60, 0xde, 0xb6, 0xfb, 0x34, 0x0f, 0x88, 0x9d, 0xbc, 0x6e, 0x01, 0x00, // D..{`...4....n..
- 0x00, 0x00, 0x5c, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..........,.....
+ 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x9c, 0x08, 0x44, 0x58, 0x42, 0x43, 0x21, 0x36, // ex0.......DXBC!6
+ 0x2a, 0x19, 0x73, 0x28, 0xce, 0xe0, 0xff, 0xcd, 0x27, 0x27, 0x8e, 0x5c, 0x18, 0x73, 0x01, 0x00, // *.s(....''...s..
+ 0x00, 0x00, 0x9c, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..........,.....
0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, // ......ISGNh.....
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ......P.........
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, // ................
@@ -319,8 +311,8 @@ static const uint8_t fs_nanovg_fill_dx11[2298] =
0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, // RD....OSGN,.....
0x00, 0x00, 0x08, 0x00, 0x00, 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, // ..............SV
- 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x84, 0x07, // _TARGET...SHDR..
- 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xe1, 0x01, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@.......Y...F.
+ 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xc4, 0x07, // _TARGET...SHDR..
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@.......Y...F.
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, // .........Z....`
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, // ......X....p....
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, // ..UU..b...2.....
@@ -390,61 +382,65 @@ static const uint8_t fs_nanovg_fill_dx11[2298] =
0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ...
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8...B.....
0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // ................
- 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, // ..8.... ......*.
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ......:.......6.
- 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..r ......F.....
- 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........B.....
- 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, // ..:. ..........@
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x1f, 0x00, 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, // .....?....*.....
- 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, // ..8...........V.
- 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ........ .......
- 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, // ..2.............
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, // ...............
- 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc2, 0x00, // ................
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, // ................
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x08, 0xc2, 0x00, // ...............
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, // ................
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, // .........E.....
- 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, // ..............F~
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, // .......`........
- 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x80, 0x20, 0x00, 0x00, 0x00, // ..B.......*. ...
- 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, // .......@......6.
- 0x00, 0x05, 0x12, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ...........@....
- 0x80, 0x3f, 0x36, 0x00, 0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, // .?6.............
- 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......7.........
- 0x00, 0x00, 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..........F.....
- 0x00, 0x00, 0x06, 0x0c, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00, // ..........8...".
+ 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0a, // ..8.... ........
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, // ......F.........
+ 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, // ......B.......:.
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ..........@....
+ 0x80, 0x3f, 0x1f, 0x00, 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // .?....*.......8.
+ 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, // ..........V.....
+ 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x32, 0x00, // .... .........2.
+ 0x00, 0x0a, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, // ............ ...
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0e, // ................
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, // ................
+ 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, // ............ ...
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, // ................
+ 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, // ............ ...
+ 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......E.........
+ 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..........F~....
+ 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x0b, 0xc2, 0x00, // ...`............
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ........ .......
+ 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@............
+ 0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, // .?...@8...r.....
+ 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..........F.....
+ 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0a, // ..7...r.........
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, // ......F.......F.
+ 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xe2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......7.........
+ 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x01, 0x00, // ................
+ 0x00, 0x00, 0x56, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, // ..V.......8.....
+ 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......F.......F.
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00, // .........8...".
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ................
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, // ......8.... ....
- 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, // ..........:.....
- 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..6...r ......F.
- 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, // ..............".
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......:. .......
- 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, // ...@.....@......
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......6.... ....
- 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // ...@.....?...?..
- 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, // .?...?........".
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......:. .......
- 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, // ...@....@@......
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......E.........
- 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..........F~....
- 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, // ...`..........".
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......*. .......
- 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x00, // ...@......6.....
- 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x36, 0x00, // .......@.....?6.
- 0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, // ................
- 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, // ..7...........V.
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x0c, // ......F.........
- 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x01, 0x00, // ......8.........
- 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, // ..........:.....
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......8.... ....
+ 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..V.......F.....
+ 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........".....
+ 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, // ..:. ..........@
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // .....@..........
+ 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ..6.... .......@
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // .....?...?...?..
+ 0x80, 0x3f, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, // .?........".....
+ 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, // ..:. ..........@
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // ....@@..........
+ 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x1a, // ..E.............
+ 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......`
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x0b, 0x62, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........b.....
+ 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x40, // .... ..........@
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .........?...@..
+ 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf6, 0x0f, // ..8...r.........
+ 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, // ......F.......7.
+ 0x00, 0x09, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, // ..r.......V.....
+ 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..F.......F.....
+ 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xe2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0a, // ..7.............
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x0e, // ..............V.
+ 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8.........
+ 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..........F.....
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..8.... ......F.
- 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // ......F. .......
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // ......F. .......
0x00, 0x00, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, // ................
0x00, 0x01, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0xb0, 0x00, // ..>.......
};
-static const uint8_t fs_nanovg_fill_mtl[3540] =
+static const uint8_t fs_nanovg_fill_mtl[3466] =
{
- 0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xc5, 0x0d, 0x00, 0x00, 0x75, 0x73, // FSH...........us
+ 0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x7b, 0x0d, 0x00, 0x00, 0x75, 0x73, // FSH.......{...us
0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me
0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat
0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput {
@@ -533,137 +529,132 @@ static const uint8_t fs_nanovg_fill_mtl[3540] =
0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // float2 tmpvar
0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, // _9;. tmpvar_9
0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // = max (tmpvar_8
- 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // , 0.0);. floa
- 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, // t4 tmpvar_10;.
- 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x6d, 0x69, // tmpvar_10 = mi
- 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, // x (_mtl_u.u_inne
- 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, // rCol, _mtl_u.u_o
- 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, // uterCol, clamp (
- 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, // (. (((min (
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, // . max (tm
- 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_8.x, tmpvar
- 0x5f, 0x38, 0x2e, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, 0x2e, // _8.y). , 0.
- 0x30, 0x29, 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // 0) + sqrt(.
- 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, // dot (tmpvar_9
- 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, // , tmpvar_9).
- 0x20, 0x20, 0x29, 0x29, 0x20, 0x2d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // )) - _mtl_u.u_
- 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, // extentRadius.z)
- 0x2b, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // + (_mtl_u.u_para
- 0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, // ms.x * 0.5)).
- 0x20, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, // / _mtl_u.u_par
- 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // ams.x), 0.0, 1.0
- 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x2e, // ));. color_6.
- 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, // xyz = tmpvar_10.
- 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, // xyz;. color_6
- 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, // .w = (tmpvar_10.
- 0x77, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, // w * (tmpvar_5 *
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_2));.
- 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // result_1 = half4
- 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, // (color_6);. } e
- 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, // lse {. if ((_
- 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // mtl_u.u_params.w
- 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // == 1.0)) {.
- 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, // half4 color_11
- 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, // ;. float3 t
- 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_12;.
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, // tmpvar_12.z = 1.
- 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 0;. tmpvar_
- 0x31, 0x32, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // 12.xy = _mtl_i.v
- 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // _position;.
- 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float2 tmpvar_1
- 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 3;. tmpvar_
- 0x31, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // 13 = ((_mtl_u.u_
- 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // paintMat * tmpva
- 0x72, 0x5f, 0x31, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // r_12).xy / _mtl_
- 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, // u.u_extentRadius
- 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // .xy);. half
- 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 4 tmpvar_14;.
- 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x68, // tmpvar_14 = h
- 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // alf4(s_tex.sampl
- 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // e(_mtlsmp_s_tex,
- 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // (float2)(tmpvar
- 0x5f, 0x31, 0x33, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // _13)));. co
- 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_11 = tmpvar_
- 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, // 14;. half4
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_15;.
- 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // if ((_mtl_u.u_p
- 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, // arams.z == 0.0))
- 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // {. tmpva
- 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // r_15 = tmpvar_14
- 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, // ;. } else {
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, // . half4 t
- 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_16;.
- 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, // tmpvar_16.xyz
- 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x31, // = half3(float3(1
- 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, // .0, 1.0, 1.0));.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // tmpvar_1
- 0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, // 6.w = tmpvar_14.
- 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // x;. tmpva
- 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, // r_15 = tmpvar_16
- 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // ;. };.
- 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // color_11.xyz =
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, // tmpvar_15.xyz;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x20, // color_11.w
- 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // = ((half)((float
- 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, // )tmpvar_15.w * (
- 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // tmpvar_5 * tmpva
- 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, // r_2)));. re
- 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // sult_1 = color_1
- 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // 1;. } else {.
+ 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // , 0.0);. colo
+ 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // r_6 = (mix (_mtl
+ 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x5f, // _u.u_innerCol, _
+ 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, // mtl_u.u_outerCol
+ 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // , clamp (.
+ 0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x6e, // ((((. min
+ 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, // (max (tmpvar_8.
+ 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, 0x79, 0x29, 0x2c, 0x20, // x, tmpvar_8.y),
+ 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2b, 0x20, 0x0a, 0x20, // 0.0). + .
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x64, 0x6f, 0x74, 0x20, // sqrt(dot
+ 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // (tmpvar_9, tmpva
+ 0x72, 0x5f, 0x39, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x2d, 0x20, // r_9)). ) -
+ 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // _mtl_u.u_extentR
+ 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // adius.z) + (_mtl
+ 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, // _u.u_params.x *
+ 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // 0.5)) / _mtl_u.u
+ 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2c, // _params.x). ,
+ 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, // 0.0, 1.0)) * (t
+ 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // mpvar_5 * tmpvar
+ 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // _2));. result
+ 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _1 = half4(color
+ 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // _6);. } else {.
+ 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u.
+ 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, // u_params.w == 1.
+ 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // 0)) {. half
+ 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 4 color_10;.
+ 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_
+ 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // 11;. tmpvar
+ 0x5f, 0x31, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, // _11.z = 1.0;.
+ 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x20, // tmpvar_11.xy
+ 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.v_posit
+ 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // ion;. float
+ 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 2 tmpvar_12;.
+ 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x28, // tmpvar_12 = (
+ 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // (_mtl_u.u_paintM
+ 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x29, 0x2e, // at * tmpvar_11).
+ 0x78, 0x79, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, // xy / _mtl_u.u_ex
+ 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, // tentRadius.xy);.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // half4 tmpv
+ 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // ar_13;. tmp
+ 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, // var_13 = half4(s
+ 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // _tex.sample(_mtl
+ 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // smp_s_tex, (floa
+ 0x74, 0x32, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x29, 0x29, // t2)(tmpvar_12)))
+ 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, // ;. color_10
+ 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_13;.
+ 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u.
+ 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, // u_params.z == 1.
+ 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 0)) {. ha
+ 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, // lf4 tmpvar_14;.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // tmpvar_14
+ 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // .xyz = (tmpvar_1
+ 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 3.xyz * tmpvar_1
+ 0x33, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // 3.w);. tm
+ 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // pvar_14.w = tmpv
+ 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_13.w;.
+ 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // color_10 = tmpv
+ 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, // ar_14;. };.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // if ((_mtl_
- 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, // u.u_params.w ==
+ 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, // u.u_params.z ==
0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 2.0)) {.
- 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // result_1 = half4
- 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // (float4(1.0, 1.0
- 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // , 1.0, 1.0));.
- 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // } else {.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // if ((_mtl_u
- 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x33, // .u_params.w == 3
- 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0)) {.
- 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x3b, // half4 color_17;
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // . half4
- 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_18;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x20, // tmpvar_18
- 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, // = half4(s_tex.sa
- 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, // mple(_mtlsmp_s_t
- 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, // ex, (float2)(_mt
- 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, // l_i.v_texcoord0)
- 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // ));. co
- 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_17 = tmpvar_
- 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 18;. ha
- 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x3b, 0x0a, 0x20, // lf4 tmpvar_19;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, // if ((_m
- 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, // tl_u.u_params.z
- 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 0.0)) {.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, // tmpvar_19
- 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_18;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, // } else {
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, // . hal
- 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x30, 0x3b, 0x0a, 0x20, 0x20, // f4 tmpvar_20;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // tmpvar
- 0x5f, 0x32, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, // _20.xyz = half3(
- 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, // float3(1.0, 1.0,
- 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 1.0));.
- 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x30, 0x2e, 0x77, 0x20, // tmpvar_20.w
- 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x2e, 0x78, 0x3b, 0x0a, 0x20, // = tmpvar_18.x;.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // tmpva
- 0x72, 0x5f, 0x31, 0x39, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x30, // r_19 = tmpvar_20
- 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, // ;. };.
+ 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_10 = color
+ 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _10.xxxx;.
+ 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // };. color_1
+ 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, // 0 = ((half4)((fl
+ 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x2a, 0x20, // oat4)color_10 *
+ 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, // _mtl_u.u_innerCo
+ 0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // l));. color
+ 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, // _10 = ((half4)((
+ 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, // float4)color_10
+ 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, // * (tmpvar_5 * tm
+ 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_2)));.
+ 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // result_1 = colo
+ 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, // r_10;. } else
+ 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, // {. if ((_m
+ 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, // tl_u.u_params.w
+ 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 2.0)) {.
+ 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, // result_1 = ha
+ 0x6c, 0x66, 0x34, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, // lf4(float4(1.0,
+ 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, // 1.0, 1.0, 1.0));
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // . } else {.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, // if ((_mt
+ 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, // l_u.u_params.w =
+ 0x3d, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 3.0)) {.
+ 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // half4 color_
+ 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 15;. ha
+ 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, // lf4 tmpvar_16;.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // tmpvar_
+ 0x31, 0x36, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // 16 = half4(s_tex
+ 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // .sample(_mtlsmp_
+ 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, // s_tex, (float2)(
+ 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // _mtl_i.v_texcoor
+ 0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // d0)));.
+ 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // color_15 = tmpv
+ 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_16;.
+ 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // if ((_mtl_u.u_p
+ 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, // arams.z == 1.0))
+ 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, // {. h
+ 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, // alf4 tmpvar_17;.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpv
+ 0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, // ar_17.xyz = (tmp
+ 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, // var_16.xyz * tmp
+ 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // var_16.w);.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, // tmpvar_17
+ 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, // .w = tmpvar_16.w
+ 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // ;. co
+ 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_15 = tmpvar_
+ 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // 17;. };
+ 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, // . if ((
+ 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params.
+ 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // z == 2.0)) {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // color_1
- 0x37, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 7.xyz = tmpvar_1
- 0x39, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 9.xyz;.
- 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, // color_17.w = ((
- 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, 0x74, 0x6d, 0x70, // half)((float)tmp
- 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // var_19.w * tmpva
- 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_2));.
- 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, // result_1 = ((ha
- 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, // lf4)((float4)col
- 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // or_17 * _mtl_u.u
- 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // _innerCol));.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // };. };
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // . };. };. _
- 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol
- 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // or = result_1;.
- 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;.
- 0x7d, 0x0a, 0x0a, 0x00, // }...
+ 0x35, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x78, 0x78, // 5 = color_15.xxx
+ 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, // x;. };.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // color_
+ 0x31, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, // 15 = ((half4)((f
+ 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x2a, // loat4)color_15 *
+ 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // tmpvar_2));.
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, // result_1
+ 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, // = ((half4)((floa
+ 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x2a, 0x20, 0x5f, 0x6d, // t4)color_15 * _m
+ 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, // tl_u.u_innerCol)
+ 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // );. };.
+ 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // };. };.
+ 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // };. _mtl_o.gl_F
+ 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // ragColor = resul
+ 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // t_1;. return _m
+ 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}...
};
diff --git a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.sc b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.sc
index 985124b7767..fb8a17b0d4c 100644
--- a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.sc
+++ b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.sc
@@ -61,7 +61,7 @@ void main()
float d = clamp( (sdroundrect(pt, u_extent, u_radius) + u_feather*0.5) / u_feather, 0.0, 1.0);
vec4 color = mix(u_innerCol, u_outerCol, d);
// Combine alpha
- color.w *= strokeAlpha * scissor;
+ color *= strokeAlpha * scissor;
result = color;
}
else if (u_type == 1.0) // Image
@@ -69,9 +69,12 @@ void main()
// Calculate color from texture
vec2 pt = mul(u_paintMat, vec3(v_position, 1.0) ).xy / u_extent;
vec4 color = texture2D(s_tex, pt);
- color = u_texType == 0.0 ? color : vec4(1.0, 1.0, 1.0, color.x);
+ if (u_texType == 1.0) color = vec4(color.xyz * color.w, color.w);
+ if (u_texType == 2.0) color = color.xxxx;
+ // Apply color tint and alpha
+ color *= u_innerCol;
// Combine alpha
- color.w *= strokeAlpha * scissor;
+ color *= strokeAlpha * scissor;
result = color;
}
else if (u_type == 2.0) // Stencil fill
@@ -81,8 +84,9 @@ void main()
else if (u_type == 3.0) // Textured tris
{
vec4 color = texture2D(s_tex, v_texcoord0.xy);
- color = u_texType == 0.0 ? color : vec4(1.0, 1.0, 1.0, color.x);
- color.w *= scissor;
+ if (u_texType == 1.0) color = vec4(color.xyz * color.w, color.w);
+ if (u_texType == 2.0) color = color.xxxx;
+ color *= scissor;
result = color * u_innerCol;
}
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
index c7433cdc45d..9904141c103 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
@@ -110,6 +110,7 @@ enum NVGpointFlags
};
struct NVGstate {
+ NVGcompositeOperationState compositeOperation;
NVGpaint fill;
NVGpaint stroke;
float strokeWidth;
@@ -247,6 +248,76 @@ static void nvg__setDevicePixelRatio(NVGcontext* ctx, float ratio)
ctx->devicePxRatio = ratio;
}
+static NVGcompositeOperationState nvg__compositeOperationState(int op)
+{
+ // NVG_SOURCE_OVER
+ int sfactor = NVG_ONE;
+ int dfactor = NVG_ONE_MINUS_SRC_ALPHA;
+
+ if (op == NVG_SOURCE_IN)
+ {
+ sfactor = NVG_DST_ALPHA;
+ dfactor = NVG_ZERO;
+ }
+ else if (op == NVG_SOURCE_OUT)
+ {
+ sfactor = NVG_ONE_MINUS_DST_ALPHA;
+ dfactor = NVG_ZERO;
+ }
+ else if (op == NVG_ATOP)
+ {
+ sfactor = NVG_DST_ALPHA;
+ dfactor = NVG_ONE_MINUS_SRC_ALPHA;
+ }
+ else if (op == NVG_DESTINATION_OVER)
+ {
+ sfactor = NVG_ONE_MINUS_DST_ALPHA;
+ dfactor = NVG_ONE;
+ }
+ else if (op == NVG_DESTINATION_IN)
+ {
+ sfactor = NVG_ZERO;
+ dfactor = NVG_SRC_ALPHA;
+ }
+ else if (op == NVG_DESTINATION_OUT)
+ {
+ sfactor = NVG_ZERO;
+ dfactor = NVG_ONE_MINUS_SRC_ALPHA;
+ }
+ else if (op == NVG_DESTINATION_ATOP)
+ {
+ sfactor = NVG_ONE_MINUS_DST_ALPHA;
+ dfactor = NVG_SRC_ALPHA;
+ }
+ else if (op == NVG_LIGHTER)
+ {
+ sfactor = NVG_ONE;
+ dfactor = NVG_ONE;
+ }
+ else if (op == NVG_COPY)
+ {
+ sfactor = NVG_ONE;
+ dfactor = NVG_ZERO;
+ }
+ else if (op == NVG_XOR)
+ {
+ sfactor = NVG_ONE_MINUS_DST_ALPHA;
+ dfactor = NVG_ONE_MINUS_SRC_ALPHA;
+ }
+
+ NVGcompositeOperationState state;
+ state.srcRGB = sfactor;
+ state.dstRGB = dfactor;
+ state.srcAlpha = sfactor;
+ state.dstAlpha = dfactor;
+ return state;
+}
+
+static NVGstate* nvg__getState(NVGcontext* ctx)
+{
+ return &ctx->states[ctx->nstates-1];
+}
+
NVGcontext* nvgCreateInternal(NVGparams* params)
{
FONSparams fontParams;
@@ -354,7 +425,8 @@ void nvgCancelFrame(NVGcontext* ctx)
void nvgEndFrame(NVGcontext* ctx)
{
- ctx->params.renderFlush(ctx->params.userPtr);
+ NVGstate* state = nvg__getState(ctx);
+ ctx->params.renderFlush(ctx->params.userPtr, state->compositeOperation);
if (ctx->fontImageIdx != 0) {
int fontImage = ctx->fontImages[ctx->fontImageIdx];
int i, j, iw, ih;
@@ -477,12 +549,6 @@ NVGcolor nvgHSLA(float h, float s, float l, unsigned char a)
return col;
}
-
-static NVGstate* nvg__getState(NVGcontext* ctx)
-{
- return &ctx->states[ctx->nstates-1];
-}
-
void nvgTransformIdentity(float* t)
{
t[0] = 1.0f; t[1] = 0.0f;
@@ -615,6 +681,7 @@ void nvgReset(NVGcontext* ctx)
nvg__setPaintColor(&state->fill, nvgRGBA(255,255,255,255));
nvg__setPaintColor(&state->stroke, nvgRGBA(0,0,0,255));
+ state->compositeOperation = nvg__compositeOperationState(NVG_SOURCE_OVER);
state->strokeWidth = 1.0f;
state->miterLimit = 10.0f;
state->lineCap = NVG_BUTT;
@@ -983,6 +1050,30 @@ void nvgResetScissor(NVGcontext* ctx)
state->scissor.extent[1] = -1.0f;
}
+// Global composite operation.
+void nvgGlobalCompositeOperation(NVGcontext* ctx, int op)
+{
+ NVGstate* state = nvg__getState(ctx);
+ state->compositeOperation = nvg__compositeOperationState(op);
+}
+
+void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor)
+{
+ nvgGlobalCompositeBlendFuncSeparate(ctx, sfactor, dfactor, sfactor, dfactor);
+}
+
+void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)
+{
+ NVGcompositeOperationState op;
+ op.srcRGB = srcRGB;
+ op.dstRGB = dstRGB;
+ op.srcAlpha = srcAlpha;
+ op.dstAlpha = dstAlpha;
+
+ NVGstate* state = nvg__getState(ctx);
+ state->compositeOperation = op;
+}
+
static int nvg__ptEquals(float x1, float y1, float x2, float y2, float tol)
{
float dx = x2 - x1;
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.h b/3rdparty/bgfx/examples/common/nanovg/nanovg.h
index 984c1935e3c..99797e21fbb 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg.h
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.h
@@ -81,10 +81,46 @@ enum NVGalign {
// Vertical align
NVG_ALIGN_TOP = 1<<3, // Align text vertically to top.
NVG_ALIGN_MIDDLE = 1<<4, // Align text vertically to middle.
- NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
- NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
+ NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
+ NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
};
+enum NVGblendFactor {
+ NVG_ZERO = 1<<0,
+ NVG_ONE = 1<<1,
+ NVG_SRC_COLOR = 1<<2,
+ NVG_ONE_MINUS_SRC_COLOR = 1<<3,
+ NVG_DST_COLOR = 1<<4,
+ NVG_ONE_MINUS_DST_COLOR = 1<<5,
+ NVG_SRC_ALPHA = 1<<6,
+ NVG_ONE_MINUS_SRC_ALPHA = 1<<7,
+ NVG_DST_ALPHA = 1<<8,
+ NVG_ONE_MINUS_DST_ALPHA = 1<<9,
+ NVG_SRC_ALPHA_SATURATE = 1<<10,
+};
+
+enum NVGcompositeOperation {
+ NVG_SOURCE_OVER,
+ NVG_SOURCE_IN,
+ NVG_SOURCE_OUT,
+ NVG_ATOP,
+ NVG_DESTINATION_OVER,
+ NVG_DESTINATION_IN,
+ NVG_DESTINATION_OUT,
+ NVG_DESTINATION_ATOP,
+ NVG_LIGHTER,
+ NVG_COPY,
+ NVG_XOR,
+};
+
+struct NVGcompositeOperationState {
+ int srcRGB;
+ int dstRGB;
+ int srcAlpha;
+ int dstAlpha;
+};
+typedef struct NVGcompositeOperationState NVGcompositeOperationState;
+
struct NVGglyphPosition {
const char* str; // Position of the glyph in the input string.
float x; // The x-coordinate of the logical glyph position.
@@ -126,6 +162,22 @@ void nvgCancelFrame(NVGcontext* ctx);
void nvgEndFrame(NVGcontext* ctx);
//
+// Composite operation
+//
+// The composite operations in NanoVG are modeled after HTML Canvas API, and
+// the blend func is based on OpenGL (see corresponding manuals for more info).
+// The colors in the blending state have premultiplied alpha.
+
+// Sets the composite operation. The op parameter should be one of NVGcompositeOperation.
+void nvgGlobalCompositeOperation(NVGcontext* ctx, int op);
+
+// Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor.
+void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor);
+
+// Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor.
+void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
+
+//
// Color utils
//
// Colors in NanoVG are stored as unsigned ints in ABGR format.
@@ -185,7 +237,7 @@ void nvgReset(NVGcontext* ctx);
// Solid color is simply defined as a color value, different kinds of paints can be created
// using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
//
-// Current render style can be saved and restored using nvgSave() and nvgRestore().
+// Current render style can be saved and restored using nvgSave() and nvgRestore().
// Sets current stroke style to a solid color.
void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
@@ -215,7 +267,7 @@ void nvgLineCap(NVGcontext* ctx, int cap);
void nvgLineJoin(NVGcontext* ctx, int join);
// Sets the transparency applied to all rendered shapes.
-// Alreade transparent paths will get proportionally more transparent as well.
+// Already transparent paths will get proportionally more transparent as well.
void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
//
@@ -233,7 +285,7 @@ void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
// Apart from nvgResetTransform(), each transformation function first creates
// specific transformation matrix and pre-multiplies the current transformation by it.
//
-// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
+// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
// Resets current transform to a identity matrix.
void nvgResetTransform(NVGcontext* ctx);
@@ -347,7 +399,7 @@ NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float
NVGcolor icol, NVGcolor ocol);
// Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
-// drop shadows or hilights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
+// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
// the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
@@ -369,8 +421,8 @@ NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey
//
// Scissoring
//
-// Scissoring allows you to clip the rendering into a rectangle. This is useful for varius
-// user interface cases like rendering a text edit or a timeline.
+// Scissoring allows you to clip the rendering into a rectangle. This is useful for various
+// user interface cases like rendering a text edit or a timeline.
// Sets the current scissor rectangle.
// The scissor rectangle is transformed by the current transform.
@@ -425,7 +477,7 @@ void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float rad
// Closes current sub-path with a line segment.
void nvgClosePath(NVGcontext* ctx);
-// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
+// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
void nvgPathWinding(NVGcontext* ctx, int dir);
// Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
@@ -442,7 +494,7 @@ void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r
// Creates new ellipse shaped sub-path.
void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry);
-// Creates new circle shaped sub-path.
+// Creates new circle shaped sub-path.
void nvgCircle(NVGcontext* ctx, float cx, float cy, float r);
// Fills the current path with current fill style.
@@ -489,7 +541,7 @@ void nvgStroke(NVGcontext* ctx);
// Returns handle to the font.
int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename);
-// Creates image by loading it from the specified memory chunk.
+// Creates font by loading it from the specified memory chunk.
// Returns handle to the font.
int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData);
@@ -505,7 +557,7 @@ void nvgFontBlur(NVGcontext* ctx, float blur);
// Sets the letter spacing of current text style.
void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
-// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
+// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);
// Sets the text align of current text style, see NVGalign for options.
@@ -592,7 +644,7 @@ struct NVGparams {
int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio);
void (*renderCancel)(void* uptr);
- void (*renderFlush)(void* uptr);
+ void (*renderFlush)(void* uptr, NVGcompositeOperationState compositeOperation);
void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);
void (*renderStroke)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths);
void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGscissor* scissor, const NVGvertex* verts, int nverts);
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
index 05973f26284..f64baa56a94 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp
@@ -31,6 +31,7 @@
#include <bx/bx.h>
#include <bx/allocator.h>
#include <bx/crtimpl.h>
+#include <bx/uint32_t.h>
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244); // warning C4244: '=' : conversion from '' to '', possible loss of data
@@ -269,7 +270,7 @@ namespace
const bgfx::Memory* mem = bgfx::alloc(4*4*4);
uint32_t* bgra8 = (uint32_t*)mem->data;
memset(bgra8, 0, 4*4*4);
- gl->texMissing = bgfx::createTexture2D(4, 4, 0, bgfx::TextureFormat::BGRA8, 0, mem);
+ gl->texMissing = bgfx::createTexture2D(4, 4, false, 1, bgfx::TextureFormat::BGRA8, 0, mem);
gl->u_scissorMat = bgfx::createUniform("u_scissorMat", bgfx::UniformType::Mat3);
gl->u_paintMat = bgfx::createUniform("u_paintMat", bgfx::UniformType::Mat3);
@@ -326,8 +327,10 @@ namespace
mem = bgfx::copy(_rgba, tex->height * pitch);
}
- tex->id = bgfx::createTexture2D(tex->width
+ tex->id = bgfx::createTexture2D(
+ tex->width
, tex->height
+ , false
, 1
, NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8
, BGFX_TEXTURE_NONE
@@ -335,14 +338,16 @@ namespace
if (NULL != mem)
{
- bgfx::updateTexture2D(tex->id
- , 0
- , 0
- , 0
- , tex->width
- , tex->height
- , mem
- );
+ bgfx::updateTexture2D(
+ tex->id
+ , 0
+ , 0
+ , 0
+ , 0
+ , tex->width
+ , tex->height
+ , mem
+ );
}
return bgfx::isValid(tex->id) ? tex->id.idx : 0;
@@ -366,15 +371,17 @@ namespace
uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1;
uint32_t pitch = tex->width * bytesPerPixel;
- bgfx::updateTexture2D(tex->id
- , 0
- , x
- , y
- , w
- , h
- , bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
- , pitch
- );
+ bgfx::updateTexture2D(
+ tex->id
+ , 0
+ , 0
+ , x
+ , y
+ , w
+ , h
+ , bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
+ , pitch
+ );
return 1;
}
@@ -395,29 +402,6 @@ namespace
return 1;
}
- static void glnvg__xformIdentity(float* t)
- {
- t[0] = 1.0f; t[1] = 0.0f;
- t[2] = 0.0f; t[3] = 1.0f;
- t[4] = 0.0f; t[5] = 0.0f;
- }
-
- static void glnvg__xformInverse(float* inv, float* t)
- {
- double invdet, det = (double)t[0] * t[3] - (double)t[2] * t[1];
- if (det > -1e-6 && det < 1e-6) {
- glnvg__xformIdentity(t);
- return;
- }
- invdet = 1.0 / det;
- inv[0] = (float)(t[3] * invdet);
- inv[2] = (float)(-t[2] * invdet);
- inv[4] = (float)( ((double)t[2] * t[5] - (double)t[3] * t[4]) * invdet);
- inv[1] = (float)(-t[1] * invdet);
- inv[3] = (float)(t[0] * invdet);
- inv[5] = (float)( ((double)t[1] * t[4] - (double)t[0] * t[5]) * invdet);
- }
-
static void glnvg__xformToMat3x4(float* m3, float* t)
{
m3[0] = t[0];
@@ -434,6 +418,14 @@ namespace
m3[11] = 0.0f;
}
+ static NVGcolor glnvg__premulColor(NVGcolor c)
+ {
+ c.r *= c.a;
+ c.g *= c.a;
+ c.b *= c.a;
+ return c;
+ }
+
static int glnvg__convertPaint(struct GLNVGcontext* gl, struct GLNVGfragUniforms* frag, struct NVGpaint* paint,
struct NVGscissor* scissor, float width, float fringe)
{
@@ -442,13 +434,10 @@ namespace
memset(frag, 0, sizeof(*frag) );
- frag->innerCol = paint->innerColor;
- frag->outerCol = paint->outerColor;
+ frag->innerCol = glnvg__premulColor(paint->innerColor);
+ frag->outerCol = glnvg__premulColor(paint->outerColor);
- glnvg__xformInverse(invxform, paint->xform);
- glnvg__xformToMat3x4(frag->paintMat, invxform);
-
- if (scissor->extent[0] < 0.5f || scissor->extent[1] < 0.5f)
+ if (scissor->extent[0] < -0.5f || scissor->extent[1] < -0.5f)
{
memset(frag->scissorMat, 0, sizeof(frag->scissorMat) );
frag->scissorExt[0] = 1.0f;
@@ -458,7 +447,7 @@ namespace
}
else
{
- glnvg__xformInverse(invxform, scissor->xform);
+ nvgTransformInverse(invxform, scissor->xform);
glnvg__xformToMat3x4(frag->scissorMat, invxform);
frag->scissorExt[0] = scissor->extent[0];
frag->scissorExt[1] = scissor->extent[1];
@@ -476,8 +465,12 @@ namespace
{
return 0;
}
+ nvgTransformInverse(invxform, paint->xform);
frag->type = NSVG_SHADER_FILLIMG;
- frag->texType = tex->type == NVG_TEXTURE_RGBA ? 0.0f : 1.0f;
+ if (tex->type == NVG_TEXTURE_RGBA)
+ frag->texType = (tex->flags & NVG_IMAGE_PREMULTIPLIED) ? 0.0f : 1.0f;
+ else
+ frag->texType = 2.0f;
gl->th = tex->id;
}
else
@@ -485,8 +478,11 @@ namespace
frag->type = NSVG_SHADER_FILLGRAD;
frag->radius = paint->radius;
frag->feather = paint->feather;
+ nvgTransformInverse(invxform, paint->xform);
}
+ glnvg__xformToMat3x4(frag->paintMat, invxform);
+
return 1;
}
@@ -548,7 +544,6 @@ namespace
static void nvgRenderViewport(void* _userPtr, int width, int height, float devicePixelRatio)
{
struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr;
- gl->state = 0;
gl->view[0] = (float)width;
gl->view[1] = (float)height;
bgfx::setViewRect(gl->m_viewId, 0, 0, width * devicePixelRatio, height * devicePixelRatio);
@@ -705,7 +700,38 @@ namespace
}
}
- static void nvgRenderFlush(void* _userPtr)
+ static const uint64_t s_blend[] =
+ {
+ BGFX_STATE_BLEND_ZERO,
+ BGFX_STATE_BLEND_ONE,
+ BGFX_STATE_BLEND_SRC_COLOR,
+ BGFX_STATE_BLEND_INV_SRC_COLOR,
+ BGFX_STATE_BLEND_DST_COLOR,
+ BGFX_STATE_BLEND_INV_DST_COLOR,
+ BGFX_STATE_BLEND_SRC_ALPHA,
+ BGFX_STATE_BLEND_INV_SRC_ALPHA,
+ BGFX_STATE_BLEND_DST_ALPHA,
+ BGFX_STATE_BLEND_INV_DST_ALPHA,
+ BGFX_STATE_BLEND_SRC_ALPHA_SAT,
+ };
+
+ static uint64_t glnvg_convertBlendFuncFactor(int factor)
+ {
+ const uint32_t numtz = bx::uint32_cnttz(factor);
+ const uint32_t idx = bx::uint32_min(numtz, BX_COUNTOF(s_blend)-1);
+ return s_blend[idx];
+ }
+
+ static uint64_t glnvg__blendCompositeOperation(NVGcompositeOperationState op)
+ {
+ return BGFX_STATE_BLEND_FUNC_SEPARATE(
+ glnvg_convertBlendFuncFactor(op.srcRGB),
+ glnvg_convertBlendFuncFactor(op.dstRGB),
+ glnvg_convertBlendFuncFactor(op.srcAlpha),
+ glnvg_convertBlendFuncFactor(op.dstAlpha));
+ }
+
+ static void nvgRenderFlush(void* _userPtr, NVGcompositeOperationState compositeOperation)
{
struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr;
@@ -723,12 +749,7 @@ namespace
memcpy(gl->tvb.data, gl->verts, gl->nverts * sizeof(struct NVGvertex) );
- if (0 == gl->state)
- {
- gl->state = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA);
- }
-
- gl->state |= 0
+ gl->state = glnvg__blendCompositeOperation(compositeOperation)
| BGFX_STATE_RGB_WRITE
| BGFX_STATE_ALPHA_WRITE
;
@@ -1089,13 +1110,6 @@ void nvgDelete(struct NVGcontext* ctx)
nvgDeleteInternal(ctx);
}
-void nvgState(struct NVGcontext* ctx, uint64_t state)
-{
- struct NVGparams* params = nvgInternalParams(ctx);
- struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr;
- gl->state = state;
-}
-
uint8_t nvgViewId(struct NVGcontext* ctx)
{
struct NVGparams* params = nvgInternalParams(ctx);
@@ -1121,8 +1135,7 @@ NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int width,
int height, int imageFlags) {
NVGLUframebuffer* framebuffer = new NVGLUframebuffer;
framebuffer->ctx = ctx;
- framebuffer->image = nvgCreateImageRGBA(ctx, width, height,
- imageFlags, NULL);
+ framebuffer->image = nvgCreateImageRGBA(ctx, width, height, imageFlags | NVG_IMAGE_PREMULTIPLIED, NULL);
bgfx::TextureHandle texture = nvglImageHandle(ctx, framebuffer->image);
if (!bgfx::isValid(texture)) {
nvgluDeleteFramebuffer(framebuffer);
@@ -1156,9 +1169,9 @@ void nvgluBindFramebuffer(NVGLUframebuffer* framebuffer) {
void nvgluDeleteFramebuffer(NVGLUframebuffer* framebuffer) {
if (framebuffer == NULL)
return;
- if (framebuffer->image >= 0)
- nvgDeleteImage(framebuffer->ctx, framebuffer->image);
if (bgfx::isValid(framebuffer->handle))
bgfx::destroyFrameBuffer(framebuffer->handle);
+ if (framebuffer->image > 0)
+ nvgDeleteImage(framebuffer->ctx, framebuffer->image);
delete framebuffer;
}
diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h
index 2268e900f99..61b0e3e06e7 100644
--- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h
+++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h
@@ -23,7 +23,6 @@ typedef struct NVGLUframebuffer NVGLUframebuffer;
NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator);
NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId);
void nvgDelete(struct NVGcontext* ctx);
-void nvgState(struct NVGcontext* ctx, uint64_t state);
uint8_t nvgViewId(struct NVGcontext* ctx);
void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId);
diff --git a/3rdparty/bgfx/examples/common/packrect.h b/3rdparty/bgfx/examples/common/packrect.h
index 5650ec74f81..86e6e9f7027 100644
--- a/3rdparty/bgfx/examples/common/packrect.h
+++ b/3rdparty/bgfx/examples/common/packrect.h
@@ -127,7 +127,7 @@ public:
void reset(uint16_t _side)
{
- for (uint32_t ii = 0; ii < 6; ++ii)
+ for (uint8_t ii = 0; ii < 6; ++ii)
{
m_mru[ii] = ii;
m_ra[ii].reset(_side, _side);
diff --git a/3rdparty/bgfx/include/bgfx/bgfx.h b/3rdparty/bgfx/include/bgfx/bgfx.h
index 03f360528a1..9902e7ab897 100644
--- a/3rdparty/bgfx/include/bgfx/bgfx.h
+++ b/3rdparty/bgfx/include/bgfx/bgfx.h
@@ -615,6 +615,7 @@ namespace bgfx
uint16_t width; //!< Texture width.
uint16_t height; //!< Texture height.
uint16_t depth; //!< Texture depth.
+ uint16_t numLayers; //!< Number of layers in texture array.
uint8_t numMips; //!< Number of MIP maps.
uint8_t bitsPerPixel; //!< Format bits per pixel.
bool cubeMap; //!< Texture is cubemap.
@@ -841,7 +842,7 @@ namespace bgfx
/// @param[in] _dstSize Destination index buffer in bytes. It must be
/// large enough to contain output indices. If destination size is
/// insufficient index buffer will be truncated.
- /// @param[in]_indices Source indices.
+ /// @param[in] _indices Source indices.
/// @param[in] _numIndices Number of input indices.
/// @param[in] _index32 Set to `true` if input indices are 32-bit.
///
@@ -1102,20 +1103,35 @@ namespace bgfx
///
void dbgTextClear(uint8_t _attr = 0, bool _small = false);
- /// Print into internal debug text buffer.
+ /// Print into internal debug text character-buffer (VGA-compatible text mode).
+ ///
+ /// @param[in] _x, _y 2D position from top-left.
+ /// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom
+ /// 4-bits represent foreground color from standard VGA text palette.
+ /// @param[in] _format `printf` style format.
///
/// @attention C99 equivalent is `bgfx_dbg_text_printf`.
///
void dbgTextPrintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
+ /// Print into internal debug text character-buffer (VGA-compatible text mode).
+ ///
+ /// @param[in] _x, _y 2D position from top-left.
+ /// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom
+ /// 4-bits represent foreground color from standard VGA text palette.
+ /// @param[in] _format `printf` style format.
+ /// @param[in] _argList additional arguments for format string
+ ///
+ /// @attention C99 equivalent is `bgfx_dbg_text_vprintf`.
+ ///
+ void dbgTextPrintfVargs(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList);
+
/// Draw image into internal debug text buffer.
///
- /// @param[in] _x X position from top-left.
- /// @param[in] _y Y position from top-left.
- /// @param[in] _width Image width.
- /// @param[in] _height Image height.
- /// @param[in] _data Raw image data (character/attribute raw encoding).
- /// @param[in] _pitch Image pitch in bytes.
+ /// @param[in] _x, _y 2D position from top-left.
+ /// @param[in] _width, _height Image width and height.
+ /// @param[in] _data Raw image data (character/attribute raw encoding).
+ /// @param[in] _pitch Image pitch in bytes.
///
/// @attention C99 equivalent is `bgfx_dbg_text_image`.
///
@@ -1510,6 +1526,15 @@ namespace bgfx
/// Calculate amount of memory required for texture.
///
+ /// @param[out] _info Resulting texture info structure.
+ /// @param[in] _width Width.
+ /// @param[in] _height Height.
+ /// @param[in] _depth Depth.
+ /// @param[in] _cubeMap Indicates that texture contains cubemap.
+ /// @param[in] _hasMips Indicates that texture contains full mip-map chain.
+ /// @param[in] _numLayers Number of layers in texture array.
+ /// @param[in] _format Texture format. See: `TextureFormat::Enum`.
+ ///
/// @attention C99 equivalent is `bgfx_calc_texture_size`.
///
void calcTextureSize(
@@ -1518,7 +1543,8 @@ namespace bgfx
, uint16_t _height
, uint16_t _depth
, bool _cubeMap
- , uint8_t _numMips
+ , bool _hasMips
+ , uint16_t _numLayers
, TextureFormat::Enum _format
);
@@ -1549,7 +1575,9 @@ namespace bgfx
///
/// @param[in] _width Width.
/// @param[in] _height Height.
- /// @param[in] _numMips Number of mip-maps.
+ /// @param[in] _hasMips Indicates that texture contains full mip-map chain.
+ /// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps
+ /// `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@@ -1559,13 +1587,16 @@ namespace bgfx
/// sampling.
///
/// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable.
+ /// When `_numLayers` is more than 1, expected memory layout is texture and all mips together
+ /// for each array element.
///
/// @attention C99 equivalent is `bgfx_create_texture_2d`.
///
TextureHandle createTexture2D(
uint16_t _width
, uint16_t _height
- , uint8_t _numMips
+ , bool _hasMips
+ , uint16_t _numLayers
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
, const Memory* _mem = NULL
@@ -1576,7 +1607,9 @@ namespace bgfx
///
/// @param[in] _ratio Frame buffer size in respect to back-buffer size. See:
/// `BackbufferRatio::Enum`.
- /// @param[in] _numMips Number of mip-maps.
+ /// @param[in] _hasMips Indicates that texture contains full mip-map chain.
+ /// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps
+ /// `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@@ -1589,7 +1622,8 @@ namespace bgfx
///
TextureHandle createTexture2D(
BackbufferRatio::Enum _ratio
- , uint8_t _numMips
+ , bool _hasMips
+ , uint16_t _numLayers
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
);
@@ -1599,7 +1633,7 @@ namespace bgfx
/// @param[in] _width Width.
/// @param[in] _height Height.
/// @param[in] _depth Depth.
- /// @param[in] _numMips Number of mip-maps.
+ /// @param[in] _hasMips Indicates that texture contains full mip-map chain.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@@ -1616,7 +1650,7 @@ namespace bgfx
uint16_t _width
, uint16_t _height
, uint16_t _depth
- , uint8_t _numMips
+ , bool _hasMips
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
, const Memory* _mem = NULL
@@ -1625,7 +1659,9 @@ namespace bgfx
/// Create Cube texture.
///
/// @param[in] _size Cube side size.
- /// @param[in] _numMips Number of mip-maps.
+ /// @param[in] _hasMips Indicates that texture contains full mip-map chain.
+ /// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps
+ /// `BGFX_CAPS_TEXTURE_CUBE_ARRAY` flag is not set.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@@ -1635,12 +1671,15 @@ namespace bgfx
/// sampling.
///
/// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable.
+ /// When `_numLayers` is more than 1, expected memory layout is cubemap texture and all mips
+ /// together for each array element.
///
/// @attention C99 equivalent is `bgfx_create_texture_cube`.
///
TextureHandle createTextureCube(
uint16_t _size
- , uint8_t _numMips
+ , bool _hasMips
+ , uint16_t _numLayers
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
, const Memory* _mem = NULL
@@ -1649,6 +1688,7 @@ namespace bgfx
/// Update 2D texture.
///
/// @param[in] _handle Texture handle.
+ /// @param[in] _layer Layers in texture array.
/// @param[in] _mip Mip level.
/// @param[in] _x X offset in texture.
/// @param[in] _y Y offset in texture.
@@ -1662,6 +1702,7 @@ namespace bgfx
///
void updateTexture2D(
TextureHandle _handle
+ , uint16_t _layer
, uint8_t _mip
, uint16_t _x
, uint16_t _y
@@ -1700,6 +1741,7 @@ namespace bgfx
/// Update Cube texture.
///
/// @param[in] _handle Texture handle.
+ /// @param[in] _layer Layers in texture array.
/// @param[in] _side Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
/// where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
///
@@ -1733,6 +1775,7 @@ namespace bgfx
///
void updateTextureCube(
TextureHandle _handle
+ , uint16_t _layer
, uint8_t _side
, uint8_t _mip
, uint16_t _x
@@ -1850,7 +1893,7 @@ namespace bgfx
///
/// @returns Handle to frame buffer object.
///
- /// @attention C99 equivalent is `bgfx_create_frame_buffer_from_handles`.
+ /// @attention C99 equivalent is `bgfx_create_frame_buffer_from_attachment`.
///
FrameBufferHandle createFrameBuffer(
uint8_t _num
diff --git a/3rdparty/bgfx/include/bgfx/bgfxdefines.h b/3rdparty/bgfx/include/bgfx/bgfxdefines.h
index 36e308507bf..c16cdaeedce 100644
--- a/3rdparty/bgfx/include/bgfx/bgfxdefines.h
+++ b/3rdparty/bgfx/include/bgfx/bgfxdefines.h
@@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
-#define BGFX_API_VERSION UINT32_C(17)
+#define BGFX_API_VERSION UINT32_C(20)
///
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
@@ -386,6 +386,8 @@
#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000040000) //!< Occlusion query is supported.
#define BGFX_CAPS_ALPHA_TO_COVERAGE UINT64_C(0x0000000000080000) //!< Alpha to coverage is supported.
#define BGFX_CAPS_CONSERVATIVE_RASTER UINT64_C(0x0000000000100000) //!< Conservative rasterization is supported.
+#define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000200000) //!< 2D texture array is supported.
+#define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000400000) //!< Cubemap texture array is supported.
///
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT16_C(0x0000) //!< Texture format is not supported.
diff --git a/3rdparty/bgfx/include/bgfx/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/bgfxplatform.h
index 4984d68e8f9..f44bb82f8e4 100644
--- a/3rdparty/bgfx/include/bgfx/bgfxplatform.h
+++ b/3rdparty/bgfx/include/bgfx/bgfxplatform.h
@@ -129,61 +129,7 @@ namespace bgfx
} // namespace bgfx
-#if BX_PLATFORM_ANDROID
-# include <android/native_window.h>
-
-namespace bgfx
-{
- ///
- inline void androidSetWindow(::ANativeWindow* _window)
- {
- PlatformData pd;
- pd.ndt = NULL;
- pd.nwh = _window;
- pd.context = NULL;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
-#elif BX_PLATFORM_IOS
-namespace bgfx
-{
- ///
- inline void iosSetEaglLayer(void* _window)
- {
- PlatformData pd;
- pd.ndt = NULL;
- pd.nwh = _window;
- pd.context = NULL;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
-#elif BX_PLATFORM_BSD || BX_PLATFORM_LINUX || BX_PLATFORM_RPI
-
-namespace bgfx
-{
- ///
- inline void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL)
- {
- PlatformData pd;
- pd.ndt = _display;
- pd.nwh = (void*)(uintptr_t)_window;
- pd.context = _glx;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
-#elif BX_PLATFORM_NACL
+#if BX_PLATFORM_NACL
# include <ppapi/c/ppb_graphics_3d.h>
# include <ppapi/c/ppb_instance.h>
@@ -196,144 +142,6 @@ namespace bgfx
} // namespace bgfx
-#elif BX_PLATFORM_OSX
-namespace bgfx
-{
- ///
- inline void osxSetNSWindow(void* _window, void* _nsgl = NULL)
- {
- PlatformData pd;
- pd.ndt = NULL;
- pd.nwh = _window;
- pd.context = _nsgl;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
-#elif BX_PLATFORM_WINDOWS
-# include <windows.h>
-
-namespace bgfx
-{
- ///
- inline void winSetHwnd(::HWND _window)
- {
- PlatformData pd;
- pd.ndt = NULL;
- pd.nwh = _window;
- pd.context = NULL;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
-#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT
-# include <Unknwn.h>
-
-namespace bgfx
-{
- ///
- inline void winrtSetWindow(::IUnknown* _window)
- {
- PlatformData pd;
- pd.ndt = NULL;
- pd.nwh = _window;
- pd.context = NULL;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
#endif // BX_PLATFORM_
-#if defined(_SDL_syswm_h)
-// If SDL_syswm.h is included before bgfxplatform.h we can enable SDL window
-// interop convenience code.
-
-namespace bgfx
-{
- ///
- inline bool sdlSetWindow(SDL_Window* _window)
- {
- SDL_SysWMinfo wmi;
- SDL_VERSION(&wmi.version);
- if (!SDL_GetWindowWMInfo(_window, &wmi) )
- {
- return false;
- }
-
- PlatformData pd;
-# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
- pd.ndt = wmi.info.x11.display;
- pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
-# elif BX_PLATFORM_OSX
- pd.ndt = NULL;
- pd.nwh = wmi.info.cocoa.window;
-# elif BX_PLATFORM_WINDOWS
- pd.ndt = NULL;
- pd.nwh = wmi.info.win.window;
-# elif BX_PLATFORM_STEAMLINK
- pd.ndt = wmi.info.vivante.display;
- pd.nwh = wmi.info.vivante.window;
-# endif // BX_PLATFORM_
- pd.context = NULL;
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
-
- return true;
- }
-
-} // namespace bgfx
-
-#elif defined(_glfw3_h_)
-// If GLFW/glfw3.h is included before bgfxplatform.h we can enable GLFW3
-// window interop convenience code.
-
-# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
-# define GLFW_EXPOSE_NATIVE_X11
-# define GLFW_EXPOSE_NATIVE_GLX
-# elif BX_PLATFORM_OSX
-# define GLFW_EXPOSE_NATIVE_COCOA
-# define GLFW_EXPOSE_NATIVE_NSGL
-# elif BX_PLATFORM_WINDOWS
-# define GLFW_EXPOSE_NATIVE_WIN32
-# define GLFW_EXPOSE_NATIVE_WGL
-# endif //
-# include <GLFW/glfw3native.h>
-
-namespace bgfx
-{
- inline void glfwSetWindow(GLFWwindow* _window)
- {
- PlatformData pd;
-# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
- pd.ndt = glfwGetX11Display();
- pd.nwh = (void*)(uintptr_t)glfwGetGLXWindow(_window);
- pd.context = glfwGetGLXContext(_window);
-# elif BX_PLATFORM_OSX
- pd.ndt = NULL;
- pd.nwh = glfwGetCocoaWindow(_window);
- pd.context = glfwGetNSGLContext(_window);
-# elif BX_PLATFORM_WINDOWS
- pd.ndt = NULL;
- pd.nwh = glfwGetWin32Window(_window);
- pd.context = NULL;
-# endif // BX_PLATFORM_WINDOWS
- pd.backBuffer = NULL;
- pd.backBufferDS = NULL;
- setPlatformData(pd);
- }
-
-} // namespace bgfx
-
-#endif // defined(_SDL_H)
-
#endif // BGFX_PLATFORM_H_HEADER_GUARD
diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h
index c91c5e7ee67..d3faaf4c6e6 100644
--- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h
+++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h
@@ -382,6 +382,7 @@ typedef struct bgfx_texture_info
uint16_t width;
uint16_t height;
uint16_t depth;
+ uint16_t numLayers;
uint8_t numMips;
uint8_t bitsPerPixel;
bool cubeMap;
@@ -566,6 +567,9 @@ BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small);
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
/**/
+BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList);
+
+/**/
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
/**/
@@ -653,31 +657,31 @@ BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle);
/**/
-BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
+BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format);
/**/
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
/**/
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
/**/
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags);
/**/
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
/**/
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
/**/
-BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
+BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
/**/
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
/**/
-BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
+BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
/**/
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data);
@@ -695,6 +699,9 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width,
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
/**/
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures);
+
+/**/
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures);
/**/
diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h
index cfde4834214..ca3679ea4c2 100644
--- a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h
+++ b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h
@@ -98,6 +98,7 @@ typedef struct bgfx_interface_vtbl
void (*set_debug)(uint32_t _debug);
void (*dbg_text_clear)(uint8_t _attr, bool _small);
void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
+ void (*dbg_text_vprintf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList);
void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags);
void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle);
@@ -127,15 +128,15 @@ typedef struct bgfx_interface_vtbl
bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders);
void (*destroy_program)(bgfx_program_handle_t _handle);
- void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
+ void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format);
bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
- bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
- bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
- bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
- bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
- void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
+ bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+ bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags);
+ bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+ bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
+ void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
- void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
+ void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
void (*destroy_texture)(bgfx_texture_handle_t _handle);
bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags);
bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp
index 90c6cee6113..627c90b85b2 100644
--- a/3rdparty/bgfx/src/bgfx.cpp
+++ b/3rdparty/bgfx/src/bgfx.cpp
@@ -352,14 +352,14 @@ namespace bgfx
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) );
- tc.m_format = _format;
- tc.m_cubeMap = false;
- tc.m_mem = NULL;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = 1;
+ tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) );
+ tc.m_format = _format;
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
bx::write(&writer, tc);
rci->destroyTexture(_handle);
@@ -472,7 +472,7 @@ namespace bgfx
uint8_t* rgba = mem->data;
charsetFillTexture(vga8x8, rgba, 8, pitch, bpp);
charsetFillTexture(vga8x16, &rgba[8*pitch], 16, pitch, bpp);
- m_texture = createTexture2D(width, height, 1, TextureFormat::R8
+ m_texture = createTexture2D(width, height, false, 1, TextureFormat::R8
, BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
| BGFX_TEXTURE_MIP_POINT
@@ -1101,6 +1101,8 @@ namespace bgfx
CAPS_FLAGS(BGFX_CAPS_OCCLUSION_QUERY),
CAPS_FLAGS(BGFX_CAPS_ALPHA_TO_COVERAGE),
CAPS_FLAGS(BGFX_CAPS_CONSERVATIVE_RASTER),
+ CAPS_FLAGS(BGFX_CAPS_TEXTURE_2D_ARRAY),
+ CAPS_FLAGS(BGFX_CAPS_TEXTURE_CUBE_ARRAY),
#undef CAPS_FLAGS
};
@@ -2882,7 +2884,7 @@ error:
s_ctx->destroyProgram(_handle);
}
- void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, TextureFormat::Enum _format)
+ void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format)
{
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
const uint8_t bpp = blockInfo.bitsPerPixel;
@@ -2894,15 +2896,15 @@ error:
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
_depth = bx::uint16_max(1, _depth);
- _numMips = uint8_t(bx::uint16_max(1, _numMips) );
+ const uint8_t numMips = calcNumMips(_hasMips, _width, _height, _depth);
+ const uint32_t sides = _cubeMap ? 6 : 1;
uint32_t width = _width;
uint32_t height = _height;
uint32_t depth = _depth;
- uint32_t sides = _cubeMap ? 6 : 1;
uint32_t size = 0;
- for (uint32_t lod = 0; lod < _numMips; ++lod)
+ for (uint32_t lod = 0; lod < numMips; ++lod)
{
width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth);
height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight);
@@ -2915,12 +2917,15 @@ error:
depth >>= 1;
}
+ size *= _numLayers;
+
_info.format = _format;
_info.width = _width;
_info.height = _height;
_info.depth = _depth;
- _info.numMips = _numMips;
- _info.cubeMap = _cubeMap;
+ _info.numMips = numMips;
+ _info.numLayers = _numLayers;
+ _info.cubeMap = _cubeMap;
_info.storageSize = size;
_info.bitsPerPixel = bpp;
}
@@ -2950,7 +2955,7 @@ error:
_height = bx::uint16_max(1, _height);
}
- static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
+ static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BGFX_CHECK_MAIN_THREAD();
@@ -2961,6 +2966,12 @@ error:
, "Format %s is not supported for 2D texture. Use bgfx::getCaps to check available texture formats."
, getName(_format)
);
+ BX_CHECK(false
+ || 1 >= _numLayers
+ || 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_2D_ARRAY)
+ , "_numLayers is %d. Texture 2D array is not supported! Use bgfx::getCaps to check BGFX_CAPS_TEXTURE_2D_ARRAY backend renderer capabilities."
+ , _numLayers
+ );
if (BackbufferRatio::Count != _ratio)
{
@@ -2969,13 +2980,14 @@ error:
getTextureSizeFromRatio(_ratio, _width, _height);
}
- _numMips = calcNumMips(_numMips, _width, _height);
+ const uint8_t numMips = calcNumMips(_hasMips, _width, _height);
+ _numLayers = bx::uint16_max(_numLayers, 1);
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& NULL != _mem)
{
TextureInfo ti;
- calcTextureSize(ti, _width, _height, 1, false, _numMips, _format);
+ calcTextureSize(ti, _width, _height, 1, false, _hasMips, _numLayers, _format);
BX_CHECK(ti.storageSize == _mem->size
, "createTexture2D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
, ti.storageSize
@@ -2991,32 +3003,32 @@ error:
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = _format;
- tc.m_cubeMap = false;
- tc.m_mem = _mem;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = _numLayers;
+ tc.m_numMips = numMips;
+ tc.m_format = _format;
+ tc.m_cubeMap = false;
+ tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, _ratio);
}
- TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
+ TextureHandle createTexture2D(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BX_CHECK(_width > 0 && _height > 0, "Invalid texture size (width %d, height %d).", _width, _height);
- return createTexture2D(BackbufferRatio::Count, _width, _height, _numMips, _format, _flags, _mem);
+ return createTexture2D(BackbufferRatio::Count, _width, _height, _hasMips, _numLayers, _format, _flags, _mem);
}
- TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags)
+ TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags)
{
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
- return createTexture2D(_ratio, 0, 0, _numMips, _format, _flags, NULL);
+ return createTexture2D(_ratio, 0, 0, _hasMips, _numLayers, _format, _flags, NULL);
}
- TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
+ TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_3D, "Texture3D is not supported!");
@@ -3025,13 +3037,13 @@ error:
, getName(_format)
);
- _numMips = calcNumMips(_numMips, _width, _height, _depth);
+ const uint8_t numMips = calcNumMips(_hasMips, _width, _height, _depth);
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& NULL != _mem)
{
TextureInfo ti;
- calcTextureSize(ti, _width, _height, _depth, false, _numMips, _format);
+ calcTextureSize(ti, _width, _height, _depth, false, _hasMips, 1, _format);
BX_CHECK(ti.storageSize == _mem->size
, "createTexture3D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
, ti.storageSize
@@ -3047,34 +3059,41 @@ error:
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = _depth;
- tc.m_numMips = _numMips;
- tc.m_format = _format;
- tc.m_cubeMap = false;
- tc.m_mem = _mem;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = _depth;
+ tc.m_numLayers = 1;
+ tc.m_numMips = numMips;
+ tc.m_format = _format;
+ tc.m_cubeMap = false;
+ tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
}
- TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
+ TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 != (g_caps.formats[_format] & (BGFX_CAPS_FORMAT_TEXTURE_CUBE|BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED|BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB) )
, "Format %s is not supported for cube texture. Use bgfx::getCaps to check available texture formats."
, getName(_format)
);
+ BX_CHECK(false
+ || 1 >= _numLayers
+ || 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_CUBE_ARRAY)
+ , "_numLayers is %d. Texture cube array is not supported! Use bgfx::getCaps to check BGFX_CAPS_TEXTURE_CUBE_ARRAY backend renderer capabilities."
+ , _numLayers
+ );
- _numMips = calcNumMips(_numMips, _size, _size);
+ const uint8_t numMips = calcNumMips(_hasMips, _size, _size);
+ _numLayers = bx::uint16_max(_numLayers, 1);
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& NULL != _mem)
{
TextureInfo ti;
- calcTextureSize(ti, _size, _size, 1, true, _numMips, _format);
+ calcTextureSize(ti, _size, _size, 1, true, _hasMips, _numLayers, _format);
BX_CHECK(ti.storageSize == _mem->size
, "createTextureCube: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
, ti.storageSize
@@ -3090,14 +3109,14 @@ error:
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _size;
- tc.m_height = _size;
- tc.m_sides = 6;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = _format;
- tc.m_cubeMap = true;
- tc.m_mem = _mem;
+ tc.m_width = _size;
+ tc.m_height = _size;
+ tc.m_depth = 0;
+ tc.m_numLayers = _numLayers;
+ tc.m_numMips = numMips;
+ tc.m_format = _format;
+ tc.m_cubeMap = true;
+ tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
@@ -3109,7 +3128,7 @@ error:
s_ctx->destroyTexture(_handle);
}
- void updateTexture2D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
+ void updateTexture2D(TextureHandle _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(NULL != _mem, "_mem can't be NULL");
@@ -3120,7 +3139,7 @@ error:
}
else
{
- s_ctx->updateTexture(_handle, 0, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
+ s_ctx->updateTexture(_handle, 0, _mip, _x, _y, _layer, _width, _height, 1, _pitch, _mem);
}
}
@@ -3142,7 +3161,7 @@ error:
}
}
- void updateTextureCube(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
+ void updateTextureCube(TextureHandle _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(NULL != _mem, "_mem can't be NULL");
@@ -3154,7 +3173,7 @@ error:
}
else
{
- s_ctx->updateTexture(_handle, _side, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
+ s_ctx->updateTexture(_handle, _side, _mip, _x, _y, _layer, _width, _height, 1, _pitch, _mem);
}
}
@@ -3177,7 +3196,7 @@ error:
FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags)
{
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
- TextureHandle th = createTexture2D(_width, _height, 1, _format, _textureFlags);
+ TextureHandle th = createTexture2D(_width, _height, false, 1, _format, _textureFlags);
return createFrameBuffer(1, &th, true);
}
@@ -3185,7 +3204,7 @@ error:
{
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
- TextureHandle th = createTexture2D(_ratio, 1, _format, _textureFlags);
+ TextureHandle th = createTexture2D(_ratio, false, 1, _format, _textureFlags);
return createFrameBuffer(1, &th, true);
}
@@ -3971,6 +3990,11 @@ BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, co
va_end(argList);
}
+BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList)
+{
+ bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, _argList);
+}
+
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch)
{
bgfx::dbgTextImage(_x, _y, _width, _height, _data, _pitch);
@@ -4156,10 +4180,10 @@ BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
bgfx::destroyProgram(handle.cpp);
}
-BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format)
+BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format)
{
bgfx::TextureInfo& info = *(bgfx::TextureInfo*)_info;
- bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _numMips, bgfx::TextureFormat::Enum(_format) );
+ bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format) );
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
@@ -4170,38 +4194,38 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem,
return handle.c;
}
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
- handle.cpp = bgfx::createTexture2D(_width, _height, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
+ handle.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
return handle.c;
}
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags)
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
- handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _numMips, bgfx::TextureFormat::Enum(_format), _flags);
+ handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags);
return handle.c;
}
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
- handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
+ handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
return handle.c;
}
-BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
+BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
- handle.cpp = bgfx::createTextureCube(_size, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
+ handle.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
return handle.c;
}
-BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
+BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
- bgfx::updateTexture2D(handle.cpp, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
+ bgfx::updateTexture2D(handle.cpp, _layer, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
}
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem)
@@ -4210,10 +4234,10 @@ BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _m
bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory*)_mem);
}
-BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
+BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
- bgfx::updateTextureCube(handle.cpp, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
+ bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
}
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data)
@@ -4248,6 +4272,13 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backb
return handle.c;
}
+BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures)
+{
+ union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
+ handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTextures);
+ return handle.c;
+}
+
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
@@ -4655,6 +4686,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
BGFX_IMPORT_FUNC(set_debug) \
BGFX_IMPORT_FUNC(dbg_text_clear) \
BGFX_IMPORT_FUNC(dbg_text_printf) \
+ BGFX_IMPORT_FUNC(dbg_text_vprintf) \
BGFX_IMPORT_FUNC(dbg_text_image) \
BGFX_IMPORT_FUNC(create_index_buffer) \
BGFX_IMPORT_FUNC(destroy_index_buffer) \
diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h
index e624dba372d..561a9fa2c99 100644
--- a/3rdparty/bgfx/src/bgfx_p.h
+++ b/3rdparty/bgfx/src/bgfx_p.h
@@ -320,8 +320,8 @@ namespace bgfx
TextureFormat::Enum m_format;
uint16_t m_width;
uint16_t m_height;
- uint16_t m_sides;
uint16_t m_depth;
+ uint16_t m_numLayers;
uint8_t m_numMips;
bool m_cubeMap;
const Memory* m_mem;
@@ -364,9 +364,9 @@ namespace bgfx
;
}
- inline uint8_t calcNumMips(uint8_t _numMips, uint16_t _width, uint16_t _height, uint16_t _depth = 1)
+ inline uint8_t calcNumMips(bool _hasMips, uint16_t _width, uint16_t _height, uint16_t _depth = 1)
{
- if (1 < _numMips)
+ if (_hasMips)
{
const uint32_t max = bx::uint32_max(bx::uint32_max(_width, _height), _depth);
const uint32_t num = 1 + uint32_t(bx::flog2(float(max) ) );
@@ -3097,7 +3097,8 @@ namespace bgfx
, (uint16_t)imageContainer.m_height
, (uint16_t)imageContainer.m_depth
, imageContainer.m_cubeMap
- , imageContainer.m_numMips
+ , imageContainer.m_numMips > 1
+ , imageContainer.m_numLayers
, TextureFormat::Enum(imageContainer.m_format)
);
}
@@ -3170,7 +3171,7 @@ namespace bgfx
BX_CHECK(BackbufferRatio::Count != textureRef.m_bbRatio, "");
getTextureSizeFromRatio(BackbufferRatio::Enum(textureRef.m_bbRatio), _width, _height);
- _numMips = calcNumMips(_numMips, _width, _height);
+ _numMips = calcNumMips(1 < _numMips, _width, _height);
BX_TRACE("Resize %3d: %4dx%d %s"
, _handle.idx
@@ -3214,7 +3215,19 @@ namespace bgfx
}
}
- BGFX_API_FUNC(void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _pitch, const Memory* _mem) )
+ BGFX_API_FUNC(void updateTexture(
+ TextureHandle _handle
+ , uint8_t _side
+ , uint8_t _mip
+ , uint16_t _x
+ , uint16_t _y
+ , uint16_t _z
+ , uint16_t _width
+ , uint16_t _height
+ , uint16_t _depth
+ , uint16_t _pitch
+ , const Memory* _mem
+ ) )
{
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateTexture);
cmdbuf.write(_handle);
@@ -3223,7 +3236,7 @@ namespace bgfx
Rect rect;
rect.m_x = _x;
rect.m_y = _y;
- rect.m_width = _width;
+ rect.m_width = _width;
rect.m_height = _height;
cmdbuf.write(rect);
cmdbuf.write(_z);
diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh
index e8a909d4be1..f607f17d74e 100644
--- a/3rdparty/bgfx/src/bgfx_shader.sh
+++ b/3rdparty/bgfx/src/bgfx_shader.sh
@@ -98,6 +98,12 @@ struct BgfxUSampler2D
Texture2D<uvec4> m_texture;
};
+struct BgfxSampler2DArray
+{
+ SamplerState m_sampler;
+ Texture2DArray m_texture;
+};
+
struct BgfxSampler2DShadow
{
SamplerComparisonState m_sampler;
@@ -153,6 +159,16 @@ vec4 bgfxTexture2DProj(BgfxSampler2D _sampler, vec4 _coord)
return _sampler.m_texture.Sample(_sampler.m_sampler, coord);
}
+vec4 bgfxTexture2DArray(BgfxSampler2DArray _sampler, vec3 _coord)
+{
+ return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
+}
+
+vec4 bgfxTexture2DArrayLod(BgfxSampler2DArray _sampler, vec3 _coord, float _lod)
+{
+ return _sampler.m_texture.SampleLevel(_sampler.m_sampler, _coord, _lod);
+}
+
float bgfxShadow2D(BgfxSampler2DShadow _sampler, vec3 _coord)
{
return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xy, _coord.z);
@@ -238,6 +254,14 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod)
# define texture2DLod(_sampler, _coord, _level) bgfxTexture2DLod(_sampler, _coord, _level)
# define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
+# define SAMPLER2DARRAY(_name, _reg) \
+ uniform SamplerState _name ## Sampler : register(s[_reg]); \
+ uniform Texture2DArray _name ## Texture : register(t[_reg]); \
+ static BgfxSampler2DArray _name = { _name ## Sampler, _name ## Texture }
+# define sampler2DArray BgfxSampler2DArray
+# define texture2DArray(_sampler, _coord) bgfxTexture2DArray(_sampler, _coord)
+# define texture2DArrayLod(_sampler, _coord, _lod) bgfxTexture2DArrayLod(_sampler, _coord, _lod)
+
# define SAMPLER2DMS(_name, _reg) \
uniform Texture2DMS<vec4> _name ## Texture : register(t[_reg]); \
static BgfxSampler2DMS _name = { _name ## Texture }
@@ -380,50 +404,26 @@ vec4 mod(vec4 _a, vec4 _b) { return _a - _b * floor(_a / _b); }
# define atan2(_x, _y) atan(_x, _y)
# define mul(_a, _b) ( (_a) * (_b) )
# define saturate(_x) clamp(_x, 0.0, 1.0)
-# define SAMPLER2D(_name, _reg) uniform sampler2D _name
-# define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name
-# define SAMPLER3D(_name, _reg) uniform sampler3D _name
-# define SAMPLERCUBE(_name, _reg) uniform samplerCube _name
+# define SAMPLER2D(_name, _reg) uniform sampler2D _name
+# define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name
+# define SAMPLER3D(_name, _reg) uniform sampler3D _name
+# define SAMPLERCUBE(_name, _reg) uniform samplerCube _name
# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name
+# define SAMPLER2DARRAY(_name, _reg) uniform sampler2DArray _name
+# define SAMPLER2DMSARRAY(_name, _reg) uniform sampler2DMSArray _name
+# define SAMPLERCUBEARRAY(_name, _reg) uniform samplerCubeArray _name
+# define SAMPLER2DARRAYSHADOW(_name, _reg) uniform sampler2DArrayShadow _name
+
# if BGFX_SHADER_LANGUAGE_GLSL >= 130
# define ISAMPLER2D(_name, _reg) uniform isampler2D _name
# define USAMPLER2D(_name, _reg) uniform usampler2D _name
# define ISAMPLER3D(_name, _reg) uniform isampler3D _name
# define USAMPLER3D(_name, _reg) uniform usampler3D _name
-vec4 bgfxTexture2D(sampler2D _sampler, vec2 _coord)
-{
- return texture(_sampler, _coord);
-}
-
-ivec4 bgfxTexture2D(isampler2D _sampler, vec2 _coord)
-{
- return texture(_sampler, _coord);
-}
-
-uvec4 bgfxTexture2D(usampler2D _sampler, vec2 _coord)
-{
- return texture(_sampler, _coord);
-}
-
-vec4 bgfxTexture3D(sampler3D _sampler, vec3 _coord)
-{
- return texture(_sampler, _coord);
-}
-
-ivec4 bgfxTexture3D(isampler3D _sampler, vec3 _coord)
-{
- return texture(_sampler, _coord);
-}
-
-uvec4 bgfxTexture3D(usampler3D _sampler, vec3 _coord)
-{
- return texture(_sampler, _coord);
-}
-
-# define texture2D(_sampler, _coord) bgfxTexture2D(_sampler, _coord)
-# define texture3D(_sampler, _coord) bgfxTexture3D(_sampler, _coord)
+# define texture2D(_sampler, _coord) texture(_sampler, _coord)
+# define texture2DArray(_sampler, _coord) texture(_sampler, _coord)
+# define texture3D(_sampler, _coord) texture(_sampler, _coord)
# endif // BGFX_SHADER_LANGUAGE_GLSL >= 130
vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_vec, _mtx); }
diff --git a/3rdparty/bgfx/src/glcontext_nsgl.mm b/3rdparty/bgfx/src/glcontext_nsgl.mm
index ac51bf63157..61a39272253 100644
--- a/3rdparty/bgfx/src/glcontext_nsgl.mm
+++ b/3rdparty/bgfx/src/glcontext_nsgl.mm
@@ -101,7 +101,24 @@ namespace bgfx { namespace gl
NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
[pixelFormat release];
- [nsWindow setContentView:glView];
+ // GLFW creates a helper contentView that handles things like keyboard and drag and
+ // drop events. We don't want to clobber that view if it exists. Instead we just
+ // add ourselves as a subview and make the view resize automatically.
+ NSView *contentView = [nsWindow contentView];
+ if( contentView != nil )
+ {
+ [glView setAutoresizingMask:( NSViewHeightSizable |
+ NSViewWidthSizable |
+ NSViewMinXMargin |
+ NSViewMaxXMargin |
+ NSViewMinYMargin |
+ NSViewMaxYMargin )];
+ [contentView addSubview:glView];
+ }
+ else
+ {
+ [nsWindow setContentView:glView];
+ }
NSOpenGLContext* glContext = [glView openGLContext];
BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
@@ -109,6 +126,12 @@ namespace bgfx { namespace gl
[glContext makeCurrentContext];
GLint interval = 0;
[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
+
+ // When initializing NSOpenGLView programatically (as we are), this sometimes doesn't
+ // get hooked up properly (especially when there are existing window elements). This ensures
+ // we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when
+ // trying to glClear() for the first time.
+ [glContext setView:glView];
m_view = glView;
m_context = glContext;
diff --git a/3rdparty/bgfx/src/hmd_openvr.cpp b/3rdparty/bgfx/src/hmd_openvr.cpp
index 9e360cbf18e..59ae813afe8 100644
--- a/3rdparty/bgfx/src/hmd_openvr.cpp
+++ b/3rdparty/bgfx/src/hmd_openvr.cpp
@@ -5,8 +5,10 @@
#include "hmd_openvr.h"
+BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-variable")
#include <openvr/openvr_capi.h>
+BX_PRAGMA_DIAGNOSTIC_POP()
namespace bgfx
{
diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp
index 4b31a7ba08a..81557c0ea11 100644
--- a/3rdparty/bgfx/src/image.cpp
+++ b/3rdparty/bgfx/src/image.cpp
@@ -263,7 +263,7 @@ namespace bgfx
return numMips;
}
- uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips)
+ uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, uint8_t _numMips)
{
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
const uint8_t bpp = blockInfo.bitsPerPixel;
@@ -275,7 +275,6 @@ namespace bgfx
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
_depth = bx::uint16_max(1, _depth);
- _numMips = uint8_t(bx::uint16_max(1, _numMips) );
uint32_t width = _width;
uint32_t height = _height;
@@ -296,7 +295,7 @@ namespace bgfx
depth >>= 1;
}
- return size;
+ return size * _numLayers;
}
void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst)
@@ -2493,7 +2492,7 @@ namespace bgfx
}
}
- const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _generateMips)
+ const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, bool _generateMips)
{
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
const uint16_t blockWidth = blockInfo.blockWidth;
@@ -2501,27 +2500,29 @@ namespace bgfx
const uint16_t minBlockX = blockInfo.minBlockX;
const uint16_t minBlockY = blockInfo.minBlockY;
- _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
- _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
- _depth = bx::uint16_max(1, _depth);
+ _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
+ _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
+ _depth = bx::uint16_max(1, _depth);
+ _numLayers = bx::uint16_max(1, _numLayers);
const uint8_t numMips = _generateMips ? imageGetNumMips(_format, _width, _height) : 1;
- uint32_t size = imageGetSize(_format, _width, _height, 0, false, numMips);
+ uint32_t size = imageGetSize(_format, _width, _height, _depth, _numLayers, _cubeMap, numMips);
const Memory* image = alloc(size);
- _imageContainer.m_data = image->data;
- _imageContainer.m_format = _format;
- _imageContainer.m_size = image->size;
- _imageContainer.m_offset = 0;
- _imageContainer.m_width = _width;
- _imageContainer.m_height = _height;
- _imageContainer.m_depth = _depth;
- _imageContainer.m_numMips = numMips;
- _imageContainer.m_hasAlpha = false;
- _imageContainer.m_cubeMap = _cubeMap;
- _imageContainer.m_ktx = false;
- _imageContainer.m_ktxLE = false;
- _imageContainer.m_srgb = false;
+ _imageContainer.m_data = image->data;
+ _imageContainer.m_format = _format;
+ _imageContainer.m_size = image->size;
+ _imageContainer.m_offset = 0;
+ _imageContainer.m_width = _width;
+ _imageContainer.m_height = _height;
+ _imageContainer.m_depth = _depth;
+ _imageContainer.m_numLayers = _numLayers;
+ _imageContainer.m_numMips = numMips;
+ _imageContainer.m_hasAlpha = false;
+ _imageContainer.m_cubeMap = _cubeMap;
+ _imageContainer.m_ktx = false;
+ _imageContainer.m_ktxLE = false;
+ _imageContainer.m_srgb = false;
return image;
}
@@ -2792,6 +2793,7 @@ namespace bgfx
bx::skip(_reader, 4); // reserved
uint32_t dxgiFormat = 0;
+ uint32_t arraySize = 1;
if (DDPF_FOURCC == pixelFlags
&& DDS_DX10 == fourcc)
{
@@ -2803,7 +2805,6 @@ namespace bgfx
uint32_t miscFlags;
bx::read(_reader, miscFlags);
- uint32_t arraySize;
bx::read(_reader, arraySize);
uint32_t miscFlags2;
@@ -2872,19 +2873,20 @@ namespace bgfx
}
}
- _imageContainer.m_data = NULL;
- _imageContainer.m_size = 0;
- _imageContainer.m_offset = (uint32_t)bx::seek(_reader);
- _imageContainer.m_width = width;
- _imageContainer.m_height = height;
- _imageContainer.m_depth = depth;
- _imageContainer.m_format = format;
- _imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1);
- _imageContainer.m_hasAlpha = hasAlpha;
- _imageContainer.m_cubeMap = cubeMap;
- _imageContainer.m_ktx = false;
- _imageContainer.m_ktxLE = false;
- _imageContainer.m_srgb = srgb;
+ _imageContainer.m_data = NULL;
+ _imageContainer.m_size = 0;
+ _imageContainer.m_offset = (uint32_t)bx::seek(_reader);
+ _imageContainer.m_width = width;
+ _imageContainer.m_height = height;
+ _imageContainer.m_depth = depth;
+ _imageContainer.m_format = format;
+ _imageContainer.m_numLayers = uint16_t(arraySize);
+ _imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1);
+ _imageContainer.m_hasAlpha = hasAlpha;
+ _imageContainer.m_cubeMap = cubeMap;
+ _imageContainer.m_ktx = false;
+ _imageContainer.m_ktxLE = false;
+ _imageContainer.m_srgb = srgb;
return TextureFormat::Unknown != format;
}
@@ -3178,19 +3180,20 @@ namespace bgfx
}
}
- _imageContainer.m_data = NULL;
- _imageContainer.m_size = 0;
- _imageContainer.m_offset = (uint32_t)offset;
- _imageContainer.m_width = width;
- _imageContainer.m_height = height;
- _imageContainer.m_depth = depth;
- _imageContainer.m_format = format;
- _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
- _imageContainer.m_hasAlpha = hasAlpha;
- _imageContainer.m_cubeMap = numFaces > 1;
- _imageContainer.m_ktx = true;
- _imageContainer.m_ktxLE = fromLittleEndian;
- _imageContainer.m_srgb = false;
+ _imageContainer.m_data = NULL;
+ _imageContainer.m_size = 0;
+ _imageContainer.m_offset = (uint32_t)offset;
+ _imageContainer.m_width = width;
+ _imageContainer.m_height = height;
+ _imageContainer.m_depth = depth;
+ _imageContainer.m_format = format;
+ _imageContainer.m_numLayers = uint16_t(bx::uint32_max(numberOfArrayElements, 1) );
+ _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
+ _imageContainer.m_hasAlpha = hasAlpha;
+ _imageContainer.m_cubeMap = numFaces > 1;
+ _imageContainer.m_ktx = true;
+ _imageContainer.m_ktxLE = fromLittleEndian;
+ _imageContainer.m_srgb = false;
return TextureFormat::Unknown != format;
}
@@ -3327,19 +3330,20 @@ namespace bgfx
}
}
- _imageContainer.m_data = NULL;
- _imageContainer.m_size = 0;
- _imageContainer.m_offset = (uint32_t)offset;
- _imageContainer.m_width = width;
- _imageContainer.m_height = height;
- _imageContainer.m_depth = depth;
- _imageContainer.m_format = format;
- _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
- _imageContainer.m_hasAlpha = hasAlpha;
- _imageContainer.m_cubeMap = numFaces > 1;
- _imageContainer.m_ktx = false;
- _imageContainer.m_ktxLE = false;
- _imageContainer.m_srgb = colorSpace > 0;
+ _imageContainer.m_data = NULL;
+ _imageContainer.m_size = 0;
+ _imageContainer.m_offset = (uint32_t)offset;
+ _imageContainer.m_width = width;
+ _imageContainer.m_height = height;
+ _imageContainer.m_depth = depth;
+ _imageContainer.m_format = format;
+ _imageContainer.m_numLayers = 1;
+ _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
+ _imageContainer.m_hasAlpha = hasAlpha;
+ _imageContainer.m_cubeMap = numFaces > 1;
+ _imageContainer.m_ktx = false;
+ _imageContainer.m_ktxLE = false;
+ _imageContainer.m_srgb = colorSpace > 0;
return TextureFormat::Unknown != format;
}
@@ -3378,15 +3382,16 @@ namespace bgfx
_imageContainer.m_data = tc.m_mem->data;
_imageContainer.m_size = tc.m_mem->size;
}
- _imageContainer.m_width = tc.m_width;
- _imageContainer.m_height = tc.m_height;
- _imageContainer.m_depth = tc.m_depth;
- _imageContainer.m_numMips = tc.m_numMips;
- _imageContainer.m_hasAlpha = false;
- _imageContainer.m_cubeMap = tc.m_cubeMap;
- _imageContainer.m_ktx = false;
- _imageContainer.m_ktxLE = false;
- _imageContainer.m_srgb = false;
+ _imageContainer.m_width = tc.m_width;
+ _imageContainer.m_height = tc.m_height;
+ _imageContainer.m_depth = tc.m_depth;
+ _imageContainer.m_numLayers = tc.m_numLayers;
+ _imageContainer.m_numMips = tc.m_numMips;
+ _imageContainer.m_hasAlpha = false;
+ _imageContainer.m_cubeMap = tc.m_cubeMap;
+ _imageContainer.m_ktx = false;
+ _imageContainer.m_ktxLE = false;
+ _imageContainer.m_srgb = false;
return true;
}
@@ -3763,7 +3768,7 @@ namespace bgfx
}
}
- bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip)
+ bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip)
{
uint32_t offset = _imageContainer.m_offset;
TextureFormat::Enum format = TextureFormat::Enum(_imageContainer.m_format);
@@ -3790,6 +3795,7 @@ namespace bgfx
}
const uint8_t* data = (const uint8_t*)_data;
+ const uint16_t numSides = _imageContainer.m_numLayers * (_imageContainer.m_cubeMap ? 6 : 1);
if (_imageContainer.m_ktx)
{
@@ -3799,7 +3805,7 @@ namespace bgfx
for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod)
{
- uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE);
+ uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE) / _imageContainer.m_numLayers;
offset += sizeof(uint32_t);
width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth);
@@ -3809,7 +3815,7 @@ namespace bgfx
uint32_t size = width*height*depth*bpp/8;
BX_CHECK(size == imageSize, "KTX: Image size mismatch %d (expected %d).", size, imageSize);
- for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
+ for (uint16_t side = 0; side < numSides; ++side)
{
if (side == _side
&& lod == _lod)
@@ -3838,7 +3844,7 @@ namespace bgfx
}
else
{
- for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
+ for (uint16_t side = 0; side < numSides; ++side)
{
uint32_t width = _imageContainer.m_width;
uint32_t height = _imageContainer.m_height;
@@ -3932,19 +3938,19 @@ namespace bgfx
int32_t size = 0;
size += bx::write(_writer, "\xabKTX 11\xbb\r\n\x1a\n", 12, _err);
- size += bx::write(_writer, UINT32_C(0x04030201), _err);
- size += bx::write(_writer, UINT32_C(0), _err); // glType
- size += bx::write(_writer, UINT32_C(1), _err); // glTypeSize
- size += bx::write(_writer, UINT32_C(0), _err); // glFormat
+ size += bx::write(_writer, uint32_t(0x04030201), _err);
+ size += bx::write(_writer, uint32_t(0), _err); // glType
+ size += bx::write(_writer, uint32_t(1), _err); // glTypeSize
+ size += bx::write(_writer, uint32_t(0), _err); // glFormat
size += bx::write(_writer, tfi.m_internalFmt, _err); // glInternalFormat
size += bx::write(_writer, tfi.m_fmt, _err); // glBaseInternalFormat
size += bx::write(_writer, _width, _err);
size += bx::write(_writer, _height, _err);
size += bx::write(_writer, _depth, _err);
- size += bx::write(_writer, UINT32_C(0), _err); // numberOfArrayElements
- size += bx::write(_writer, _cubeMap ? UINT32_C(6) : UINT32_C(0), _err);
+ size += bx::write(_writer, uint32_t(0), _err); // numberOfArrayElements
+ size += bx::write(_writer, _cubeMap ? uint32_t(6) : uint32_t(0), _err);
size += bx::write(_writer, uint32_t(_numMips), _err);
- size += bx::write(_writer, UINT32_C(0), _err); // Meta-data size.
+ size += bx::write(_writer, uint32_t(0), _err); // Meta-data size.
BX_WARN(size == 64, "KTX: Failed to write header size %d (expected: %d).", size, 64);
return size;
diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h
index 64bbf1c5f29..d9479bb82c4 100644
--- a/3rdparty/bgfx/src/image.h
+++ b/3rdparty/bgfx/src/image.h
@@ -19,6 +19,7 @@ namespace bgfx
uint32_t m_width;
uint32_t m_height;
uint32_t m_depth;
+ uint16_t m_numLayers;
uint8_t m_numMips;
bool m_hasAlpha;
bool m_cubeMap;
@@ -294,10 +295,23 @@ namespace bgfx
TextureFormat::Enum getFormat(const char* _name);
/// Returns number of mip-maps required for complete mip-map chain.
- uint8_t imageGetNumMips(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0);
+ uint8_t imageGetNumMips(
+ TextureFormat::Enum _format
+ , uint16_t _width
+ , uint16_t _height
+ , uint16_t _depth = 0
+ );
/// Returns image size.
- uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, uint8_t _numMips = 0);
+ uint32_t imageGetSize(
+ TextureFormat::Enum _format
+ , uint16_t _width
+ , uint16_t _height
+ , uint16_t _depth = 0
+ , uint16_t _numLayers = 1
+ , bool _cubeMap = false
+ , uint8_t _numMips = 1
+ );
///
void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst);
@@ -342,7 +356,16 @@ namespace bgfx
bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height);
///
- const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _generateMips = false);
+ const Memory* imageAlloc(
+ ImageContainer& _imageContainer
+ , TextureFormat::Enum _format
+ , uint16_t _width
+ , uint16_t _height
+ , uint16_t _depth = 0
+ , uint16_t _numLayers = 1
+ , bool _cubeMap = false
+ , bool _generateMips = false
+ );
///
void imageFree(const Memory* _memory);
@@ -372,7 +395,7 @@ namespace bgfx
void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format);
///
- bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip);
+ bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip);
} // namespace bgfx
diff --git a/3rdparty/bgfx/src/renderer_d3d.h b/3rdparty/bgfx/src/renderer_d3d.h
index 97cfb045821..f52fe6a87f6 100644
--- a/3rdparty/bgfx/src/renderer_d3d.h
+++ b/3rdparty/bgfx/src/renderer_d3d.h
@@ -96,6 +96,14 @@ namespace bgfx
# define PIX_ENDEVENT()
#endif // BGFX_CONFIG_DEBUG_PIX
+#define D3DCOLOR_FRAME D3DCOLOR_RGBA(0xff, 0xd7, 0xc9, 0xff)
+#define D3DCOLOR_VIEW D3DCOLOR_RGBA(0xe4, 0xb4, 0x8e, 0xff)
+#define D3DCOLOR_VIEW_L D3DCOLOR_RGBA(0xf9, 0xee, 0xe5, 0xff)
+#define D3DCOLOR_VIEW_R D3DCOLOR_RGBA(0xe8, 0xd3, 0xc0, 0xff)
+#define D3DCOLOR_DRAW D3DCOLOR_RGBA(0xc6, 0xe5, 0xb9, 0xff)
+#define D3DCOLOR_COMPUTE D3DCOLOR_RGBA(0xa7, 0xdb, 0xd8, 0xff)
+#define D3DCOLOR_MARKER D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff)
+
inline int getRefCount(IUnknown* _interface)
{
_interface->AddRef();
diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp
index 5e6fb036dde..6bab23dd024 100644
--- a/3rdparty/bgfx/src/renderer_d3d11.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d11.cpp
@@ -1251,6 +1251,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
| ( (m_featureLevel >= D3D_FEATURE_LEVEL_9_2) ? BGFX_CAPS_OCCLUSION_QUERY : 0)
| BGFX_CAPS_ALPHA_TO_COVERAGE
| ( (m_deviceInterfaceVersion >= 3) ? BGFX_CAPS_CONSERVATIVE_RASTER : 0)
+ | BGFX_CAPS_TEXTURE_2D_ARRAY
+ | BGFX_CAPS_TEXTURE_CUBE_ARRAY
);
m_timerQuerySupport = m_featureLevel >= D3D_FEATURE_LEVEL_10_0;
@@ -1850,14 +1852,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
- tc.m_cubeMap = false;
- tc.m_mem = NULL;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = 1;
+ tc.m_numMips = _numMips;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@@ -2030,7 +2032,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
uint32_t size = _size*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
- PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
+ PIX_SETMARKER(D3DCOLOR_MARKER, name);
}
}
@@ -4117,23 +4119,23 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
for (uint32_t ii = 0; ii < count; ++ii)
{
- uint8_t nameSize;
+ uint8_t nameSize = 0;
bx::read(&reader, nameSize);
- char name[256];
+ char name[256] = { '\0' };
bx::read(&reader, &name, nameSize);
name[nameSize] = '\0';
- uint8_t type;
+ uint8_t type = 0;
bx::read(&reader, type);
- uint8_t num;
+ uint8_t num = 0;
bx::read(&reader, num);
- uint16_t regIndex;
+ uint16_t regIndex = 0;
bx::read(&reader, regIndex);
- uint16_t regCount;
+ uint16_t regCount = 0;
bx::read(&reader, regCount);
const char* kind = "invalid";
@@ -4211,7 +4213,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create compute shader.");
}
- uint8_t numAttrs;
+ uint8_t numAttrs = 0;
bx::read(&reader, numAttrs);
memset(m_attrMask, 0, sizeof(m_attrMask) );
@@ -4257,6 +4259,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
+ const uint16_t numLayers = imageContainer.m_numLayers;
m_flags = _flags;
m_width = textureWidth;
@@ -4282,7 +4285,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
m_numMips = numMips;
- uint32_t numSrd = numMips*(imageContainer.m_cubeMap ? 6 : 1);
+ const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
+ const uint32_t numSrd = numSides * numMips;
D3D11_SUBRESOURCE_DATA* srd = (D3D11_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D11_SUBRESOURCE_DATA) );
uint32_t kk = 0;
@@ -4290,10 +4294,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
- BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s%s."
+ BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s%s%s."
, getHandle()
, getName( (TextureFormat::Enum)m_textureFormat)
, getName( (TextureFormat::Enum)m_requestedFormat)
+ , numLayers
, textureWidth
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
@@ -4301,7 +4306,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
, swizzle ? " (swizzle BGRA8 -> RGBA8)" : ""
);
- for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
+ for (uint16_t side = 0; side < numSides; ++side)
{
uint32_t width = textureWidth;
uint32_t height = textureHeight;
@@ -4403,6 +4408,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
desc.Width = textureWidth;
desc.Height = textureHeight;
desc.MipLevels = numMips;
+ desc.ArraySize = numSides;
desc.Format = format;
desc.SampleDesc = msaa;
desc.Usage = kk == 0 || blit ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
@@ -4439,22 +4445,46 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (imageContainer.m_cubeMap)
{
- desc.ArraySize = 6;
desc.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE;
- srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
- srvd.TextureCube.MipLevels = numMips;
+ if (1 < numLayers)
+ {
+ srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY;
+ srvd.TextureCubeArray.MipLevels = numMips;
+ srvd.TextureCubeArray.NumCubes = numLayers;
+ }
+ else
+ {
+ srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ srvd.TextureCube.MipLevels = numMips;
+ }
}
else
{
- desc.ArraySize = 1;
if (msaaSample)
{
- srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ if (1 < numLayers)
+ {
+ srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY;
+ srvd.Texture2DMSArray.ArraySize = numLayers;
+ }
+ else
+ {
+ srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ }
}
else
{
- srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
- srvd.Texture2D.MipLevels = numMips;
+ if (1 < numLayers)
+ {
+ srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvd.Texture2DArray.MipLevels = numMips;
+ srvd.Texture2DArray.ArraySize = numLayers;
+ }
+ else
+ {
+ srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvd.Texture2D.MipLevels = numMips;
+ }
}
}
@@ -4510,7 +4540,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
&& 0 != kk)
{
kk = 0;
- for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
+ for (uint16_t side = 0; side < numSides; ++side)
{
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
{
@@ -4552,10 +4582,22 @@ BX_PRAGMA_DIAGNOSTIC_POP();
box.top = _rect.m_y;
box.right = box.left + _rect.m_width;
box.bottom = box.top + _rect.m_height;
- box.front = _z;
- box.back = box.front + _depth;
- const uint32_t subres = _mip + (_side * m_numMips);
+ uint32_t layer = 0;
+
+ if (TextureD3D11::Texture3D == m_type)
+ {
+ box.front = _z;
+ box.back = box.front + _depth;
+ }
+ else
+ {
+ layer = _z * (TextureD3D11::TextureCube == m_type ? 6 : 1);
+ box.front = 0;
+ box.back = 1;
+ }
+
+ const uint32_t subres = _mip + ( (layer + _side) * m_numMips);
const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
const uint32_t rectpitch = _rect.m_width*bpp/8;
const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch;
@@ -5104,7 +5146,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
renderDocTriggerCapture();
}
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
+ PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
BGFX_GPU_PROFILER_BEGIN_DYNAMIC("rendererSubmit");
ID3D11DeviceContext* deviceCtx = m_deviceCtx;
@@ -5255,7 +5297,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L' ';
viewNameW[4] = eye ? L'R' : L'L';
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+ PIX_BEGINEVENT(0 == ( (view*2+eye)&1)
+ ? D3DCOLOR_VIEW_L
+ : D3DCOLOR_VIEW_R
+ , viewNameW
+ );
}
if (m_ovr.isEnabled() )
@@ -5276,7 +5322,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L' ';
viewNameW[4] = L' ';
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+ PIX_BEGINEVENT(D3DCOLOR_VIEW, viewNameW);
}
}
@@ -5387,7 +5433,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L'C';
PIX_ENDEVENT();
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+ PIX_BEGINEVENT(D3DCOLOR_COMPUTE, viewNameW);
}
deviceCtx->IASetVertexBuffers(0, 2, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero);
@@ -5539,7 +5585,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L' ';
PIX_ENDEVENT();
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+ PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
programIdx = invalidHandle;
@@ -5988,7 +6034,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L'C';
PIX_ENDEVENT();
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+ PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
invalidateCompute();
@@ -6058,7 +6104,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+ PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
TextVideoMem& tvm = m_textVideoMem;
@@ -6192,7 +6238,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
else if (_render->m_debug & BGFX_DEBUG_TEXT)
{
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+ PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp
index 5624dc5dc58..f66e735e38f 100644
--- a/3rdparty/bgfx/src/renderer_d3d12.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d12.cpp
@@ -1008,6 +1008,8 @@ namespace bgfx { namespace d3d12
| BGFX_CAPS_TEXTURE_READ_BACK
| BGFX_CAPS_OCCLUSION_QUERY
| BGFX_CAPS_ALPHA_TO_COVERAGE
+ | BGFX_CAPS_TEXTURE_2D_ARRAY
+ | BGFX_CAPS_TEXTURE_CUBE_ARRAY
);
g_caps.maxTextureSize = 16384;
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
@@ -1476,14 +1478,14 @@ namespace bgfx { namespace d3d12
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
- tc.m_cubeMap = false;
- tc.m_mem = NULL;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = 1;
+ tc.m_numMips = _numMips;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@@ -3844,23 +3846,23 @@ data.NumQualityLevels = 0;
{
for (uint32_t ii = 0; ii < count; ++ii)
{
- uint8_t nameSize;
+ uint8_t nameSize = 0;
bx::read(&reader, nameSize);
- char name[256];
+ char name[256] = {};
bx::read(&reader, &name, nameSize);
name[nameSize] = '\0';
- uint8_t type;
+ uint8_t type = 0;
bx::read(&reader, type);
- uint8_t num;
+ uint8_t num = 0;
bx::read(&reader, num);
- uint16_t regIndex;
+ uint16_t regIndex = 0;
bx::read(&reader, regIndex);
- uint16_t regCount;
+ uint16_t regCount = 0;
bx::read(&reader, regCount);
const char* kind = "invalid";
@@ -3920,7 +3922,7 @@ data.NumQualityLevels = 0;
m_code = copy(code, shaderSize);
- uint8_t numAttrs;
+ uint8_t numAttrs = 0;
bx::read(&reader, numAttrs);
memset(m_attrMask, 0, sizeof(m_attrMask) );
@@ -3961,6 +3963,7 @@ data.NumQualityLevels = 0;
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
+ const uint16_t numLayers = imageContainer.m_numLayers;
m_flags = _flags;
m_width = textureWidth;
@@ -3985,9 +3988,8 @@ data.NumQualityLevels = 0;
}
m_numMips = numMips;
- const uint16_t numSides = imageContainer.m_cubeMap ? 6 : 1;
-
- uint32_t numSrd = numMips*numSides;
+ const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
+ const uint32_t numSrd = numSides * numMips;
D3D12_SUBRESOURCE_DATA* srd = (D3D12_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D12_SUBRESOURCE_DATA) );
uint32_t kk = 0;
@@ -4185,15 +4187,63 @@ data.NumQualityLevels = 0;
switch (m_type)
{
case Texture2D:
+ case TextureCube:
resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- m_srvd.ViewDimension = 1 < msaa.Count ? D3D12_SRV_DIMENSION_TEXTURE2DMS : D3D12_SRV_DIMENSION_TEXTURE2D;
- m_srvd.Texture2D.MostDetailedMip = 0;
- m_srvd.Texture2D.MipLevels = numMips;
- m_srvd.Texture2D.ResourceMinLODClamp = 0.0f;
-
- m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
- m_uavd.Texture2D.MipSlice = 0;
- m_uavd.Texture2D.PlaneSlice = 0;
+ if (imageContainer.m_cubeMap)
+ {
+ if (1 < numLayers)
+ {
+ m_srvd.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBEARRAY;
+ m_srvd.TextureCubeArray.MostDetailedMip = 0;
+ m_srvd.TextureCubeArray.MipLevels = numMips;
+ m_srvd.TextureCubeArray.ResourceMinLODClamp = 0.0f;
+ m_srvd.TextureCubeArray.NumCubes = numLayers;
+ }
+ else
+ {
+ m_srvd.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE;
+ m_srvd.TextureCube.MostDetailedMip = 0;
+ m_srvd.TextureCube.MipLevels = numMips;
+ m_srvd.TextureCube.ResourceMinLODClamp = 0.0f;
+ }
+ }
+ else
+ {
+ if (1 < numLayers)
+ {
+ m_srvd.ViewDimension = 1 < msaa.Count
+ ? D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY
+ : D3D12_SRV_DIMENSION_TEXTURE2DARRAY
+ ;
+ m_srvd.Texture2DArray.MostDetailedMip = 0;
+ m_srvd.Texture2DArray.MipLevels = numMips;
+ m_srvd.Texture2DArray.ResourceMinLODClamp = 0.0f;
+ m_srvd.Texture2DArray.ArraySize = numLayers;
+ }
+ else
+ {
+ m_srvd.ViewDimension = 1 < msaa.Count
+ ? D3D12_SRV_DIMENSION_TEXTURE2DMS
+ : D3D12_SRV_DIMENSION_TEXTURE2D
+ ;
+ m_srvd.Texture2D.MostDetailedMip = 0;
+ m_srvd.Texture2D.MipLevels = numMips;
+ m_srvd.Texture2D.ResourceMinLODClamp = 0.0f;
+ }
+ }
+
+ if (1 < numLayers)
+ {
+ m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
+ m_uavd.Texture2DArray.MipSlice = 0;
+ m_uavd.Texture2DArray.PlaneSlice = 0;
+ }
+ else
+ {
+ m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
+ m_uavd.Texture2D.MipSlice = 0;
+ m_uavd.Texture2D.PlaneSlice = 0;
+ }
break;
case Texture3D:
@@ -4208,18 +4258,6 @@ data.NumQualityLevels = 0;
m_uavd.Texture3D.FirstWSlice = 0;
m_uavd.Texture3D.WSize = 0;
break;
-
- case TextureCube:
- resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
- m_srvd.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE;
- m_srvd.TextureCube.MostDetailedMip = 0;
- m_srvd.TextureCube.MipLevels = numMips;
- m_srvd.TextureCube.ResourceMinLODClamp = 0.0f;
-
- m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
- m_uavd.Texture2D.MipSlice = 0;
- m_uavd.Texture2D.PlaneSlice = 0;
- break;
}
m_ptr = createCommittedResource(device, HeapProperty::Default, &resourceDesc, clearValue);
@@ -4697,7 +4735,7 @@ data.NumQualityLevels = 0;
void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter)
{
-// PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
+// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
updateResolution(_render->m_resolution);
@@ -5133,7 +5171,7 @@ data.NumQualityLevels = 0;
// wchar_t* viewNameW = s_viewNameW[view];
// viewNameW[3] = L' ';
// PIX_ENDEVENT();
-// PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+// PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
commandListChanged = true;
@@ -5433,7 +5471,7 @@ data.NumQualityLevels = 0;
if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
{
-// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
TextVideoMem& tvm = m_textVideoMem;
@@ -5599,7 +5637,7 @@ data.NumQualityLevels = 0;
}
else if (_render->m_debug & BGFX_DEBUG_TEXT)
{
-// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp
index 81e53cecba1..be388785ada 100644
--- a/3rdparty/bgfx/src/renderer_d3d9.cpp
+++ b/3rdparty/bgfx/src/renderer_d3d9.cpp
@@ -1031,14 +1031,14 @@ namespace bgfx { namespace d3d9
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
- tc.m_cubeMap = false;
- tc.m_mem = NULL;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = 1;
+ tc.m_numMips = _numMips;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy(true);
@@ -1191,7 +1191,7 @@ namespace bgfx { namespace d3d9
uint32_t size = _size*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
- PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
+ PIX_SETMARKER(D3DCOLOR_MARKER, name);
#endif // BGFX_CONFIG_DEBUG_PIX
BX_UNUSED(_marker, _size);
}
@@ -2393,23 +2393,23 @@ namespace bgfx { namespace d3d9
{
for (uint32_t ii = 0; ii < count; ++ii)
{
- uint8_t nameSize;
+ uint8_t nameSize = 0;
bx::read(&reader, nameSize);
- char name[256];
+ char name[256] = {};
bx::read(&reader, &name, nameSize);
name[nameSize] = '\0';
- uint8_t type;
+ uint8_t type = 0;
bx::read(&reader, type);
- uint8_t num;
+ uint8_t num = 0;
bx::read(&reader, num);
- uint16_t regIndex;
+ uint16_t regIndex = 0;
bx::read(&reader, regIndex);
- uint16_t regCount;
+ uint16_t regCount = 0;
bx::read(&reader, regCount);
const char* kind = "invalid";
@@ -3522,7 +3522,7 @@ namespace bgfx { namespace d3d9
{
IDirect3DDevice9* device = m_device;
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
+ PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
updateResolution(_render->m_resolution);
@@ -3633,7 +3633,7 @@ namespace bgfx { namespace d3d9
currentState.m_stencil = newStencil;
PIX_ENDEVENT();
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
+ PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[key.m_view]);
if (item > 0)
{
BGFX_PROFILER_END();
@@ -4224,7 +4224,7 @@ namespace bgfx { namespace d3d9
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+ PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
TextVideoMem& tvm = m_textVideoMem;
@@ -4314,7 +4314,7 @@ namespace bgfx { namespace d3d9
}
else if (_render->m_debug & BGFX_DEBUG_TEXT)
{
- PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+ PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp
index 0fea6a7c9d8..75e3a4ef3a7 100644
--- a/3rdparty/bgfx/src/renderer_gl.cpp
+++ b/3rdparty/bgfx/src/renderer_gl.cpp
@@ -500,6 +500,7 @@ namespace bgfx { namespace gl
ARB_shader_texture_lod,
ARB_texture_compression_bptc,
ARB_texture_compression_rgtc,
+ ARB_texture_cube_map_array,
ARB_texture_float,
ARB_texture_multisample,
ARB_texture_rg,
@@ -555,6 +556,7 @@ namespace bgfx { namespace gl
EXT_texture_compression_latc,
EXT_texture_compression_rgtc,
EXT_texture_compression_s3tc,
+ EXT_texture_cube_map_array,
EXT_texture_filter_anisotropic,
EXT_texture_format_BGRA8888,
EXT_texture_rg,
@@ -614,6 +616,7 @@ namespace bgfx { namespace gl
OES_texture_half_float,
OES_texture_half_float_linear,
OES_texture_stencil8,
+ OES_texture_storage_multisample_2d_array,
OES_vertex_array_object,
OES_vertex_half_float,
OES_vertex_type_10_10_10_2,
@@ -659,185 +662,188 @@ namespace bgfx { namespace gl
//
static Extension s_extension[] =
{
- { "AMD_conservative_depth", false, true },
- { "AMD_multi_draw_indirect", false, true },
-
- { "ANGLE_depth_texture", false, true },
- { "ANGLE_framebuffer_blit", false, true },
- { "ANGLE_framebuffer_multisample", false, false },
- { "ANGLE_instanced_arrays", false, true },
- { "ANGLE_texture_compression_dxt1", false, true },
- { "ANGLE_texture_compression_dxt3", false, true },
- { "ANGLE_texture_compression_dxt5", false, true },
- { "ANGLE_timer_query", false, true },
- { "ANGLE_translated_shader_source", false, true },
-
- { "APPLE_texture_format_BGRA8888", false, true },
- { "APPLE_texture_max_level", false, true },
-
- { "ARB_clip_control", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_compute_shader", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_conservative_depth", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
- { "ARB_copy_image", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
- { "ARB_debug_label", false, true },
- { "ARB_debug_output", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_depth_buffer_float", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_depth_clamp", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
- { "ARB_draw_buffers_blend", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
- { "ARB_draw_indirect", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
- { "ARB_draw_instanced", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_ES3_compatibility", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_framebuffer_sRGB", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_get_program_binary", BGFX_CONFIG_RENDERER_OPENGL >= 41, true },
- { "ARB_half_float_pixel", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_half_float_vertex", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_instanced_arrays", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_internalformat_query", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
- { "ARB_internalformat_query2", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_invalidate_subdata", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_map_buffer_range", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_multi_draw_indirect", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_multisample", false, true },
- { "ARB_occlusion_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_occlusion_query2", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_program_interface_query", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_sampler_objects", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_seamless_cube_map", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
- { "ARB_shader_bit_encoding", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_shader_image_load_store", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
- { "ARB_shader_storage_buffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "ARB_shader_texture_lod", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_texture_compression_bptc", BGFX_CONFIG_RENDERER_OPENGL >= 44, true },
- { "ARB_texture_compression_rgtc", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_texture_float", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_texture_multisample", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
- { "ARB_texture_rg", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_texture_rgb10_a2ui", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_texture_stencil8", false, true },
- { "ARB_texture_storage", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
- { "ARB_texture_swizzle", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_timer_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "ARB_uniform_buffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 31, true },
- { "ARB_vertex_array_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "ARB_vertex_type_2_10_10_10_rev", false, true },
-
- { "ATI_meminfo", false, true },
-
- { "CHROMIUM_color_buffer_float_rgb", false, true },
- { "CHROMIUM_color_buffer_float_rgba", false, true },
- { "CHROMIUM_depth_texture", false, true },
- { "CHROMIUM_framebuffer_multisample", false, true },
- { "CHROMIUM_texture_compression_dxt3", false, true },
- { "CHROMIUM_texture_compression_dxt5", false, true },
-
- { "EXT_bgra", false, true },
- { "EXT_blend_color", BGFX_CONFIG_RENDERER_OPENGL >= 31, true },
- { "EXT_blend_minmax", BGFX_CONFIG_RENDERER_OPENGL >= 14, true },
- { "EXT_blend_subtract", BGFX_CONFIG_RENDERER_OPENGL >= 14, true },
- { "EXT_color_buffer_half_float", false, true }, // GLES2 extension.
- { "EXT_color_buffer_float", false, true }, // GLES2 extension.
- { "EXT_copy_image", false, true }, // GLES2 extension.
- { "EXT_compressed_ETC1_RGB8_sub_texture", false, true }, // GLES2 extension.
- { "EXT_debug_label", false, true },
- { "EXT_debug_marker", false, true },
- { "EXT_debug_tool", false, true }, // RenderDoc extension.
- { "EXT_discard_framebuffer", false, true }, // GLES2 extension.
- { "EXT_disjoint_timer_query", false, true }, // GLES2 extension.
- { "EXT_draw_buffers", false, true }, // GLES2 extension.
- { "EXT_draw_instanced", false, true }, // GLES2 extension.
- { "EXT_instanced_arrays", false, true }, // GLES2 extension.
- { "EXT_frag_depth", false, true }, // GLES2 extension.
- { "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "EXT_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "EXT_framebuffer_sRGB", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "EXT_gpu_shader4", false, true },
- { "EXT_multi_draw_indirect", false, true }, // GLES3.1 extension.
- { "EXT_occlusion_query_boolean", false, true }, // GLES2 extension.
- { "EXT_packed_float", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "EXT_read_format_bgra", false, true },
- { "EXT_shader_image_load_store", false, true },
- { "EXT_shader_texture_lod", false, true }, // GLES2 extension.
- { "EXT_shadow_samplers", false, true },
- { "EXT_sRGB_write_control", false, true }, // GLES2 extension.
- { "EXT_texture_array", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "EXT_texture_compression_dxt1", false, true },
- { "EXT_texture_compression_latc", false, true },
- { "EXT_texture_compression_rgtc", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "EXT_texture_compression_s3tc", false, true },
- { "EXT_texture_filter_anisotropic", false, true },
- { "EXT_texture_format_BGRA8888", false, true },
- { "EXT_texture_rg", false, true }, // GLES2 extension.
- { "EXT_texture_shared_exponent", false, true },
- { "EXT_texture_snorm", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
- { "EXT_texture_sRGB", false, true },
- { "EXT_texture_storage", false, true },
- { "EXT_texture_swizzle", false, true },
- { "EXT_texture_type_2_10_10_10_REV", false, true },
- { "EXT_timer_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
- { "EXT_unpack_subimage", false, true },
-
- { "GOOGLE_depth_texture", false, true },
-
- { "GREMEDY_string_marker", false, true },
- { "GREMEDY_frame_terminator", false, true },
-
- { "IMG_multisampled_render_to_texture", false, true },
- { "IMG_read_format", false, true },
- { "IMG_shader_binary", false, true },
- { "IMG_texture_compression_pvrtc", false, true },
- { "IMG_texture_compression_pvrtc2", false, true },
- { "IMG_texture_format_BGRA8888", false, true },
-
- { "INTEL_fragment_shader_ordering", false, true },
-
- { "KHR_debug", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
- { "KHR_no_error", false, true },
-
- { "MOZ_WEBGL_compressed_texture_s3tc", false, true },
- { "MOZ_WEBGL_depth_texture", false, true },
-
- { "NV_conservative_raster", false, true },
- { "NV_copy_image", false, true },
- { "NV_draw_buffers", false, true }, // GLES2 extension.
- { "NV_occlusion_query", false, true },
- { "NV_texture_border_clamp", false, true }, // GLES2 extension.
- { "NVX_gpu_memory_info", false, true },
-
- { "OES_copy_image", false, true },
- { "OES_compressed_ETC1_RGB8_texture", false, true },
- { "OES_depth24", false, true },
- { "OES_depth32", false, true },
- { "OES_depth_texture", false, true },
- { "OES_element_index_uint", false, true },
- { "OES_fragment_precision_high", false, true },
- { "OES_get_program_binary", false, true },
- { "OES_required_internalformat", false, true },
- { "OES_packed_depth_stencil", false, true },
- { "OES_read_format", false, true },
- { "OES_rgb8_rgba8", false, true },
- { "OES_standard_derivatives", false, true },
- { "OES_texture_3D", false, true },
- { "OES_texture_float", false, true },
- { "OES_texture_float_linear", false, true },
- { "OES_texture_npot", false, true },
- { "OES_texture_half_float", false, true },
- { "OES_texture_half_float_linear", false, true },
- { "OES_texture_stencil8", false, true },
- { "OES_vertex_array_object", false, !BX_PLATFORM_IOS },
- { "OES_vertex_half_float", false, true },
- { "OES_vertex_type_10_10_10_2", false, true },
-
- { "WEBGL_color_buffer_float", false, true },
- { "WEBGL_compressed_texture_etc1", false, true },
- { "WEBGL_compressed_texture_s3tc", false, true },
- { "WEBGL_compressed_texture_pvrtc", false, true },
- { "WEBGL_depth_texture", false, true },
- { "WEBGL_draw_buffers", false, true },
-
- { "WEBKIT_EXT_texture_filter_anisotropic", false, true },
- { "WEBKIT_WEBGL_compressed_texture_s3tc", false, true },
- { "WEBKIT_WEBGL_depth_texture", false, true },
+ { "AMD_conservative_depth", false, true },
+ { "AMD_multi_draw_indirect", false, true },
+
+ { "ANGLE_depth_texture", false, true },
+ { "ANGLE_framebuffer_blit", false, true },
+ { "ANGLE_framebuffer_multisample", false, false },
+ { "ANGLE_instanced_arrays", false, true },
+ { "ANGLE_texture_compression_dxt1", false, true },
+ { "ANGLE_texture_compression_dxt3", false, true },
+ { "ANGLE_texture_compression_dxt5", false, true },
+ { "ANGLE_timer_query", false, true },
+ { "ANGLE_translated_shader_source", false, true },
+
+ { "APPLE_texture_format_BGRA8888", false, true },
+ { "APPLE_texture_max_level", false, true },
+
+ { "ARB_clip_control", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_compute_shader", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_conservative_depth", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
+ { "ARB_copy_image", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
+ { "ARB_debug_label", false, true },
+ { "ARB_debug_output", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_depth_buffer_float", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_depth_clamp", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
+ { "ARB_draw_buffers_blend", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
+ { "ARB_draw_indirect", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
+ { "ARB_draw_instanced", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_ES3_compatibility", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_framebuffer_sRGB", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_get_program_binary", BGFX_CONFIG_RENDERER_OPENGL >= 41, true },
+ { "ARB_half_float_pixel", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_half_float_vertex", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_instanced_arrays", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_internalformat_query", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
+ { "ARB_internalformat_query2", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_invalidate_subdata", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_map_buffer_range", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_multi_draw_indirect", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_multisample", false, true },
+ { "ARB_occlusion_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_occlusion_query2", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_program_interface_query", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_sampler_objects", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_seamless_cube_map", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
+ { "ARB_shader_bit_encoding", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_shader_image_load_store", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
+ { "ARB_shader_storage_buffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "ARB_shader_texture_lod", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_texture_compression_bptc", BGFX_CONFIG_RENDERER_OPENGL >= 44, true },
+ { "ARB_texture_compression_rgtc", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_texture_cube_map_array", BGFX_CONFIG_RENDERER_OPENGL >= 40, true },
+ { "ARB_texture_float", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_texture_multisample", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
+ { "ARB_texture_rg", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_texture_rgb10_a2ui", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_texture_stencil8", false, true },
+ { "ARB_texture_storage", BGFX_CONFIG_RENDERER_OPENGL >= 42, true },
+ { "ARB_texture_swizzle", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_timer_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "ARB_uniform_buffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 31, true },
+ { "ARB_vertex_array_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "ARB_vertex_type_2_10_10_10_rev", false, true },
+
+ { "ATI_meminfo", false, true },
+
+ { "CHROMIUM_color_buffer_float_rgb", false, true },
+ { "CHROMIUM_color_buffer_float_rgba", false, true },
+ { "CHROMIUM_depth_texture", false, true },
+ { "CHROMIUM_framebuffer_multisample", false, true },
+ { "CHROMIUM_texture_compression_dxt3", false, true },
+ { "CHROMIUM_texture_compression_dxt5", false, true },
+
+ { "EXT_bgra", false, true },
+ { "EXT_blend_color", BGFX_CONFIG_RENDERER_OPENGL >= 31, true },
+ { "EXT_blend_minmax", BGFX_CONFIG_RENDERER_OPENGL >= 14, true },
+ { "EXT_blend_subtract", BGFX_CONFIG_RENDERER_OPENGL >= 14, true },
+ { "EXT_color_buffer_half_float", false, true }, // GLES2 extension.
+ { "EXT_color_buffer_float", false, true }, // GLES2 extension.
+ { "EXT_copy_image", false, true }, // GLES2 extension.
+ { "EXT_compressed_ETC1_RGB8_sub_texture", false, true }, // GLES2 extension.
+ { "EXT_debug_label", false, true },
+ { "EXT_debug_marker", false, true },
+ { "EXT_debug_tool", false, true }, // RenderDoc extension.
+ { "EXT_discard_framebuffer", false, true }, // GLES2 extension.
+ { "EXT_disjoint_timer_query", false, true }, // GLES2 extension.
+ { "EXT_draw_buffers", false, true }, // GLES2 extension.
+ { "EXT_draw_instanced", false, true }, // GLES2 extension.
+ { "EXT_instanced_arrays", false, true }, // GLES2 extension.
+ { "EXT_frag_depth", false, true }, // GLES2 extension.
+ { "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "EXT_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "EXT_framebuffer_sRGB", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "EXT_gpu_shader4", false, true },
+ { "EXT_multi_draw_indirect", false, true }, // GLES3.1 extension.
+ { "EXT_occlusion_query_boolean", false, true }, // GLES2 extension.
+ { "EXT_packed_float", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "EXT_read_format_bgra", false, true },
+ { "EXT_shader_image_load_store", false, true },
+ { "EXT_shader_texture_lod", false, true }, // GLES2 extension.
+ { "EXT_shadow_samplers", false, true },
+ { "EXT_sRGB_write_control", false, true }, // GLES2 extension.
+ { "EXT_texture_array", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "EXT_texture_compression_dxt1", false, true },
+ { "EXT_texture_compression_latc", false, true },
+ { "EXT_texture_compression_rgtc", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "EXT_texture_compression_s3tc", false, true },
+ { "EXT_texture_cube_map_array", false, true }, // GLES3.1 extension.
+ { "EXT_texture_filter_anisotropic", false, true },
+ { "EXT_texture_format_BGRA8888", false, true },
+ { "EXT_texture_rg", false, true }, // GLES2 extension.
+ { "EXT_texture_shared_exponent", false, true },
+ { "EXT_texture_snorm", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
+ { "EXT_texture_sRGB", false, true },
+ { "EXT_texture_storage", false, true },
+ { "EXT_texture_swizzle", false, true },
+ { "EXT_texture_type_2_10_10_10_REV", false, true },
+ { "EXT_timer_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
+ { "EXT_unpack_subimage", false, true },
+
+ { "GOOGLE_depth_texture", false, true },
+
+ { "GREMEDY_string_marker", false, true },
+ { "GREMEDY_frame_terminator", false, true },
+
+ { "IMG_multisampled_render_to_texture", false, true },
+ { "IMG_read_format", false, true },
+ { "IMG_shader_binary", false, true },
+ { "IMG_texture_compression_pvrtc", false, true },
+ { "IMG_texture_compression_pvrtc2", false, true },
+ { "IMG_texture_format_BGRA8888", false, true },
+
+ { "INTEL_fragment_shader_ordering", false, true },
+
+ { "KHR_debug", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
+ { "KHR_no_error", false, true },
+
+ { "MOZ_WEBGL_compressed_texture_s3tc", false, true },
+ { "MOZ_WEBGL_depth_texture", false, true },
+
+ { "NV_conservative_raster", false, true },
+ { "NV_copy_image", false, true },
+ { "NV_draw_buffers", false, true }, // GLES2 extension.
+ { "NV_occlusion_query", false, true },
+ { "NV_texture_border_clamp", false, true }, // GLES2 extension.
+ { "NVX_gpu_memory_info", false, true },
+
+ { "OES_copy_image", false, true },
+ { "OES_compressed_ETC1_RGB8_texture", false, true },
+ { "OES_depth24", false, true },
+ { "OES_depth32", false, true },
+ { "OES_depth_texture", false, true },
+ { "OES_element_index_uint", false, true },
+ { "OES_fragment_precision_high", false, true },
+ { "OES_get_program_binary", false, true },
+ { "OES_required_internalformat", false, true },
+ { "OES_packed_depth_stencil", false, true },
+ { "OES_read_format", false, true },
+ { "OES_rgb8_rgba8", false, true },
+ { "OES_standard_derivatives", false, true },
+ { "OES_texture_3D", false, true },
+ { "OES_texture_float", false, true },
+ { "OES_texture_float_linear", false, true },
+ { "OES_texture_npot", false, true },
+ { "OES_texture_half_float", false, true },
+ { "OES_texture_half_float_linear", false, true },
+ { "OES_texture_stencil8", false, true },
+ { "OES_texture_storage_multisample_2d_array", false, true },
+ { "OES_vertex_array_object", false, !BX_PLATFORM_IOS },
+ { "OES_vertex_half_float", false, true },
+ { "OES_vertex_type_10_10_10_2", false, true },
+
+ { "WEBGL_color_buffer_float", false, true },
+ { "WEBGL_compressed_texture_etc1", false, true },
+ { "WEBGL_compressed_texture_s3tc", false, true },
+ { "WEBGL_compressed_texture_pvrtc", false, true },
+ { "WEBGL_depth_texture", false, true },
+ { "WEBGL_draw_buffers", false, true },
+
+ { "WEBKIT_EXT_texture_filter_anisotropic", false, true },
+ { "WEBKIT_WEBGL_compressed_texture_s3tc", false, true },
+ { "WEBKIT_WEBGL_depth_texture", false, true },
};
BX_STATIC_ASSERT(Extension::Count == BX_COUNTOF(s_extension) );
@@ -910,6 +916,15 @@ namespace bgfx { namespace gl
NULL
};
+ static const char* s_textureArray[] =
+ {
+ "sampler2DArray",
+ "sampler2DMSArray",
+ "samplerCubeArray",
+ "sampler2DArrayShadow",
+ NULL
+ };
+
static const char* s_ARB_texture_multisample[] =
{
"sampler2DMS",
@@ -1074,6 +1089,7 @@ namespace bgfx { namespace gl
case GL_DEBUG_SEVERITY_HIGH: return "High";
case GL_DEBUG_SEVERITY_MEDIUM: return "Medium";
case GL_DEBUG_SEVERITY_LOW: return "Low";
+ case GL_DEBUG_SEVERITY_NOTIFICATION: return "SPAM";
default:
break;
}
@@ -1083,14 +1099,17 @@ namespace bgfx { namespace gl
void GL_APIENTRY debugProcCb(GLenum _source, GLenum _type, GLuint _id, GLenum _severity, GLsizei /*_length*/, const GLchar* _message, const void* /*_userParam*/)
{
- BX_TRACE("src %s, type %s, id %d, severity %s, '%s'"
- , toString(_source)
- , toString(_type)
- , _id
- , toString(_severity)
- , _message
- );
- BX_UNUSED(_source, _type, _id, _severity, _message);
+ if (GL_DEBUG_SEVERITY_NOTIFICATION != _severity)
+ {
+ BX_TRACE("src %s, type %s, id %d, severity %s, '%s'"
+ , toString(_source)
+ , toString(_type)
+ , _id
+ , toString(_severity)
+ , _message
+ );
+ BX_UNUSED(_source, _type, _id, _severity, _message);
+ }
}
GLint glGet(GLenum _pname)
@@ -1110,6 +1129,11 @@ namespace bgfx { namespace gl
tfi.m_type = _type;
}
+ void flushGlError()
+ {
+ for (GLenum err = glGetError(); err != 0; err = glGetError());
+ }
+
GLenum initTestTexture(TextureFormat::Enum _format, bool _srgb, bool _mipmaps)
{
const TextureFormatInfo& tfi = s_textureFormat[_format];
@@ -1121,6 +1145,7 @@ namespace bgfx { namespace gl
GLsizei size = (16*16*getBitsPerPixel(_format) )/8;
void* data = bx::alignPtr(alloca(size+16), 0, 16);
+ flushGlError();
GLenum err = 0;
if (isCompressed(_format) )
@@ -1200,8 +1225,12 @@ namespace bgfx { namespace gl
GLuint id;
GL_CHECK(glGenTextures(1, &id) );
GL_CHECK(glBindTexture(GL_TEXTURE_2D, id) );
+
+ flushGlError();
+ GLenum err = 0;
+
glTexStorage2D(GL_TEXTURE_2D, 1, s_imageFormat[_format], 16, 16);
- GLenum err = glGetError();
+ err |= glGetError();
if (0 == err)
{
glBindImageTexture(0
@@ -1212,7 +1241,7 @@ namespace bgfx { namespace gl
, GL_READ_WRITE
, s_imageFormat[_format]
);
- err = glGetError();
+ err |= glGetError();
}
GL_CHECK(glDeleteTextures(1, &id) );
@@ -1603,6 +1632,7 @@ namespace bgfx { namespace gl
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) )
{
setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT);
+ setTextureFormat(TextureFormat::RGBA32F, GL_RGBA, GL_RGBA, GL_FLOAT);
// internalFormat and format must match:
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml
setTextureFormat(TextureFormat::RGBA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
@@ -1859,6 +1889,21 @@ namespace bgfx { namespace gl
: 0
;
+ g_caps.supported |= false
+ || s_extension[Extension::EXT_texture_array].m_supported
+ || s_extension[Extension::EXT_gpu_shader4].m_supported
+ || !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
+ ? BGFX_CAPS_TEXTURE_2D_ARRAY
+ : 0
+ ;
+
+ g_caps.supported |= false
+ || s_extension[Extension::ARB_texture_cube_map_array].m_supported
+ || s_extension[Extension::EXT_texture_cube_map_array].m_supported
+ ? BGFX_CAPS_TEXTURE_CUBE_ARRAY
+ : 0
+ ;
+
g_caps.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) );
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
@@ -2318,14 +2363,14 @@ namespace bgfx { namespace gl
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
- tc.m_cubeMap = false;
- tc.m_mem = NULL;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = 1;
+ tc.m_numMips = _numMips;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@@ -3617,8 +3662,19 @@ namespace bgfx { namespace gl
GLSL_TYPE(GL_FLOAT_MAT4);
GLSL_TYPE(GL_SAMPLER_2D);
+ GLSL_TYPE(GL_SAMPLER_2D_ARRAY);
+ GLSL_TYPE(GL_SAMPLER_2D_MULTISAMPLE);
+
GLSL_TYPE(GL_INT_SAMPLER_2D);
+ GLSL_TYPE(GL_INT_SAMPLER_2D_ARRAY);
+ GLSL_TYPE(GL_INT_SAMPLER_2D_MULTISAMPLE);
+
GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_2D);
+ GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY);
+ GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE);
+
+ GLSL_TYPE(GL_SAMPLER_2D_SHADOW);
+ GLSL_TYPE(GL_SAMPLER_2D_ARRAY_SHADOW);
GLSL_TYPE(GL_SAMPLER_3D);
GLSL_TYPE(GL_INT_SAMPLER_3D);
@@ -3628,12 +3684,6 @@ namespace bgfx { namespace gl
GLSL_TYPE(GL_INT_SAMPLER_CUBE);
GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_CUBE);
- GLSL_TYPE(GL_SAMPLER_2D_MULTISAMPLE);
- GLSL_TYPE(GL_INT_SAMPLER_2D_MULTISAMPLE);
- GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE);
-
- GLSL_TYPE(GL_SAMPLER_2D_SHADOW);
-
GLSL_TYPE(GL_IMAGE_1D);
GLSL_TYPE(GL_INT_IMAGE_1D);
GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_1D);
@@ -3709,8 +3759,19 @@ namespace bgfx { namespace gl
return UniformType::Mat4;
case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+
case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+
case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
case GL_SAMPLER_3D:
case GL_INT_SAMPLER_3D:
@@ -3720,12 +3781,6 @@ namespace bgfx { namespace gl
case GL_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_SAMPLER_2D_SHADOW:
-
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
-
case GL_IMAGE_1D:
case GL_INT_IMAGE_1D:
case GL_UNSIGNED_INT_IMAGE_1D:
@@ -3964,8 +4019,19 @@ namespace bgfx { namespace gl
switch (gltype)
{
case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+
case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+
case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
case GL_SAMPLER_3D:
case GL_INT_SAMPLER_3D:
@@ -3975,8 +4041,6 @@ namespace bgfx { namespace gl
case GL_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_SAMPLER_2D_SHADOW:
-
case GL_IMAGE_1D:
case GL_INT_IMAGE_1D:
case GL_UNSIGNED_INT_IMAGE_1D:
@@ -4207,60 +4271,218 @@ namespace bgfx { namespace gl
m_vcref.invalidate(s_renderGL->m_vaoStateCache);
}
- static void texImage(GLenum _target, uint32_t _msaaQuality, GLint _level, GLint _internalFormat, GLsizei _width, GLsizei _height, GLsizei _depth, GLint _border, GLenum _format, GLenum _type, const GLvoid* _data)
+ static void texSubImage(
+ GLenum _target
+ , GLint _level
+ , GLint _xoffset
+ , GLint _yoffset
+ , GLint _zoffset
+ , GLsizei _width
+ , GLsizei _height
+ , GLsizei _depth
+ , GLenum _format
+ , GLenum _type
+ , const GLvoid* _data
+ )
+ {
+ if (_target == GL_TEXTURE_3D
+ || _target == GL_TEXTURE_2D_ARRAY
+ || _target == GL_TEXTURE_CUBE_MAP_ARRAY)
+ {
+ GL_CHECK(glTexSubImage3D(
+ _target
+ , _level
+ , _xoffset
+ , _yoffset
+ , _zoffset
+ , _width
+ , _height
+ , _depth
+ , _format
+ , _type
+ , _data
+ ) );
+ }
+ else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
+ {
+ }
+ else
+ {
+ BX_UNUSED(_zoffset, _depth);
+ GL_CHECK(glTexSubImage2D(
+ _target
+ , _level
+ , _xoffset
+ , _yoffset
+ , _width
+ , _height
+ , _format
+ , _type
+ , _data
+ ) );
+ }
+ }
+
+ static void texImage(
+ GLenum _target
+ , uint32_t _msaaQuality
+ , GLint _level
+ , GLint _internalFormat
+ , GLsizei _width
+ , GLsizei _height
+ , GLsizei _depth
+ , GLint _border
+ , GLenum _format
+ , GLenum _type
+ , const GLvoid* _data
+ )
{
if (_target == GL_TEXTURE_3D)
{
- GL_CHECK(glTexImage3D(_target, _level, _internalFormat, _width, _height, _depth, _border, _format, _type, _data) );
+ GL_CHECK(glTexImage3D(
+ _target
+ , _level
+ , _internalFormat
+ , _width
+ , _height
+ , _depth
+ , _border
+ , _format
+ , _type
+ , _data
+ ) );
+ }
+ else if (_target == GL_TEXTURE_2D_ARRAY
+ || _target == GL_TEXTURE_CUBE_MAP_ARRAY)
+ {
+ texSubImage(_target, _level, 0, 0, _depth, _width, _height, 1, _format, _type, _data);
+ }
+ else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
+ {
}
else if (_target == GL_TEXTURE_2D_MULTISAMPLE)
{
- GL_CHECK(glTexImage2DMultisample(_target, _msaaQuality, _internalFormat, _width, _height, false) );
+ GL_CHECK(glTexImage2DMultisample(
+ _target
+ , _msaaQuality
+ , _internalFormat
+ , _width
+ , _height
+ , false
+ ) );
}
else
{
- GL_CHECK(glTexImage2D(_target, _level, _internalFormat, _width, _height, _border, _format, _type, _data) );
+ GL_CHECK(glTexImage2D(
+ _target
+ , _level
+ , _internalFormat
+ , _width
+ , _height
+ , _border
+ , _format
+ , _type
+ , _data
+ ) );
}
BX_UNUSED(_msaaQuality, _depth, _border, _data);
}
- static void texSubImage(GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _zoffset, GLsizei _width, GLsizei _height, GLsizei _depth, GLenum _format, GLenum _type, const GLvoid* _data)
+ static void compressedTexSubImage(
+ GLenum _target
+ , GLint _level
+ , GLint _xoffset
+ , GLint _yoffset
+ , GLint _zoffset
+ , GLsizei _width
+ , GLsizei _height
+ , GLsizei _depth
+ , GLenum _format
+ , GLsizei _imageSize
+ , const GLvoid* _data
+ )
{
if (_target == GL_TEXTURE_3D)
{
- GL_CHECK(glTexSubImage3D(_target, _level, _xoffset, _yoffset, _zoffset, _width, _height, _depth, _format, _type, _data) );
+ GL_CHECK(glCompressedTexSubImage3D(
+ _target
+ , _level
+ , _xoffset
+ , _yoffset
+ , _zoffset
+ , _width
+ , _height
+ , _depth
+ , _format
+ , _imageSize
+ , _data
+ ) );
}
else
{
BX_UNUSED(_zoffset, _depth);
- GL_CHECK(glTexSubImage2D(_target, _level, _xoffset, _yoffset, _width, _height, _format, _type, _data) );
+ GL_CHECK(glCompressedTexSubImage2D(
+ _target
+ , _level
+ , _xoffset
+ , _yoffset
+ , _width
+ , _height
+ , _format
+ , _imageSize
+ , _data
+ ) );
}
}
- static void compressedTexImage(GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, GLsizei _height, GLsizei _depth, GLint _border, GLsizei _imageSize, const GLvoid* _data)
+ static void compressedTexImage(
+ GLenum _target
+ , GLint _level
+ , GLenum _internalformat
+ , GLsizei _width
+ , GLsizei _height
+ , GLsizei _depth
+ , GLint _border
+ , GLsizei _imageSize
+ , const GLvoid* _data
+ )
{
if (_target == GL_TEXTURE_3D)
{
- GL_CHECK(glCompressedTexImage3D(_target, _level, _internalformat, _width, _height, _depth, _border, _imageSize, _data) );
+ GL_CHECK(glCompressedTexImage3D(
+ _target
+ , _level
+ , _internalformat
+ , _width
+ , _height
+ , _depth
+ , _border
+ , _imageSize
+ , _data
+ ) );
}
- else
+ else if (_target == GL_TEXTURE_2D_ARRAY
+ || _target == GL_TEXTURE_CUBE_MAP_ARRAY)
{
- BX_UNUSED(_depth);
- GL_CHECK(glCompressedTexImage2D(_target, _level, _internalformat, _width, _height, _border, _imageSize, _data) );
+ compressedTexSubImage(_target, _level, 0, 0, _depth, _width, _height, 1, _internalformat, _imageSize, _data);
}
- }
-
- static void compressedTexSubImage(GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _zoffset, GLsizei _width, GLsizei _height, GLsizei _depth, GLenum _format, GLsizei _imageSize, const GLvoid* _data)
- {
- if (_target == GL_TEXTURE_3D)
+ else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
{
- GL_CHECK(glCompressedTexSubImage3D(_target, _level, _xoffset, _yoffset, _zoffset, _width, _height, _depth, _format, _imageSize, _data) );
}
else
{
- BX_UNUSED(_zoffset, _depth);
- GL_CHECK(glCompressedTexSubImage2D(_target, _level, _xoffset, _yoffset, _width, _height, _format, _imageSize, _data) );
+ BX_UNUSED(_depth);
+ GL_CHECK(glCompressedTexImage2D(
+ _target
+ , _level
+ , _internalformat
+ , _width
+ , _height
+ , _border
+ , _imageSize
+ , _data
+ ) );
}
}
@@ -4276,6 +4498,10 @@ namespace bgfx { namespace gl
const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE );
+ const bool textureArray = false
+ || _target == GL_TEXTURE_2D_ARRAY
+ || _target == GL_TEXTURE_CUBE_MAP_ARRAY
+ ;
if (!writeOnly)
{
@@ -4305,6 +4531,17 @@ namespace bgfx { namespace gl
m_type = tfiRgba8.m_type;
}
+ if (textureArray)
+ {
+ GL_CHECK(glTexStorage3D(_target
+ , _numMips
+ , s_textureFormat[m_textureFormat].m_internalFmt
+ , m_width
+ , m_height
+ , _depth
+ ) );
+ }
+
if (computeWrite)
{
if (_target == GL_TEXTURE_3D)
@@ -4397,6 +4634,7 @@ namespace bgfx { namespace gl
uint8_t numMips = imageContainer.m_numMips;
const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) );
numMips -= startLod;
+ const uint16_t numLayers = imageContainer.m_numLayers;
uint32_t textureWidth;
uint32_t textureHeight;
uint32_t textureDepth;
@@ -4404,7 +4642,10 @@ namespace bgfx { namespace gl
const ImageBlockInfo& ibi = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
textureWidth = bx::uint32_max(ibi.blockWidth, imageContainer.m_width >>startLod);
textureHeight = bx::uint32_max(ibi.blockHeight, imageContainer.m_height>>startLod);
- textureDepth = imageContainer.m_depth;
+ textureDepth = 1 < imageContainer.m_depth
+ ? imageContainer.m_depth
+ : imageContainer.m_numLayers
+ ;
}
m_requestedFormat = uint8_t(imageContainer.m_format);
@@ -4427,6 +4668,17 @@ namespace bgfx { namespace gl
target = GL_TEXTURE_3D;
}
+ const bool textureArray = 1 < numLayers;
+ if (textureArray)
+ {
+ switch (target)
+ {
+ case GL_TEXTURE_CUBE_MAP: target = GL_TEXTURE_CUBE_MAP_ARRAY;
+ case GL_TEXTURE_2D_MULTISAMPLE: target = GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
+ default: target = GL_TEXTURE_2D_ARRAY;
+ }
+ }
+
if (!init(target
, textureWidth
, textureHeight
@@ -4438,7 +4690,10 @@ namespace bgfx { namespace gl
return;
}
- target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
+ target = isCubeMap()
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ : m_target
+ ;
const GLenum internalFmt = srgb
? s_textureFormat[m_textureFormat].m_internalFmtSrgb
@@ -4456,11 +4711,12 @@ namespace bgfx { namespace gl
|| swizzle
;
- BX_TRACE("Texture%-4s %3d: %s (requested: %s), %dx%dx%d%s."
+ BX_TRACE("Texture%-4s %3d: %s (requested: %s), layers %d, %dx%dx%d%s."
, imageContainer.m_cubeMap ? "Cube" : (1 < imageContainer.m_depth ? "3D" : "2D")
, this - s_renderGL->m_textures
, getName( (TextureFormat::Enum)m_textureFormat)
, getName( (TextureFormat::Enum)m_requestedFormat)
+ , numLayers
, textureWidth
, textureHeight
, imageContainer.m_cubeMap ? 6 : (1 < imageContainer.m_depth ? imageContainer.m_depth : 0)
@@ -4481,17 +4737,26 @@ namespace bgfx { namespace gl
temp = (uint8_t*)BX_ALLOC(g_allocator, textureWidth*textureHeight*4);
}
- for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
+ const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
+
+ for (uint16_t side = 0; side < numSides; ++side)
{
uint32_t width = textureWidth;
uint32_t height = textureHeight;
uint32_t depth = imageContainer.m_depth;
+ GLenum imageTarget = imageContainer.m_cubeMap && !textureArray
+ ? target+side
+ : target
+ ;
for (uint8_t lod = 0, num = numMips; lod < num; ++lod)
{
width = bx::uint32_max(1, width);
height = bx::uint32_max(1, height);
- depth = bx::uint32_max(1, depth);
+ depth = 1 < imageContainer.m_depth
+ ? bx::uint32_max(1, depth)
+ : side
+ ;
ImageMip mip;
if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) )
@@ -4499,7 +4764,7 @@ namespace bgfx { namespace gl
if (compressed
&& !convert)
{
- compressedTexImage(target+side
+ compressedTexImage(imageTarget
, lod
, internalFmt
, width
@@ -4526,7 +4791,7 @@ namespace bgfx { namespace gl
data = temp;
}
- texImage(target+side
+ texImage(imageTarget
, msaaQuality
, lod
, internalFmt
@@ -4549,7 +4814,7 @@ namespace bgfx { namespace gl
* 4*4*getBitsPerPixel(TextureFormat::Enum(m_textureFormat) )/8
;
- compressedTexImage(target+side
+ compressedTexImage(imageTarget
, lod
, internalFmt
, width
@@ -4562,7 +4827,7 @@ namespace bgfx { namespace gl
}
else
{
- texImage(target+side
+ texImage(imageTarget
, msaaQuality
, lod
, internalFmt
@@ -4618,8 +4883,6 @@ namespace bgfx { namespace gl
void TextureGL::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
{
- BX_UNUSED(_z, _depth);
-
const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
const uint32_t rectpitch = _rect.m_width*bpp/8;
uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch;
@@ -4627,7 +4890,10 @@ namespace bgfx { namespace gl
GL_CHECK(glBindTexture(m_target, m_id) );
GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1) );
- GLenum target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
+ GLenum target = isCubeMap()
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ : m_target
+ ;
const bool swizzle = true
&& TextureFormat::BGRA8 == m_requestedFormat
@@ -5128,11 +5394,12 @@ namespace bgfx { namespace gl
&& s_extension[Extension::ARB_shader_texture_lod].m_supported
&& bx::findIdentifierMatch(code, s_ARB_shader_texture_lod)
;
- const bool usesGpuShader5 = !!bx::findIdentifierMatch(code, s_ARB_gpu_shader5);
- const bool usesIUsamplers = !!bx::findIdentifierMatch(code, s_uisamplers);
- const bool usesTexelFetch = !!bx::findIdentifierMatch(code, s_texelFetch);
- const bool usesTextureMS = !!bx::findIdentifierMatch(code, s_ARB_texture_multisample);
- const bool usesPacking = !!bx::findIdentifierMatch(code, s_ARB_shading_language_packing);
+ const bool usesGpuShader5 = !!bx::findIdentifierMatch(code, s_ARB_gpu_shader5);
+ const bool usesIUsamplers = !!bx::findIdentifierMatch(code, s_uisamplers);
+ const bool usesTexelFetch = !!bx::findIdentifierMatch(code, s_texelFetch);
+ const bool usesTextureArray = !!bx::findIdentifierMatch(code, s_textureArray);
+ const bool usesTextureMS = !!bx::findIdentifierMatch(code, s_ARB_texture_multisample);
+ const bool usesPacking = !!bx::findIdentifierMatch(code, s_ARB_shading_language_packing);
uint32_t version =
usesIUsamplers || usesTexelFetch ? 130
@@ -5168,6 +5435,11 @@ namespace bgfx { namespace gl
writeString(&writer, "#extension GL_ARB_texture_multisample : enable\n");
}
+ if (usesTextureArray)
+ {
+ writeString(&writer, "#extension GL_EXT_texture_array : enable\n");
+ }
+
if (130 <= version)
{
if (m_type == GL_FRAGMENT_SHADER)
@@ -5456,7 +5728,7 @@ namespace bgfx { namespace gl
}
else
{
- GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target
+ GLenum target = texture.isCubeMap()
? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer
: texture.m_target
;
@@ -5517,7 +5789,7 @@ namespace bgfx { namespace gl
{
++colorIdx;
- GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target
+ GLenum target = texture.isCubeMap()
? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer
: texture.m_target
;
@@ -5935,6 +6207,7 @@ namespace bgfx { namespace gl
if (BGFX_CLEAR_NONE != (clear.m_flags & BGFX_CLEAR_MASK) )
{
clearQuad(_clearQuad, viewState.m_rect, clear, resolutionHeight, _render->m_colorPalette);
+ currentVao = UINT32_MAX; // clearQuad will mess with VAO, invalidate it.
}
GL_CHECK(glDisable(GL_STENCIL_TEST) );
diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h
index 189c17b29e5..9227d0e00cf 100644
--- a/3rdparty/bgfx/src/renderer_gl.h
+++ b/3rdparty/bgfx/src/renderer_gl.h
@@ -624,6 +624,14 @@ typedef uint64_t GLuint64;
# define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
#endif // GL_UNSIGNED_INT_SAMPLER_2D
+#ifndef GL_INT_SAMPLER_2D_ARRAY
+# define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#endif // GL_INT_SAMPLER_2D_ARRAY
+
+#ifndef GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
+# define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#endif // GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
+
#ifndef GL_INT_SAMPLER_3D
# define GL_INT_SAMPLER_3D 0x8DCB
#endif // GL_INT_SAMPLER_3D
@@ -656,6 +664,14 @@ typedef uint64_t GLuint64;
# define GL_SAMPLER_2D_SHADOW 0x8B62
#endif // GL_SAMPLER_2D_SHADOW
+#ifndef GL_SAMPLER_2D_ARRAY
+# define GL_SAMPLER_2D_ARRAY 0x8DC1
+#endif // GL_SAMPLER_2D_ARRAY
+
+#ifndef GL_SAMPLER_2D_ARRAY_SHADOW
+# define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#endif // GL_SAMPLER_2D_ARRAY_SHADOW
+
#ifndef GL_TEXTURE_MAX_LEVEL
# define GL_TEXTURE_MAX_LEVEL 0x813D
#endif // GL_TEXTURE_MAX_LEVEL
@@ -863,6 +879,18 @@ typedef uint64_t GLuint64;
# define GL_CLAMP_TO_BORDER 0x812D
#endif // GL_CLAMP_TO_BORDER
+#ifndef GL_TEXTURE_2D_ARRAY
+# define GL_TEXTURE_2D_ARRAY 0x8C1A
+#endif // GL_TEXTURE_2D_ARRAY
+
+#ifndef GL_TEXTURE_2D_MULTISAMPLE_ARRAY
+# define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#endif // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
+
+#ifndef GL_TEXTURE_CUBE_MAP_ARRAY
+# define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#endif // GL_TEXTURE_CUBE_MAP_ARRAY
+
#ifndef GL_TEXTURE_CUBE_MAP_SEAMLESS
# define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
#endif // GL_TEXTURE_CUBE_MAP_SEAMLESS
@@ -883,6 +911,10 @@ typedef uint64_t GLuint64;
# define GL_MAX_NAME_LENGTH 0x92F6
#endif // GL_MAX_NAME_LENGTH
+#ifndef GL_DEBUG_SEVERITY_NOTIFICATION
+# define GL_DEBUG_SEVERITY_NOTIFICATION 0x826b
+#endif // GL_DEBUG_SEVERITY_NOTIFICATION
+
#if BX_PLATFORM_NACL
# include "glcontext_ppapi.h"
#elif BX_PLATFORM_WINDOWS
@@ -1236,6 +1268,14 @@ namespace bgfx { namespace gl
void commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]);
void resolve() const;
+ bool isCubeMap() const
+ {
+ return 0
+ || GL_TEXTURE_CUBE_MAP == m_target
+ || GL_TEXTURE_CUBE_MAP_ARRAY == m_target
+ ;
+ }
+
GLuint m_id;
GLuint m_rbo;
GLenum m_target;
diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h
index 13f1bf6b7af..00981372cd0 100644
--- a/3rdparty/bgfx/src/renderer_mtl.h
+++ b/3rdparty/bgfx/src/renderer_mtl.h
@@ -87,6 +87,7 @@ namespace bgfx { namespace mtl
destinationSlice:_destinationSlice destinationLevel:_destinationLevel destinationOrigin:_destinationOrigin];
}
+#if BX_PLATFORM_OSX
void synchronizeTexture(id<MTLTexture> _texture, NSUInteger _slice, NSUInteger _level)
{
[m_obj synchronizeTexture:_texture slice:_slice level:_level];
@@ -96,6 +97,7 @@ namespace bgfx { namespace mtl
{
[m_obj synchronizeResource:_resource];
}
+#endif // BX_PLATFORM_OSX
void endEncoding()
{
diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm
index ce2bf3b8b51..d3721c9062d 100644
--- a/3rdparty/bgfx/src/renderer_mtl.mm
+++ b/3rdparty/bgfx/src/renderer_mtl.mm
@@ -310,9 +310,9 @@ namespace bgfx { namespace mtl
{ MTLPixelFormatRG32Sint, MTLPixelFormatInvalid }, // RG32I
{ MTLPixelFormatRG32Uint, MTLPixelFormatInvalid }, // RG32U
{ MTLPixelFormatRG32Float, MTLPixelFormatInvalid }, // RG32F
- { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8
- { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8I
- { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8U
+ { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8
+ { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8I
+ { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8U
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8S
{ MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid }, // RGB9E5F
{ MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB }, // BGRA8
@@ -474,26 +474,27 @@ namespace bgfx { namespace mtl
m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor);
g_caps.supported |= (0
- | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader
- | BGFX_CAPS_TEXTURE_COMPARE_ALL
- | BGFX_CAPS_TEXTURE_3D
- | BGFX_CAPS_VERTEX_ATTRIB_HALF
- | BGFX_CAPS_VERTEX_ATTRIB_UINT10
- | BGFX_CAPS_INSTANCING
- | BGFX_CAPS_FRAGMENT_DEPTH
- | BGFX_CAPS_BLEND_INDEPENDENT
- //| BGFX_CAPS_COMPUTE // TODO: api/hw supports it but metal compute shaders are not yet supported
- | BGFX_CAPS_INDEX32
- //| BGFX_CAPS_DRAW_INDIRECT // TODO: support on iOS9+gpu family3+ and on macOS
- | BGFX_CAPS_TEXTURE_BLIT
- | BGFX_CAPS_TEXTURE_READ_BACK
- | BGFX_CAPS_OCCLUSION_QUERY
- | BGFX_CAPS_ALPHA_TO_COVERAGE
- );
+ | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader
+ | BGFX_CAPS_TEXTURE_COMPARE_ALL
+ | BGFX_CAPS_TEXTURE_3D
+ | BGFX_CAPS_VERTEX_ATTRIB_HALF
+ | BGFX_CAPS_VERTEX_ATTRIB_UINT10
+ | BGFX_CAPS_INSTANCING
+ | BGFX_CAPS_FRAGMENT_DEPTH
+ | BGFX_CAPS_BLEND_INDEPENDENT
+// | BGFX_CAPS_COMPUTE // TODO: api/hw supports it but metal compute shaders are not yet supported
+ | BGFX_CAPS_INDEX32
+// | BGFX_CAPS_DRAW_INDIRECT // TODO: support on iOS9+gpu family3+ and on macOS
+ | BGFX_CAPS_TEXTURE_BLIT
+ | BGFX_CAPS_TEXTURE_READ_BACK
+ | BGFX_CAPS_OCCLUSION_QUERY
+ | BGFX_CAPS_ALPHA_TO_COVERAGE
+ | BGFX_CAPS_TEXTURE_2D_ARRAY // supported on all platforms
+ );
if (BX_ENABLED(BX_PLATFORM_IOS) )
{
- if ( iOSVersionEqualOrGreater("9.0.0") )
+ if (iOSVersionEqualOrGreater("9.0.0") )
{
g_caps.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192;
}
@@ -501,20 +502,30 @@ namespace bgfx { namespace mtl
{
g_caps.maxTextureSize = 4096;
}
- g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
- } else if (BX_ENABLED(BX_PLATFORM_OSX) )
+ g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
+ }
+ else if (BX_ENABLED(BX_PLATFORM_OSX) )
{
- g_caps.maxTextureSize = 16384;
+ g_caps.maxTextureSize = 16384;
g_caps.maxFBAttachments = 8;
+ g_caps.supported |= BGFX_CAPS_TEXTURE_CUBE_ARRAY;
}
//todo: vendor id, device id, gpu enum
- m_hasPixelFormatDepth32Float_Stencil8 = (BX_ENABLED(BX_PLATFORM_OSX) ||
- ( BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") ) );
- m_macOS11Runtime = (BX_ENABLED(BX_PLATFORM_OSX) && macOSVersionEqualOrGreater(10,11,0) );
- m_iOS9Runtime = (BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") );
+ m_hasPixelFormatDepth32Float_Stencil8 = false
+ || BX_ENABLED(BX_PLATFORM_OSX)
+ || (BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") )
+ ;
+ m_macOS11Runtime = true
+ && BX_ENABLED(BX_PLATFORM_OSX)
+ && macOSVersionEqualOrGreater(10,11,0)
+ ;
+ m_iOS9Runtime = true
+ && BX_ENABLED(BX_PLATFORM_IOS)
+ && iOSVersionEqualOrGreater("9.0.0")
+ ;
if (BX_ENABLED(BX_PLATFORM_OSX) )
{
@@ -809,14 +820,14 @@ namespace bgfx { namespace mtl
bx::write(&writer, magic);
TextureCreate tc;
- tc.m_width = _width;
- tc.m_height = _height;
- tc.m_sides = 0;
- tc.m_depth = 0;
- tc.m_numMips = _numMips;
- tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
- tc.m_cubeMap = false;
- tc.m_mem = NULL;
+ tc.m_width = _width;
+ tc.m_height = _height;
+ tc.m_depth = 0;
+ tc.m_numLayers = 1;
+ tc.m_numMips = _numMips;
+ tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
+ tc.m_cubeMap = false;
+ tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@@ -2384,8 +2395,9 @@ namespace bgfx { namespace mtl
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
+ const uint16_t numLayers = imageContainer.m_numLayers;
- m_flags = _flags;
+ m_flags = _flags;
m_width = textureWidth;
m_height = textureHeight;
m_depth = imageContainer.m_depth;
@@ -2396,7 +2408,20 @@ namespace bgfx { namespace mtl
TextureDescriptor desc = s_renderMtl->m_textureDescriptor;
- if (imageContainer.m_cubeMap)
+ if (1 < numLayers)
+ {
+ if (imageContainer.m_cubeMap)
+ {
+ desc.textureType = MTLTextureTypeCubeArray;
+ }
+ else
+ {
+ desc.textureType = MTLTextureType2DArray;
+ }
+
+ desc.arrayLength = numLayers;
+ }
+ else if (imageContainer.m_cubeMap)
{
desc.textureType = MTLTextureTypeCube;
}
@@ -2410,23 +2435,28 @@ namespace bgfx { namespace mtl
}
m_numMips = numMips;
+ const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
- const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
+ const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
+ const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
+ const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
+ const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
+ const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
- BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s."
+ BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s RT[%c], WO[%c], CW[%c], sRGB[%c]"
, this - s_renderMtl->m_textures
, getName( (TextureFormat::Enum)m_textureFormat)
, getName( (TextureFormat::Enum)m_requestedFormat)
+ , numLayers
, textureWidth
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
- , 0 != (_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
+ , renderTarget ? 'x' : '.'
+ , writeOnly ? 'x' : '.'
+ , computeWrite ? 'x' : '.'
+ , srgb ? 'x' : '.'
);
- const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
- const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
- const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
- const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
int sampleCount = s_msaa[msaaQuality];
@@ -2455,7 +2485,7 @@ namespace bgfx { namespace mtl
if (s_renderMtl->m_iOS9Runtime || s_renderMtl->m_macOS11Runtime)
{
- desc.cpuCacheMode = MTLCPUCacheModeDefaultCache;
+ desc.cpuCacheMode = MTLCPUCacheModeDefaultCache;
desc.storageMode = (MTLStorageMode)(writeOnly||isDepth(TextureFormat::Enum(m_textureFormat))
? 2 /*MTLStorageModePrivate*/
@@ -2493,7 +2523,7 @@ namespace bgfx { namespace mtl
temp = (uint8_t*)BX_ALLOC(g_allocator, textureWidth*textureHeight*4);
}
- for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
+ for (uint8_t side = 0; side < numSides; ++side)
{
uint32_t width = textureWidth;
uint32_t height = textureHeight;
@@ -3023,23 +3053,29 @@ namespace bgfx { namespace mtl
uint32_t width = bx::uint32_min(srcWidth, dstWidth);
uint32_t height = bx::uint32_min(srcHeight, dstHeight);
uint32_t depth = bx::uint32_min(srcDepth, dstDepth);
+#if BX_PLATFORM_OSX
bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK);
+#endif // BX_PLATFORM_OSX
if ( MTLTextureType3D == src.m_ptr.textureType())
{
m_blitCommandEncoder.copyFromTexture(src.m_ptr, 0, 0, MTLOriginMake(blit.m_srcX, blit.m_srcY, blit.m_srcZ), MTLSizeMake(width, height, bx::uint32_imax(depth, 1)),
dst.m_ptr, 0, 0, MTLOriginMake(blit.m_dstX, blit.m_dstY, blit.m_dstZ));
+#if BX_PLATFORM_OSX
if (m_macOS11Runtime &&readBack) {
m_blitCommandEncoder.synchronizeResource(dst.m_ptr);
}
+#endif // BX_PLATFORM_OSX
}
else
{
m_blitCommandEncoder.copyFromTexture(src.m_ptr, blit.m_srcZ, blit.m_srcMip, MTLOriginMake(blit.m_srcX, blit.m_srcY, 0), MTLSizeMake(width, height, 1),
dst.m_ptr, blit.m_dstZ, blit.m_dstMip, MTLOriginMake(blit.m_dstX, blit.m_dstY, 0));
+#if BX_PLATFORM_OSX
if (m_macOS11Runtime && readBack) {
m_blitCommandEncoder.synchronizeTexture(dst.m_ptr, 0, blit.m_dstMip);
}
+#endif // BX_PLATFORM_OSX
}
}
diff --git a/3rdparty/bgfx/src/shader_dxbc.cpp b/3rdparty/bgfx/src/shader_dxbc.cpp
index 1cc948d316e..0ad82cc61a7 100644
--- a/3rdparty/bgfx/src/shader_dxbc.cpp
+++ b/3rdparty/bgfx/src/shader_dxbc.cpp
@@ -1000,7 +1000,7 @@ namespace bgfx
break;
}
- for (uint32_t ii = 0; ii < _operand.numAddrModes; ++ii)
+ for (uint32_t ii = 0, num = bx::uint32_min(_operand.numAddrModes, BX_COUNTOF(_operand.addrMode) ); ii < num; ++ii)
{
switch (_operand.addrMode[ii])
{
@@ -1526,7 +1526,7 @@ namespace bgfx
);
}
- for (uint32_t jj = first; jj < operand.numAddrModes; ++jj)
+ for (uint32_t jj = first, num = bx::uint32_min(operand.numAddrModes, BX_COUNTOF(operand.addrMode) ); jj < num; ++jj)
{
switch (operand.addrMode[jj])
{
diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.cpp b/3rdparty/bgfx/tools/shaderc/shaderc.cpp
index 1b3e03900c0..08f3b4efd26 100644
--- a/3rdparty/bgfx/tools/shaderc/shaderc.cpp
+++ b/3rdparty/bgfx/tools/shaderc/shaderc.cpp
@@ -23,6 +23,7 @@ namespace bgfx
static const char* s_ARB_shader_texture_lod[] =
{
"texture2DLod",
+ "texture2DArrayLod", // BK - interacts with ARB_texture_array.
"texture2DProjLod",
"texture3DLod",
"texture3DProjLod",
@@ -89,6 +90,14 @@ namespace bgfx
NULL
};
+ static const char* s_textureArray[] =
+ {
+ "texture2DArray",
+ "texture2DArrayLod",
+ "shadow2DArray",
+ NULL
+ };
+
static const char* s_ARB_texture_multisample[] =
{
"sampler2DMS",
@@ -1760,11 +1769,12 @@ namespace bgfx
{
std::string code;
- const bool usesTextureLod = !!bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
- const bool usesGpuShader5 = !!bx::findIdentifierMatch(input, s_ARB_gpu_shader5);
- const bool usesPacking = !!bx::findIdentifierMatch(input, s_ARB_shading_language_packing);
- const bool usesTextureMS = !!bx::findIdentifierMatch(input, s_ARB_texture_multisample);
- const bool usesTexelFetch = !!bx::findIdentifierMatch(input, s_texelFetch);
+ const bool usesGpuShader5 = !!bx::findIdentifierMatch(input, s_ARB_gpu_shader5);
+ const bool usesTexelFetch = !!bx::findIdentifierMatch(input, s_texelFetch);
+ const bool usesTextureLod = !!bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
+ const bool usesTextureMS = !!bx::findIdentifierMatch(input, s_ARB_texture_multisample);
+ const bool usesTextureArray = !!bx::findIdentifierMatch(input, s_textureArray);
+ const bool usesPacking = !!bx::findIdentifierMatch(input, s_ARB_shading_language_packing);
if (0 == essl)
{
@@ -1782,15 +1792,6 @@ namespace bgfx
bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile);
}
- if (130 > glsl)
- {
- bx::stringPrintf(code,
- "#define ivec2 vec2\n"
- "#define ivec3 vec3\n"
- "#define ivec4 vec4\n"
- );
- }
-
if (usesGpuShader5)
{
bx::stringPrintf(code
@@ -1805,11 +1806,6 @@ namespace bgfx
);
}
- bx::stringPrintf(code
- , "#define bgfxShadow2D shadow2D\n"
- "#define bgfxShadow2DProj shadow2DProj\n"
- );
-
if (usesTextureLod
&& 130 > glsl)
{
@@ -1824,15 +1820,30 @@ namespace bgfx
, "#extension GL_ARB_texture_multisample : enable\n"
);
}
+
+ if (usesTextureArray)
+ {
+ bx::stringPrintf(code
+ , "#extension GL_EXT_texture_array : enable\n"
+ );
+ }
+
+ if (130 > glsl)
+ {
+ bx::stringPrintf(code,
+ "#define ivec2 vec2\n"
+ "#define ivec3 vec3\n"
+ "#define ivec4 vec4\n"
+ );
+ }
+
+ bx::stringPrintf(code
+ , "#define bgfxShadow2D shadow2D\n"
+ "#define bgfxShadow2DProj shadow2DProj\n"
+ );
}
else
{
- bx::stringPrintf(code,
- "#define ivec2 vec2\n"
- "#define ivec3 vec3\n"
- "#define ivec4 vec4\n"
- );
-
// Pretend that all extensions are available.
// This will be stripped later.
if (usesTextureLod)
@@ -1888,6 +1899,19 @@ namespace bgfx
"#define gl_FragDepth gl_FragDepthEXT\n"
);
}
+
+ if (usesTextureArray)
+ {
+ bx::stringPrintf(code
+ , "#extension GL_EXT_texture_array : enable\n"
+ );
+ }
+
+ bx::stringPrintf(code,
+ "#define ivec2 vec2\n"
+ "#define ivec3 vec3\n"
+ "#define ivec4 vec4\n"
+ );
}
code += preprocessor.m_preprocessed;
diff --git a/3rdparty/bgfx/tools/texturec/texturec.cpp b/3rdparty/bgfx/tools/texturec/texturec.cpp
index 687ccf82fdb..0640d25e30c 100644
--- a/3rdparty/bgfx/tools/texturec/texturec.cpp
+++ b/3rdparty/bgfx/tools/texturec/texturec.cpp
@@ -622,7 +622,7 @@ int main(int _argc, const char* _argv[])
if (normalMap)
{
- output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
+ output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, 1, false, mips);
ImageMip dstMip;
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
@@ -686,7 +686,7 @@ int main(int _argc, const char* _argv[])
}
else if (8 != getBlockInfo(imageContainer.m_format).rBits)
{
- output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
+ output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, 1, false, mips);
ImageMip dstMip;
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
@@ -746,7 +746,7 @@ int main(int _argc, const char* _argv[])
}
else
{
- output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
+ output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, 1, false, mips);
ImageMip dstMip;
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h
new file mode 100644
index 00000000000..27c6ec99e5b
--- /dev/null
+++ b/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h
@@ -0,0 +1,112 @@
+static const uint8_t fs_texture_array_glsl[329] =
+{
+ 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
+ 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color.......u_pa
+ 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1a, 0x01, 0x00, 0x00, 0x76, 0x61, // rams..........va
+ 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // rying vec4 v_col
+ 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, // or0;.varying vec
+ 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, // 2 v_texcoord0;.u
+ 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // niform sampler2D
+ 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // Array s_texColor
+ 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, // ;.uniform vec4 u
+ 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // _params;.void ma
+ 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, // in ().{. vec3 t
+ 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1;. tmpva
+ 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // r_1.xy = v_texco
+ 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ord0;. tmpvar_1
+ 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, // .z = u_params.y;
+ 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor
+ 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, // = (texture2DArra
+ 0x79, 0x4c, 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // yLod (s_texColor
+ 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, // , tmpvar_1, u_pa
+ 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // rams.x) * v_colo
+ 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r0);.}...
+};
+static const uint8_t fs_texture_array_dx11[488] =
+{
+ 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par
+ 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC
+ 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb8, 0x01, 0x44, 0x58, 0x42, 0x43, // olor0.......DXBC
+ 0x81, 0x20, 0x2f, 0xf0, 0x22, 0x82, 0x15, 0xc5, 0x5c, 0x50, 0xb5, 0xdb, 0x71, 0x0a, 0x7d, 0x9a, // . /."....P..q.}.
+ 0x01, 0x00, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, // ............,...
+ 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, // ........ISGNl...
+ 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P.......
+ 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, 0x03, 0x00, 0x00, 0x00, // ................
+ 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........b.......
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................
+ 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // SV_POSITION.COLO
+ 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, // R.TEXCOORD..OSGN
+ 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 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, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET...
+ 0x53, 0x48, 0x44, 0x52, 0xdc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, // SHDR....@...7...
+ 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // Y...F. .........
+ 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x04, // Z....`......X@..
+ 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, // .p......UU..b...
+ 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ........b...2...
+ 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
+ 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, // h.......6...2...
+ 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, // ....F.......6...
+ 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // B......... .....
+ 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...........
+ 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~......
+ 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .`........ .....
+ 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....8.... ......
+ 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // F.......F.......
+ 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // >.......
+};
+static const uint8_t fs_texture_array_mtl[811] =
+{
+ 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH...........us
+ 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me
+ 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat
+ 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput {
+ 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 v_colo
+ 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x74, // r0;. float2 v_t
+ 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, // excoord0;.};.str
+ 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // uct xlatMtlShade
+ 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // rOutput {. half
+ 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // 4 gl_FragColor;.
+ 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt
+ 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform {
+ 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // . float4 u_para
+ 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // ms;.};.fragment
+ 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut
+ 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain
+ 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn
+ 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta
+ 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan
+ 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU
+ 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [
+ 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. ,
+ 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x5f, 0x61, 0x72, 0x72, // texture2d_arr
+ 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ay<float> s_texC
+ 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, // olor [[texture(0
+ 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, // )]], sampler _mt
+ 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // lsmp_s_texColor
+ 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, // [[sampler(0)]]).
+ 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // {. xlatMtlShade
+ 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // rOutput _mtl_o;.
+ 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_
+ 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, // 1;. tmpvar_1.xy
+ 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // = _mtl_i.v_texc
+ 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // oord0;. tmpvar_
+ 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // 1.z = _mtl_u.u_p
+ 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // arams.y;. half4
+ 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp
+ 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, // var_2 = half4(s_
+ 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, // texColor.sample(
+ 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // _mtlsmp_s_texCol
+ 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x28, 0x74, 0x6d, // or, (float2)((tm
+ 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x28, 0x75, 0x69, // pvar_1).xy), (ui
+ 0x6e, 0x74, 0x29, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x7a, // nt)((tmpvar_1).z
+ 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // ), level(_mtl_u.
+ 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, // u_params.x)));.
+ 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // _mtl_o.gl_FragC
+ 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, // olor = ((half4)(
+ 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // (float4)tmpvar_2
+ 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // * _mtl_i.v_colo
+ 0x72, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // r0));. return _
+ 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}...
+};
diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_array.sc b/3rdparty/bgfx/tools/texturev/fs_texture_array.sc
new file mode 100644
index 00000000000..4059652ab35
--- /dev/null
+++ b/3rdparty/bgfx/tools/texturev/fs_texture_array.sc
@@ -0,0 +1,20 @@
+$input v_texcoord0, v_color0
+
+/*
+ * Copyright 2011-2016 Branimir Karadzic. All rights reserved.
+ * License: http://www.opensource.org/licenses/BSD-2-Clause
+ */
+
+#include <bgfx_shader.sh>
+
+SAMPLER2DARRAY(s_texColor, 0);
+
+uniform vec4 u_params;
+#define u_textureLod u_params.x
+#define u_textureLayer u_params.y
+
+void main()
+{
+ vec4 color = texture2DArrayLod(s_texColor, vec3(v_texcoord0, u_textureLayer), u_textureLod);
+ gl_FragColor = color * v_color0;
+}
diff --git a/3rdparty/bgfx/tools/texturev/texturev.cpp b/3rdparty/bgfx/tools/texturev/texturev.cpp
index faa10220d2f..0ea30e59c88 100644
--- a/3rdparty/bgfx/tools/texturev/texturev.cpp
+++ b/3rdparty/bgfx/tools/texturev/texturev.cpp
@@ -19,6 +19,7 @@
#include "vs_texture.bin.h"
#include "fs_texture.bin.h"
+#include "fs_texture_array.bin.h"
#include "vs_texture_cube.bin.h"
#include "fs_texture_cube.bin.h"
@@ -82,6 +83,9 @@ static const InputBinding s_bindingView[] =
{ entry::Key::PageUp, entry::Modifier::None, 1, NULL, "view file-pgup" },
{ entry::Key::PageDown, entry::Modifier::None, 1, NULL, "view file-pgdown" },
+ { entry::Key::Left, entry::Modifier::None, 1, NULL, "view layer prev" },
+ { entry::Key::Right, entry::Modifier::None, 1, NULL, "view layer next" },
+
{ entry::Key::KeyR, entry::Modifier::None, 1, NULL, "view rgb r" },
{ entry::Key::KeyG, entry::Modifier::None, 1, NULL, "view rgb g" },
{ entry::Key::KeyB, entry::Modifier::None, 1, NULL, "view rgb b" },
@@ -112,6 +116,7 @@ struct View
: m_fileIndex(0)
, m_scaleFn(0)
, m_mip(0)
+ , m_layer(0)
, m_abgr(UINT32_MAX)
, m_zoom(1.0f)
, m_filter(true)
@@ -156,6 +161,35 @@ struct View
m_mip = 0;
}
}
+ if (0 == strcmp(_argv[1], "layer") )
+ {
+ if (_argc >= 3)
+ {
+ uint32_t layer = m_layer;
+ if (0 == strcmp(_argv[2], "next") )
+ {
+ ++layer;
+ }
+ else if (0 == strcmp(_argv[2], "prev") )
+ {
+ --layer;
+ }
+ else if (0 == strcmp(_argv[2], "last") )
+ {
+ layer = INT32_MAX;
+ }
+ else
+ {
+ layer = atoi(_argv[2]);
+ }
+
+ m_layer = bx::uint32_iclamp(layer, 0, m_info.numLayers-1);
+ }
+ else
+ {
+ m_layer = 0;
+ }
+ }
else if (0 == strcmp(_argv[1], "zoom") )
{
if (_argc >= 3)
@@ -296,6 +330,7 @@ struct View
uint32_t m_fileIndex;
uint32_t m_scaleFn;
uint32_t m_mip;
+ uint32_t m_layer;
uint32_t m_abgr;
float m_zoom;
bool m_filter;
@@ -522,7 +557,7 @@ void associate()
bx::Error err;
if (bx::open(&writer, temp, false, &err) )
{
- bx::write(&writer, str.c_str(), str.length(), &err);
+ bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
bx::close(&writer);
if (err.isOk() )
@@ -553,7 +588,7 @@ void associate()
bx::Error err;
if (bx::open(&writer, "/tmp/texturev.sh", false, &err) )
{
- bx::write(&writer, str.c_str(), str.length(), &err);
+ bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
bx::close(&writer);
if (err.isOk() )
@@ -611,37 +646,53 @@ int _main_(int _argc, char** _argv)
const bgfx::Memory* vs_texture;
const bgfx::Memory* fs_texture;
+ const bgfx::Memory* fs_texture_array;
const bgfx::Memory* vs_texture_cube;
const bgfx::Memory* fs_texture_cube;
switch (bgfx::getRendererType())
{
case bgfx::RendererType::Direct3D9:
- vs_texture = bgfx::makeRef(vs_texture_dx9, sizeof(vs_texture_dx9) );
- fs_texture = bgfx::makeRef(fs_texture_dx9, sizeof(fs_texture_dx9) );
- vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx9, sizeof(vs_texture_cube_dx9) );
- fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx9, sizeof(fs_texture_cube_dx9) );
+ vs_texture = bgfx::makeRef(vs_texture_dx9, sizeof(vs_texture_dx9) );
+ fs_texture = bgfx::makeRef(fs_texture_dx9, sizeof(fs_texture_dx9) );
+ fs_texture_array = NULL;
+ vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx9, sizeof(vs_texture_cube_dx9) );
+ fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx9, sizeof(fs_texture_cube_dx9) );
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
- vs_texture = bgfx::makeRef(vs_texture_dx11, sizeof(vs_texture_dx11) );
- fs_texture = bgfx::makeRef(fs_texture_dx11, sizeof(fs_texture_dx11) );
- vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx11, sizeof(vs_texture_cube_dx11) );
- fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx11, sizeof(fs_texture_cube_dx11) );
+ vs_texture = bgfx::makeRef(vs_texture_dx11, sizeof(vs_texture_dx11) );
+ fs_texture = bgfx::makeRef(fs_texture_dx11, sizeof(fs_texture_dx11) );
+ fs_texture_array = bgfx::makeRef(fs_texture_array_dx11, sizeof(fs_texture_dx11) );
+ vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx11, sizeof(vs_texture_cube_dx11) );
+ fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx11, sizeof(fs_texture_cube_dx11) );
break;
default:
- vs_texture = bgfx::makeRef(vs_texture_glsl, sizeof(vs_texture_glsl) );
- fs_texture = bgfx::makeRef(fs_texture_glsl, sizeof(fs_texture_glsl) );
- vs_texture_cube = bgfx::makeRef(vs_texture_cube_glsl, sizeof(vs_texture_cube_glsl) );
- fs_texture_cube = bgfx::makeRef(fs_texture_cube_glsl, sizeof(fs_texture_cube_glsl) );
+ vs_texture = bgfx::makeRef(vs_texture_glsl, sizeof(vs_texture_glsl) );
+ fs_texture = bgfx::makeRef(fs_texture_glsl, sizeof(fs_texture_glsl) );
+ fs_texture_array = bgfx::makeRef(fs_texture_array_glsl, sizeof(fs_texture_array_glsl) );
+ fs_texture = bgfx::makeRef(fs_texture_glsl, sizeof(fs_texture_glsl) );
+ vs_texture_cube = bgfx::makeRef(vs_texture_cube_glsl, sizeof(vs_texture_cube_glsl) );
+ fs_texture_cube = bgfx::makeRef(fs_texture_cube_glsl, sizeof(fs_texture_cube_glsl) );
break;
}
+ bgfx::ShaderHandle vsTexture = bgfx::createShader(vs_texture);
+ bgfx::ShaderHandle fsTexture = bgfx::createShader(fs_texture);
+
bgfx::ProgramHandle textureProgram = bgfx::createProgram(
- bgfx::createShader(vs_texture)
- , bgfx::createShader(fs_texture)
+ vsTexture
+ , fsTexture
+ , true
+ );
+
+ bgfx::ProgramHandle textureArrayProgram = bgfx::createProgram(
+ vsTexture
+ , NULL != fs_texture_array
+ ? bgfx::createShader(fs_texture_array)
+ : fsTexture
, true
);
@@ -658,9 +709,10 @@ int _main_(int _argc, char** _argv)
float speed = 0.37f;
float time = 0.0f;
- Interpolator mip(0.0);
- Interpolator zoom(1.0);
- Interpolator scale(1.0);
+ Interpolator mip(0.0f);
+ Interpolator layer(0.0f);
+ Interpolator zoom(1.0f);
+ Interpolator scale(1.0f);
const char* filePath = _argc < 2 ? "" : _argv[1];
bool directory = false;
@@ -750,6 +802,10 @@ int _main_(int _argc, char** _argv)
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "/"); ImGui::SameLine(64); ImGui::Text("Toggle linear/point texture sampling.");
ImGui::NextLine();
+ ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "left"); ImGui::SameLine(64); ImGui::Text("Previous layer in texture array.");
+ ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "right"); ImGui::SameLine(64); ImGui::Text("Next layer in texture array.");
+ ImGui::NextLine();
+
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "up"); ImGui::SameLine(64); ImGui::Text("Previous texture.");
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "down"); ImGui::SameLine(64); ImGui::Text("Next texture.");
ImGui::NextLine();
@@ -849,9 +905,10 @@ int _main_(int _argc, char** _argv)
bx::mtxRotateXY(mtx, 0.0f, time);
bgfx::setUniform(u_mtx, mtx);
- mip.set( float(view.m_mip), 0.5f);
+ mip.set(float(view.m_mip), 0.5f);
+ layer.set(float(view.m_layer), 0.25f);
- float params[4] = { mip.getValue(), 0.0f, 0.0f, 0.0f };
+ float params[4] = { mip.getValue(), layer.getValue(), 0.0f, 0.0f };
bgfx::setUniform(u_params, params);
bgfx::setTexture(0
@@ -869,7 +926,10 @@ int _main_(int _argc, char** _argv)
| BGFX_STATE_ALPHA_WRITE
| (view.m_alpha ? BGFX_STATE_BLEND_ALPHA : BGFX_STATE_NONE)
);
- bgfx::submit(0, view.m_info.cubeMap ? textureCubeProgram : textureProgram);
+ bgfx::submit(0, view.m_info.cubeMap ? textureCubeProgram
+ : 1 < view.m_info.numLayers ? textureArrayProgram
+ : textureProgram
+ );
bgfx::frame();
}
@@ -883,6 +943,7 @@ int _main_(int _argc, char** _argv)
bgfx::destroyUniform(u_mtx);
bgfx::destroyUniform(u_params);
bgfx::destroyProgram(textureProgram);
+ bgfx::destroyProgram(textureArrayProgram);
bgfx::destroyProgram(textureCubeProgram);
imguiDestroy();
diff --git a/3rdparty/bx/include/bx/macros.h b/3rdparty/bx/include/bx/macros.h
index 870f8726738..90a0ca8c132 100644
--- a/3rdparty/bx/include/bx/macros.h
+++ b/3rdparty/bx/include/bx/macros.h
@@ -136,46 +136,46 @@
///
#if BX_COMPILER_CLANG
-# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG() _Pragma("clang diagnostic push")
-# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG() _Pragma("clang diagnostic pop")
+# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG_() _Pragma("clang diagnostic push")
+# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG_() _Pragma("clang diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x) _Pragma(BX_STRINGIZE(clang diagnostic ignored _x) )
#else
-# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG()
-# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
+# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG_()
+# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG_()
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x)
#endif // BX_COMPILER_CLANG
#if BX_COMPILER_GCC && BX_COMPILER_GCC >= 40600
-# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC() _Pragma("GCC diagnostic push")
-# define BX_PRAGMA_DIAGNOSTIC_POP_GCC() _Pragma("GCC diagnostic pop")
+# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC_() _Pragma("GCC diagnostic push")
+# define BX_PRAGMA_DIAGNOSTIC_POP_GCC_() _Pragma("GCC diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x) _Pragma(BX_STRINGIZE(GCC diagnostic ignored _x) )
#else
-# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC()
-# define BX_PRAGMA_DIAGNOSTIC_POP_GCC()
+# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC_()
+# define BX_PRAGMA_DIAGNOSTIC_POP_GCC_()
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x)
#endif // BX_COMPILER_GCC
#if BX_COMPILER_MSVC
-# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC() __pragma(warning(push) )
-# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC() __pragma(warning(pop) )
+# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC_() __pragma(warning(push) )
+# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC_() __pragma(warning(pop) )
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(_x) __pragma(warning(disable:_x) )
#else
-# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC()
-# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC()
+# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC_()
+# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC_()
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(_x)
#endif // BX_COMPILER_CLANG
#if BX_COMPILER_CLANG
-# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG
-# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_CLANG
+# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG_
+# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_CLANG_
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG
#elif BX_COMPILER_GCC
-# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_GCC
-# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_GCC
+# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_GCC_
+# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_GCC_
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC
#elif BX_COMPILER_MSVC
-# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC
-# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_MSVC
+# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC_
+# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_MSVC_
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC(_x)
#endif // BX_COMPILER_
diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h
index 0bdeb3c1eba..39505d73989 100644
--- a/3rdparty/bx/include/bx/os.h
+++ b/3rdparty/bx/include/bx/os.h
@@ -34,14 +34,10 @@
# include <pthread.h> // mach_port_t
# endif // BX_PLATFORM_*
-# if BX_PLATFORM_NACL
-# include <sys/nacl_syscalls.h> // nanosleep
-# else
-# include <time.h> // nanosleep
-# if !BX_PLATFORM_PS4
-# include <dlfcn.h> // dlopen, dlclose, dlsym
-# endif // !BX_PLATFORM_PS4
-# endif // BX_PLATFORM_NACL
+# include <time.h> // nanosleep
+# if !BX_PLATFORM_PS4 && !BX_PLATFORM_NACL
+# include <dlfcn.h> // dlopen, dlclose, dlsym
+# endif // !BX_PLATFORM_PS4 && !BX_PLATFORM_NACL
# if BX_PLATFORM_ANDROID
# include <malloc.h> // mallinfo
diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h
index 02a80045285..d917d07df21 100644
--- a/3rdparty/bx/include/bx/platform.h
+++ b/3rdparty/bx/include/bx/platform.h
@@ -341,6 +341,8 @@
#if BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
# pragma warning(error:4062) // ENABLE warning C4062: enumerator'...' in switch of enum '...' is not handled
+# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
+# pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
# pragma warning(error:4121) // ENABLE warning C4121: 'symbol' : alignment of a member was sensitive to packing
//# pragma warning(error:4127) // ENABLE warning C4127: conditional expression is constant
# pragma warning(error:4130) // ENABLE warning C4130: 'operator' : logical operation on address of string constant
@@ -350,13 +352,12 @@
# pragma warning(error:4263) // ENABLE warning C4263: 'function' : member function does not override any base class virtual member function
# pragma warning(error:4265) // ENABLE warning C4265: class has virtual functions, but destructor is not virtual
# pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
+# pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
# pragma warning(error:4545) // ENABLE warning C4545: expression before comma evaluates to a function which is missing an argument list
# pragma warning(error:4549) // ENABLE warning C4549: 'operator' : operator before comma has no effect; did you intend 'operator'?
# pragma warning(error:4701) // ENABLE warning C4701: potentially uninitialized local variable 'name' used
# pragma warning(error:4706) // ENABLE warning C4706: assignment within conditional expression
-# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
-# pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
-# pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
+# pragma warning(error:4800) // ENABLE warning C4800: '': forcing value to bool 'true' or 'false' (performance warning)
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
#endif // BX_PLATFORM_H_HEADER_GUARD
diff --git a/3rdparty/bx/include/bx/simd256_avx.inl b/3rdparty/bx/include/bx/simd256_avx.inl
index c0f925e4160..33f5af701e4 100644
--- a/3rdparty/bx/include/bx/simd256_avx.inl
+++ b/3rdparty/bx/include/bx/simd256_avx.inl
@@ -6,4 +6,40 @@
#ifndef BX_SIMD256_AVX_H_HEADER_GUARD
#define BX_SIMD256_AVX_H_HEADER_GUARD
+#include "simd_ni.inl"
+
+namespace bx
+{
+
+ template<>
+ BX_SIMD_FORCE_INLINE simd256_avx_t simd_ld(const void* _ptr)
+ {
+ return _mm256_load_ps(reinterpret_cast<const float*>(_ptr) );
+ }
+
+ template<>
+ BX_SIMD_FORCE_INLINE void simd_st(void* _ptr, simd256_avx_t _a)
+ {
+ _mm256_store_ps(reinterpret_cast<float*>(_ptr), _a);
+ }
+
+ template<>
+ BX_SIMD_FORCE_INLINE simd256_avx_t simd_ld(float _x, float _y, float _z, float _w, float _A, float _B, float _C, float _D)
+ {
+ return _mm256_set_ps(_D, _C, _B, _A, _w, _z, _y, _x);
+ }
+
+ template<>
+ BX_SIMD_FORCE_INLINE simd256_avx_t simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _A, uint32_t _B, uint32_t _C, uint32_t _D)
+ {
+ const __m256i set = _mm256_set_epi32(_D, _C, _B, _A, _w, _z, _y, _x);
+ const simd256_avx_t result = _mm256_castsi256_ps(set);
+
+ return result;
+ }
+
+ typedef simd256_avx_t simd256_t;
+
+} // namespace bx
+
#endif // BX_SIMD256_AVX_H_HEADER_GUARD
diff --git a/3rdparty/bx/include/bx/simd256_ref.inl b/3rdparty/bx/include/bx/simd256_ref.inl
index 84ecd6e5f9f..b1bca3f56a6 100644
--- a/3rdparty/bx/include/bx/simd256_ref.inl
+++ b/3rdparty/bx/include/bx/simd256_ref.inl
@@ -6,4 +6,46 @@
#ifndef BX_SIMD256_REF_H_HEADER_GUARD
#define BX_SIMD256_REF_H_HEADER_GUARD
+#include "simd_ni.inl"
+
+namespace bx
+{
+ template<>
+ BX_SIMD_FORCE_INLINE simd256_ref_t simd_ld(const void* _ptr)
+ {
+ const simd128_t* ptr = reinterpret_cast<const simd128_t*>(_ptr);
+ simd256_ref_t result;
+ result.simd128_0 = simd_ld<simd128_t>(&ptr[0]);
+ result.simd128_1 = simd_ld<simd128_t>(&ptr[1]);
+ return result;
+ }
+
+ template<>
+ BX_SIMD_FORCE_INLINE void simd_st(void* _ptr, simd256_ref_t& _a)
+ {
+ simd128_t* result = reinterpret_cast<simd128_t*>(_ptr);
+ simd_st<simd128_t>(&result[0], _a.simd128_0);
+ simd_st<simd128_t>(&result[1], _a.simd128_1);
+ }
+
+ template<>
+ BX_SIMD_FORCE_INLINE simd256_ref_t simd_ld(float _x, float _y, float _z, float _w, float _a, float _b, float _c, float _d)
+ {
+ simd256_ref_t result;
+ result.simd128_0 = simd_ld<simd128_t>(_x, _y, _z, _w);
+ result.simd128_1 = simd_ld<simd128_t>(_a, _b, _c, _d);
+ return result;
+ }
+
+ template<>
+ BX_SIMD_FORCE_INLINE simd256_ref_t simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _d)
+ {
+ simd256_ref_t result;
+ result.simd128_0 = simd_ild<simd128_t>(_x, _y, _z, _w);
+ result.simd128_1 = simd_ild<simd128_t>(_a, _b, _c, _d);
+ return result;
+ }
+
+} // namespace bx
+
#endif // BX_SIMD256_REF_H_HEADER_GUARD
diff --git a/3rdparty/bx/include/bx/simd_t.h b/3rdparty/bx/include/bx/simd_t.h
index a2884f6e734..5e1fa55d7dc 100644
--- a/3rdparty/bx/include/bx/simd_t.h
+++ b/3rdparty/bx/include/bx/simd_t.h
@@ -136,9 +136,15 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
BX_SIMD_FORCE_INLINE Ty simd_ld(float _x, float _y, float _z, float _w);
template<typename Ty>
+ BX_SIMD_FORCE_INLINE Ty simd_ld(float _x, float _y, float _z, float _w, float _a, float _b, float _c, float _d);
+
+ template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w);
template<typename Ty>
+ BX_SIMD_FORCE_INLINE Ty simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _d);
+
+ template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_splat(const void* _ptr);
template<typename Ty>
@@ -352,14 +358,6 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
typedef __m128 simd128_sse_t;
#endif // BX_SIMD_SSE
- union simd128_ref_t
- {
- float fxyzw[4];
- int32_t ixyzw[4];
- uint32_t uxyzw[4];
-
- };
-
} // namespace bx
#if BX_SIMD_AVX
@@ -378,27 +376,51 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
# include "simd128_sse.inl"
#endif // BX_SIMD_SSE
-#include "simd128_ref.inl"
-#include "simd256_ref.inl"
-
namespace bx
{
-#if !( BX_SIMD_AVX \
- || BX_SIMD_LANGEXT \
+ union simd128_ref_t
+ {
+ float fxyzw[4];
+ int32_t ixyzw[4];
+ uint32_t uxyzw[4];
+ };
+
+#ifndef BX_SIMD_WARN_REFERENCE_IMPL
+# define BX_SIMD_WARN_REFERENCE_IMPL 0
+#endif // BX_SIMD_WARN_REFERENCE_IMPL
+
+#if !( BX_SIMD_LANGEXT \
|| BX_SIMD_NEON \
|| BX_SIMD_SSE \
)
-# ifndef BX_SIMD_WARN_REFERENCE_IMPL
-# define BX_SIMD_WARN_REFERENCE_IMPL 0
-# endif // BX_SIMD_WARN_REFERENCE_IMPL
-
# if BX_SIMD_WARN_REFERENCE_IMPL
-# pragma message("************************************\nUsing SIMD reference implementation!\n************************************")
+# pragma message("*** Using SIMD128 reference implementation! ***")
# endif // BX_SIMD_WARN_REFERENCE_IMPL
typedef simd128_ref_t simd128_t;
#endif //
+ struct simd256_ref_t
+ {
+ simd128_t simd128_0;
+ simd128_t simd128_1;
+ };
+
+#if !BX_SIMD_AVX
+# if BX_SIMD_WARN_REFERENCE_IMPL
+# pragma message("*** Using SIMD256 reference implementation! ***")
+# endif // BX_SIMD_WARN_REFERENCE_IMPL
+
+ typedef simd256_ref_t simd256_t;
+#endif // !BX_SIMD_AVX
+
+} // namespace bx
+
+#include "simd128_ref.inl"
+#include "simd256_ref.inl"
+
+namespace bx
+{
BX_SIMD_FORCE_INLINE simd128_t simd_zero()
{
return simd_zero<simd128_t>();
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua
index 0f751dd3aa4..59795b2be9d 100644
--- a/3rdparty/bx/scripts/toolchain.lua
+++ b/3rdparty/bx/scripts/toolchain.lua
@@ -61,7 +61,6 @@ function toolchain(_buildDir, _libDir)
},
}
-
newoption {
trigger = "xcode",
value = "xcode_target",
@@ -74,28 +73,38 @@ function toolchain(_buildDir, _libDir)
}
newoption {
- trigger = "with-android",
- value = "#",
+ trigger = "with-android",
+ value = "#",
description = "Set Android platform version (default: android-14).",
}
newoption {
- trigger = "with-ios",
- value = "#",
+ trigger = "with-ios",
+ value = "#",
description = "Set iOS target version (default: 8.0).",
}
newoption {
- trigger = "with-tvos",
- value = "#",
+ trigger = "with-tvos",
+ value = "#",
description = "Set tvOS target version (default: 9.0).",
}
newoption {
- trigger = "with-dynamic-runtime",
+ trigger = "with-dynamic-runtime",
description = "Dynamically link with the runtime rather than statically",
}
+ newoption {
+ trigger = "with-32bit-compiler",
+ description = "Use 32-bit compiler instead 64-bit.",
+ }
+
+ newoption {
+ trigger = "with-avx",
+ description = "Use AVX extension.",
+ }
+
-- Avoid error when invoking genie --help.
if (_ACTION == nil) then return false end
@@ -122,6 +131,11 @@ function toolchain(_buildDir, _libDir)
tvosPlatform = _OPTIONS["with-tvos"]
end
+ local compiler32bit = false
+ if _OPTIONS["with-32bit-compiler"] then
+ compiler32bit = true
+ end
+
if _ACTION == "gmake" or _ACTION == "ninja" then
if nil == _OPTIONS["gcc"] then
@@ -249,8 +263,17 @@ function toolchain(_buildDir, _libDir)
location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink"))
elseif "mingw-gcc" == _OPTIONS["gcc"] then
- premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
- premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
+ local mingwToolchain = "x86_64-w64-mingw32"
+ if compiler32bit then
+ if os.is("linux") then
+ mingwToolchain = "i686-w64-mingw32"
+ else
+ mingwToolchain = "mingw32"
+ end
+ end
+
+ premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
+ premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
premake.gcc.ar = "$(MINGW)/bin/ar"
location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
@@ -268,11 +291,11 @@ function toolchain(_buildDir, _libDir)
print("Set NACL_SDK_ROOT enviroment variable.")
end
- naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
+ naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_glibc/bin/x86_64-nacl-"
if os.is("macosx") then
- naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_newlib/bin/x86_64-nacl-"
+ naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_glibc/bin/x86_64-nacl-"
elseif os.is("linux") then
- naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/x86_64-nacl-"
+ naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_glibc/bin/x86_64-nacl-"
end
premake.gcc.cc = naclToolchain .. "gcc"
@@ -286,11 +309,11 @@ function toolchain(_buildDir, _libDir)
print("Set NACL_SDK_ROOT enviroment variable.")
end
- naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
+ naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_glibc/bin/arm-nacl-"
if os.is("macosx") then
- naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_newlib/bin/arm-nacl-"
+ naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_glibc/bin/arm-nacl-"
elseif os.is("linux") then
- naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_newlib/bin/arm-nacl-"
+ naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_glibc/bin/arm-nacl-"
end
premake.gcc.cc = naclToolchain .. "gcc"
@@ -304,10 +327,14 @@ function toolchain(_buildDir, _libDir)
elseif "osx" == _OPTIONS["gcc"] then
if os.is("linux") then
+ if not os.getenv("OSXCROSS") then
+ print("Set OSXCROSS enviroment variable.")
+ end
+
local osxToolchain = "x86_64-apple-darwin15-"
- premake.gcc.cc = osxToolchain .. "clang"
- premake.gcc.cxx = osxToolchain .. "clang++"
- premake.gcc.ar = osxToolchain .. "ar"
+ premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
+ premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
+ premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
end
location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
@@ -438,6 +465,10 @@ function toolchain(_buildDir, _libDir)
flags { "StaticRuntime" }
end
+ if _OPTIONS["with-avx"] then
+ flags { "EnableAVX" }
+ end
+
flags {
"NoPCH",
"NativeWChar",
@@ -907,10 +938,10 @@ function toolchain(_buildDir, _libDir)
linkoptions { "-melf32_nacl" }
configuration { "x32", "nacl", "Debug" }
- libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
+ libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Debug" }
configuration { "x32", "nacl", "Release" }
- libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
+ libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Release" }
configuration { "x64", "nacl" }
targetdir (path.join(_buildDir, "nacl-x64/bin"))
@@ -919,10 +950,10 @@ function toolchain(_buildDir, _libDir)
linkoptions { "-melf64_nacl" }
configuration { "x64", "nacl", "Debug" }
- libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
+ libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Debug" }
configuration { "x64", "nacl", "Release" }
- libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
+ libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Release" }
configuration { "nacl-arm" }
buildoptions {
@@ -933,10 +964,10 @@ function toolchain(_buildDir, _libDir)
libdirs { path.join(_libDir, "lib/nacl-arm") }
configuration { "nacl-arm", "Debug" }
- libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
+ libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Debug" }
configuration { "nacl-arm", "Release" }
- libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
+ libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Release" }
configuration { "pnacl" }
targetdir (path.join(_buildDir, "pnacl/bin"))
diff --git a/3rdparty/bx/tests/simd_t.cpp b/3rdparty/bx/tests/simd_t.cpp
index 999438a234a..0edf3030625 100644
--- a/3rdparty/bx/tests/simd_t.cpp
+++ b/3rdparty/bx/tests/simd_t.cpp
@@ -12,11 +12,12 @@ using namespace bx;
union simd_cast
{
- bx::simd128_t f4;
- float f[4];
- uint32_t ui[4];
- int32_t i[4];
- char c[16];
+ bx::simd256_t simd256;
+ bx::simd128_t simd128;
+ float f[8];
+ uint32_t ui[8];
+ int32_t i[8];
+ char c[32];
};
void simd_check_bool(const char* _str, bool _a, bool _0)
@@ -30,9 +31,16 @@ void simd_check_bool(const char* _str, bool _a, bool _0)
CHECK_EQUAL(_a, _0);
}
-void simd_check_int32(const char* _str, bx::simd128_t _a, int32_t _0, int32_t _1, int32_t _2, int32_t _3)
+void simd_check_int32(
+ const char* _str
+ , bx::simd128_t _a
+ , int32_t _0
+ , int32_t _1
+ , int32_t _2
+ , int32_t _3
+ )
{
- simd_cast c; c.f4 = _a;
+ simd_cast c; c.simd128 = _a;
DBG("%s (%d, %d, %d, %d) == (%d, %d, %d, %d)"
, _str
, c.i[0], c.i[1], c.i[2], c.i[3]
@@ -45,9 +53,48 @@ void simd_check_int32(const char* _str, bx::simd128_t _a, int32_t _0, int32_t _1
CHECK_EQUAL(c.i[3], _3);
}
-void simd_check_uint32(const char* _str, bx::simd128_t _a, uint32_t _0, uint32_t _1, uint32_t _2, uint32_t _3)
+#if 0
+void simd_check_int32(
+ const char* _str
+ , bx::simd256_t _a
+ , int32_t _0
+ , int32_t _1
+ , int32_t _2
+ , int32_t _3
+ , int32_t _4
+ , int32_t _5
+ , int32_t _6
+ , int32_t _7
+ )
{
- simd_cast c; c.f4 = _a;
+ simd_cast c; c.simd256 = _a;
+ DBG("%s (%d, %d, %d, %d, %d, %d, %d, %d) == (%d, %d, %d, %d, %d, %d, %d, %d)"
+ , _str
+ , c.i[0], c.i[1], c.i[2], c.i[3], c.i[4], c.i[5], c.i[6], c.i[7]
+ , _0, _1, _2, _3, _4, _5, _6, _7
+ );
+
+ CHECK_EQUAL(c.i[0], _0);
+ CHECK_EQUAL(c.i[1], _1);
+ CHECK_EQUAL(c.i[2], _2);
+ CHECK_EQUAL(c.i[3], _3);
+ CHECK_EQUAL(c.i[4], _4);
+ CHECK_EQUAL(c.i[5], _5);
+ CHECK_EQUAL(c.i[6], _6);
+ CHECK_EQUAL(c.i[7], _7);
+}
+#endif // 0
+
+void simd_check_uint32(
+ const char* _str
+ , bx::simd128_t _a
+ , uint32_t _0
+ , uint32_t _1
+ , uint32_t _2
+ , uint32_t _3
+ )
+{
+ simd_cast c; c.simd128 = _a;
DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x)"
, _str
@@ -61,9 +108,49 @@ void simd_check_uint32(const char* _str, bx::simd128_t _a, uint32_t _0, uint32_t
CHECK_EQUAL(c.ui[3], _3);
}
-void simd_check_float(const char* _str, bx::simd128_t _a, float _0, float _1, float _2, float _3)
+#if 0
+void simd_check_uint32(
+ const char* _str
+ , bx::simd256_t _a
+ , uint32_t _0
+ , uint32_t _1
+ , uint32_t _2
+ , uint32_t _3
+ , uint32_t _4
+ , uint32_t _5
+ , uint32_t _6
+ , uint32_t _7
+ )
+{
+ simd_cast c; c.simd256 = _a;
+
+ DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)"
+ , _str
+ , c.ui[0], c.ui[1], c.ui[2], c.ui[3], c.ui[4], c.ui[5], c.ui[6], c.ui[7]
+ , _0, _1, _2, _3, _4, _5, _6, _7
+ );
+
+ CHECK_EQUAL(c.ui[0], _0);
+ CHECK_EQUAL(c.ui[1], _1);
+ CHECK_EQUAL(c.ui[2], _2);
+ CHECK_EQUAL(c.ui[3], _3);
+ CHECK_EQUAL(c.ui[4], _4);
+ CHECK_EQUAL(c.ui[5], _5);
+ CHECK_EQUAL(c.ui[6], _6);
+ CHECK_EQUAL(c.ui[7], _7);
+}
+#endif // 0
+
+void simd_check_float(
+ const char* _str
+ , bx::simd128_t _a
+ , float _0
+ , float _1
+ , float _2
+ , float _3
+ )
{
- simd_cast c; c.f4 = _a;
+ simd_cast c; c.simd128 = _a;
DBG("%s (%f, %f, %f, %f) == (%f, %f, %f, %f)"
, _str
@@ -77,9 +164,42 @@ void simd_check_float(const char* _str, bx::simd128_t _a, float _0, float _1, fl
CHECK(bx::fequal(c.f[3], _3, 0.0001f) );
}
+#if 0
+void simd_check_float(
+ const char* _str
+ , bx::simd256_t _a
+ , float _0
+ , float _1
+ , float _2
+ , float _3
+ , float _4
+ , float _5
+ , float _6
+ , float _7
+ )
+{
+ simd_cast c; c.simd256 = _a;
+
+ DBG("%s (%f, %f, %f, %f, %f, %f, %f, %f) == (%f, %f, %f, %f, %f, %f, %f, %f)"
+ , _str
+ , c.f[0], c.f[1], c.f[2], c.f[3], c.f[4], c.f[5], c.f[6], c.f[7]
+ , _0, _1, _2, _3, _4, _5, _6, _7
+ );
+
+ CHECK(bx::fequal(c.f[0], _0, 0.0001f) );
+ CHECK(bx::fequal(c.f[1], _1, 0.0001f) );
+ CHECK(bx::fequal(c.f[2], _2, 0.0001f) );
+ CHECK(bx::fequal(c.f[3], _3, 0.0001f) );
+ CHECK(bx::fequal(c.f[4], _4, 0.0001f) );
+ CHECK(bx::fequal(c.f[5], _5, 0.0001f) );
+ CHECK(bx::fequal(c.f[6], _6, 0.0001f) );
+ CHECK(bx::fequal(c.f[7], _7, 0.0001f) );
+}
+#endif // 0
+
void simd_check_string(const char* _str, bx::simd128_t _a)
{
- simd_cast c; c.f4 = _a;
+ simd_cast c; c.simd128 = _a;
const char test[5] = { c.c[0], c.c[4], c.c[8], c.c[12], '\0' };
DBG("%s %s", _str, test);
@@ -200,11 +320,21 @@ TEST(simd_load)
, 0.0f, 1.0f, 2.0f, 3.0f
);
+// simd_check_float("ld"
+// , simd_ld<simd256_t>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)
+// , 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f
+// );
+
simd_check_int32("ild"
, simd_ild(uint32_t(-1), 0, 1, 2)
, uint32_t(-1), 0, 1, 2
);
+// simd_check_int32("ild"
+// , simd_ild<simd256_t>(uint32_t(-1), 0, 1, 2, 3, 4, 5, 6)
+// , uint32_t(-1), 0, 1, 2, 3, 4, 5, 6
+// );
+
simd_check_int32("ild"
, simd_ild(uint32_t(-1), uint32_t(-2), uint32_t(-3), uint32_t(-4) )
, uint32_t(-1), uint32_t(-2), uint32_t(-3), uint32_t(-4)
diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie
index ca02eb91450..80d02527821 100755
--- a/3rdparty/bx/tools/bin/darwin/genie
+++ b/3rdparty/bx/tools/bin/darwin/genie
Binary files differ
diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie
index 7b68c735e1b..54880325a2b 100755
--- a/3rdparty/bx/tools/bin/linux/genie
+++ b/3rdparty/bx/tools/bin/linux/genie
Binary files differ
diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe
index 1fd05d21798..867d651dd02 100644
--- a/3rdparty/bx/tools/bin/windows/genie.exe
+++ b/3rdparty/bx/tools/bin/windows/genie.exe
Binary files differ
diff --git a/bgfx/shaders/dx11/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/dx11/chains/crt/fs_crt-caligari.bin
new file mode 100644
index 00000000000..4a28e2df9d4
--- /dev/null
+++ b/bgfx/shaders/dx11/chains/crt/fs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/dx11/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/dx11/chains/crt/vs_crt-caligari.bin
new file mode 100644
index 00000000000..a77f940d6f7
--- /dev/null
+++ b/bgfx/shaders/dx11/chains/crt/vs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/dx9/chains/crt/fs_crt-caligari.bin
new file mode 100644
index 00000000000..3d8ec4bbc8d
--- /dev/null
+++ b/bgfx/shaders/dx9/chains/crt/fs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/dx9/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/dx9/chains/crt/vs_crt-caligari.bin
new file mode 100644
index 00000000000..557e8e334be
--- /dev/null
+++ b/bgfx/shaders/dx9/chains/crt/vs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/gles/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/gles/chains/crt/fs_crt-caligari.bin
new file mode 100644
index 00000000000..523acc795ef
--- /dev/null
+++ b/bgfx/shaders/gles/chains/crt/fs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/gles/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/gles/chains/crt/vs_crt-caligari.bin
new file mode 100644
index 00000000000..7e262c17691
--- /dev/null
+++ b/bgfx/shaders/gles/chains/crt/vs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/glsl/chains/crt/fs_crt-caligari.bin
new file mode 100644
index 00000000000..0f84a90df98
--- /dev/null
+++ b/bgfx/shaders/glsl/chains/crt/fs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/glsl/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/glsl/chains/crt/vs_crt-caligari.bin
new file mode 100644
index 00000000000..de8e1df2d6b
--- /dev/null
+++ b/bgfx/shaders/glsl/chains/crt/vs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin
new file mode 100644
index 00000000000..212ad376c6b
--- /dev/null
+++ b/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin
Binary files differ
diff --git a/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin
new file mode 100644
index 00000000000..dec99f5b2b1
--- /dev/null
+++ b/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin
Binary files differ
diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp
index e6ec9061389..74b284dfb1d 100644
--- a/src/osd/modules/render/bgfx/target.cpp
+++ b/src/osd/modules/render/bgfx/target.cpp
@@ -37,7 +37,7 @@ bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uin
m_targets = new bgfx::FrameBufferHandle[m_page_count];
for (int page = 0; page < m_page_count; page++)
{
- m_textures[page] = bgfx::createTexture2D(m_width, m_height, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT);
+ m_textures[page] = bgfx::createTexture2D(m_width, m_height, false, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT);
assert(m_textures[page].idx != 0xffff);
m_targets[page] = bgfx::createFrameBuffer(1, &m_textures[page], false);
assert(m_targets[page].idx != 0xffff);
diff --git a/src/osd/modules/render/bgfx/texture.cpp b/src/osd/modules/render/bgfx/texture.cpp
index c698f7a9ac5..ac2d9008568 100644
--- a/src/osd/modules/render/bgfx/texture.cpp
+++ b/src/osd/modules/render/bgfx/texture.cpp
@@ -17,18 +17,18 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u
, m_height(height)
{
bgfx::TextureInfo info;
- bgfx::calcTextureSize(info, width, height, 1, false, 1, format);
+ bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format);
if (data != nullptr)
{
- m_texture = bgfx::createTexture2D(width, height, 1, format, flags, bgfx::copy(data, info.storageSize));
+ m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, bgfx::copy(data, info.storageSize));
}
else
{
- m_texture = bgfx::createTexture2D(width, height, 1, format, flags);
+ m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags);
const bgfx::Memory* memory = bgfx::alloc(info.storageSize);
memset(memory->data, 0, info.storageSize);
- bgfx::updateTexture2D(m_texture, 0, 0, 0, width, height, memory, info.storageSize / height);
+ bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, width, height, memory, info.storageSize / height);
}
}
@@ -39,8 +39,8 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u
, m_height(height)
{
bgfx::TextureInfo info;
- bgfx::calcTextureSize(info, width, height, 1, false, 1, format);
- m_texture = bgfx::createTexture2D(width, height, 1, format, flags, data);
+ bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format);
+ m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, data);
}
bgfx_texture::~bgfx_texture()
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 29721c65b77..8c623cf6a67 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -146,6 +146,50 @@ static void* sdlNativeWindowHandle(SDL_Window* _window)
}
#endif
+inline void winSetHwnd(::HWND _window)
+{
+ bgfx::PlatformData pd;
+ pd.ndt = NULL;
+ pd.nwh = _window;
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+}
+
+#ifdef OSD_SDL
+inline bool sdlSetWindow(SDL_Window* _window)
+{
+ SDL_SysWMinfo wmi;
+ SDL_VERSION(&wmi.version);
+ if (!SDL_GetWindowWMInfo(_window, &wmi) )
+ {
+ return false;
+ }
+
+ bgfx::PlatformData pd;
+# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
+ pd.ndt = wmi.info.x11.display;
+ pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
+# elif BX_PLATFORM_OSX
+ pd.ndt = NULL;
+ pd.nwh = wmi.info.cocoa.window;
+# elif BX_PLATFORM_WINDOWS
+ pd.ndt = NULL;
+ pd.nwh = wmi.info.win.window;
+# elif BX_PLATFORM_STEAMLINK
+ pd.ndt = wmi.info.vivante.display;
+ pd.nwh = wmi.info.vivante.window;
+# endif // BX_PLATFORM_
+ pd.context = NULL;
+ pd.backBuffer = NULL;
+ pd.backBufferDS = NULL;
+ bgfx::setPlatformData(pd);
+
+ return true;
+}
+#endif
+
int renderer_bgfx::create()
{
// create renderer
@@ -168,9 +212,9 @@ int renderer_bgfx::create()
bgfx::setPlatformData(blank_pd);
}
#ifdef OSD_WINDOWS
- bgfx::winSetHwnd(win->platform_window<HWND>());
+ winSetHwnd(win->platform_window<HWND>());
#else
- bgfx::sdlSetWindow(win->platform_window<SDL_Window*>());
+ sdlSetWindow(win->platform_window<SDL_Window*>());
#endif
std::string backend(m_options.bgfx_backend());
if (backend == "auto")
@@ -285,7 +329,7 @@ void renderer_bgfx::record()
{
m_avi_writer->record(m_options.bgfx_avi_name());
m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0);
- m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK);
+ m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK);
}
}
@@ -477,7 +521,7 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient
const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base);
- bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem);
+ bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, false, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem);
bgfx_effect** effects = PRIMFLAG_GET_SCREENTEX(prim->flags) ? m_screen_effect : m_gui_effect;
@@ -1084,7 +1128,7 @@ void renderer_bgfx::process_atlas_packs(std::vector<std::vector<rectangle_packer
}
m_hash_to_entry[rect.hash()] = rect;
const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base());
- bgfx::updateTexture2D(m_texture_cache->texture(), 0, rect.x(), rect.y(), rect.width(), rect.height(), mem);
+ bgfx::updateTexture2D(m_texture_cache->texture(), 0, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem);
}
}
}