Skip to content

Commit

Permalink
Update to latest BGFX and BX(nw)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic authored and mmicko committed Mar 20, 2016
1 parent 3a60b4b commit fae7a2c
Show file tree
Hide file tree
Showing 73 changed files with 4,360 additions and 1,414 deletions.
1 change: 1 addition & 0 deletions 3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#define _Out_writes_bytes_opt_(size)
#define _Out_writes_bytes_to_(size,count)
#define _Outptr_
#define _Outptr_opt_
#define _Outptr_opt_result_maybenull_
#define _Outptr_opt_result_bytebuffer_(size)
#define _Outptr_result_maybenull_
Expand Down
399 changes: 380 additions & 19 deletions 3rdparty/bgfx/3rdparty/khronos/gl/glcorearb.h

Large diffs are not rendered by default.

1,302 changes: 1,148 additions & 154 deletions 3rdparty/bgfx/3rdparty/khronos/gl/glext.h

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions 3rdparty/bgfx/3rdparty/khronos/vulkan/vk_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
*/


#ifndef __VK_PLATFORM_H__
#define __VK_PLATFORM_H__
#ifndef VK_PLATFORM_H_
#define VK_PLATFORM_H_

#ifdef __cplusplus
extern "C"
Expand Down Expand Up @@ -124,4 +124,4 @@ extern "C"
#include <xcb/xcb.h>
#endif

#endif // __VK_PLATFORM_H__
#endif
22 changes: 14 additions & 8 deletions 3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __vulkan_h_
#define __vulkan_h_ 1
#ifndef VULKAN_H_
#define VULKAN_H_ 1

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -41,7 +41,7 @@ extern "C" {
(((major) << 22) | ((minor) << 12) | (patch))

// Vulkan API version supported by this file
#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 3)
#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 4)

#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
Expand Down Expand Up @@ -209,7 +209,7 @@ typedef enum VkStructureType {
VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000,
VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000,
VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
Expand Down Expand Up @@ -701,8 +701,8 @@ typedef enum VkSamplerAddressMode {
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT,
VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
} VkSamplerAddressMode;

Expand Down Expand Up @@ -3326,8 +3326,8 @@ typedef enum VkDisplayPlaneAlphaFlagBitsKHR {
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
} VkDisplayPlaneAlphaFlagBitsKHR;
typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplayPlaneAlphaFlagsKHR;
typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;

typedef struct VkDisplayPropertiesKHR {
Expand Down Expand Up @@ -3667,11 +3667,17 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
#endif
#endif /* VK_USE_PLATFORM_WIN32_KHR */

#define VK_KHR_sampler_mirror_clamp_to_edge 1
#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge"


#define VK_EXT_debug_report 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)

#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1
#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT


typedef enum VkDebugReportObjectTypeEXT {
Expand Down
101 changes: 62 additions & 39 deletions 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ namespace ImGui
IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text
IMGUI_API void LabelText(const char* label, const char* fmt, ...) IM_PRINTFARGS(2); // display text+label aligned the same way as value+label widgets
IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args);
IMGUI_API void Bullet();
IMGUI_API void Bullet(); // draw a small circle and keep the cursor on the same line. advance you by the same distance as an empty TreeNode() call.
IMGUI_API void BulletText(const char* fmt, ...) IM_PRINTFARGS(1);
IMGUI_API void BulletTextV(const char* fmt, va_list args);
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0));
Expand Down Expand Up @@ -303,8 +303,8 @@ namespace ImGui
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");

// Widgets: Trees
IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop()
IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_PRINTFARGS(2); // "
IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop().
IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_PRINTFARGS(2); // read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet().
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_PRINTFARGS(2); // "
IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args); // "
IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args); // "
Expand Down Expand Up @@ -415,8 +415,8 @@ namespace ImGui
IMGUI_API void ResetMouseDragDelta(int button = 0); //
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type
IMGUI_API void CaptureKeyboardFromApp(); // manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered.
IMGUI_API void CaptureMouseFromApp(); // manually enforce imgui setting the io.WantCaptureMouse flag next frame (your application needs to handle it).
IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application handle). e.g. force capture keyboard when your widget is being hovered.
IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application handle).

// Helpers functions to access functions pointers in ImGui::GetIO()
IMGUI_API void* MemAlloc(size_t sz);
Expand Down Expand Up @@ -488,7 +488,7 @@ enum ImGuiInputTextFlags_
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified)
ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Call user function on pressing TAB (for completion handling)
ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Call user function on pressing Up/Down arrows (for history handling)
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time. User code may query cursor position, modify text buffer.
ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field
ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, allow exiting edition by pressing Enter. Ctrl+Enter to add new line (by default adds new lines with Enter).
Expand All @@ -505,7 +505,8 @@ enum ImGuiSelectableFlags_
{
// Default: 0
ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window
ImGuiSelectableFlags_SpanAllColumns = 1 << 1 // Selectable frame can span all columns (text will still fit in current column)
ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column)
ImGuiSelectableFlags_AllowDoubleClick = 1 << 2 // Generate press events on double clicks too
};

// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
Expand Down Expand Up @@ -946,7 +947,7 @@ struct ImGuiStorage
IMGUI_API void SetAllInt(int val);
};

// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used.
// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used and the corresponding callback is triggered.
struct ImGuiTextEditCallbackData
{
ImGuiInputTextFlags EventFlag; // One of ImGuiInputTextFlags_Callback* // Read-only
Expand All @@ -958,15 +959,17 @@ struct ImGuiTextEditCallbackData
ImWchar EventChar; // Character input // Read-write (replace character or set to zero)

// Completion,History,Always events:
// If you modify the buffer contents make sure you update 'BufTextLen' and set 'BufDirty' to true.
ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only
char* Buf; // Current text // Read-write (pointed data only)
int BufSize; // // Read-only
bool BufDirty; // Must set if you modify Buf directly // Write
char* Buf; // Current text buffer // Read-write (pointed data only, can't replace the actual pointer)
int BufTextLen; // Current text length in bytes // Read-write
int BufSize; // Maximum text length in bytes // Read-only
bool BufDirty; // Set if you modify Buf/BufTextLen!! // Write
int CursorPos; // // Read-write
int SelectionStart; // // Read-write (== to SelectionEnd when no selection)
int SelectionEnd; // // Read-write

// NB: calling those function loses selection.
// NB: Helper functions for text manipulation. Calling those function loses selection.
void DeleteChars(int pos, int bytes_count);
void InsertChars(int pos, const char* text, const char* text_end = NULL);
bool HasSelection() const { return SelectionStart != SelectionEnd; }
Expand Down Expand Up @@ -1256,7 +1259,7 @@ struct ImFontAtlas
int TexHeight; // Texture height calculated during Build().
int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
ImVec2 TexUvWhitePixel; // Texture coordinates to a white pixel (part of the TexExtraData block)
ImVector<ImFont*> Fonts;
ImVector<ImFont*> Fonts; // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font.

// Private
ImVector<ImFontConfig> ConfigData; // Internal data
Expand Down
31 changes: 20 additions & 11 deletions 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,14 @@ void ImGui::ShowTestWindow(bool* p_opened)
{
if (ImGui::TreeNode("Basic"))
{
static bool selected[3] = { false, true, false };
static bool selected[4] = { false, true, false, false };
ImGui::Selectable("1. I am selectable", &selected[0]);
ImGui::Selectable("2. I am selectable", &selected[1]);
ImGui::Text("3. I am not selectable");
ImGui::Selectable("4. I am selectable", &selected[2]);
if (ImGui::Selectable("5. I am double clickable", selected[3], ImGuiSelectableFlags_AllowDoubleClick))
if (ImGui::IsMouseDoubleClicked(0))
selected[3] = !selected[3];
ImGui::TreePop();
}
if (ImGui::TreeNode("Rendering more text into the same block"))
Expand Down Expand Up @@ -713,7 +716,9 @@ void ImGui::ShowTestWindow(bool* p_opened)
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));

static ImVector<float> values; if (values.empty()) { values.resize(90); memset(values.Data, 0, values.Size*sizeof(float)); }
// Create a dummy array of contiguous float values to plot
// Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float and the sizeof() of your structure in the Stride parameter.
static float values[90] = { 0 };
static int values_offset = 0;
if (animate)
{
Expand All @@ -722,11 +727,11 @@ void ImGui::ShowTestWindow(bool* p_opened)
{
static float phase = 0.0f;
values[values_offset] = cosf(phase);
values_offset = (values_offset+1)%values.Size;
values_offset = (values_offset+1) % IM_ARRAYSIZE(values);
phase += 0.10f*values_offset;
}
}
ImGui::PlotLines("Lines", values.Data, values.Size, values_offset, "avg 0.0", -1.0f, 1.0f, ImVec2(0,80));
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, "avg 0.0", -1.0f, 1.0f, ImVec2(0,80));
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0,80));

// Use functions to generate output
Expand Down Expand Up @@ -1501,10 +1506,14 @@ void ImGui::ShowTestWindow(bool* p_opened)
ImGui::Text("WantCaptureKeyboard: %s", io.WantCaptureKeyboard ? "true" : "false");
ImGui::Text("WantTextInput: %s", io.WantTextInput ? "true" : "false");

ImGui::Button("Hover me\nto enforce\ninputs capture");
ImGui::Button("Hovering me sets the\nkeyboard capture flag");
if (ImGui::IsItemHovered())
ImGui::CaptureKeyboardFromApp();

ImGui::CaptureKeyboardFromApp(true);
ImGui::SameLine();
ImGui::Button("Holding me clears the\nthe keyboard capture flag");
if (ImGui::IsItemActive())
ImGui::CaptureKeyboardFromApp(false);

ImGui::TreePop();
}

Expand Down Expand Up @@ -1886,18 +1895,19 @@ struct ExampleAppConsole
Commands.push_back("HISTORY");
Commands.push_back("CLEAR");
Commands.push_back("CLASSIFY"); // "classify" is here to provide an example of "C"+[tab] completing to "CL" and displaying matches.
AddLog("Welcome to ImGui!");
}
~ExampleAppConsole()
{
ClearLog();
for (int i = 0; i < Items.Size; i++)
for (int i = 0; i < History.Size; i++)
free(History[i]);
}

// Portable helpers
static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; }
static int Strnicmp(const char* str1, const char* str2, int n) { int d = 0; while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; } return d; }
static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = ImGui::MemAlloc(len); return (char*)memcpy(buff, (const void*)str, len); }
static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = malloc(len); return (char*)memcpy(buff, (const void*)str, len); }

void ClearLog()
{
Expand Down Expand Up @@ -2126,9 +2136,8 @@ struct ExampleAppConsole
// A better implementation would preserve the data on the current input line along with cursor position.
if (prev_history_pos != HistoryPos)
{
snprintf(data->Buf, data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
data->CursorPos = data->SelectionStart = data->SelectionEnd = data->BufTextLen = (int)snprintf(data->Buf, data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
data->BufDirty = true;
data->CursorPos = data->SelectionStart = data->SelectionEnd = (int)strlen(data->Buf);
}
}
}
Expand Down
Loading

0 comments on commit fae7a2c

Please sign in to comment.