summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/imgui/imgui.cpp
diff options
context:
space:
mode:
author Julian Sikorski <belegdol+github@gmail.com>2019-10-13 13:50:38 +0200
committer R. Belmont <rb6502@users.noreply.github.com>2019-10-13 07:50:38 -0400
commit0837e7451a84f95c29dbdb9bd6b8b931fee1635d (patch)
tree626bcbd250a7fbebdf5958a288d2f438d4f9fb5a /3rdparty/bgfx/examples/common/imgui/imgui.cpp
parentc913ccb59d713ce0b91135520719ac5385e54358 (diff)
WIP: sync bgfx, bx and bimg with latest upstream (#5723)
* Sync with bgfx upstream revision b91d0b6 * Sync with bx upstream revision d60912b * Sync with bimg upstream revision bd81f60 * Add astc-codec decoder * Rename VertexDecl to VertexLayout * Rename UniformType enum Int1 to Sampler. * Add NVN stub * Fix unused-const-variable error on macOS * Drop redundant explicit language parameters buildoptions_cpp are only applied to c++ files and buildoptions_objcpp are only applied to objective c++ files. As such, hardcoding -x offers no benefit while preventing overrides (such as one needed by 3rdparty/bgfx/src/renderer_vk.cpp on macOS) from working. * Re-introduce -x c++ in places where C code is compiled as C++ to prevent clang from throwing a warning * Build bgfx as Objective-C++ on macOS It is needed due to included headers * Enable Direct3D12 and Vulkan bgfx rendering backends * Enable building of spirv shaders * Properly escape /c in cmd call * Comment out dx12 bgfx renderer * Honor VERBOSE setting during shaders build * Only invert hlsl shader XYZ_TO_sRGB matrix for opengl * Add spirv shaders * OpenGL ES needs transposed matrix too * Metal needs transposed matrix as well
Diffstat (limited to '3rdparty/bgfx/examples/common/imgui/imgui.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/imgui/imgui.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp
index 6cd4b13c191..34558323fb9 100644
--- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp
+++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp
@@ -16,11 +16,7 @@
//#define USE_ENTRY 1
#ifndef USE_ENTRY
-# if defined(SCI_NAMESPACE)
-# define USE_ENTRY 1
-# else
-# define USE_ENTRY 0
-# endif // defined(SCI_NAMESPACE)
+# define USE_ENTRY 0
#endif // USE_ENTRY
#if USE_ENTRY
@@ -28,10 +24,6 @@
# include "../entry/input.h"
#endif // USE_ENTRY
-#if defined(SCI_NAMESPACE)
-# include "scintilla.h"
-#endif // defined(SCI_NAMESPACE)
-
#include "vs_ocornut_imgui.bin.h"
#include "fs_ocornut_imgui.bin.h"
#include "vs_imgui_image.bin.h"
@@ -97,13 +89,13 @@ struct OcornutImguiContext
uint32_t numVertices = (uint32_t)drawList->VtxBuffer.size();
uint32_t numIndices = (uint32_t)drawList->IdxBuffer.size();
- if (!checkAvailTransientBuffers(numVertices, m_decl, numIndices) )
+ if (!checkAvailTransientBuffers(numVertices, m_layout, numIndices) )
{
// not enough space in transient buffer just quit drawing the rest...
break;
}
- bgfx::allocTransientVertexBuffer(&tvb, numVertices, m_decl);
+ bgfx::allocTransientVertexBuffer(&tvb, numVertices, m_layout);
bgfx::allocTransientIndexBuffer(&tib, numIndices);
ImDrawVert* verts = (ImDrawVert*)tvb.data;
@@ -153,9 +145,9 @@ struct OcornutImguiContext
const uint16_t xx = uint16_t(bx::max(cmd->ClipRect.x, 0.0f) );
const uint16_t yy = uint16_t(bx::max(cmd->ClipRect.y, 0.0f) );
bgfx::setScissor(xx, yy
- , uint16_t(bx::min(cmd->ClipRect.z, 65535.0f)-xx)
- , uint16_t(bx::min(cmd->ClipRect.w, 65535.0f)-yy)
- );
+ , uint16_t(bx::min(cmd->ClipRect.z, 65535.0f)-xx)
+ , uint16_t(bx::min(cmd->ClipRect.w, 65535.0f)-yy)
+ );
bgfx::setState(state);
bgfx::setTexture(0, s_tex, th);
@@ -255,14 +247,14 @@ struct OcornutImguiContext
, true
);
- m_decl
+ m_layout
.begin()
.add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float)
.add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float)
.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true)
.end();
- s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Int1);
+ s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Sampler);
uint8_t* data;
int32_t width;
@@ -348,16 +340,16 @@ struct OcornutImguiContext
, int32_t _scroll
, int _width
, int _height
- , char _inputChar
+ , int _inputChar
, bgfx::ViewId _viewId
)
{
m_viewId = _viewId;
ImGuiIO& io = ImGui::GetIO();
- if (_inputChar < 0x7f)
+ if (_inputChar >= 0)
{
- io.AddInputCharacter(_inputChar); // ASCII or GTFO! :(
+ io.AddInputCharacter(_inputChar);
}
io.DisplaySize = ImVec2( (float)_width, (float)_height);
@@ -399,7 +391,7 @@ struct OcornutImguiContext
ImGuiContext* m_imgui;
bx::AllocatorI* m_allocator;
- bgfx::VertexDecl m_decl;
+ bgfx::VertexLayout m_layout;
bgfx::ProgramHandle m_program;
bgfx::ProgramHandle m_imageProgram;
bgfx::TextureHandle m_texture;
@@ -435,7 +427,7 @@ void imguiDestroy()
s_ctx.destroy();
}
-void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, bgfx::ViewId _viewId)
+void imguiBeginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, int _inputChar, bgfx::ViewId _viewId)
{
s_ctx.beginFrame(_mx, _my, _button, _scroll, _width, _height, _inputChar, _viewId);
}
@@ -454,10 +446,9 @@ namespace ImGui
} // namespace ImGui
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4505); // error C4505: '' : unreferenced local function has been removed
-BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-function"); // warning: ‘int rect_width_compare(const void*, const void*)’ defined but not used
+BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-function"); // warning: 'int rect_width_compare(const void*, const void*)' defined but not used
BX_PRAGMA_DIAGNOSTIC_PUSH();
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunknown-pragmas")
-//BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-but-set-variable"); // warning: variable ‘L1’ set but not used
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wtype-limits"); // warning: comparison is always true due to limited range of data type
#define STBTT_malloc(_size, _userData) memAlloc(_size, _userData)
#define STBTT_free(_ptr, _userData) memFree(_ptr, _userData)