mirror of
https://github.com/holub/mame
synced 2025-10-04 08:28:39 +03:00
Update BGFX (nw)
This commit is contained in:
parent
08bfa598df
commit
a163b28277
5
3rdparty/bgfx/3rdparty/.editorconfig
vendored
Normal file
5
3rdparty/bgfx/3rdparty/.editorconfig
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
root = true
|
||||
|
||||
[ocornut-imgui/*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
@ -172,7 +172,8 @@ es_lod_exists_in_stage(const _mesa_glsl_parse_state *state)
|
||||
* is enabled.
|
||||
*/
|
||||
return
|
||||
state->stage == MESA_SHADER_FRAGMENT &&
|
||||
// BK - EXT_shader_texture_lod is available in vertex and fragment shaders.
|
||||
// state->stage == MESA_SHADER_FRAGMENT &&
|
||||
state->es_shader &&
|
||||
state->is_version(110, 100) &&
|
||||
state->EXT_shader_texture_lod_enable;
|
||||
|
@ -949,6 +949,13 @@ builtin_variable_generator::generate_fs_special_vars()
|
||||
var->enable_extension_warning("GL_EXT_shader_framebuffer_fetch");
|
||||
}
|
||||
|
||||
{
|
||||
// BK - gl_PrimitiveID
|
||||
ir_variable *var;
|
||||
var = add_output(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID", glsl_precision_high);
|
||||
var->data.interpolation = INTERP_QUALIFIER_FLAT;
|
||||
}
|
||||
|
||||
if (state->ARB_sample_shading_enable) {
|
||||
add_system_value(SYSTEM_VALUE_SAMPLE_ID, int_t, "gl_SampleID", glsl_precision_high);
|
||||
add_system_value(SYSTEM_VALUE_SAMPLE_POS, vec2_t, "gl_SamplePosition", glsl_precision_high);
|
||||
|
@ -160,7 +160,7 @@ public:
|
||||
int uses_texlodproj_impl; // 3 bits per tex_dimension, bit set for each precision if any texture sampler needs the GLES2 lod workaround.
|
||||
};
|
||||
|
||||
static void print_texlod_workarounds(int usage_bitfield, int usage_proj_bitfield, string_buffer &str)
|
||||
void print_texlod_workarounds(int usage_bitfield, int usage_proj_bitfield, string_buffer &str)
|
||||
{
|
||||
static const char *precStrings[3] = {"lowp", "mediump", "highp"};
|
||||
static const char *precNameStrings[3] = { "low_", "medium_", "high_" };
|
||||
@ -283,7 +283,9 @@ _mesa_print_ir_glsl(exec_list *instructions,
|
||||
|
||||
delete ls;
|
||||
|
||||
#if 0 // BK - disable LOD workarounds.
|
||||
print_texlod_workarounds(uses_texlod_impl, uses_texlodproj_impl, str);
|
||||
#endif // 0
|
||||
|
||||
// Add the optimized glsl code
|
||||
str.asprintf_append("%s", body.c_str());
|
||||
@ -821,7 +823,8 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
sampler_uv_dim += 1;
|
||||
const bool is_proj = (uv_dim > sampler_uv_dim);
|
||||
const bool is_lod = (ir->op == ir_txl);
|
||||
|
||||
|
||||
#if 0 // BK - disable LOD workarounds.
|
||||
if (is_lod && state->es_shader && state->language_version < 300 && state->stage == MESA_SHADER_FRAGMENT)
|
||||
{
|
||||
// Special workaround for GLES 2.0 LOD samplers to prevent a lot of debug spew.
|
||||
@ -850,8 +853,8 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
else
|
||||
uses_texlod_impl |= (1 << position);
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
|
||||
// texture function name
|
||||
//ACS: shadow lookups and lookups with dimensionality included in the name were deprecated in 130
|
||||
if(state->language_version<130)
|
||||
|
14
3rdparty/bgfx/3rdparty/ocornut-imgui/imconfig.h
vendored
14
3rdparty/bgfx/3rdparty/ocornut-imgui/imconfig.h
vendored
@ -19,8 +19,6 @@
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)
|
||||
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
|
||||
#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
|
||||
#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||
#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||
|
||||
@ -30,7 +28,17 @@
|
||||
//---- Include imgui_user.h at the end of imgui.h
|
||||
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
||||
|
||||
//---- Define implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
|
||||
//---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)
|
||||
#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
|
||||
#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
|
||||
|
||||
//---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty)
|
||||
//#define IMGUI_DISABLE_TEST_WINDOWS
|
||||
|
||||
//---- Implement STB libraries in a namespace to avoid conflicts
|
||||
//#define IMGUI_STB_NAMESPACE ImStb
|
||||
|
||||
//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
|
||||
/*
|
||||
#define IM_VEC2_CLASS_EXTRA \
|
||||
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
|
||||
|
4830
3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
vendored
4830
3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp
vendored
File diff suppressed because it is too large
Load Diff
396
3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
vendored
396
3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h
vendored
@ -1,4 +1,4 @@
|
||||
// ImGui library v1.35
|
||||
// ImGui library v1.39 WIP
|
||||
// See .cpp file for documentation.
|
||||
// See ImGui::ShowTestWindow() for sample code.
|
||||
// Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
|
||||
@ -9,9 +9,11 @@
|
||||
#include "imconfig.h" // User-editable configuration file
|
||||
#include <float.h> // FLT_MAX
|
||||
#include <stdarg.h> // va_list
|
||||
#include <stddef.h> // ptrdiff_t
|
||||
#include <stdlib.h> // NULL, malloc
|
||||
#include <string.h> // memset, memmove
|
||||
#include <stddef.h> // ptrdiff_t, NULL
|
||||
#include <stdlib.h> // NULL, malloc, free, qsort, atoi
|
||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||
|
||||
#define IMGUI_VERSION "1.39 WIP"
|
||||
|
||||
// Define assertion handler.
|
||||
#ifndef IM_ASSERT
|
||||
@ -34,26 +36,28 @@ struct ImGuiStorage;
|
||||
struct ImGuiStyle;
|
||||
|
||||
typedef unsigned int ImU32;
|
||||
typedef unsigned short ImWchar; // character for display
|
||||
typedef unsigned short ImWchar; // character for keyboard input/display
|
||||
typedef void* ImTextureID; // user data to refer to a texture (e.g. store your texture handle/id)
|
||||
typedef ImU32 ImGuiID; // unique ID used by widgets (typically hashed from a stack of string)
|
||||
typedef int ImGuiCol; // enum ImGuiCol_
|
||||
typedef int ImGuiStyleVar; // enum ImGuiStyleVar_
|
||||
typedef int ImGuiKey; // enum ImGuiKey_
|
||||
typedef int ImGuiAlign; // enum ImGuiAlign_
|
||||
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
||||
typedef int ImGuiMouseCursor; // enum ImGuiMouseCursor_
|
||||
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
||||
typedef int ImGuiSetCond; // enum ImGuiSetCondition_
|
||||
typedef int ImGuiSetCond; // enum ImGuiSetCond_
|
||||
typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_
|
||||
struct ImGuiTextEditCallbackData; // for advanced uses of InputText()
|
||||
struct ImGuiTextEditCallbackData; // for advanced uses of InputText()
|
||||
typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
|
||||
|
||||
struct ImVec2
|
||||
{
|
||||
float x, y;
|
||||
ImVec2() {}
|
||||
ImVec2() { x = y = 0.0f; }
|
||||
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
||||
|
||||
#ifdef IM_VEC2_CLASS_EXTRA
|
||||
#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2.
|
||||
IM_VEC2_CLASS_EXTRA
|
||||
#endif
|
||||
};
|
||||
@ -61,10 +65,10 @@ struct ImVec2
|
||||
struct ImVec4
|
||||
{
|
||||
float x, y, z, w;
|
||||
ImVec4() {}
|
||||
ImVec4() { x = y = z = w = 0.0f; }
|
||||
ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }
|
||||
|
||||
#ifdef IM_VEC4_CLASS_EXTRA
|
||||
#ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec4.
|
||||
IM_VEC4_CLASS_EXTRA
|
||||
#endif
|
||||
};
|
||||
@ -76,9 +80,9 @@ namespace ImGui
|
||||
IMGUI_API void MemFree(void* ptr);
|
||||
}
|
||||
|
||||
// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
|
||||
// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
|
||||
// Use '#define ImVector std::vector' if you want to use the STL type or your own type.
|
||||
// Our implementation does NOT call c++ constructors! because the data types we use don't need them (but that could be added as well). Only provide the minimum functionalities we need.
|
||||
// Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code!
|
||||
#ifndef ImVector
|
||||
template<typename T>
|
||||
class ImVector
|
||||
@ -117,14 +121,14 @@ public:
|
||||
inline void swap(ImVector<T>& rhs) { const size_t rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; const size_t rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
|
||||
|
||||
inline void resize(size_t new_size) { if (new_size > Capacity) reserve(new_size); Size = new_size; }
|
||||
inline void reserve(size_t new_capacity)
|
||||
{
|
||||
inline void reserve(size_t new_capacity)
|
||||
{
|
||||
if (new_capacity <= Capacity) return;
|
||||
T* new_data = (value_type*)ImGui::MemAlloc(new_capacity * sizeof(value_type));
|
||||
memcpy(new_data, Data, Size * sizeof(value_type));
|
||||
ImGui::MemFree(Data);
|
||||
Data = new_data;
|
||||
Capacity = new_capacity;
|
||||
Capacity = new_capacity;
|
||||
}
|
||||
|
||||
inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; }
|
||||
@ -140,11 +144,14 @@ public:
|
||||
// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
||||
// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
|
||||
// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually)
|
||||
// - struct ImGuiTextEditCallbackData // Shared state of ImGui::InputText() when using custom callbacks
|
||||
// - struct ImColor // Helper functions to created packed 32-bit RGBA color values
|
||||
// - struct ImDrawList // Draw command list
|
||||
// - struct ImFont // TTF font loader, bake glyphs into bitmap
|
||||
// - struct ImFontAtlas // Bake multiple fonts into a single texture, TTF font loader, bake glyphs into bitmap
|
||||
// - struct ImFont // Single font
|
||||
|
||||
// ImGui end-user API
|
||||
// In a namespace so that user can add extra functions (e.g. Value() helpers for your vector or common types)
|
||||
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
||||
namespace ImGui
|
||||
{
|
||||
// Main
|
||||
@ -153,48 +160,49 @@ namespace ImGui
|
||||
IMGUI_API void NewFrame();
|
||||
IMGUI_API void Render();
|
||||
IMGUI_API void Shutdown();
|
||||
IMGUI_API void ShowUserGuide();
|
||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL);
|
||||
IMGUI_API void ShowTestWindow(bool* open = NULL);
|
||||
IMGUI_API void ShowUserGuide(); // help block
|
||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block
|
||||
IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features
|
||||
IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window for debugging imgui
|
||||
|
||||
// Window
|
||||
// See implementation in .cpp for details
|
||||
IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, const ImVec2& initial_size = ImVec2(0,0), float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
|
||||
IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. 'bool* p_opened' creates a widget on the upper-right to close the window (which sets your bool to false).
|
||||
IMGUI_API bool Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // this is the older/longer API. call SetNextWindowSize() instead if you want to set a window size. For regular windows, 'size_on_first_use' only applies to the first time EVER the window is created and probably not what you want! maybe obsolete this API eventually.
|
||||
IMGUI_API void End();
|
||||
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
|
||||
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
||||
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400).
|
||||
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
||||
IMGUI_API void EndChild();
|
||||
IMGUI_API bool GetWindowIsFocused();
|
||||
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // window boundaries, in windows coordinates
|
||||
IMGUI_API ImVec2 GetWindowContentRegionMax();
|
||||
IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives.
|
||||
IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives
|
||||
IMGUI_API ImFont* GetWindowFont();
|
||||
IMGUI_API float GetWindowFontSize(); // size (also height in pixels) of current font with current scale applied
|
||||
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows.
|
||||
IMGUI_API ImVec2 GetWindowPos(); // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing.
|
||||
IMGUI_API ImVec2 GetWindowSize(); // get current window position.
|
||||
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows
|
||||
IMGUI_API ImVec2 GetWindowPos(); // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing
|
||||
IMGUI_API ImVec2 GetWindowSize(); // get current window position
|
||||
IMGUI_API float GetWindowWidth();
|
||||
IMGUI_API bool GetWindowCollapsed();
|
||||
|
||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set next window position - call before Begin().
|
||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set next window size. set to ImVec2(0,0) to force an auto-fit.
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set next window collapsed state.
|
||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set next window position - call before Begin()
|
||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set next window size. set to ImVec2(0,0) to force an auto-fit
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set next window collapsed state
|
||||
IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set current window position - call within Begin()/End(). may incur tearing.
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set current window collapsed state.
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set current window position - call within Begin()/End(). may incur tearing
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set current window collapsed state
|
||||
IMGUI_API void SetWindowFocus(); // set current window to be focused / front-most
|
||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing.
|
||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
|
||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state.
|
||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most
|
||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing
|
||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
|
||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state
|
||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus.
|
||||
|
||||
IMGUI_API float GetScrollPosY(); // get scrolling position (0..GetScrollMaxY())
|
||||
IMGUI_API float GetScrollPosY(); // get scrolling position [0..GetScrollMaxY()]
|
||||
IMGUI_API float GetScrollMaxY(); // get maximum scrolling position == ContentSize.Y - WindowSize.Y
|
||||
IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
||||
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget.
|
||||
IMGUI_API void SetStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it).
|
||||
IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position
|
||||
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget
|
||||
IMGUI_API void SetStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
||||
IMGUI_API ImGuiStorage* GetStateStorage();
|
||||
|
||||
// Parameters stacks (shared)
|
||||
@ -207,29 +215,37 @@ namespace ImGui
|
||||
IMGUI_API void PopStyleVar(int count = 1);
|
||||
|
||||
// Parameters stacks (current window)
|
||||
IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -0.01f always align width to the right side)
|
||||
IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side)
|
||||
IMGUI_API void PopItemWidth();
|
||||
IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position
|
||||
IMGUI_API void PushAllowKeyboardFocus(bool v); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.
|
||||
IMGUI_API void PushAllowKeyboardFocus(bool v); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
|
||||
IMGUI_API void PopAllowKeyboardFocus();
|
||||
IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space.
|
||||
IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
|
||||
IMGUI_API void PopTextWrapPos();
|
||||
|
||||
// Tooltip
|
||||
IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins.
|
||||
IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins
|
||||
IMGUI_API void SetTooltipV(const char* fmt, va_list args);
|
||||
IMGUI_API void BeginTooltip(); // use to create full-featured tooltip windows that aren't just text.
|
||||
IMGUI_API void BeginTooltip(); // use to create full-featured tooltip windows that aren't just text
|
||||
IMGUI_API void EndTooltip();
|
||||
|
||||
// Popup
|
||||
IMGUI_API void BeginPopup(bool* p_opened);
|
||||
IMGUI_API void EndPopup();
|
||||
|
||||
// Layout
|
||||
IMGUI_API void BeginGroup();
|
||||
IMGUI_API void EndGroup();
|
||||
IMGUI_API void Separator(); // horizontal line
|
||||
IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets to layout them horizontally
|
||||
IMGUI_API void Spacing();
|
||||
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns
|
||||
IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets or groups to layout them horizontally
|
||||
IMGUI_API void Spacing(); // add vertical spacing
|
||||
IMGUI_API void Indent(); // move content position toward the right by style.IndentSpacing pixels
|
||||
IMGUI_API void Unindent(); // move content position back to the left (cancel Indent)
|
||||
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns. use an identifier to distinguish multiple column sets. close with Columns(1).
|
||||
IMGUI_API void NextColumn(); // next column
|
||||
IMGUI_API int GetColumnIndex(); // get current column index
|
||||
IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this.
|
||||
IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column.
|
||||
IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this
|
||||
IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column
|
||||
IMGUI_API float GetColumnWidth(int column_index = -1); // column width (== GetColumnOffset(GetColumnIndex()+1) - GetColumnOffset(GetColumnOffset())
|
||||
IMGUI_API int GetColumnsCount(); // number of columns (what was passed to Columns())
|
||||
IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position
|
||||
@ -238,20 +254,22 @@ namespace ImGui
|
||||
IMGUI_API void SetCursorPos(const ImVec2& pos); // "
|
||||
IMGUI_API void SetCursorPosX(float x); // "
|
||||
IMGUI_API void SetCursorPosY(float y); // "
|
||||
IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates (0..io.DisplaySize)
|
||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates (0..io.DisplaySize)
|
||||
IMGUI_API void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets.
|
||||
IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates [0..io.DisplaySize]
|
||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates [0..io.DisplaySize]
|
||||
IMGUI_API void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets
|
||||
IMGUI_API float GetTextLineHeight(); // height of font == GetWindowFontSize()
|
||||
IMGUI_API float GetTextLineHeightWithSpacing(); // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
|
||||
|
||||
// ID scopes
|
||||
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.
|
||||
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
|
||||
// You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
|
||||
IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the *entire* stack!
|
||||
IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end);
|
||||
IMGUI_API void PushID(const void* ptr_id);
|
||||
IMGUI_API void PushID(const int int_id);
|
||||
IMGUI_API void PopID();
|
||||
IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). useful if you want to query into ImGuiStorage yourself. otherwise rarely needed.
|
||||
IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). useful if you want to query into ImGuiStorage yourself. otherwise rarely needed
|
||||
IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end);
|
||||
IMGUI_API ImGuiID GetID(const void* ptr_id);
|
||||
|
||||
// Widgets
|
||||
@ -261,8 +279,8 @@ namespace ImGui
|
||||
IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
|
||||
IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
|
||||
IMGUI_API void TextWrappedV(const char* fmt, va_list args);
|
||||
IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text.
|
||||
IMGUI_API void LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets
|
||||
IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text
|
||||
IMGUI_API void LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets
|
||||
IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args);
|
||||
IMGUI_API void Bullet();
|
||||
IMGUI_API void BulletText(const char* fmt, ...);
|
||||
@ -271,31 +289,12 @@ namespace ImGui
|
||||
IMGUI_API bool SmallButton(const char* label);
|
||||
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size);
|
||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no paddnig.
|
||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
||||
IMGUI_API bool CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false);
|
||||
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders.
|
||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderAngle(const char* label, float* v, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); // *v in radians
|
||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
|
||||
IMGUI_API void PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
|
||||
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
|
||||
IMGUI_API void PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
|
||||
IMGUI_API bool Checkbox(const char* label, bool* v);
|
||||
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
||||
IMGUI_API bool RadioButton(const char* label, bool active);
|
||||
IMGUI_API bool RadioButton(const char* label, int* v, int v_button);
|
||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
|
||||
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1);
|
||||
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1);
|
||||
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
||||
IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1); // separate items with \0, end item-list with \0\0
|
||||
IMGUI_API bool Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
||||
@ -303,8 +302,46 @@ namespace ImGui
|
||||
IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
||||
IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
||||
IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
||||
IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
|
||||
IMGUI_API void PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
|
||||
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
|
||||
IMGUI_API void PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
|
||||
|
||||
// Trees
|
||||
// Widgets: Sliders (tip: ctrl+click on a slider to input text)
|
||||
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders
|
||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
|
||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
||||
|
||||
// Widgets: Drags (tip: ctrl+click on a drag box to input text)
|
||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||
|
||||
// Widgets: Input
|
||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);
|
||||
|
||||
// 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, ...); // "
|
||||
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...); // "
|
||||
@ -315,8 +352,8 @@ namespace ImGui
|
||||
IMGUI_API void TreePop();
|
||||
IMGUI_API void SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond = 0); // set next tree node to be opened.
|
||||
|
||||
// Selectable / Lists
|
||||
IMGUI_API bool Selectable(const char* label, bool selected, const ImVec2& size = ImVec2(0,0));
|
||||
// Widgets: Selectable / Lists
|
||||
IMGUI_API bool Selectable(const char* label, bool selected = false, const ImVec2& size = ImVec2(0,0));
|
||||
IMGUI_API bool Selectable(const char* label, bool* p_selected, const ImVec2& size = ImVec2(0,0));
|
||||
IMGUI_API bool ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
||||
@ -324,7 +361,12 @@ namespace ImGui
|
||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
||||
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
||||
|
||||
// Value() Helpers: output single value in "name: value" format. Tip: freely declare your own within the ImGui namespace!
|
||||
// Widgets: Menus
|
||||
// FIXME-WIP: v1.39 in development
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false); // bool enabled = true
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected); // bool enabled = true
|
||||
|
||||
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
|
||||
IMGUI_API void Value(const char* prefix, bool b);
|
||||
IMGUI_API void Value(const char* prefix, int v);
|
||||
IMGUI_API void Value(const char* prefix, unsigned int v);
|
||||
@ -332,7 +374,7 @@ namespace ImGui
|
||||
IMGUI_API void Color(const char* prefix, const ImVec4& v);
|
||||
IMGUI_API void Color(const char* prefix, unsigned int v);
|
||||
|
||||
// Logging: All text output from your interface are redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
||||
// Logging: all text output from interface is redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
||||
IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty
|
||||
IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file
|
||||
IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard
|
||||
@ -342,26 +384,40 @@ namespace ImGui
|
||||
|
||||
// Utilities
|
||||
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse?
|
||||
IMGUI_API bool IsItemHoveredRect(); // was the last item hovered by mouse? even if another item is active while we are hovering this
|
||||
IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
||||
IMGUI_API bool IsAnyItemActive(); //
|
||||
IMGUI_API ImVec2 GetItemBoxMin(); // get bounding box of last item
|
||||
IMGUI_API ImVec2 GetItemBoxMax(); // get bounding box of last item
|
||||
IMGUI_API bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimization)
|
||||
IMGUI_API bool IsKeyPressed(int key_index, bool repeat = true); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
|
||||
IMGUI_API bool IsAnyItemActive(); //
|
||||
IMGUI_API bool IsItemVisible();
|
||||
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space
|
||||
IMGUI_API ImVec2 GetItemRectMax(); // "
|
||||
IMGUI_API ImVec2 GetItemRectSize(); // "
|
||||
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
||||
IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
||||
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
||||
IMGUI_API bool IsRectClipped(const ImVec2& size); // test if rectangle of given size starting from cursor pos is out of clipping region. to perform coarse clipping on user's side (as an optimization)
|
||||
IMGUI_API bool IsKeyDown(int key_index); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
|
||||
IMGUI_API bool IsKeyPressed(int key_index, bool repeat = true); // "
|
||||
IMGUI_API bool IsMouseDown(int button);
|
||||
IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
||||
IMGUI_API bool IsMouseDoubleClicked(int button);
|
||||
IMGUI_API bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window)
|
||||
IMGUI_API bool IsMouseHoveringAnyWindow(); // is mouse hovering any active imgui window
|
||||
IMGUI_API bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is mouse hovering given bounding box
|
||||
IMGUI_API bool IsMouseHoveringRect(const ImVec2& rect_min, const ImVec2& rect_max);// is mouse hovering given bounding rect
|
||||
IMGUI_API bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f); // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold
|
||||
IMGUI_API bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window
|
||||
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||
IMGUI_API ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); // dragging amount since clicking, also see: GetItemActiveDragDelta(). if lock_threshold < -1.0f uses io.MouseDraggingThreshold
|
||||
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 float GetTime();
|
||||
IMGUI_API int GetFrameCount();
|
||||
IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
||||
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f); // utility to find the closest point the last item bounding rectangle edge. useful to visually link items
|
||||
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
||||
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // helper to manually clip large list of items. see comments in implementation.
|
||||
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // helper to manually clip large list of items. see comments in implementation
|
||||
|
||||
IMGUI_API void BeginChildFrame(ImGuiID id, const ImVec2& size); // helper to create a child window / scrolling region that looks like a normal widget frame.
|
||||
IMGUI_API void BeginChildFrame(ImGuiID id, const ImVec2& size); // helper to create a child window / scrolling region that looks like a normal widget frame
|
||||
IMGUI_API void EndChildFrame();
|
||||
|
||||
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in);
|
||||
@ -369,13 +425,19 @@ namespace ImGui
|
||||
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
||||
|
||||
// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
|
||||
IMGUI_API const char* GetVersion();
|
||||
IMGUI_API void* GetInternalState();
|
||||
IMGUI_API size_t GetInternalStateSize();
|
||||
IMGUI_API void SetInternalState(void* state, bool construct = false);
|
||||
|
||||
// Obsolete (will be removed)
|
||||
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); }
|
||||
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size); // OBSOLETE
|
||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); } // OBSOLETE
|
||||
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE
|
||||
static inline ImVec2 GetItemBoxMin() { return GetItemRectMin(); } // OBSOLETE
|
||||
static inline ImVec2 GetItemBoxMax() { return GetItemRectMax(); } // OBSOLETE
|
||||
static inline bool IsClipped(const ImVec2& size) { return IsRectClipped(size); } // OBSOLETE
|
||||
static inline bool IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); } // OBSOLETE
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
@ -397,7 +459,8 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 10, // For internal use by BeginChild()
|
||||
ImGuiWindowFlags_ChildWindowAutoFitY = 1 << 11, // For internal use by BeginChild()
|
||||
ImGuiWindowFlags_ComboBox = 1 << 12, // For internal use by ComboBox()
|
||||
ImGuiWindowFlags_Tooltip = 1 << 13 // For internal use by BeginTooltip()
|
||||
ImGuiWindowFlags_Tooltip = 1 << 13, // For internal use by BeginTooltip()
|
||||
ImGuiWindowFlags_Popup = 1 << 14 // For internal use by BeginPopup()
|
||||
};
|
||||
|
||||
// Flags for ImGui::InputText()
|
||||
@ -448,6 +511,8 @@ enum ImGuiCol_
|
||||
ImGuiCol_Border,
|
||||
ImGuiCol_BorderShadow,
|
||||
ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input
|
||||
ImGuiCol_FrameBgHovered,
|
||||
ImGuiCol_FrameBgActive,
|
||||
ImGuiCol_TitleBg,
|
||||
ImGuiCol_TitleBgCollapsed,
|
||||
ImGuiCol_ScrollbarBg,
|
||||
@ -455,8 +520,6 @@ enum ImGuiCol_
|
||||
ImGuiCol_ScrollbarGrabHovered,
|
||||
ImGuiCol_ScrollbarGrabActive,
|
||||
ImGuiCol_ComboBg,
|
||||
ImGuiCol_CheckHovered,
|
||||
ImGuiCol_CheckActive,
|
||||
ImGuiCol_CheckMark,
|
||||
ImGuiCol_SliderGrab,
|
||||
ImGuiCol_SliderGrabActive,
|
||||
@ -496,7 +559,16 @@ enum ImGuiStyleVar_
|
||||
ImGuiStyleVar_FrameRounding, // float
|
||||
ImGuiStyleVar_ItemSpacing, // ImVec2
|
||||
ImGuiStyleVar_ItemInnerSpacing, // ImVec2
|
||||
ImGuiStyleVar_TreeNodeSpacing // float
|
||||
ImGuiStyleVar_IndentSpacing, // float
|
||||
ImGuiStyleVar_GrabMinSize // float
|
||||
};
|
||||
|
||||
enum ImGuiAlign_
|
||||
{
|
||||
ImGuiAlign_Left = 1 << 0,
|
||||
ImGuiAlign_Center = 1 << 1,
|
||||
ImGuiAlign_Right = 1 << 2,
|
||||
ImGuiAlign_Default = ImGuiAlign_Left,
|
||||
};
|
||||
|
||||
// Enumeration for ColorEditMode()
|
||||
@ -509,13 +581,27 @@ enum ImGuiColorEditMode_
|
||||
ImGuiColorEditMode_HEX = 2
|
||||
};
|
||||
|
||||
// Enumeration for GetMouseCursor()
|
||||
enum ImGuiMouseCursor_
|
||||
{
|
||||
ImGuiMouseCursor_Arrow = 0,
|
||||
ImGuiMouseCursor_TextInput, // When hovering over InputText, etc.
|
||||
ImGuiMouseCursor_Move, // Unused
|
||||
ImGuiMouseCursor_ResizeNS, // Unused
|
||||
ImGuiMouseCursor_ResizeEW, // When hovering over a column
|
||||
ImGuiMouseCursor_ResizeNESW, // Unused
|
||||
ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
|
||||
ImGuiMouseCursor_Count_
|
||||
};
|
||||
|
||||
// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
|
||||
// All those functions treat 0 as a shortcut to ImGuiSetCond_Always
|
||||
enum ImGuiSetCond_
|
||||
{
|
||||
ImGuiSetCond_Always = 1 << 0, // Set the variable
|
||||
ImGuiSetCond_Once = 1 << 1, // Only set the variable on the first call per runtime session
|
||||
ImGuiSetCond_FirstUseEver = 1 << 2 // Only set the variable if the window doesn't exist in the .ini file
|
||||
ImGuiSetCond_FirstUseEver = 1 << 2, // Only set the variable if the window doesn't exist in the .ini file
|
||||
ImGuiSetCond_Appearing = 1 << 3 // Only set the variable if the window is appearing after being inactive (or the first time)
|
||||
};
|
||||
|
||||
struct ImGuiStyle
|
||||
@ -524,18 +610,21 @@ struct ImGuiStyle
|
||||
ImVec2 WindowPadding; // Padding within a window
|
||||
ImVec2 WindowMinSize; // Minimum window size
|
||||
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
||||
ImGuiAlign WindowTitleAlign; // Alignment for title bar text
|
||||
float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
|
||||
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets)
|
||||
float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
|
||||
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines
|
||||
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||||
ImVec2 TouchExtraPadding; // Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
|
||||
ImVec2 AutoFitPadding; // Extra space after auto-fit (double-clicking on resize grip)
|
||||
ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
||||
float WindowFillAlphaDefault; // Default alpha of window background, if not specified in ImGui::Begin()
|
||||
float TreeNodeSpacing; // Horizontal spacing when entering a tree node
|
||||
float IndentSpacing; // Horizontal indentation when e.g. entering a tree node
|
||||
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
|
||||
float ScrollbarWidth; // Width of the vertical scrollbar
|
||||
float GrabMinSize; // Minimum width/height of a slider or scrollbar grab
|
||||
float ScrollbarRounding; // Radius of grab corners for scrollbar
|
||||
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar
|
||||
ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
|
||||
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||||
ImVec4 Colors[ImGuiCol_COUNT];
|
||||
|
||||
IMGUI_API ImGuiStyle();
|
||||
@ -556,6 +645,7 @@ struct ImGuiIO
|
||||
const char* LogFilename; // = "imgui_log.txt" // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging
|
||||
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array
|
||||
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
||||
|
||||
@ -569,9 +659,9 @@ struct ImGuiIO
|
||||
// User Functions
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// REQUIRED: rendering function.
|
||||
// REQUIRED: rendering function.
|
||||
// See example code if you are unsure of how to implement this.
|
||||
void (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);
|
||||
void (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);
|
||||
|
||||
// Optional: access OS clipboard
|
||||
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
|
||||
@ -594,10 +684,11 @@ struct ImGuiIO
|
||||
|
||||
ImVec2 MousePos; // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
|
||||
bool MouseDown[5]; // Mouse buttons. ImGui itself only uses button 0 (left button). Others buttons allows to track if mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
||||
float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text.
|
||||
float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text.
|
||||
bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
||||
bool KeyCtrl; // Keyboard modifier pressed: Control
|
||||
bool KeyShift; // Keyboard modifier pressed: Shift
|
||||
bool KeyAlt; // Keyboard modifier pressed: Alt
|
||||
bool KeysDown[512]; // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
|
||||
ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
||||
|
||||
@ -611,6 +702,8 @@ struct ImGuiIO
|
||||
bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
|
||||
bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input)
|
||||
float Framerate; // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames
|
||||
int MetricsRenderVertices; // Vertices processed during last call to Render()
|
||||
int MetricsActiveWindows; // Number of visible windows (exclude child windows)
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// [Internal] ImGui will maintain those fields for you
|
||||
@ -624,6 +717,7 @@ struct ImGuiIO
|
||||
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked?
|
||||
bool MouseDownOwned[5]; // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds.
|
||||
float MouseDownTime[5]; // Time the mouse button has been down
|
||||
float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the click point
|
||||
float KeysDownTime[512]; // Time the keyboard key has been down
|
||||
|
||||
IMGUI_API ImGuiIO();
|
||||
@ -686,7 +780,6 @@ struct ImGuiTextBuffer
|
||||
ImVector<char> Buf;
|
||||
|
||||
ImGuiTextBuffer() { Buf.push_back(0); }
|
||||
~ImGuiTextBuffer() { }
|
||||
const char* begin() const { return &Buf.front(); }
|
||||
const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator
|
||||
size_t size() const { return Buf.size()-1; }
|
||||
@ -706,13 +799,13 @@ struct ImGuiTextBuffer
|
||||
// - You want to store custom debug data easily without adding or editing structures in your code.
|
||||
struct ImGuiStorage
|
||||
{
|
||||
struct Pair
|
||||
{
|
||||
ImGuiID key;
|
||||
union { int val_i; float val_f; void* val_p; };
|
||||
Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; }
|
||||
Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }
|
||||
Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; }
|
||||
struct Pair
|
||||
{
|
||||
ImGuiID key;
|
||||
union { int val_i; float val_f; void* val_p; };
|
||||
Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; }
|
||||
Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }
|
||||
Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; }
|
||||
};
|
||||
ImVector<Pair> Data;
|
||||
|
||||
@ -727,13 +820,14 @@ struct ImGuiStorage
|
||||
IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL
|
||||
IMGUI_API void SetVoidPtr(ImGuiID key, void* val);
|
||||
|
||||
// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
|
||||
// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
|
||||
// - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
|
||||
// - A typical use case where this is convenient:
|
||||
// float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
|
||||
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
|
||||
IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
|
||||
IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0);
|
||||
IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);
|
||||
|
||||
// Use on your own storage if you know only integer are being stored (open/close all tree nodes)
|
||||
IMGUI_API void SetAllInt(int val);
|
||||
@ -824,6 +918,7 @@ IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
||||
// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future.
|
||||
// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
|
||||
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
|
||||
// All positions are in screen coordinates (0,0=top-left, 1 pixel per unit). Primitives are always added to the list and not culled (culling is done at render time and at a higher-level by ImGui:: functions).
|
||||
// Note that this only gives you access to rendering polygons. If your intent is to create custom widgets and the publicly exposed functions/data aren't sufficient, you can add code in imgui_user.inl
|
||||
struct ImDrawList
|
||||
{
|
||||
@ -833,38 +928,43 @@ struct ImDrawList
|
||||
|
||||
// [Internal to ImGui]
|
||||
ImVector<ImVec4> clip_rect_stack; // [Internal]
|
||||
ImVector<ImTextureID> texture_id_stack; // [Internal]
|
||||
ImVector<ImTextureID> texture_id_stack; // [Internal]
|
||||
ImDrawVert* vtx_write; // [Internal] point within vtx_buffer after each add command (to avoid using the ImVector<> operators too much)
|
||||
|
||||
ImDrawList() { Clear(); }
|
||||
IMGUI_API void Clear();
|
||||
IMGUI_API void ClearFreeMemory();
|
||||
IMGUI_API void PushClipRect(const ImVec4& clip_rect); // Scissoring. The values are x1, y1, x2, y2.
|
||||
IMGUI_API void PushClipRectFullScreen();
|
||||
IMGUI_API void PopClipRect();
|
||||
IMGUI_API void PushTextureID(const ImTextureID& texture_id);
|
||||
IMGUI_API void PopTextureID();
|
||||
|
||||
// Primitives
|
||||
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
||||
IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
||||
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
||||
// Primitives
|
||||
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
||||
IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
|
||||
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
|
||||
IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
||||
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
||||
IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
||||
IMGUI_API void AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
|
||||
IMGUI_API void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL);
|
||||
IMGUI_API void AddArcFast(const ImVec2& center, float radius, ImU32 col, int a_min_12, int a_max_12, bool filled = false, const ImVec2& third_point_offset = ImVec2(0,0)); // Angles in 0..12 range
|
||||
IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL);
|
||||
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
|
||||
|
||||
// Advanced
|
||||
IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'user_callback' in ImDrawCmd and call the function instead of rendering triangles.
|
||||
IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible
|
||||
IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'user_callback' in ImDrawCmd and call the function instead of rendering triangles.
|
||||
IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible
|
||||
|
||||
// Internal helpers
|
||||
IMGUI_API void ReserveVertices(unsigned int vtx_count);
|
||||
IMGUI_API void AddVtx(const ImVec2& pos, ImU32 col);
|
||||
IMGUI_API void AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
|
||||
IMGUI_API void AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
||||
IMGUI_API void PrimReserve(unsigned int vtx_count);
|
||||
IMGUI_API void PrimTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
||||
IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col);
|
||||
IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);
|
||||
IMGUI_API void PrimQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col);
|
||||
IMGUI_API void PrimLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
||||
IMGUI_API void UpdateClipRect();
|
||||
IMGUI_API void UpdateTextureID();
|
||||
IMGUI_API void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { vtx_write->pos = pos; vtx_write->uv = uv; vtx_write->col = col; vtx_write++; }
|
||||
};
|
||||
|
||||
// Load and rasterize multiple TTF fonts into a same texture.
|
||||
@ -874,16 +974,19 @@ struct ImDrawList
|
||||
// 2. Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data.
|
||||
// 3. Upload the pixels data into a texture within your graphics system.
|
||||
// 4. Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture. This value will be passed back to you during rendering to identify the texture.
|
||||
// 5. Call ClearPixelsData() to free textures memory on the heap.
|
||||
// 5. Call ClearTexData() to free textures memory on the heap.
|
||||
struct ImFontAtlas
|
||||
{
|
||||
IMGUI_API ImFontAtlas();
|
||||
IMGUI_API ~ImFontAtlas();
|
||||
IMGUI_API ImFont* AddFontDefault();
|
||||
IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0);
|
||||
IMGUI_API ImFont* AddFontFromMemoryTTF(void* in_ttf_data, size_t in_ttf_data_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // Pass ownership of 'in_ttf_data' memory.
|
||||
IMGUI_API void ClearTexData(); // Saves RAM once the texture has been copied to graphics memory.
|
||||
IMGUI_API void Clear();
|
||||
IMGUI_API ImFont* AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // Transfer ownership of 'ttf_data' to ImFontAtlas, will be deleted after Build()
|
||||
IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // 'compressed_ttf_data' untouched and still owned by caller. Compress with binary_to_compressed_c.cpp
|
||||
IMGUI_API void ClearTexData(); // Clear the CPU-side texture data. Saves RAM once the texture has been copied to graphics memory.
|
||||
IMGUI_API void ClearInputData(); // Clear the input TTF data (inc sizes, glyph ranges)
|
||||
IMGUI_API void ClearFonts(); // Clear the ImGui-side font data (glyphs storage, UV coordinates)
|
||||
IMGUI_API void Clear(); // Clear all
|
||||
|
||||
// Retrieve texture data
|
||||
// User is in charge of copying the pixels into graphics memory, then call SetTextureUserID()
|
||||
@ -895,7 +998,7 @@ struct ImFontAtlas
|
||||
IMGUI_API void SetTexID(void* id) { TexID = id; }
|
||||
|
||||
// Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
|
||||
// (Those functions could be static, aren't so simple use case doesn't have to refer to the ImFontAtlas:: type ever if in their code)
|
||||
// (Those functions could be static but aren't so most users don't have to refer to the ImFontAtlas:: name ever if in their code; just using io.Fonts->)
|
||||
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
||||
IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
||||
IMGUI_API const ImWchar* GetGlyphRangesChinese(); // Japanese + full set of about 21000 CJK Unified Ideographs
|
||||
@ -907,7 +1010,6 @@ struct ImFontAtlas
|
||||
unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4
|
||||
int TexWidth;
|
||||
int TexHeight;
|
||||
ImVec2 TexExtraDataPos; // Position of our rectangle where we draw non-font graphics
|
||||
ImVec2 TexUvWhitePixel; // Texture coordinates to a white pixel (part of the TexExtraData block)
|
||||
ImVector<ImFont*> Fonts;
|
||||
|
||||
@ -915,8 +1017,7 @@ struct ImFontAtlas
|
||||
struct ImFontAtlasData;
|
||||
ImVector<ImFontAtlasData*> InputData; // Internal data
|
||||
IMGUI_API bool Build(); // Build pixels data. This is automatically for you by the GetTexData*** functions.
|
||||
IMGUI_API void ClearInputData(); // Clear the input TTF data.
|
||||
IMGUI_API void RenderCustomTexData();
|
||||
IMGUI_API void RenderCustomTexData(int pass, void* rects);
|
||||
};
|
||||
|
||||
// TTF font loading and rendering
|
||||
@ -939,6 +1040,7 @@ struct ImFont
|
||||
signed short XOffset, YOffset;
|
||||
float U0, V0, U1, V1; // Texture coordinates
|
||||
};
|
||||
float BaseLine; // Distance from top to bottom of e.g. 'A' [0..FontSize]
|
||||
ImFontAtlas* ContainerAtlas; // What we has been loaded into
|
||||
ImVector<Glyph> Glyphs;
|
||||
const Glyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
|
||||
@ -948,19 +1050,19 @@ struct ImFont
|
||||
|
||||
// Methods
|
||||
IMGUI_API ImFont();
|
||||
IMGUI_API ~ImFont() { Clear(); }
|
||||
IMGUI_API void Clear();
|
||||
IMGUI_API void BuildLookupTable();
|
||||
IMGUI_API const Glyph* FindGlyph(unsigned short c) const;
|
||||
IMGUI_API void SetFallbackChar(ImWchar c);
|
||||
IMGUI_API bool IsLoaded() const { return ContainerAtlas != NULL; }
|
||||
IMGUI_API ~ImFont();
|
||||
IMGUI_API void Clear();
|
||||
IMGUI_API void BuildLookupTable();
|
||||
IMGUI_API const Glyph* FindGlyph(unsigned short c) const;
|
||||
IMGUI_API void SetFallbackChar(ImWchar c);
|
||||
IMGUI_API bool IsLoaded() const { return ContainerAtlas != NULL; }
|
||||
|
||||
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
|
||||
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
||||
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8
|
||||
IMGUI_API ImVec2 CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const; // wchar
|
||||
IMGUI_API void RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL) const;
|
||||
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
|
||||
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8
|
||||
IMGUI_API ImVec2 CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const; // wchar
|
||||
IMGUI_API void RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawList* draw_list, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL) const;
|
||||
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
|
||||
};
|
||||
|
||||
//---- Include imgui_user.h at the end of imgui.h
|
||||
|
22
3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h
vendored
22
3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h
vendored
@ -182,7 +182,12 @@ enum InAppOverlay
|
||||
|
||||
// API breaking change history:
|
||||
// Version 1 -> 2 - strings changed from wchar_t* to char* (UTF-8)
|
||||
#define RENDERDOC_API_VERSION 2
|
||||
// Version 2 -> 3 - StartFrameCapture, EndFrameCapture and SetActiveWindow take
|
||||
// 'device' pointer as well as window handles.
|
||||
// This is either ID3D11Device* or the GL context (HGLRC/GLXContext)
|
||||
// You can still pass NULL to both to capture the default, as long as
|
||||
// there's only one device/window pair alive.
|
||||
#define RENDERDOC_API_VERSION 3
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// In-program functions
|
||||
@ -191,6 +196,9 @@ enum InAppOverlay
|
||||
extern "C" RENDERDOC_API int RENDERDOC_CC RENDERDOC_GetAPIVersion();
|
||||
typedef int (RENDERDOC_CC *pRENDERDOC_GetAPIVersion)();
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_Shutdown();
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_Shutdown)();
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetLogFile(const char *logfile);
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_SetLogFile)(const char *logfile);
|
||||
|
||||
@ -203,17 +211,17 @@ typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *logfi
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetCaptureOptions(const CaptureOptions *opts);
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_SetCaptureOptions)(const CaptureOptions *opts);
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetActiveWindow(void *wndHandle);
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(void *wndHandle);
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetActiveWindow(void *device, void *wndHandle);
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(void *device, void *wndHandle);
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_TriggerCapture();
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_TriggerCapture)();
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartFrameCapture(void *wndHandle);
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(void *wndHandle);
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartFrameCapture(void *device, void *wndHandle);
|
||||
typedef void (RENDERDOC_CC *pRENDERDOC_StartFrameCapture)(void *device, void *wndHandle);
|
||||
|
||||
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EndFrameCapture(void *wndHandle);
|
||||
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(void *wndHandle);
|
||||
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EndFrameCapture(void *device, void *wndHandle);
|
||||
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(void *device, void *wndHandle);
|
||||
|
||||
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_GetOverlayBits();
|
||||
typedef uint32_t (RENDERDOC_CC *pRENDERDOC_GetOverlayBits)();
|
||||
|
2
3rdparty/bgfx/3rdparty/stb/stb_rect_pack.h
vendored
2
3rdparty/bgfx/3rdparty/stb/stb_rect_pack.h
vendored
@ -488,7 +488,6 @@ static int rect_height_compare(const void *a, const void *b)
|
||||
return (p->w > q->w) ? -1 : (p->w < q->w);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int rect_width_compare(const void *a, const void *b)
|
||||
{
|
||||
stbrp_rect *p = (stbrp_rect *) a;
|
||||
@ -499,7 +498,6 @@ static int rect_width_compare(const void *a, const void *b)
|
||||
return 1;
|
||||
return (p->h > q->h) ? -1 : (p->h < q->h);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int rect_original_order(const void *a, const void *b)
|
||||
{
|
||||
|
20
3rdparty/bgfx/README.md
vendored
20
3rdparty/bgfx/README.md
vendored
@ -27,11 +27,11 @@ Supported platforms:
|
||||
* asm.js/Emscripten (1.25.0)
|
||||
* FreeBSD
|
||||
* iOS
|
||||
* Linux
|
||||
* Linux /statusIcon)
|
||||
* Native Client (PPAPI 37+, ARM, x86, x64, PNaCl)
|
||||
* OSX (10.9)
|
||||
* RaspberryPi
|
||||
* Windows (XP, Vista, 7, 8, 10)
|
||||
* Windows (XP, Vista, 7, 8, 10) /statusIcon)
|
||||
* WinRT (WinPhone 8.0+)
|
||||
|
||||
Supported compilers:
|
||||
@ -48,16 +48,17 @@ Languages:
|
||||
* [D language API bindings](https://github.com/DerelictOrg/DerelictBgfx)
|
||||
* [Go language API bindings](https://github.com/james4k/go-bgfx)
|
||||
|
||||
Build status
|
||||
------------
|
||||
|
||||
https://tc27.draster.com/guestAuth/overview.html
|
||||
|
||||
Who is using it?
|
||||
----------------
|
||||
|
||||
http://airmech.com/ AirMech is a free-to-play futuristic action real-time
|
||||
strategy video game developed and published by Carbon Games.
|
||||
|
||||
http://loomsdk.com/ Loom Game Engine developed by The Engine Company. Loom
|
||||
is a powerful 2D game engine with live reloading of code and assets, a friendly
|
||||
scripting language, and an efficient command-line workflow.
|
||||
|
||||
https://github.com/dariomanesku/cmftStudio cmftStudio - cubemap filtering tool.
|
||||

|
||||
|
||||
@ -335,6 +336,8 @@ Building
|
||||
Steps bellow are for default build system inside bgfx repository. There is
|
||||
alterative way to build bgfx and examples with [fips](https://github.com/floooh/fips-bgfx/#fips-bgfx).
|
||||
|
||||
Binary builds (for Windows and Linux) are also available [here](https://tc27.draster.com/bgfx-bins/).
|
||||
|
||||
### Getting source
|
||||
|
||||
git clone git://github.com/bkaradzic/bx.git
|
||||
@ -795,7 +798,7 @@ Miloš Tošić ([@milostosic](https://github.com/milostosic)) - 12-lod example.
|
||||
Dario Manesku ([@dariomanesku](https://github.com/dariomanesku)) - 13-stencil,
|
||||
14-shadowvolumes, 15-shadowmaps-simple, 16-shadowmaps, 18-ibl
|
||||
James Gray ([@james4k](https://github.com/james4k)) - Go language API bindings.
|
||||
p0nce ([@p0nce](https://github.com/p0nce)) - D language API bindings.
|
||||
Guillaume Piolat ([@p0nce](https://github.com/p0nce)) - D language API bindings.
|
||||
Mike Popoloski ([@MikePopoloski](https://github.com/MikePopoloski)) - C#/VB/F#
|
||||
language API bindings, WinRT/WinPhone support.
|
||||
Kai Jourdan ([@questor](https://github.com/questor)) - 23-vectordisplay example
|
||||
@ -803,7 +806,8 @@ Stanlo Slasinski ([@stanlo](https://github.com/stanlo)) - 24-nbody example
|
||||
Daniel Collin ([@emoon](https://github.com/emoon)) - Port of Ocornut's ImGui
|
||||
to bgfx.
|
||||
Andre Weissflog ([@floooh](https://github.com/floooh)) - Alternative build
|
||||
system fips.
|
||||
system fips.
|
||||
Andrew Johnson ([@ajohnson23](https://github.com/ajohnson23)) - TeamCity build.
|
||||
|
||||
[License (BSD 2-clause)](https://github.com/bkaradzic/bgfx/blob/master/LICENSE)
|
||||
-------------------------------------------------------------------------------
|
||||
|
@ -18,12 +18,12 @@ uniform vec4 u_lightPosRadius[MAX_NUM_LIGHTS];
|
||||
uniform vec4 u_lightRgbInnerR[MAX_NUM_LIGHTS];
|
||||
SAMPLER2D(u_texColor, 0);
|
||||
|
||||
#define u_ambientPass u_params.x
|
||||
#define u_lightningPass u_params.y
|
||||
#define u_lightCount u_params.z
|
||||
#define u_lightIndex u_params.w
|
||||
#define u_specular u_specular_shininess.xyz
|
||||
#define u_shininess u_specular_shininess.w
|
||||
#define u_ambientPass u_params.x
|
||||
#define u_lightingPass u_params.y
|
||||
#define u_lightCount u_params.z
|
||||
#define u_lightIndex u_params.w
|
||||
#define u_specular u_specular_shininess.xyz
|
||||
#define u_shininess u_specular_shininess.w
|
||||
|
||||
vec2 blinn(vec3 _lightDir, vec3 _normal, vec3 _viewDir)
|
||||
{
|
||||
@ -67,17 +67,18 @@ void main()
|
||||
for(int ii = 0; ii < MAX_NUM_LIGHTS; ++ii)
|
||||
{
|
||||
float condition = 0.0;
|
||||
if (u_lightCount > 1.0)
|
||||
if (u_lightCount > 1.0) // Stencil Reflection Scene.
|
||||
{
|
||||
condition = 1.0 - step(u_lightCount, float(ii));
|
||||
condition = 1.0 - step(u_lightCount, float(ii)); // True for every light up to u_lightCount.
|
||||
}
|
||||
else
|
||||
else // Projection Shadows Scene.
|
||||
{
|
||||
condition = float(float(ii) == u_lightIndex);
|
||||
condition = float(float(ii) == u_lightIndex); // True only for current light.
|
||||
}
|
||||
|
||||
lightColor += calcLight(ii, v_view, normal, viewDir) * condition;
|
||||
}
|
||||
lightColor *= u_lightningPass;
|
||||
lightColor *= u_lightingPass;
|
||||
|
||||
vec3 color = toLinear(texture2D(u_texColor, v_texcoord0)).xyz;
|
||||
|
||||
|
@ -262,8 +262,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
float lightProj[16];
|
||||
|
||||
eye[0] = -lightPos[0];
|
||||
eye[0] = -lightPos[1];
|
||||
eye[0] = -lightPos[2];
|
||||
eye[1] = -lightPos[1];
|
||||
eye[2] = -lightPos[2];
|
||||
|
||||
at[0] = 0.0f;
|
||||
at[1] = 0.0f;
|
||||
|
5
3rdparty/bgfx/examples/20-nanovg/nanovg.cpp
vendored
5
3rdparty/bgfx/examples/20-nanovg/nanovg.cpp
vendored
@ -30,6 +30,7 @@
|
||||
#include <bx/string.h>
|
||||
#include <bx/timer.h>
|
||||
#include "entry/entry.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "nanovg/nanovg.h"
|
||||
|
||||
BX_PRAGMA_DIAGNOSTIC_PUSH();
|
||||
@ -1221,6 +1222,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
, 0
|
||||
);
|
||||
|
||||
imguiCreate();
|
||||
|
||||
NVGcontext* nvg = nvgCreate(1, 0);
|
||||
bgfx::setViewSeq(0, true);
|
||||
|
||||
@ -1266,6 +1269,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
|
||||
nvgDelete(nvg);
|
||||
|
||||
imguiDestroy();
|
||||
|
||||
// Shutdown bgfx.
|
||||
bgfx::shutdown();
|
||||
|
||||
|
16
3rdparty/bgfx/examples/24-nbody/cs_indirect.sc
vendored
Normal file
16
3rdparty/bgfx/examples/24-nbody/cs_indirect.sc
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright 2014 Stanlo Slasinski. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "bgfx_compute.sh"
|
||||
#include "uniforms.sh"
|
||||
|
||||
BUFFER_WR(indirectBuffer, uvec4, 0);
|
||||
|
||||
NUM_THREADS(1, 1, 1)
|
||||
void main()
|
||||
{
|
||||
drawIndexedIndirect(indirectBuffer, 0, 6, u_dispatchSize * threadGroupUpdateSize, 0, 0, 0);
|
||||
dispatchIndirect(indirectBuffer, 1, u_dispatchSize, 1, 1);
|
||||
}
|
64
3rdparty/bgfx/examples/24-nbody/nbody.cpp
vendored
64
3rdparty/bgfx/examples/24-nbody/nbody.cpp
vendored
@ -118,7 +118,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
);
|
||||
|
||||
const bgfx::Caps* caps = bgfx::getCaps();
|
||||
const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE);
|
||||
const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE);
|
||||
const bool indirectSupported = !!(caps->supported & BGFX_CAPS_DRAW_INDIRECT);
|
||||
|
||||
if (computeSupported)
|
||||
{
|
||||
@ -162,10 +163,17 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
|
||||
bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3);
|
||||
|
||||
bgfx::ShaderHandle initInstancesShader = loadShader("cs_init_instances");
|
||||
bgfx::ProgramHandle initInstancesProgram = bgfx::createProgram(initInstancesShader, true);
|
||||
bgfx::ShaderHandle updateInstancesShader = loadShader("cs_update_instances");
|
||||
bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true);
|
||||
bgfx::ProgramHandle initInstancesProgram = bgfx::createProgram(loadShader("cs_init_instances"), true);
|
||||
bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(loadShader("cs_update_instances"), true);
|
||||
|
||||
bgfx::ProgramHandle indirectProgram = BGFX_INVALID_HANDLE;
|
||||
bgfx::IndirectBufferHandle indirectBuffer = BGFX_INVALID_HANDLE;
|
||||
|
||||
if (indirectSupported)
|
||||
{
|
||||
indirectProgram = bgfx::createProgram(loadShader("cs_indirect"), true);
|
||||
indirectBuffer = bgfx::createIndirectBuffer(2);
|
||||
}
|
||||
|
||||
u_paramsDataStruct u_paramsData;
|
||||
InitializeParams(0, &u_paramsData);
|
||||
@ -184,6 +192,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
|
||||
int32_t scrollArea = 0;
|
||||
|
||||
bool useIndirect = false;
|
||||
|
||||
entry::MouseState mouseState;
|
||||
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
|
||||
{
|
||||
@ -194,6 +204,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
const double freq = double(bx::getHPFrequency() );
|
||||
const float deltaTime = float(frameTime/freq);
|
||||
|
||||
if (deltaTime > 1000.0)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, width, height);
|
||||
|
||||
@ -225,6 +240,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f);
|
||||
imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f);
|
||||
imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f);
|
||||
imguiSeparatorLine();
|
||||
if (imguiCheck("Use draw/dispatch indirect", useIndirect, indirectSupported) )
|
||||
{
|
||||
useIndirect = !useIndirect;
|
||||
}
|
||||
imguiEndScrollArea();
|
||||
imguiEndFrame();
|
||||
|
||||
@ -243,12 +263,27 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1);
|
||||
}
|
||||
|
||||
if (useIndirect)
|
||||
{
|
||||
bgfx::setUniform(u_params, &u_paramsData, 3);
|
||||
bgfx::setBuffer(0, indirectBuffer, bgfx::Access::Write);
|
||||
bgfx::dispatch(0, indirectProgram);
|
||||
}
|
||||
|
||||
bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read);
|
||||
bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read);
|
||||
bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write);
|
||||
bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write);
|
||||
bgfx::setUniform(u_params, &u_paramsData, 3);
|
||||
bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1);
|
||||
|
||||
if (useIndirect)
|
||||
{
|
||||
bgfx::dispatch(0, updateInstancesProgram, indirectBuffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1);
|
||||
}
|
||||
|
||||
bx::xchg(currPositionBuffer0, currPositionBuffer1);
|
||||
bx::xchg(prevPositionBuffer0, prevPositionBuffer1);
|
||||
@ -305,7 +340,14 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
);
|
||||
|
||||
// Submit primitive for rendering to view 0.
|
||||
bgfx::submit(0);
|
||||
if (useIndirect)
|
||||
{
|
||||
bgfx::submit(0, indirectBuffer, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bgfx::submit(0);
|
||||
}
|
||||
|
||||
// Advance to next frame. Rendering thread will be kicked to
|
||||
// process submitted rendering primitives.
|
||||
@ -315,6 +357,14 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
// Cleanup.
|
||||
cameraDestroy();
|
||||
imguiDestroy();
|
||||
|
||||
if (indirectSupported)
|
||||
{
|
||||
bgfx::destroyProgram(indirectProgram);
|
||||
bgfx::destroyIndirectBuffer(indirectBuffer);
|
||||
}
|
||||
|
||||
|
||||
bgfx::destroyUniform(u_params);
|
||||
bgfx::destroyDynamicVertexBuffer(currPositionBuffer0);
|
||||
bgfx::destroyDynamicVertexBuffer(currPositionBuffer1);
|
||||
|
2
3rdparty/bgfx/examples/24-nbody/uniforms.sh
vendored
2
3rdparty/bgfx/examples/24-nbody/uniforms.sh
vendored
@ -5,6 +5,8 @@
|
||||
|
||||
uniform vec4 u_params[3];
|
||||
|
||||
#define threadGroupUpdateSize 512
|
||||
|
||||
#define u_timeStep u_params[0].x
|
||||
#define u_dispatchSize floatBitsToUint(u_params[0].y)
|
||||
#define u_gravity u_params[0].z
|
||||
|
89
3rdparty/bgfx/examples/common/bgfx_utils.cpp
vendored
89
3rdparty/bgfx/examples/common/bgfx_utils.cpp
vendored
@ -15,6 +15,7 @@ namespace stl = tinystl;
|
||||
#include <bgfx.h>
|
||||
#include <bx/readerwriter.h>
|
||||
#include <bx/fpumath.h>
|
||||
#include <bx/string.h>
|
||||
#include "entry/entry.h"
|
||||
#include <ib-compress/indexbufferdecompression.h>
|
||||
|
||||
@ -62,6 +63,25 @@ static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePa
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void* loadMem(bx::FileReaderI* _reader, bx::ReallocatorI* _allocator, const char* _filePath, uint32_t* _size)
|
||||
{
|
||||
if (0 == bx::open(_reader, _filePath) )
|
||||
{
|
||||
uint32_t size = (uint32_t)bx::getSize(_reader);
|
||||
void* data = BX_ALLOC(_allocator, size);
|
||||
bx::read(_reader, data, size);
|
||||
bx::close(_reader);
|
||||
|
||||
if (NULL != _size)
|
||||
{
|
||||
*_size = size;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name)
|
||||
{
|
||||
char filePath[512];
|
||||
@ -112,15 +132,76 @@ bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName)
|
||||
return loadProgram(entry::getFileReader(), _vsName, _fsName);
|
||||
}
|
||||
|
||||
typedef unsigned char stbi_uc;
|
||||
extern "C" stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
|
||||
|
||||
bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _name, uint32_t _flags, uint8_t _skip, bgfx::TextureInfo* _info)
|
||||
{
|
||||
char filePath[512];
|
||||
strcpy(filePath, "textures/");
|
||||
char filePath[512] = { '\0' };
|
||||
if (NULL == strchr(_name, '/') )
|
||||
{
|
||||
strcpy(filePath, "textures/");
|
||||
}
|
||||
|
||||
strcat(filePath, _name);
|
||||
|
||||
const bgfx::Memory* mem = loadMem(_reader, filePath);
|
||||
if (NULL != bx::stristr(_name, ".dds")
|
||||
|| NULL != bx::stristr(_name, ".pvr")
|
||||
|| NULL != bx::stristr(_name, ".ktx") )
|
||||
{
|
||||
const bgfx::Memory* mem = loadMem(_reader, filePath);
|
||||
if (NULL != mem)
|
||||
{
|
||||
return bgfx::createTexture(mem, _flags, _skip, _info);
|
||||
}
|
||||
|
||||
return bgfx::createTexture(mem, _flags, _skip, _info);
|
||||
bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
|
||||
DBG("Failed to load %s.", filePath);
|
||||
return handle;
|
||||
}
|
||||
|
||||
bgfx::TextureHandle handle = BGFX_INVALID_HANDLE;
|
||||
bx::ReallocatorI* allocator = entry::getAllocator();
|
||||
|
||||
uint32_t size = 0;
|
||||
void* data = loadMem(_reader, allocator, filePath, &size);
|
||||
if (NULL != data)
|
||||
{
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int comp = 0;
|
||||
|
||||
uint8_t* img = NULL;
|
||||
img = stbi_load_from_memory( (uint8_t*)data, size, &width, &height, &comp, 4);
|
||||
|
||||
BX_FREE(allocator, data);
|
||||
|
||||
handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), 1
|
||||
, bgfx::TextureFormat::RGBA8
|
||||
, _flags
|
||||
, bgfx::copy(img, width*height*4)
|
||||
);
|
||||
|
||||
free(img);
|
||||
|
||||
if (NULL != _info)
|
||||
{
|
||||
bgfx::calcTextureSize(*_info
|
||||
, uint16_t(width)
|
||||
, uint16_t(height)
|
||||
, 0
|
||||
, false
|
||||
, 1
|
||||
, bgfx::TextureFormat::RGBA8
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG("Failed to load %s.", filePath);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
bgfx::TextureHandle loadTexture(const char* _name, uint32_t _flags, uint8_t _skip, bgfx::TextureInfo* _info)
|
||||
|
17
3rdparty/bgfx/examples/common/entry/entry.cpp
vendored
17
3rdparty/bgfx/examples/common/entry/entry.cpp
vendored
@ -118,13 +118,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
{
|
||||
if (_argc > 1)
|
||||
{
|
||||
if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv)
|
||||
if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "flush", BGFX_RESET_FLUSH_AFTER_RENDER, 1, _argc, _argv)
|
||||
|| setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv)
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
@ -178,7 +179,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
{ entry::Key::F4, entry::Modifier::LeftCtrl, 1, cmd, "graphics hmddbg" },
|
||||
{ entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" },
|
||||
{ entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" },
|
||||
{ entry::Key::F9, entry::Modifier::None, 1, cmd, "graphics flip" },
|
||||
{ entry::Key::F9, entry::Modifier::None, 1, cmd, "graphics flush" },
|
||||
{ entry::Key::Print, entry::Modifier::None, 1, cmd, "graphics screenshot" },
|
||||
|
||||
INPUT_BINDING_END
|
||||
|
@ -12,6 +12,7 @@
|
||||
#endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
#include <bgfxplatform.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -450,20 +451,28 @@ namespace entry
|
||||
uint8_t modifiers = translateKeyModifiers(kev.keysym.mod);
|
||||
Key::Enum key = translateKey(kev.keysym.scancode);
|
||||
|
||||
const uint8_t shiftMask = Modifier::LeftShift|Modifier::RightShift;
|
||||
const bool nonShiftModifiers = (0 != (modifiers&(~shiftMask) ) );
|
||||
const bool isCharPressed = (Key::Key0 <= key && key <= Key::KeyZ) || (Key::Esc <= key && key <= Key::Minus);
|
||||
const bool isText = isCharPressed && !nonShiftModifiers;
|
||||
|
||||
if (isText)
|
||||
// TODO: These keys are not captured by SDL_TEXTINPUT. Should be probably handled by SDL_TEXTEDITING. This is a workaround for now.
|
||||
if (key == 1) // Escape
|
||||
{
|
||||
uint8_t pressedChar[4];
|
||||
pressedChar[0] = keyToAscii(key, modifiers);
|
||||
pressedChar[0] = 0x1b;
|
||||
m_eventQueue.postCharEvent(handle, 1, pressedChar);
|
||||
}
|
||||
else if (key == 2) // Enter
|
||||
{
|
||||
uint8_t pressedChar[4];
|
||||
pressedChar[0] = 0x0d;
|
||||
m_eventQueue.postCharEvent(handle, 1, pressedChar);
|
||||
}
|
||||
else if (key == 5) // Backspace
|
||||
{
|
||||
uint8_t pressedChar[4];
|
||||
pressedChar[0] = 0x08;
|
||||
m_eventQueue.postCharEvent(handle, 1, pressedChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eventQueue.postKeyEvent(handle, key, modifiers, kev.state == SDL_PRESSED);
|
||||
m_eventQueue.postKeyEvent(handle, key, modifiers, kev.state == SDL_PRESSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ static entry::EventQueue g_eventQueue;
|
||||
|
||||
ref class App sealed : public IFrameworkView
|
||||
{
|
||||
public:
|
||||
App()
|
||||
: m_windowVisible(true)
|
||||
, m_windowClosed(false)
|
||||
public:
|
||||
App()
|
||||
: m_windowVisible(true)
|
||||
, m_windowClosed(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -57,13 +57,14 @@ ref class App sealed : public IFrameworkView
|
||||
thread.init(MainThreadFunc, nullptr);
|
||||
|
||||
CoreWindow^ window = CoreWindow::GetForCurrentThread();
|
||||
if (window == nullptr) {
|
||||
int i = 4;
|
||||
i++;
|
||||
}
|
||||
auto bounds = window->Bounds;
|
||||
auto dpi = DisplayInformation::GetForCurrentView()->LogicalDpi;
|
||||
|
||||
//auto bounds = window->Bounds;
|
||||
//g_eventQueue.postSizeEvent(g_defaultWindow, bounds.Width, bounds.Height);
|
||||
static const float dipsPerInch = 96.0f;
|
||||
g_eventQueue.postSizeEvent(g_defaultWindow
|
||||
, lround(floorf(bounds.Width * dpi / dipsPerInch + 0.5f))
|
||||
, lround(floorf(bounds.Height * dpi / dipsPerInch + 0.5f))
|
||||
);
|
||||
|
||||
while (!m_windowClosed)
|
||||
{
|
||||
@ -92,12 +93,6 @@ private:
|
||||
|
||||
void OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
|
||||
{
|
||||
CoreWindow^ window = CoreWindow::GetForCurrentThread();
|
||||
if (window == nullptr) {
|
||||
int i = 4;
|
||||
i++;
|
||||
}
|
||||
|
||||
CoreWindow::GetForCurrentThread()->Activate();
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,6 @@ namespace entry
|
||||
| KeyPressMask
|
||||
| KeyReleaseMask
|
||||
| PointerMotionMask
|
||||
| ResizeRedirectMask
|
||||
| StructureNotifyMask
|
||||
;
|
||||
|
||||
@ -357,9 +356,6 @@ namespace entry
|
||||
case Expose:
|
||||
break;
|
||||
|
||||
case ConfigureNotify:
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
if ( (Atom)event.xclient.data.l[0] == wmDeleteWindow)
|
||||
{
|
||||
@ -449,14 +445,13 @@ namespace entry
|
||||
}
|
||||
break;
|
||||
|
||||
case ResizeRequest:
|
||||
case ConfigureNotify:
|
||||
{
|
||||
const XResizeRequestEvent& xresize = event.xresizerequest;
|
||||
XResizeWindow(xresize.display, xresize.window, xresize.width, xresize.height);
|
||||
WindowHandle handle = findHandle(xresize.window);
|
||||
const XConfigureEvent& xev = event.xconfigure;
|
||||
WindowHandle handle = findHandle(xev.window);
|
||||
if (isValid(handle) )
|
||||
{
|
||||
m_eventQueue.postSizeEvent(handle, xresize.width, xresize.height);
|
||||
m_eventQueue.postSizeEvent(handle, xev.width, xev.height);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1,42 +1,28 @@
|
||||
static const uint8_t fs_imgui_cubemap_glsl[578] =
|
||||
static const uint8_t fs_imgui_cubemap_glsl[363] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x03, 0xe3, 0xc2, 0x5c, 0x65, 0x00, 0x00, 0x33, 0x02, 0x00, 0x00, 0x6c, 0x6f, // FSH....e..3...lo
|
||||
0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, // wp vec4 impl_low
|
||||
0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, // _textureCubeLod
|
||||
0x20, 0x20, 0x28, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, // (lowp samplerC
|
||||
0x75, 0x62, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x68, 0x69, 0x67, // ube sampler, hig
|
||||
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6d, // hp vec3 coord, m
|
||||
0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x6c, 0x6f, 0x64, // ediump float lod
|
||||
0x29, 0x0a, 0x7b, 0x0a, 0x23, 0x69, 0x66, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x28, // ).{.#if defined(
|
||||
0x47, 0x4c, 0x5f, 0x45, 0x58, 0x54, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x65, // GL_EXT_shader_te
|
||||
0x78, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6c, 0x6f, 0x64, 0x29, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, // xture_lod)..retu
|
||||
0x72, 0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, // rn textureCubeLo
|
||||
0x64, 0x20, 0x20, 0x20, 0x28, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, // d (sampler, co
|
||||
0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, 0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6c, 0x73, 0x65, // ord, lod);.#else
|
||||
0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ..return texture
|
||||
0x43, 0x75, 0x62, 0x65, 0x28, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, // Cube(sampler, co
|
||||
0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, 0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, 0x69, // ord, lod);.#endi
|
||||
0x66, 0x0a, 0x7d, 0x0a, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, // f.}..varying hig
|
||||
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, // hp vec3 v_normal
|
||||
0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ;.uniform highp
|
||||
0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, // vec4 u_imageLodE
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // nabled;.uniform
|
||||
0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, // lowp samplerCube
|
||||
0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // s_texColor;.voi
|
||||
0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, // d main ().{. lo
|
||||
0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // wp vec4 tmpvar_1
|
||||
0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, // ;. tmpvar_1.xyz
|
||||
0x20, 0x3d, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x78, 0x74, // = impl_low_text
|
||||
0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, // ureCubeLod (s
|
||||
0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x6e, 0x6f, 0x72, // _texColor, v_nor
|
||||
0x6d, 0x61, 0x6c, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, // mal, u_imageLodE
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, // nabled.x).xyz;.
|
||||
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, // tmpvar_1.w = (0
|
||||
0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, // .2 + (0.8 * u_im
|
||||
0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, // ageLodEnabled.y)
|
||||
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, // );. gl_FragColo
|
||||
0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}.
|
||||
0x0a, 0x00, // ..
|
||||
0x46, 0x53, 0x48, 0x03, 0xe3, 0xc2, 0x5c, 0x65, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH....e...u_ima
|
||||
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled....
|
||||
0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
|
||||
0x00, 0x01, 0x00, 0x33, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...3...varying h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // ighp vec3 v_norm
|
||||
0x61, 0x6c, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, // al;.uniform high
|
||||
0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, // p vec4 u_imageLo
|
||||
0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, // dEnabled;.unifor
|
||||
0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, // m lowp samplerCu
|
||||
0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, // be s_texColor;.v
|
||||
0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // oid main ().{.
|
||||
0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // lowp vec4 tmpvar
|
||||
0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // _1;. tmpvar_1.x
|
||||
0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, // yz = textureCube
|
||||
0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // Lod (s_texCol
|
||||
0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x2c, 0x20, 0x75, 0x5f, // or, v_normal, u_
|
||||
0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, // imageLodEnabled.
|
||||
0x78, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // x).xyz;. tmpvar
|
||||
0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, // _1.w = (0.2 + (0
|
||||
0x2e, 0x38, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, // .8 * u_imageLodE
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // nabled.y));. gl
|
||||
0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp
|
||||
0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_1;.}...
|
||||
};
|
||||
static const uint8_t fs_imgui_cubemap_dx9[373] =
|
||||
{
|
||||
|
@ -1,41 +1,28 @@
|
||||
static const uint8_t fs_imgui_image_glsl[567] =
|
||||
static const uint8_t fs_imgui_image_glsl[360] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x6c, 0x6f, // FSH.o.><..(...lo
|
||||
0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, // wp vec4 impl_low
|
||||
0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, // _texture2DLod
|
||||
0x28, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, // (lowp sampler2D
|
||||
0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, // sampler, highp v
|
||||
0x65, 0x63, 0x32, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, // ec2 coord, mediu
|
||||
0x6d, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x6c, 0x6f, 0x64, 0x29, 0x0a, 0x7b, 0x0a, // mp float lod).{.
|
||||
0x23, 0x69, 0x66, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x28, 0x47, 0x4c, 0x5f, 0x45, // #if defined(GL_E
|
||||
0x58, 0x54, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // XT_shader_textur
|
||||
0x65, 0x5f, 0x6c, 0x6f, 0x64, 0x29, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, // e_lod)..return t
|
||||
0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x28, 0x73, // exture2DLod (s
|
||||
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, // ampler, coord, l
|
||||
0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, // od);.#else..retu
|
||||
0x72, 0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x73, 0x61, 0x6d, // rn texture2D(sam
|
||||
0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, 0x6f, 0x64, // pler, coord, lod
|
||||
0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, 0x69, 0x66, 0x0a, 0x7d, 0x0a, 0x0a, 0x76, 0x61, 0x72, // );.#endif.}..var
|
||||
0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ying highp vec2
|
||||
0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // form highp vec4
|
||||
0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable
|
||||
0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, // d;.uniform sampl
|
||||
0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, // er2D s_texColor;
|
||||
0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{.
|
||||
0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // lowp vec4 tmpv
|
||||
0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1;. tmpvar_1
|
||||
0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, 0x5f, // .xyz = impl_low_
|
||||
0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, // texture2DLod
|
||||
0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, // (s_texColor, v_t
|
||||
0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // excoord0, u_imag
|
||||
0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, // eLodEnabled.x).x
|
||||
0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, // yz;. tmpvar_1.w
|
||||
0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, // = (0.2 + (0.8 *
|
||||
0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, // u_imageLodEnabl
|
||||
0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ed.y));. gl_Fra
|
||||
0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // gColor = tmpvar_
|
||||
0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}...
|
||||
0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
|
||||
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled....
|
||||
0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
|
||||
0x00, 0x01, 0x00, 0x30, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...0...varying h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
|
||||
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag
|
||||
0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // eLodEnabled;.uni
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, // form sampler2D s
|
||||
0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // _texColor;.void
|
||||
0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // main ().{. lowp
|
||||
0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // vec4 tmpvar_1;.
|
||||
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_1.xyz =
|
||||
0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, // texture2DLod
|
||||
0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, // (s_texColor, v_
|
||||
0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, // texcoord0, u_ima
|
||||
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, // geLodEnabled.x).
|
||||
0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // xyz;. tmpvar_1.
|
||||
0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, // w = (0.2 + (0.8
|
||||
0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // * u_imageLodEnab
|
||||
0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // led.y));. gl_Fr
|
||||
0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar
|
||||
0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _1;.}...
|
||||
};
|
||||
static const uint8_t fs_imgui_image_dx9[377] =
|
||||
{
|
||||
|
@ -1,44 +1,32 @@
|
||||
static const uint8_t fs_imgui_image_swizz_glsl[616] =
|
||||
static const uint8_t fs_imgui_image_swizz_glsl[425] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x59, 0x02, 0x00, 0x00, 0x6c, 0x6f, // FSH.o.><..Y...lo
|
||||
0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, // wp vec4 impl_low
|
||||
0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, // _texture2DLod
|
||||
0x28, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, // (lowp sampler2D
|
||||
0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, // sampler, highp v
|
||||
0x65, 0x63, 0x32, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, // ec2 coord, mediu
|
||||
0x6d, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x6c, 0x6f, 0x64, 0x29, 0x0a, 0x7b, 0x0a, // mp float lod).{.
|
||||
0x23, 0x69, 0x66, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x28, 0x47, 0x4c, 0x5f, 0x45, // #if defined(GL_E
|
||||
0x58, 0x54, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // XT_shader_textur
|
||||
0x65, 0x5f, 0x6c, 0x6f, 0x64, 0x29, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, // e_lod)..return t
|
||||
0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x28, 0x73, // exture2DLod (s
|
||||
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, // ampler, coord, l
|
||||
0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6c, 0x73, 0x65, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, // od);.#else..retu
|
||||
0x72, 0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x73, 0x61, 0x6d, // rn texture2D(sam
|
||||
0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, 0x6f, 0x64, // pler, coord, lod
|
||||
0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, 0x69, 0x66, 0x0a, 0x7d, 0x0a, 0x0a, 0x76, 0x61, 0x72, // );.#endif.}..var
|
||||
0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ying highp vec2
|
||||
0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni
|
||||
0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x03, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
|
||||
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled....
|
||||
0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x07, 0x01, 0x00, 0x00, // ...u_swizzle....
|
||||
0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
|
||||
0x00, 0x01, 0x00, 0x61, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...a...varying h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
|
||||
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag
|
||||
0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // eLodEnabled;.uni
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // form highp vec4
|
||||
0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable
|
||||
0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // d;.uniform highp
|
||||
0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x3b, // vec4 u_swizzle;
|
||||
0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // .uniform sampler
|
||||
0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, // 2D s_texColor;.v
|
||||
0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // oid main ().{.
|
||||
0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // lowp vec4 tmpvar
|
||||
0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // _1;. tmpvar_1.x
|
||||
0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x69, // yz = vec3(dot (i
|
||||
0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // mpl_low_texture2
|
||||
0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // DLod (s_texCo
|
||||
0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // lor, v_texcoord0
|
||||
0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // , u_imageLodEnab
|
||||
0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, // led.x), u_swizzl
|
||||
0x65, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // e));. tmpvar_1.
|
||||
0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, // w = (0.2 + (0.8
|
||||
0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // * u_imageLodEnab
|
||||
0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // led.y));. gl_Fr
|
||||
0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar
|
||||
0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _1;.}...
|
||||
0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // u_swizzle;.unifo
|
||||
0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, // rm sampler2D s_t
|
||||
0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // exColor;.void ma
|
||||
0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, // in ().{. lowp v
|
||||
0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // ec4 tmpvar_1;.
|
||||
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, // tmpvar_1.xyz = v
|
||||
0x65, 0x63, 0x33, 0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ec3(dot (texture
|
||||
0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // 2DLod (s_texC
|
||||
0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // olor, v_texcoord
|
||||
0x30, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // 0, u_imageLodEna
|
||||
0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, // bled.x), u_swizz
|
||||
0x6c, 0x65, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // le));. tmpvar_1
|
||||
0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, // .w = (0.2 + (0.8
|
||||
0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // * u_imageLodEna
|
||||
0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // bled.y));. gl_F
|
||||
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva
|
||||
0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_1;.}...
|
||||
};
|
||||
static const uint8_t fs_imgui_image_swizz_dx9[441] =
|
||||
{
|
||||
|
@ -1,60 +1,46 @@
|
||||
static const uint8_t fs_imgui_latlong_glsl[866] =
|
||||
static const uint8_t fs_imgui_latlong_glsl[651] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x53, 0x03, 0x00, 0x00, 0x6c, 0x6f, // FSH.o.><..S...lo
|
||||
0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, // wp vec4 impl_low
|
||||
0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, // _textureCubeLod
|
||||
0x20, 0x20, 0x28, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, // (lowp samplerC
|
||||
0x75, 0x62, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x68, 0x69, 0x67, // ube sampler, hig
|
||||
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6d, // hp vec3 coord, m
|
||||
0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x6c, 0x6f, 0x64, // ediump float lod
|
||||
0x29, 0x0a, 0x7b, 0x0a, 0x23, 0x69, 0x66, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x28, // ).{.#if defined(
|
||||
0x47, 0x4c, 0x5f, 0x45, 0x58, 0x54, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x65, // GL_EXT_shader_te
|
||||
0x78, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6c, 0x6f, 0x64, 0x29, 0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, // xture_lod)..retu
|
||||
0x72, 0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, // rn textureCubeLo
|
||||
0x64, 0x20, 0x20, 0x20, 0x28, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, // d (sampler, co
|
||||
0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, 0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6c, 0x73, 0x65, // ord, lod);.#else
|
||||
0x0a, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ..return texture
|
||||
0x43, 0x75, 0x62, 0x65, 0x28, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x63, 0x6f, // Cube(sampler, co
|
||||
0x6f, 0x72, 0x64, 0x2c, 0x20, 0x6c, 0x6f, 0x64, 0x29, 0x3b, 0x0a, 0x23, 0x65, 0x6e, 0x64, 0x69, // ord, lod);.#endi
|
||||
0x66, 0x0a, 0x7d, 0x0a, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, // f.}..varying hig
|
||||
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // hp vec2 v_texcoo
|
||||
0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, // rd0;.uniform hig
|
||||
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, // hp vec4 u_imageL
|
||||
0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // odEnabled;.unifo
|
||||
0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, // rm lowp samplerC
|
||||
0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // ube s_texColor;.
|
||||
0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // void main ().{.
|
||||
0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x72, 0x65, 0x73, 0x75, // highp vec3 resu
|
||||
0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, // lt_1;. highp fl
|
||||
0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, // oat tmpvar_2;.
|
||||
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, // tmpvar_2 = (v_te
|
||||
0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x36, 0x2e, 0x32, 0x38, // xcoord0.x * 6.28
|
||||
0x33, 0x31, 0x38, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x66, // 3185);. highp f
|
||||
0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, // loat tmpvar_3;.
|
||||
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, 0x74, // tmpvar_3 = (v_t
|
||||
0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x31, // excoord0.y * 3.1
|
||||
0x34, 0x31, 0x35, 0x39, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // 41593);. result
|
||||
0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, // _1.x = (-(sin(tm
|
||||
0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, // pvar_3)) * sin(t
|
||||
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, // mpvar_2));. res
|
||||
0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, // ult_1.y = cos(tm
|
||||
0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // pvar_3);. resul
|
||||
0x74, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, // t_1.z = (-(sin(t
|
||||
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, // mpvar_3)) * cos(
|
||||
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, // tmpvar_2));. lo
|
||||
0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // wp vec4 tmpvar_4
|
||||
0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, // ;. tmpvar_4.xyz
|
||||
0x20, 0x3d, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x5f, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x78, 0x74, // = impl_low_text
|
||||
0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, // ureCubeLod (s
|
||||
0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // _texColor, resul
|
||||
0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, // t_1, u_imageLodE
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, // nabled.x).xyz;.
|
||||
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, // tmpvar_4.w = (0
|
||||
0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, // .2 + (0.8 * u_im
|
||||
0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, // ageLodEnabled.y)
|
||||
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, // );. gl_FragColo
|
||||
0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_4;.}.
|
||||
0x0a, 0x00, // ..
|
||||
0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima
|
||||
0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled....
|
||||
0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor...
|
||||
0x00, 0x01, 0x00, 0x53, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...S...varying h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc
|
||||
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h
|
||||
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag
|
||||
0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // eLodEnabled;.uni
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // form lowp sample
|
||||
0x72, 0x43, 0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // rCube s_texColor
|
||||
0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, // ;.void main ().{
|
||||
0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x72, 0x65, // . highp vec3 re
|
||||
0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // sult_1;. highp
|
||||
0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, // float tmpvar_2;.
|
||||
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, // tmpvar_2 = (v_
|
||||
0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x36, 0x2e, // texcoord0.x * 6.
|
||||
0x32, 0x38, 0x33, 0x31, 0x38, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 283185);. highp
|
||||
0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, // float tmpvar_3;
|
||||
0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, // . tmpvar_3 = (v
|
||||
0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, // _texcoord0.y * 3
|
||||
0x2e, 0x31, 0x34, 0x31, 0x35, 0x39, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, // .141593);. resu
|
||||
0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, // lt_1.x = (-(sin(
|
||||
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, // tmpvar_3)) * sin
|
||||
0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, // (tmpvar_2));. r
|
||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, // esult_1.y = cos(
|
||||
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, // tmpvar_3);. res
|
||||
0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, // ult_1.z = (-(sin
|
||||
0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, // (tmpvar_3)) * co
|
||||
0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // s(tmpvar_2));.
|
||||
0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // lowp vec4 tmpvar
|
||||
0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, // _4;. tmpvar_4.x
|
||||
0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, // yz = textureCube
|
||||
0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // Lod (s_texCol
|
||||
0x6f, 0x72, 0x2c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, // or, result_1, u_
|
||||
0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, // imageLodEnabled.
|
||||
0x78, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // x).xyz;. tmpvar
|
||||
0x5f, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, // _4.w = (0.2 + (0
|
||||
0x2e, 0x38, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, // .8 * u_imageLodE
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // nabled.y));. gl
|
||||
0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp
|
||||
0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_4;.}...
|
||||
};
|
||||
static const uint8_t fs_imgui_latlong_dx9[537] =
|
||||
{
|
||||
|
@ -604,12 +604,11 @@ struct Imgui
|
||||
bgfx::destroyUniform(u_imageSwizzle);
|
||||
bgfx::destroyUniform(s_texColor);
|
||||
#if !USE_NANOVG_FONT
|
||||
for (uint16_t ii = 0; ii < IMGUI_CONFIG_MAX_FONTS; ++ii)
|
||||
for (uint16_t ii = 0, num = m_fontHandle.getNumHandles(); ii < num; ++ii)
|
||||
{
|
||||
if (bgfx::isValid(m_fonts[ii].m_texture) )
|
||||
{
|
||||
bgfx::destroyTexture(m_fonts[ii].m_texture);
|
||||
}
|
||||
uint16_t idx = m_fontHandle.getHandleAt(0);
|
||||
bgfx::destroyTexture(m_fonts[idx].m_texture);
|
||||
m_fontHandle.free(idx);
|
||||
}
|
||||
#endif // !USE_NANOVG_FONT
|
||||
bgfx::destroyTexture(m_missingTexture);
|
||||
|
12
3rdparty/bgfx/examples/common/imgui/imgui.h
vendored
12
3rdparty/bgfx/examples/common/imgui/imgui.h
vendored
@ -204,4 +204,16 @@ bool imguiCube(bgfx::TextureHandle _cubemap, float _lod = 0.0f, ImguiCubemap::En
|
||||
float imguiGetTextLength(const char* _text, ImguiFontHandle _handle);
|
||||
bool imguiMouseOverArea();
|
||||
|
||||
namespace ImGui
|
||||
{
|
||||
// Helper function for passing bgfx::TextureHandle to ImGui::Image.
|
||||
inline void Image(bgfx::TextureHandle _handle, const ImVec2& _size, const ImVec2& _uv0 = ImVec2(0, 0), const ImVec2& _uv1 = ImVec2(1, 1), const ImVec4& _tint_col = ImVec4(1, 1, 1, 1), const ImVec4& _border_col = ImVec4(0, 0, 0, 0))
|
||||
{
|
||||
union { bgfx::TextureHandle handle; ImTextureID ptr; } texture;
|
||||
texture.handle = _handle;
|
||||
Image(texture.ptr, _size, _uv0, _uv1, _tint_col, _border_col);
|
||||
}
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
#endif // IMGUI_H_HEADER_GUARD
|
||||
|
@ -72,7 +72,13 @@ struct OcornutImguiContext
|
||||
, uint16_t(pcmd->clip_rect.z-pcmd->clip_rect.x)
|
||||
, uint16_t(pcmd->clip_rect.w-pcmd->clip_rect.y)
|
||||
);
|
||||
bgfx::setTexture(0, s_tex, m_texture);
|
||||
union { void* ptr; bgfx::TextureHandle handle; } texture = { pcmd->texture_id };
|
||||
|
||||
bgfx::setTexture(0, s_tex, 0 != texture.handle.idx
|
||||
? texture.handle
|
||||
: m_texture
|
||||
);
|
||||
|
||||
bgfx::setVertexBuffer(&tvb, vtx_offset, pcmd->vtx_count);
|
||||
bgfx::setProgram(m_program);
|
||||
bgfx::submit(m_viewId);
|
||||
|
BIN
3rdparty/bgfx/examples/runtime/images/SplashScreen.png
vendored
Normal file
BIN
3rdparty/bgfx/examples/runtime/images/SplashScreen.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
3rdparty/bgfx/examples/runtime/shaders/dx11/cs_indirect.bin
vendored
Normal file
BIN
3rdparty/bgfx/examples/runtime/shaders/dx11/cs_indirect.bin
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin
vendored
Normal file
BIN
3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin
vendored
Normal file
Binary file not shown.
1049
3rdparty/bgfx/include/bgfx.c99.h
vendored
1049
3rdparty/bgfx/include/bgfx.c99.h
vendored
File diff suppressed because it is too large
Load Diff
295
3rdparty/bgfx/include/bgfx.h
vendored
295
3rdparty/bgfx/include/bgfx.h
vendored
@ -193,13 +193,14 @@ namespace bgfx
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
None,
|
||||
Equal,
|
||||
Half,
|
||||
Quarter,
|
||||
Eighth,
|
||||
Sixteenth,
|
||||
Double,
|
||||
|
||||
Count
|
||||
};
|
||||
};
|
||||
|
||||
@ -209,6 +210,7 @@ namespace bgfx
|
||||
BGFX_HANDLE(DynamicVertexBufferHandle);
|
||||
BGFX_HANDLE(FrameBufferHandle);
|
||||
BGFX_HANDLE(IndexBufferHandle);
|
||||
BGFX_HANDLE(IndirectBufferHandle);
|
||||
BGFX_HANDLE(ProgramHandle);
|
||||
BGFX_HANDLE(ShaderHandle);
|
||||
BGFX_HANDLE(TextureHandle);
|
||||
@ -620,12 +622,21 @@ namespace bgfx
|
||||
const Caps* getCaps();
|
||||
|
||||
/// Returns HMD info.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_get_hmd`.
|
||||
///
|
||||
const HMD* getHMD();
|
||||
|
||||
/// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_alloc`.
|
||||
///
|
||||
const Memory* alloc(uint32_t _size);
|
||||
|
||||
/// Allocate buffer and copy data into it. Data will be freed inside bgfx.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_copy`.
|
||||
///
|
||||
const Memory* copy(const void* _data, uint32_t _size);
|
||||
|
||||
/// Make reference to data to pass to bgfx. Unlike `bgfx::alloc` this call
|
||||
@ -634,6 +645,9 @@ namespace bgfx
|
||||
/// consumed, or you must make sure data is available for at least 2
|
||||
/// `bgfx::frame` calls. `ReleaseFn` function must be able to be called
|
||||
/// called from any thread.
|
||||
///
|
||||
/// @attention C99 equivalent are `bgfx_make_ref`, `bgfx_make_ref_release`.
|
||||
///
|
||||
const Memory* makeRef(const void* _data, uint32_t _size, ReleaseFn _releaseFn = NULL, void* _userData = NULL);
|
||||
|
||||
/// Set debug flags.
|
||||
@ -647,12 +661,20 @@ namespace bgfx
|
||||
/// - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering
|
||||
/// primitives will be rendered as lines.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_debug`.
|
||||
///
|
||||
void setDebug(uint32_t _debug);
|
||||
|
||||
/// Clear internal debug text buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_dbg_text_clear`.
|
||||
///
|
||||
void dbgTextClear(uint8_t _attr = 0, bool _small = false);
|
||||
|
||||
/// Print into internal debug text buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_dbg_text_printf`.
|
||||
///
|
||||
void dbgTextPrintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
|
||||
|
||||
/// Draw image into internal debug text buffer.
|
||||
@ -664,6 +686,8 @@ namespace bgfx
|
||||
/// @param _data Raw image data (character/attribute raw encoding).
|
||||
/// @param _pitch Image pitch in bytes.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_dbg_text_image`.
|
||||
///
|
||||
void dbgTextImage(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
|
||||
|
||||
/// Create static index buffer.
|
||||
@ -682,9 +706,14 @@ namespace bgfx
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
///
|
||||
IndexBufferHandle createIndexBuffer(const Memory* _mem, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
/// @attention C99 equivalent is `bgfx_create_index_buffer`.
|
||||
///
|
||||
IndexBufferHandle createIndexBuffer(const Memory* _mem, uint16_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Destroy static index buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_index_buffer`.
|
||||
///
|
||||
void destroyIndexBuffer(IndexBufferHandle _handle);
|
||||
|
||||
/// Create static vertex buffer.
|
||||
@ -693,12 +722,16 @@ namespace bgfx
|
||||
/// @param _decl Vertex declaration.
|
||||
/// @returns Static vertex buffer handle.
|
||||
///
|
||||
VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
/// @attention C99 equivalent is `bgfx_create_vertex_buffer`.
|
||||
///
|
||||
VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Destroy static vertex buffer.
|
||||
///
|
||||
/// @param _handle Static vertex buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_vertex_buffer`.
|
||||
///
|
||||
void destroyVertexBuffer(VertexBufferHandle _handle);
|
||||
|
||||
/// Create empty dynamic index buffer.
|
||||
@ -717,7 +750,9 @@ namespace bgfx
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
///
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_index_buffer`.
|
||||
///
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint16_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Create dynamic index buffer and initialized it.
|
||||
///
|
||||
@ -735,19 +770,25 @@ namespace bgfx
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
///
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_index_buffer_mem`.
|
||||
///
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint16_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Update dynamic index buffer.
|
||||
///
|
||||
/// @param _handle Dynamic index buffer handle.
|
||||
/// @param _mem Index buffer data.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_update_dynamic_index_buffer`.
|
||||
///
|
||||
void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, const Memory* _mem);
|
||||
|
||||
/// Destroy dynamic index buffer.
|
||||
///
|
||||
/// @param _handle Dynamic index buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_dynamic_index_buffer`.
|
||||
///
|
||||
void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle);
|
||||
|
||||
/// Create empty dynamic vertex buffer.
|
||||
@ -767,7 +808,9 @@ namespace bgfx
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
///
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_vertex_buffer`.
|
||||
///
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Create dynamic vertex buffer and initialize it.
|
||||
///
|
||||
@ -786,18 +829,28 @@ namespace bgfx
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
///
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_vertex_buffer_mem`.
|
||||
///
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags = BGFX_BUFFER_NONE);
|
||||
|
||||
/// Update dynamic vertex buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_update_dynamic_vertex_buffer`.
|
||||
///
|
||||
void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem);
|
||||
|
||||
/// Destroy dynamic vertex buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_dynamic_vertex_buffer`.
|
||||
///
|
||||
void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle);
|
||||
|
||||
/// Returns true if internal transient index buffer has enough space.
|
||||
///
|
||||
/// @param _num Number of indices.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_check_avail_transient_index_buffer`.
|
||||
///
|
||||
bool checkAvailTransientIndexBuffer(uint32_t _num);
|
||||
|
||||
/// Returns true if internal transient vertex buffer has enough space.
|
||||
@ -805,6 +858,8 @@ namespace bgfx
|
||||
/// @param _num Number of vertices.
|
||||
/// @param _decl Vertex declaration.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_check_avail_transient_vertex_buffer`.
|
||||
///
|
||||
bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl);
|
||||
|
||||
/// Returns true if internal instance data buffer has enough space.
|
||||
@ -812,6 +867,8 @@ namespace bgfx
|
||||
/// @param _num Number of instances.
|
||||
/// @param _stride Stride per instance.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_check_avail_instance_data_buffer`.
|
||||
///
|
||||
bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride);
|
||||
|
||||
/// Returns true if both internal transient index and vertex buffer have
|
||||
@ -821,6 +878,8 @@ namespace bgfx
|
||||
/// @param _decl Vertex declaration.
|
||||
/// @param _numIndices Number of indices.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_check_avail_transient_buffers`.
|
||||
///
|
||||
bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices);
|
||||
|
||||
/// Allocate transient index buffer.
|
||||
@ -835,6 +894,8 @@ namespace bgfx
|
||||
/// leak.
|
||||
/// 2. Only 16-bit index buffer is supported.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_alloc_transient_index_buffer`.
|
||||
///
|
||||
void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num);
|
||||
|
||||
/// Allocate transient vertex buffer.
|
||||
@ -849,6 +910,8 @@ namespace bgfx
|
||||
/// You must call setVertexBuffer after alloc in order to avoid memory
|
||||
/// leak.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_alloc_transient_vertex_buffer`.
|
||||
///
|
||||
void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl);
|
||||
|
||||
/// Check for required space and allocate transient vertex and index
|
||||
@ -858,6 +921,8 @@ namespace bgfx
|
||||
/// @remarks
|
||||
/// Only 16-bit index buffer is supported.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_alloc_transient_buffers`.
|
||||
///
|
||||
bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint32_t _numVertices, TransientIndexBuffer* _tib, uint32_t _numIndices);
|
||||
|
||||
/// Allocate instance data buffer.
|
||||
@ -866,9 +931,26 @@ namespace bgfx
|
||||
/// You must call setInstanceDataBuffer after alloc in order to avoid
|
||||
/// memory leak.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_alloc_instance_data_buffer`.
|
||||
///
|
||||
const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride);
|
||||
|
||||
/// Create draw indirect buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_indirect_buffer`.
|
||||
///
|
||||
IndirectBufferHandle createIndirectBuffer(uint32_t _num);
|
||||
|
||||
/// Destroy draw indirect buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_indirect_buffer`.
|
||||
///
|
||||
void destroyIndirectBuffer(IndirectBufferHandle _handle);
|
||||
|
||||
/// Create shader from memory buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_shader`.
|
||||
///
|
||||
ShaderHandle createShader(const Memory* _mem);
|
||||
|
||||
/// Returns num of uniforms, and uniform handles used inside shader.
|
||||
@ -881,10 +963,15 @@ namespace bgfx
|
||||
/// @remarks
|
||||
/// Only non-predefined uniforms are returned.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_get_shader_uniforms`.
|
||||
///
|
||||
uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms = NULL, uint16_t _max = 0);
|
||||
|
||||
/// Destroy shader. Once program is created with shader it is safe to
|
||||
/// destroy shader.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_shader`.
|
||||
///
|
||||
void destroyShader(ShaderHandle _handle);
|
||||
|
||||
/// Create program with vertex and fragment shaders.
|
||||
@ -896,6 +983,8 @@ namespace bgfx
|
||||
/// @returns Program handle if vertex shader output and fragment shader
|
||||
/// input are matching, otherwise returns invalid program handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_program`.
|
||||
///
|
||||
ProgramHandle createProgram(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders = false);
|
||||
|
||||
/// Create program with compute shader.
|
||||
@ -905,12 +994,20 @@ namespace bgfx
|
||||
/// program is destroyed.
|
||||
/// @returns Program handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_compute_program`.
|
||||
///
|
||||
ProgramHandle createProgram(ShaderHandle _csh, bool _destroyShader = false);
|
||||
|
||||
/// Destroy program.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_program`.
|
||||
///
|
||||
void destroyProgram(ProgramHandle _handle);
|
||||
|
||||
/// Calculate amount of memory required for texture.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_calc_texture_size`.
|
||||
///
|
||||
void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, TextureFormat::Enum _format);
|
||||
|
||||
/// Create texture from memory buffer.
|
||||
@ -927,6 +1024,8 @@ namespace bgfx
|
||||
/// @param[out] _info When non-`NULL` is specified it returns parsed texture information.
|
||||
/// @returns Texture handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_texture`.
|
||||
///
|
||||
TextureHandle createTexture(const Memory* _mem, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, TextureInfo* _info = NULL);
|
||||
|
||||
/// Create 2D texture.
|
||||
@ -938,8 +1037,12 @@ namespace bgfx
|
||||
/// @param _flags
|
||||
/// @param _mem
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_texture_2d`.
|
||||
///
|
||||
TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE, const Memory* _mem = NULL);
|
||||
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_texture_2d_scaled`.
|
||||
///
|
||||
TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE);
|
||||
|
||||
@ -953,6 +1056,8 @@ namespace bgfx
|
||||
/// @param _flags
|
||||
/// @param _mem
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_texture_3d`.
|
||||
///
|
||||
TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE, const Memory* _mem = NULL);
|
||||
|
||||
/// Create Cube texture.
|
||||
@ -963,6 +1068,8 @@ namespace bgfx
|
||||
/// @param _flags
|
||||
/// @param _mem
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_texture_cube`.
|
||||
///
|
||||
TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE, const Memory* _mem = NULL);
|
||||
|
||||
/// Update 2D texture.
|
||||
@ -977,6 +1084,8 @@ namespace bgfx
|
||||
/// @param _pitch Pitch of input image (bytes). When _pitch is set to
|
||||
/// UINT16_MAX, it will be calculated internally based on _width.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_update_texture_2d`.
|
||||
///
|
||||
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 = UINT16_MAX);
|
||||
|
||||
/// Update 3D texture.
|
||||
@ -991,6 +1100,8 @@ namespace bgfx
|
||||
/// @param _depth
|
||||
/// @param _mem
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_update_texture_3d`.
|
||||
///
|
||||
void updateTexture3D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const Memory* _mem);
|
||||
|
||||
/// Update Cube texture.
|
||||
@ -1025,9 +1136,14 @@ namespace bgfx
|
||||
/// @param _pitch Pitch of input image (bytes). When _pitch is set to
|
||||
/// UINT16_MAX, it will be calculated internally based on _width.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_update_texture_cube`.
|
||||
///
|
||||
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 = UINT16_MAX);
|
||||
|
||||
/// Destroy texture.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_texture`.
|
||||
///
|
||||
void destroyTexture(TextureHandle _handle);
|
||||
|
||||
/// Create frame buffer (simple).
|
||||
@ -1037,8 +1153,12 @@ namespace bgfx
|
||||
/// @param _format Texture format.
|
||||
/// @param _textureFlags Texture flags.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_frame_buffer`.
|
||||
///
|
||||
FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags = BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
|
||||
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_frame_buffer_scaled`.
|
||||
///
|
||||
FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint32_t _textureFlags = BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
|
||||
|
||||
@ -1049,6 +1169,8 @@ namespace bgfx
|
||||
/// @param _destroyTextures If true, textures will be destroyed when
|
||||
/// frame buffer is destroyed.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_frame_buffer_from_handles`.
|
||||
///
|
||||
FrameBufferHandle createFrameBuffer(uint8_t _num, TextureHandle* _handles, bool _destroyTextures = false);
|
||||
|
||||
/// Create frame buffer for multiple window rendering.
|
||||
@ -1063,9 +1185,14 @@ namespace bgfx
|
||||
/// @remarks
|
||||
/// Frame buffer cannnot be used for sampling.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_frame_buffer_from_nwh`.
|
||||
///
|
||||
FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat = TextureFormat::UnknownDepth);
|
||||
|
||||
/// Destroy frame buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_frame_buffer`.
|
||||
///
|
||||
void destroyFrameBuffer(FrameBufferHandle _handle);
|
||||
|
||||
/// Create shader uniform parameter.
|
||||
@ -1094,12 +1221,16 @@ namespace bgfx
|
||||
/// - `u_modelViewProj mat4` - concatenated model view projection matrix.
|
||||
/// - `u_alphaRef float` - alpha reference value for alpha test.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_uniform`.
|
||||
///
|
||||
UniformHandle createUniform(const char* _name, UniformType::Enum _type, uint16_t _num = 1);
|
||||
|
||||
/// Destroy shader uniform parameter.
|
||||
///
|
||||
/// @param _handle Handle to uniform object.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_uniform`.
|
||||
///
|
||||
void destroyUniform(UniformHandle _handle);
|
||||
|
||||
/// Set clear color palette value.
|
||||
@ -1107,6 +1238,8 @@ namespace bgfx
|
||||
/// @param _index Index into palette.
|
||||
/// @param _rgba Packed 32-bit RGBA value.
|
||||
///
|
||||
/// @attention C99 equivalent is ``.
|
||||
///
|
||||
void setClearColor(uint8_t _index, uint32_t _rgba);
|
||||
|
||||
/// Set clear color palette value.
|
||||
@ -1114,6 +1247,8 @@ namespace bgfx
|
||||
/// @param _index Index into palette.
|
||||
/// @param _r, _g, _b, _a RGBA floating point values.
|
||||
///
|
||||
/// @attention C99 equivalent is ``.
|
||||
///
|
||||
void setClearColor(uint8_t _index, float _r, float _g, float _b, float _a);
|
||||
|
||||
/// Set clear color palette value.
|
||||
@ -1121,6 +1256,8 @@ namespace bgfx
|
||||
/// @param _index Index into palette.
|
||||
/// @param _rgba RGBA floating point value.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_clear_color`.
|
||||
///
|
||||
void setClearColor(uint8_t _index, const float _rgba[4]);
|
||||
|
||||
/// Set view name.
|
||||
@ -1139,6 +1276,8 @@ namespace bgfx
|
||||
/// | +-- compute (C)
|
||||
/// +-- view id
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_name`.
|
||||
///
|
||||
void setViewName(uint8_t _id, const char* _name);
|
||||
|
||||
/// Set view rectangle. Draw primitive outside view will be clipped.
|
||||
@ -1149,6 +1288,8 @@ namespace bgfx
|
||||
/// @param _width Width of view port region.
|
||||
/// @param _height Height of view port region.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_rect`.
|
||||
///
|
||||
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
||||
|
||||
/// Set view scissor. Draw primitive outside view will be clipped. When
|
||||
@ -1159,6 +1300,8 @@ namespace bgfx
|
||||
/// @param _width Width of scissor region.
|
||||
/// @param _height Height of scissor region.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_scissor`.
|
||||
///
|
||||
void setViewScissor(uint8_t _id, uint16_t _x = 0, uint16_t _y = 0, uint16_t _width = 0, uint16_t _height = 0);
|
||||
|
||||
/// Set view clear flags.
|
||||
@ -1170,6 +1313,8 @@ namespace bgfx
|
||||
/// @param _depth Depth clear value.
|
||||
/// @param _stencil Stencil clear value.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_clear`.
|
||||
///
|
||||
void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba = 0x000000ff, float _depth = 1.0f, uint8_t _stencil = 0);
|
||||
|
||||
/// Set view clear flags with different clear color for each
|
||||
@ -1182,10 +1327,15 @@ namespace bgfx
|
||||
/// @param _depth Depth clear value.
|
||||
/// @param _stencil Stencil clear value.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_clear_mrt`.
|
||||
///
|
||||
void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0 = UINT8_MAX, uint8_t _1 = UINT8_MAX, uint8_t _2 = UINT8_MAX, uint8_t _3 = UINT8_MAX, uint8_t _4 = UINT8_MAX, uint8_t _5 = UINT8_MAX, uint8_t _6 = UINT8_MAX, uint8_t _7 = UINT8_MAX);
|
||||
|
||||
/// Set view into sequential mode. Draw calls will be sorted in the same
|
||||
/// order in which submit calls were called.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_seq`.
|
||||
///
|
||||
void setViewSeq(uint8_t _id, bool _enabled);
|
||||
|
||||
/// Set view frame buffer.
|
||||
@ -1198,10 +1348,25 @@ namespace bgfx
|
||||
/// @remarks
|
||||
/// Not persistent after `bgfx::reset` call.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_view_frame_buffer`.
|
||||
///
|
||||
void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle);
|
||||
|
||||
/// Set view view and projection matrices, all draw primitives in this
|
||||
/// view will use these matrices.
|
||||
///
|
||||
/// @param _id View id.
|
||||
/// @param _view View matrix.
|
||||
/// @param _projL Projection matrix. When using stereo rendering this projection matrix
|
||||
/// represent projection matrix for left eye.
|
||||
/// @param _flags View flags. Use
|
||||
/// - `BGFX_VIEW_NONE` - View will be rendered only once if stereo mode is enabled.
|
||||
/// - `BGFX_VIEW_STEREO` - View will be rendered for both eyes if stereo mode is enabled. When
|
||||
/// stereo mode is disabled this flag doesn't have effect.
|
||||
/// @param _projR Projection matrix for right eye in stereo mode.
|
||||
///
|
||||
/// @attention C99 equivalent are `bgfx_set_view_transform`, `bgfx_set_view_transform_stereo`.
|
||||
///
|
||||
void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags = BGFX_VIEW_STEREO, const void* _projR = NULL);
|
||||
|
||||
/// Post submit view reordering.
|
||||
@ -1211,9 +1376,14 @@ namespace bgfx
|
||||
/// @param _remap View remap id table. Passing `NULL` will reset view ids
|
||||
/// to default state.
|
||||
///
|
||||
/// @attention C99 equivalent is ``.
|
||||
///
|
||||
void setViewRemap(uint8_t _id = 0, uint8_t _num = UINT8_MAX, const void* _remap = NULL);
|
||||
|
||||
/// Sets debug marker.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_marker`.
|
||||
///
|
||||
void setMarker(const char* _marker);
|
||||
|
||||
/// Set render states for draw primitive.
|
||||
@ -1239,6 +1409,8 @@ namespace bgfx
|
||||
/// 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend
|
||||
/// equation is specified.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_state`.
|
||||
///
|
||||
void setState(uint64_t _state, uint32_t _rgba = 0);
|
||||
|
||||
/// Set stencil test state.
|
||||
@ -1247,6 +1419,8 @@ namespace bgfx
|
||||
/// @param _bstencil Back stencil state. If back is set to `BGFX_STENCIL_NONE`
|
||||
/// _fstencil is applied to both front and back facing primitives.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_stencil`.
|
||||
///
|
||||
void setStencil(uint32_t _fstencil, uint32_t _bstencil = BGFX_STENCIL_NONE);
|
||||
|
||||
/// Set scissor for draw primitive. For scissor for all primitives in
|
||||
@ -1258,6 +1432,8 @@ namespace bgfx
|
||||
/// @param _height Height of scissor region.
|
||||
/// @returns Scissor cache index.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_scissor`.
|
||||
///
|
||||
uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
|
||||
|
||||
/// Set scissor from cache for draw primitive.
|
||||
@ -1265,6 +1441,8 @@ namespace bgfx
|
||||
/// @param _cache Index in scissor cache. Passing UINT16_MAX unset primitive
|
||||
/// scissor and primitive will use view scissor instead.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_scissor_cached`.
|
||||
///
|
||||
void setScissor(uint16_t _cache = UINT16_MAX);
|
||||
|
||||
/// Set model matrix for draw primitive. If it is not called model will
|
||||
@ -1275,6 +1453,8 @@ namespace bgfx
|
||||
/// @returns index into matrix cache in case the same model matrix has
|
||||
/// to be used for other draw primitive call.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_transform`.
|
||||
///
|
||||
uint32_t setTransform(const void* _mtx, uint16_t _num = 1);
|
||||
|
||||
/// Reserve `_num` matrices in internal matrix cache. Pointer returned
|
||||
@ -1284,6 +1464,8 @@ namespace bgfx
|
||||
/// @param _num Number of matrices.
|
||||
/// @returns index into matrix cache.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_alloc_transform`.
|
||||
///
|
||||
uint32_t allocTransform(Transform* _transform, uint16_t _num);
|
||||
|
||||
/// Set model matrix from matrix cache for draw primitive.
|
||||
@ -1291,48 +1473,92 @@ namespace bgfx
|
||||
/// @param _cache Index in matrix cache.
|
||||
/// @param _num Number of matrices from cache.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_transform_cached`.
|
||||
///
|
||||
void setTransform(uint32_t _cache, uint16_t _num = 1);
|
||||
|
||||
/// Set shader uniform parameter for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_uniform`.
|
||||
///
|
||||
void setUniform(UniformHandle _handle, const void* _value, uint16_t _num = 1);
|
||||
|
||||
/// Set index buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_index_buffer`.
|
||||
///
|
||||
void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex = 0, uint32_t _numIndices = UINT32_MAX);
|
||||
|
||||
/// Set index buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_dynamic_index_buffer`.
|
||||
///
|
||||
void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex = 0, uint32_t _numIndices = UINT32_MAX);
|
||||
|
||||
/// Set index buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is ``.
|
||||
///
|
||||
void setIndexBuffer(const TransientIndexBuffer* _tib);
|
||||
|
||||
/// Set index buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_transient_index_buffer`.
|
||||
///
|
||||
void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is ``.
|
||||
///
|
||||
void setVertexBuffer(VertexBufferHandle _handle);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_vertex_buffer`.
|
||||
///
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_dynamic_vertex_buffer`.
|
||||
///
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is ``.
|
||||
///
|
||||
void setVertexBuffer(const TransientVertexBuffer* _tvb);
|
||||
|
||||
/// Set vertex buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_transient_vertex_buffer`.
|
||||
///
|
||||
void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices);
|
||||
|
||||
/// Set instance data buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_instance_data_buffer`.
|
||||
///
|
||||
void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num = UINT32_MAX);
|
||||
|
||||
/// Set instance data buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_instance_data_from_vertex_buffer`.
|
||||
///
|
||||
void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num);
|
||||
|
||||
/// Set instance data buffer for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_instance_data_from_dynamic_vertex_buffer`.
|
||||
///
|
||||
void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num);
|
||||
|
||||
/// Set program for draw primitive.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_program`.
|
||||
///
|
||||
void setProgram(ProgramHandle _handle);
|
||||
|
||||
/// Set texture stage for draw primitive.
|
||||
@ -1350,6 +1576,8 @@ namespace bgfx
|
||||
/// @param _flags Texture sampler filtering flags. UINT32_MAX use the
|
||||
/// sampler filtering mode set by texture.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_texture`.
|
||||
///
|
||||
void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags = UINT32_MAX);
|
||||
|
||||
/// Set texture stage for draw primitive.
|
||||
@ -1365,38 +1593,85 @@ namespace bgfx
|
||||
/// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
|
||||
/// sampling.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_texture_from_frame_buffer`.
|
||||
///
|
||||
void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment = 0, uint32_t _flags = UINT32_MAX);
|
||||
|
||||
/// Submit primitive for rendering into single view.
|
||||
/// Submit primitive for rendering.
|
||||
///
|
||||
/// @param _id View id.
|
||||
/// @param _depth Depth for sorting.
|
||||
/// @returns Number of draw calls.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_submit`.
|
||||
///
|
||||
uint32_t submit(uint8_t _id, int32_t _depth = 0);
|
||||
|
||||
/// Submit primitive for rendering with index and instance data info from
|
||||
/// indirect buffer.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_submit_indirect`.
|
||||
///
|
||||
uint32_t submit(uint8_t _id, IndirectBufferHandle _indirectHandle, uint16_t _start = 0, uint16_t _num = 1, int32_t _depth = 0);
|
||||
|
||||
///
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_compute_index_buffer`.
|
||||
///
|
||||
void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access);
|
||||
|
||||
///
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_compute_vertex_buffer`.
|
||||
///
|
||||
void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access);
|
||||
|
||||
///
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_compute_dynamic_index_buffer`.
|
||||
///
|
||||
void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access);
|
||||
|
||||
///
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_compute_dynamic_vertex_buffer`.
|
||||
///
|
||||
void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access);
|
||||
|
||||
///
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_compute_indirect_buffer`.
|
||||
///
|
||||
void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access);
|
||||
|
||||
/// Set compute image from texture.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_image`.
|
||||
///
|
||||
void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format = TextureFormat::Count);
|
||||
|
||||
/// Set compute image from frame buffer texture.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_image_from_frame_buffer`.
|
||||
///
|
||||
void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format = TextureFormat::Count);
|
||||
|
||||
/// Dispatch compute.
|
||||
void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX = 1, uint16_t _numY = 1, uint16_t _numZ = 1, uint8_t _flags = BGFX_SUBMIT_EYE_FIRST);
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_dispatch`.
|
||||
///
|
||||
uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX = 1, uint16_t _numY = 1, uint16_t _numZ = 1, uint8_t _flags = BGFX_SUBMIT_EYE_FIRST);
|
||||
|
||||
/// Dispatch compute indirect.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_dispatch_indirect`.
|
||||
///
|
||||
uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start = 0, uint16_t _num = 1, uint8_t _flags = BGFX_SUBMIT_EYE_FIRST);
|
||||
|
||||
/// Discard all previously set state for draw or compute call.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_discard`.
|
||||
///
|
||||
void discard();
|
||||
|
||||
/// Request screen shot.
|
||||
@ -1406,6 +1681,8 @@ namespace bgfx
|
||||
/// @remarks
|
||||
/// `bgfx::CallbackI::screenShot` must be implemented.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_save_screen_shot`.
|
||||
///
|
||||
void saveScreenShot(const char* _filePath);
|
||||
|
||||
} // namespace bgfx
|
||||
|
56
3rdparty/bgfx/include/bgfxdefines.h
vendored
56
3rdparty/bgfx/include/bgfxdefines.h
vendored
@ -221,11 +221,31 @@
|
||||
#define BGFX_DEBUG_TEXT UINT32_C(0x00000008)
|
||||
|
||||
///
|
||||
#define BGFX_BUFFER_NONE UINT8_C(0x00)
|
||||
#define BGFX_BUFFER_COMPUTE_READ UINT8_C(0x01)
|
||||
#define BGFX_BUFFER_COMPUTE_WRITE UINT8_C(0x02)
|
||||
#define BGFX_BUFFER_ALLOW_RESIZE UINT8_C(0x04)
|
||||
#define BGFX_BUFFER_INDEX32 UINT8_C(0x08)
|
||||
#define BGFX_BUFFER_NONE UINT16_C(0x0000)
|
||||
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_8x1 UINT16_C(0x0001)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_8x2 UINT16_C(0x0002)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_8x4 UINT16_C(0x0003)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_16x1 UINT16_C(0x0004)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_16x2 UINT16_C(0x0005)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_16x4 UINT16_C(0x0006)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_32x1 UINT16_C(0x0007)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_32x2 UINT16_C(0x0008)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_32x4 UINT16_C(0x0009)
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_SHIFT 0
|
||||
#define BGFX_BUFFER_COMPUTE_FORMAT_MASK UINT16_C(0x000f)
|
||||
|
||||
#define BGFX_BUFFER_COMPUTE_TYPE_UINT UINT16_C(0x0010)
|
||||
#define BGFX_BUFFER_COMPUTE_TYPE_INT UINT16_C(0x0020)
|
||||
#define BGFX_BUFFER_COMPUTE_TYPE_FLOAT UINT16_C(0x0030)
|
||||
#define BGFX_BUFFER_COMPUTE_TYPE_SHIFT 4
|
||||
#define BGFX_BUFFER_COMPUTE_TYPE_MASK UINT16_C(0x0030)
|
||||
|
||||
#define BGFX_BUFFER_COMPUTE_READ UINT16_C(0x0100)
|
||||
#define BGFX_BUFFER_COMPUTE_WRITE UINT16_C(0x0200)
|
||||
#define BGFX_BUFFER_DRAW_INDIRECT UINT16_C(0x0400)
|
||||
#define BGFX_BUFFER_ALLOW_RESIZE UINT16_C(0x0800)
|
||||
#define BGFX_BUFFER_INDEX32 UINT16_C(0x1000)
|
||||
#define BGFX_BUFFER_COMPUTE_READ_WRITE (BGFX_BUFFER_COMPUTE_READ | BGFX_BUFFER_COMPUTE_WRITE)
|
||||
|
||||
///
|
||||
@ -273,6 +293,7 @@
|
||||
#define BGFX_TEXTURE_COMPARE_SHIFT 16
|
||||
#define BGFX_TEXTURE_COMPARE_MASK UINT32_C(0x000f0000)
|
||||
#define BGFX_TEXTURE_COMPUTE_WRITE UINT32_C(0x00100000)
|
||||
#define BGFX_TEXTURE_SRGB UINT32_C(0x00200000)
|
||||
#define BGFX_TEXTURE_RESERVED_SHIFT 24
|
||||
#define BGFX_TEXTURE_RESERVED_MASK UINT32_C(0xff000000)
|
||||
|
||||
@ -303,7 +324,9 @@
|
||||
#define BGFX_RESET_HMD UINT32_C(0x00000400)
|
||||
#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800)
|
||||
#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000)
|
||||
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00002000)
|
||||
#define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000)
|
||||
#define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000)
|
||||
#define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000)
|
||||
|
||||
///
|
||||
#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001)
|
||||
@ -319,12 +342,16 @@
|
||||
#define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000000400)
|
||||
#define BGFX_CAPS_HMD UINT64_C(0x0000000000000800)
|
||||
#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000001000)
|
||||
#define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000002000)
|
||||
|
||||
///
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT8_C(0x00)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR UINT8_C(0x01)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_EMULATED UINT8_C(0x02)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT8_C(0x04)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT8_C(0x00)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR UINT8_C(0x01)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB UINT8_C(0x02)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_EMULATED UINT8_C(0x04)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_VERTEX UINT8_C(0x08)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_IMAGE UINT8_C(0x10)
|
||||
#define BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER UINT8_C(0x20)
|
||||
|
||||
///
|
||||
#define BGFX_VIEW_NONE UINT8_C(0x00)
|
||||
@ -337,9 +364,10 @@
|
||||
#define BGFX_SUBMIT_EYE_FIRST BGFX_SUBMIT_EYE_LEFT
|
||||
|
||||
///
|
||||
#define BGFX_PCI_ID_NONE UINT16_C(0x0000)
|
||||
#define BGFX_PCI_ID_AMD UINT16_C(0x1002)
|
||||
#define BGFX_PCI_ID_INTEL UINT16_C(0x8086)
|
||||
#define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de)
|
||||
#define BGFX_PCI_ID_NONE UINT16_C(0x0000)
|
||||
#define BGFX_PCI_ID_SOFTWARE_RASTERIZER UINT16_C(0x0001)
|
||||
#define BGFX_PCI_ID_AMD UINT16_C(0x1002)
|
||||
#define BGFX_PCI_ID_INTEL UINT16_C(0x8086)
|
||||
#define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de)
|
||||
|
||||
#endif // BGFX_DEFINES_H_HEADER_GUARD
|
||||
|
57
3rdparty/bgfx/include/bgfxplatform.c99.h
vendored
57
3rdparty/bgfx/include/bgfxplatform.c99.h
vendored
@ -31,55 +31,16 @@ typedef enum bgfx_render_frame
|
||||
*/
|
||||
BGFX_C_API bgfx_render_frame_t bgfx_render_frame();
|
||||
|
||||
#if BX_PLATFORM_ANDROID
|
||||
# include <android/native_window.h>
|
||||
typedef struct bgfx_platform_data
|
||||
{
|
||||
void* ndt;
|
||||
void* nwh;
|
||||
void* context;
|
||||
void* backBuffer;
|
||||
void* backBufferDS;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
BGFX_C_API void bgfx_android_set_window(ANativeWindow* _window);
|
||||
} bgfx_platform_data_t;
|
||||
|
||||
#elif BX_PLATFORM_IOS
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
BGFX_C_API void bgfx_ios_set_eagl_layer(void* _layer);
|
||||
|
||||
#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX || BX_PLATFORM_RPI
|
||||
# include <X11/Xlib.h>
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
BGFX_C_API void bgfx_x11_set_display_window(Display* _display, Window _window);
|
||||
|
||||
#elif BX_PLATFORM_NACL
|
||||
# include <ppapi/c/ppb_graphics_3d.h>
|
||||
# include <ppapi/c/ppb_instance.h>
|
||||
|
||||
typedef void (*bgfx_post_swap_buffers_fn)(uint32_t _width, uint32_t _height);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
BGFX_C_API bool bgfx_nacl_set_interfaces(PP_Instance, const PPB_Instance*, const PPB_Graphics3D*, bgfx_post_swap_buffers_fn);
|
||||
|
||||
#elif BX_PLATFORM_OSX
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
BGFX_C_API void bgfx_osx_set_ns_window(void* _window);
|
||||
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
# include <windows.h>
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
BGFX_C_API void bgfx_win_set_hwnd(HWND _window);
|
||||
|
||||
#endif // BX_PLATFORM_
|
||||
BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd);
|
||||
|
||||
#endif // BGFX_PLATFORM_C99_H_HEADER_GUARD
|
||||
|
122
3rdparty/bgfx/include/bgfxplatform.h
vendored
122
3rdparty/bgfx/include/bgfxplatform.h
vendored
@ -30,7 +30,19 @@ namespace bgfx
|
||||
/// allow creating separate rendering thread. If it is called before
|
||||
/// to bgfx::init, render thread won't be created by bgfx::init call.
|
||||
RenderFrame::Enum renderFrame();
|
||||
}
|
||||
|
||||
struct PlatformData
|
||||
{
|
||||
void* ndt; //< Native display type
|
||||
void* nwh; //< Native window handle
|
||||
void* context; //< GL context, or D3D device
|
||||
void* backBuffer; //< GL backbuffer, or D3D render target view
|
||||
void* backBufferDS; //< Backbuffer depth/stencil.
|
||||
};
|
||||
|
||||
void setPlatformData(const PlatformData& _hooks);
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
#if BX_PLATFORM_ANDROID
|
||||
# include <android/native_window.h>
|
||||
@ -38,7 +50,16 @@ namespace bgfx
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void androidSetWindow(::ANativeWindow* _window);
|
||||
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
|
||||
|
||||
@ -46,7 +67,16 @@ namespace bgfx
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void iosSetEaglLayer(void* _layer);
|
||||
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
|
||||
|
||||
@ -55,7 +85,16 @@ namespace bgfx
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL);
|
||||
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
|
||||
|
||||
@ -76,7 +115,16 @@ namespace bgfx
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void osxSetNSWindow(void* _window, void* _nsgl = NULL);
|
||||
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
|
||||
|
||||
@ -86,7 +134,16 @@ namespace bgfx
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void winSetHwnd(::HWND _window);
|
||||
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
|
||||
|
||||
@ -96,18 +153,25 @@ namespace bgfx
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void winrtSetWindow(IUnknown* _window);
|
||||
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_H)
|
||||
// If SDL.h is included before bgfxplatform.h we can enable SDL window
|
||||
#if defined(_SDL_syswm_h)
|
||||
// If SDL_syswm.h is included before bgfxplatform.h we can enable SDL window
|
||||
// interop convenience code.
|
||||
|
||||
# include <SDL2/SDL_syswm.h>
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
///
|
||||
@ -120,13 +184,21 @@ namespace bgfx
|
||||
return false;
|
||||
}
|
||||
|
||||
PlatformData pd;
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||
x11SetDisplayWindow(wmi.info.x11.display, wmi.info.x11.window);
|
||||
pd.ndt = wmi.info.x11.display;
|
||||
pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
|
||||
# elif BX_PLATFORM_OSX
|
||||
osxSetNSWindow(wmi.info.cocoa.window);
|
||||
pd.ndt = NULL;
|
||||
pd.nwh = wmi.info.cocoa.window;
|
||||
# elif BX_PLATFORM_WINDOWS
|
||||
winSetHwnd(wmi.info.win.window);
|
||||
pd.ndt = NULL;
|
||||
pd.nwh = wmi.info.win.window;
|
||||
# endif // BX_PLATFORM_
|
||||
pd.context = NULL;
|
||||
pd.backBuffer = NULL;
|
||||
pd.backBufferDS = NULL;
|
||||
setPlatformData(pd);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -153,19 +225,23 @@ namespace bgfx
|
||||
{
|
||||
inline void glfwSetWindow(GLFWwindow* _window)
|
||||
{
|
||||
PlatformData pd;
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||
::Display* display = glfwGetX11Display();
|
||||
::Window window = glfwGetX11Window(_window);
|
||||
void* glx = glfwGetGLXContext(_window);
|
||||
x11SetDisplayWindow(display, window, glx);
|
||||
pd.ndt = glfwGetX11Display();
|
||||
pd.nwh = (void*)(uintptr_t)glfwGetX11Window(_window);
|
||||
pd.context = glfwGetGLXContext(_window);
|
||||
# elif BX_PLATFORM_OSX
|
||||
void* window = glfwGetCocoaWindow(_window);
|
||||
void* nsgl = glfwGetNSGLContext(_window);
|
||||
osxSetNSWindow(window, nsgl);
|
||||
pd.ndt = NULL;
|
||||
pd.nwh = glfwGetCocoaWindow(_window);
|
||||
pd.context = glfwGetNSGLContext(_window);
|
||||
# elif BX_PLATFORM_WINDOWS
|
||||
HWND hwnd = glfwGetWin32Window(_window);
|
||||
winSetHwnd(hwnd);
|
||||
pd.ndt = NULL;
|
||||
pd.nwh = glfwGetWin32Window(_window);
|
||||
pd.context = NULL;
|
||||
# endif // BX_PLATFORM_WINDOWS
|
||||
pd.backBuffer = NULL;
|
||||
pd.backBufferDS = NULL;
|
||||
setPlatformData(pd);
|
||||
}
|
||||
|
||||
} // namespace bgfx
|
||||
|
2
3rdparty/bgfx/scripts/bgfx.lua
vendored
2
3rdparty/bgfx/scripts/bgfx.lua
vendored
@ -81,7 +81,7 @@ function bgfxProject(_name, _kind, _defines)
|
||||
"$(DXSDK_DIR)/include",
|
||||
}
|
||||
|
||||
configuration { "winphone8*"}
|
||||
configuration { "winphone8* or winstore8*"}
|
||||
linkoptions {
|
||||
"/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
|
||||
}
|
||||
|
3
3rdparty/bgfx/scripts/example-common.lua
vendored
3
3rdparty/bgfx/scripts/example-common.lua
vendored
@ -48,7 +48,8 @@ project ("example-common")
|
||||
}
|
||||
end
|
||||
|
||||
configuration { "winphone8*"}
|
||||
configuration { "winphone8* or winstore8*"}
|
||||
linkoptions {
|
||||
"/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
|
||||
}
|
||||
premake.vstudio.splashpath = "../../../examples/runtime/images/SplashScreen.png"
|
||||
|
25
3rdparty/bgfx/scripts/genie.lua
vendored
25
3rdparty/bgfx/scripts/genie.lua
vendored
@ -88,10 +88,7 @@ function exampleProject(_name)
|
||||
|
||||
configuration {}
|
||||
|
||||
-- don't output debugdir for winphone builds
|
||||
if "winphone81" ~= _OPTIONS["vs"] then
|
||||
debugdir (path.join(BGFX_DIR, "examples/runtime"))
|
||||
end
|
||||
debugdir (path.join(BGFX_DIR, "examples/runtime"))
|
||||
|
||||
includedirs {
|
||||
path.join(BX_DIR, "include"),
|
||||
@ -221,7 +218,7 @@ function exampleProject(_name)
|
||||
"psapi",
|
||||
}
|
||||
|
||||
configuration { "winphone8*"}
|
||||
configuration { "winphone8* or winstore8*" }
|
||||
removelinks {
|
||||
"DelayImp",
|
||||
"gdi32",
|
||||
@ -234,7 +231,17 @@ function exampleProject(_name)
|
||||
linkoptions {
|
||||
"/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
|
||||
}
|
||||
-- WinRT targets need their own output directories are build files stomp over each other
|
||||
|
||||
-- WinRT targets need their own output directories or build files stomp over each other
|
||||
configuration { "x32", "winphone8* or winstore8*" }
|
||||
targetdir (path.join(BGFX_BUILD_DIR, "win32_" .. _ACTION, "bin", _name))
|
||||
objdir (path.join(BGFX_BUILD_DIR, "win32_" .. _ACTION, "obj", _name))
|
||||
|
||||
configuration { "x64", "winphone8* or winstore8*" }
|
||||
targetdir (path.join(BGFX_BUILD_DIR, "win64_" .. _ACTION, "bin", _name))
|
||||
objdir (path.join(BGFX_BUILD_DIR, "win64_" .. _ACTION, "obj", _name))
|
||||
|
||||
configuration { "ARM", "winphone8* or winstore8*" }
|
||||
targetdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "bin", _name))
|
||||
objdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "obj", _name))
|
||||
|
||||
@ -366,7 +373,11 @@ exampleProject("21-deferred")
|
||||
exampleProject("22-windows")
|
||||
exampleProject("23-vectordisplay")
|
||||
exampleProject("24-nbody")
|
||||
exampleProject("25-c99")
|
||||
|
||||
-- C99 source doesn't compile under WinRT settings
|
||||
if not premake.vstudio.iswinrt() then
|
||||
exampleProject("25-c99")
|
||||
end
|
||||
|
||||
if _OPTIONS["with-shared-lib"] then
|
||||
group "libs"
|
||||
|
5
3rdparty/bgfx/scripts/shaderc.lua
vendored
5
3rdparty/bgfx/scripts/shaderc.lua
vendored
@ -50,7 +50,7 @@ project "shaderc"
|
||||
"Cocoa.framework",
|
||||
}
|
||||
|
||||
configuration { "windows", "vs*" }
|
||||
configuration { "vs*" }
|
||||
includedirs {
|
||||
path.join(GLSL_OPTIMIZER, "include/c99"),
|
||||
}
|
||||
@ -61,10 +61,9 @@ project "shaderc"
|
||||
}
|
||||
|
||||
|
||||
configuration { "windows" }
|
||||
configuration { "vs* or mingw*" }
|
||||
links {
|
||||
"d3dcompiler",
|
||||
"dxguid",
|
||||
}
|
||||
|
||||
configuration {}
|
||||
|
343
3rdparty/bgfx/src/bgfx.cpp
vendored
343
3rdparty/bgfx/src/bgfx.cpp
vendored
@ -7,7 +7,7 @@
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
#define BGFX_MAIN_THREAD_MAGIC 0x78666762
|
||||
#define BGFX_MAIN_THREAD_MAGIC UINT32_C(0x78666762)
|
||||
|
||||
#if BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
|
||||
# define BGFX_CHECK_MAIN_THREAD() \
|
||||
@ -19,56 +19,6 @@ namespace bgfx
|
||||
# define BGFX_CHECK_RENDER_THREAD()
|
||||
#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
|
||||
|
||||
#if BX_PLATFORM_ANDROID
|
||||
::ANativeWindow* g_bgfxAndroidWindow = NULL;
|
||||
|
||||
void androidSetWindow(::ANativeWindow* _window)
|
||||
{
|
||||
g_bgfxAndroidWindow = _window;
|
||||
}
|
||||
#elif BX_PLATFORM_IOS
|
||||
void* g_bgfxEaglLayer = NULL;
|
||||
|
||||
void iosSetEaglLayer(void* _layer)
|
||||
{
|
||||
g_bgfxEaglLayer = _layer;
|
||||
}
|
||||
#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||
void* g_bgfxX11Display;
|
||||
uint32_t g_bgfxX11Window;
|
||||
void* g_bgfxGLX;
|
||||
|
||||
void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx)
|
||||
{
|
||||
g_bgfxX11Display = _display;
|
||||
g_bgfxX11Window = _window;
|
||||
g_bgfxGLX = _glx;
|
||||
}
|
||||
#elif BX_PLATFORM_OSX
|
||||
void* g_bgfxNSWindow = NULL;
|
||||
void* g_bgfxNSGL = NULL;
|
||||
|
||||
void osxSetNSWindow(void* _window, void* _nsgl)
|
||||
{
|
||||
g_bgfxNSWindow = _window;
|
||||
g_bgfxNSGL = _nsgl;
|
||||
}
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
::HWND g_bgfxHwnd = NULL;
|
||||
|
||||
void winSetHwnd(::HWND _window)
|
||||
{
|
||||
g_bgfxHwnd = _window;
|
||||
}
|
||||
#elif BX_PLATFORM_WINRT
|
||||
::IUnknown* g_bgfxCoreWindow = NULL;
|
||||
|
||||
void winrtSetWindow(::IUnknown* _window)
|
||||
{
|
||||
g_bgfxCoreWindow = _window;
|
||||
}
|
||||
#endif // BX_PLATFORM_*
|
||||
|
||||
#if BGFX_CONFIG_USE_TINYSTL
|
||||
void* TinyStlAllocator::static_allocate(size_t _bytes)
|
||||
{
|
||||
@ -252,6 +202,22 @@ namespace bgfx
|
||||
static BX_THREAD uint32_t s_threadIndex = 0;
|
||||
static Context* s_ctx = NULL;
|
||||
static bool s_renderFrameCalled = false;
|
||||
PlatformData g_platformData;
|
||||
|
||||
void setPlatformData(const PlatformData& _pd)
|
||||
{
|
||||
if (NULL != s_ctx)
|
||||
{
|
||||
BGFX_FATAL(true
|
||||
&& g_platformData.ndt == _pd.ndt
|
||||
&& g_platformData.nwh == _pd.nwh
|
||||
&& g_platformData.context == _pd.context
|
||||
, Fatal::UnableToInitialize
|
||||
, "Only backbuffer pointer can be changed after initialization!"
|
||||
);
|
||||
}
|
||||
memcpy(&g_platformData, &_pd, sizeof(PlatformData) );
|
||||
}
|
||||
|
||||
void setGraphicsDebuggerPresent(bool _present)
|
||||
{
|
||||
@ -387,7 +353,6 @@ namespace bgfx
|
||||
|
||||
void blit(RendererContextI* _renderCtx, TextVideoMemBlitter& _blitter, const TextVideoMem& _mem)
|
||||
{
|
||||
BGFX_CHECK_RENDER_THREAD();
|
||||
struct Vertex
|
||||
{
|
||||
float m_x;
|
||||
@ -796,6 +761,7 @@ namespace bgfx
|
||||
if (NULL == s_ctx)
|
||||
{
|
||||
s_renderFrameCalled = true;
|
||||
s_threadIndex = ~BGFX_MAIN_THREAD_MAGIC;
|
||||
return RenderFrame::NoContext;
|
||||
}
|
||||
|
||||
@ -871,6 +837,7 @@ namespace bgfx
|
||||
CAPS_FLAGS(BGFX_CAPS_SWAP_CHAIN),
|
||||
CAPS_FLAGS(BGFX_CAPS_HMD),
|
||||
CAPS_FLAGS(BGFX_CAPS_INDEX32),
|
||||
CAPS_FLAGS(BGFX_CAPS_DRAW_INDIRECT),
|
||||
#undef CAPS_FLAGS
|
||||
};
|
||||
|
||||
@ -890,18 +857,24 @@ namespace bgfx
|
||||
}
|
||||
|
||||
BX_TRACE("Supported texture formats:");
|
||||
BX_TRACE("\t +------ x = supported / * = emulated");
|
||||
BX_TRACE("\t |+----- vertex format");
|
||||
BX_TRACE("\t || +-- name");
|
||||
BX_TRACE("\t +--------- x = supported / * = emulated");
|
||||
BX_TRACE("\t |+-------- sRGB format");
|
||||
BX_TRACE("\t ||+------- vertex format");
|
||||
BX_TRACE("\t |||+------ image");
|
||||
BX_TRACE("\t ||||+----- framebuffer");
|
||||
BX_TRACE("\t ||||| +-- name");
|
||||
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
|
||||
{
|
||||
if (TextureFormat::Unknown != ii
|
||||
&& TextureFormat::UnknownDepth != ii)
|
||||
{
|
||||
uint8_t flags = g_caps.formats[ii];
|
||||
BX_TRACE("\t[%c%c] %s"
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_COLOR ? 'x' : flags&BGFX_CAPS_FORMAT_TEXTURE_EMULATED ? '*' : ' '
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_VERTEX ? 'v' : ' '
|
||||
BX_TRACE("\t[%c%c%c%c%c] %s"
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_COLOR ? 'x' : flags&BGFX_CAPS_FORMAT_TEXTURE_EMULATED ? '*' : ' '
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB ? 'l' : ' '
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_VERTEX ? 'v' : ' '
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_IMAGE ? 'i' : ' '
|
||||
, flags&BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER ? 'f' : ' '
|
||||
, getName(TextureFormat::Enum(ii) )
|
||||
);
|
||||
BX_UNUSED(flags);
|
||||
@ -946,16 +919,26 @@ namespace bgfx
|
||||
// When bgfx::renderFrame is called before init render thread
|
||||
// should not be created.
|
||||
BX_TRACE("Application called bgfx::renderFrame directly, not creating render thread.");
|
||||
m_singleThreaded = true
|
||||
&& !BX_ENABLED(BX_PLATFORM_OSX || BX_PLATFORM_IOS)
|
||||
&& ~BGFX_MAIN_THREAD_MAGIC == s_threadIndex
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
BX_TRACE("Creating rendering thread.");
|
||||
m_thread.init(renderThread, this);
|
||||
m_singleThreaded = false;
|
||||
}
|
||||
#else
|
||||
BX_TRACE("Multithreaded renderer is disabled.");
|
||||
m_singleThreaded = true;
|
||||
#endif // BGFX_CONFIG_MULTITHREADED
|
||||
|
||||
BX_TRACE("Running in %s-threaded mode", m_singleThreaded ? "single" : "multi");
|
||||
|
||||
s_threadIndex = BGFX_MAIN_THREAD_MAGIC;
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii)
|
||||
{
|
||||
m_viewRemap[ii] = uint8_t(ii);
|
||||
@ -1004,6 +987,10 @@ namespace bgfx
|
||||
g_caps.rendererType = m_renderCtx->getRendererType();
|
||||
initAttribTypeSizeTable(g_caps.rendererType);
|
||||
|
||||
g_caps.supported |= 0
|
||||
| (BX_ENABLED(BGFX_CONFIG_MULTITHREADED) && !m_singleThreaded ? BGFX_CAPS_RENDERER_MULTITHREADED : 0)
|
||||
;
|
||||
|
||||
dumpCaps();
|
||||
|
||||
m_textVideoMemBlitter.init();
|
||||
@ -1012,9 +999,13 @@ namespace bgfx
|
||||
m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
|
||||
m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
|
||||
frame();
|
||||
m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
|
||||
m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
|
||||
frame();
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_MULTITHREADED) )
|
||||
{
|
||||
m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
|
||||
m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
|
||||
frame();
|
||||
}
|
||||
}
|
||||
|
||||
void Context::shutdown()
|
||||
@ -1060,6 +1051,8 @@ namespace bgfx
|
||||
m_render->destroy();
|
||||
#endif // BGFX_CONFIG_MULTITHREADED
|
||||
|
||||
s_ctx = NULL;
|
||||
|
||||
m_submit->destroy();
|
||||
|
||||
if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
|
||||
@ -1187,7 +1180,8 @@ namespace bgfx
|
||||
|
||||
bx::xchg(m_render, m_submit);
|
||||
|
||||
if (!BX_ENABLED(BGFX_CONFIG_MULTITHREADED) )
|
||||
if (!BX_ENABLED(BGFX_CONFIG_MULTITHREADED)
|
||||
|| m_singleThreaded)
|
||||
{
|
||||
renderFrame();
|
||||
}
|
||||
@ -1567,7 +1561,7 @@ again:
|
||||
Memory* mem;
|
||||
_cmdbuf.read(mem);
|
||||
|
||||
uint8_t flags;
|
||||
uint16_t flags;
|
||||
_cmdbuf.read(flags);
|
||||
|
||||
m_renderCtx->createIndexBuffer(handle, mem, flags);
|
||||
@ -1617,7 +1611,7 @@ again:
|
||||
VertexDeclHandle declHandle;
|
||||
_cmdbuf.read(declHandle);
|
||||
|
||||
uint8_t flags;
|
||||
uint16_t flags;
|
||||
_cmdbuf.read(flags);
|
||||
|
||||
m_renderCtx->createVertexBuffer(handle, mem, declHandle, flags);
|
||||
@ -1643,7 +1637,7 @@ again:
|
||||
uint32_t size;
|
||||
_cmdbuf.read(size);
|
||||
|
||||
uint8_t flags;
|
||||
uint16_t flags;
|
||||
_cmdbuf.read(flags);
|
||||
|
||||
m_renderCtx->createDynamicIndexBuffer(handle, size, flags);
|
||||
@ -1687,7 +1681,7 @@ again:
|
||||
uint32_t size;
|
||||
_cmdbuf.read(size);
|
||||
|
||||
uint8_t flags;
|
||||
uint16_t flags;
|
||||
_cmdbuf.read(flags);
|
||||
|
||||
m_renderCtx->createDynamicVertexBuffer(handle, size, flags);
|
||||
@ -2007,9 +2001,6 @@ again:
|
||||
BX_TRACE("Init...");
|
||||
|
||||
memset(&g_caps, 0, sizeof(g_caps) );
|
||||
g_caps.supported = 0
|
||||
| (BGFX_CONFIG_MULTITHREADED ? BGFX_CAPS_RENDERER_MULTITHREADED : 0)
|
||||
;
|
||||
g_caps.maxViews = BGFX_CONFIG_MAX_VIEWS;
|
||||
g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
|
||||
g_caps.maxFBAttachments = 1;
|
||||
@ -2037,8 +2028,6 @@ again:
|
||||
s_callbackStub = BX_NEW(g_allocator, CallbackStub);
|
||||
}
|
||||
|
||||
s_threadIndex = BGFX_MAIN_THREAD_MAGIC;
|
||||
|
||||
s_ctx = BX_ALIGNED_NEW(g_allocator, Context, 16);
|
||||
s_ctx->init(_type);
|
||||
|
||||
@ -2052,6 +2041,7 @@ again:
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
Context* ctx = s_ctx; // it's going to be NULLd inside shutdown.
|
||||
ctx->shutdown();
|
||||
BX_CHECK(NULL == s_ctx, "bgfx is should be uninitialized here.");
|
||||
|
||||
BX_ALIGNED_DELETE(g_allocator, ctx, 16);
|
||||
|
||||
@ -2188,7 +2178,7 @@ again:
|
||||
s_ctx->dbgTextImage(_x, _y, _width, _height, _data, _pitch);
|
||||
}
|
||||
|
||||
IndexBufferHandle createIndexBuffer(const Memory* _mem, uint8_t _flags)
|
||||
IndexBufferHandle createIndexBuffer(const Memory* _mem, uint16_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
@ -2201,7 +2191,7 @@ again:
|
||||
s_ctx->destroyIndexBuffer(_handle);
|
||||
}
|
||||
|
||||
VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags)
|
||||
VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
@ -2215,13 +2205,13 @@ again:
|
||||
s_ctx->destroyVertexBuffer(_handle);
|
||||
}
|
||||
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint8_t _flags)
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint16_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
return s_ctx->createDynamicIndexBuffer(_num, _flags);
|
||||
}
|
||||
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint8_t _flags)
|
||||
DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint16_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
@ -2241,14 +2231,14 @@ again:
|
||||
s_ctx->destroyDynamicIndexBuffer(_handle);
|
||||
}
|
||||
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags)
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
|
||||
return s_ctx->createDynamicVertexBuffer(_num, _decl, _flags);
|
||||
}
|
||||
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags)
|
||||
DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
@ -2337,6 +2327,18 @@ again:
|
||||
return s_ctx->allocInstanceDataBuffer(_num, _stride);
|
||||
}
|
||||
|
||||
IndirectBufferHandle createIndirectBuffer(uint32_t _num)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
return s_ctx->createIndirectBuffer(_num);
|
||||
}
|
||||
|
||||
void destroyIndirectBuffer(IndirectBufferHandle _handle)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
s_ctx->destroyIndirectBuffer(_handle);
|
||||
}
|
||||
|
||||
ShaderHandle createShader(const Memory* _mem)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
@ -2436,7 +2438,7 @@ again:
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::None);
|
||||
return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::Count);
|
||||
}
|
||||
|
||||
void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height)
|
||||
@ -2482,7 +2484,7 @@ again:
|
||||
uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
|
||||
bx::write(&writer, magic);
|
||||
|
||||
if (BackbufferRatio::None != _ratio)
|
||||
if (BackbufferRatio::Count != _ratio)
|
||||
{
|
||||
_width = uint16_t(s_ctx->m_frame->m_resolution.m_width);
|
||||
_height = uint16_t(s_ctx->m_frame->m_resolution.m_height);
|
||||
@ -2506,11 +2508,13 @@ again:
|
||||
|
||||
TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
|
||||
{
|
||||
return createTexture2D(BackbufferRatio::None, _width, _height, _numMips, _format, _flags, _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);
|
||||
}
|
||||
|
||||
TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags)
|
||||
{
|
||||
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
|
||||
return createTexture2D(_ratio, 0, 0, _numMips, _format, _flags, NULL);
|
||||
}
|
||||
|
||||
@ -2552,7 +2556,7 @@ again:
|
||||
tc.m_mem = _mem;
|
||||
bx::write(&writer, tc);
|
||||
|
||||
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::None);
|
||||
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)
|
||||
@ -2592,7 +2596,7 @@ again:
|
||||
tc.m_mem = _mem;
|
||||
bx::write(&writer, tc);
|
||||
|
||||
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::None);
|
||||
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
|
||||
}
|
||||
|
||||
void destroyTexture(TextureHandle _handle)
|
||||
@ -2657,6 +2661,7 @@ again:
|
||||
|
||||
FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint32_t _textureFlags)
|
||||
{
|
||||
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);
|
||||
return createFrameBuffer(1, &th, true);
|
||||
@ -2960,6 +2965,12 @@ again:
|
||||
return s_ctx->submit(_id, _depth);
|
||||
}
|
||||
|
||||
uint32_t submit(uint8_t _id, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
return s_ctx->submit(_id, _indirectHandle, _start, _num, _depth);
|
||||
}
|
||||
|
||||
void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
@ -2984,6 +2995,12 @@ again:
|
||||
s_ctx->setBuffer(_stage, _handle, _access);
|
||||
}
|
||||
|
||||
void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
s_ctx->setBuffer(_stage, _handle, _access);
|
||||
}
|
||||
|
||||
void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
@ -2996,10 +3013,16 @@ again:
|
||||
s_ctx->setImage(_stage, _sampler, _handle, _attachment, _access, _format);
|
||||
}
|
||||
|
||||
void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
|
||||
uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
s_ctx->dispatch(_id, _handle, _numX, _numY, _numZ, _flags);
|
||||
return s_ctx->dispatch(_id, _handle, _numX, _numY, _numZ, _flags);
|
||||
}
|
||||
|
||||
uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
return s_ctx->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags);
|
||||
}
|
||||
|
||||
void discard()
|
||||
@ -3033,6 +3056,7 @@ BX_STATIC_ASSERT(sizeof(bgfx::TransientVertexBuffer) == sizeof(bgfx_transient_ve
|
||||
BX_STATIC_ASSERT(sizeof(bgfx::InstanceDataBuffer) == sizeof(bgfx_instance_data_buffer_t) );
|
||||
BX_STATIC_ASSERT(sizeof(bgfx::TextureInfo) == sizeof(bgfx_texture_info_t) );
|
||||
BX_STATIC_ASSERT(sizeof(bgfx::Caps) == sizeof(bgfx_caps_t) );
|
||||
BX_STATIC_ASSERT(sizeof(bgfx::PlatformData) == sizeof(bgfx_platform_data_t) );
|
||||
|
||||
BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer)
|
||||
{
|
||||
@ -3191,10 +3215,10 @@ BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, u
|
||||
bgfx::dbgTextImage(_x, _y, _width, _height, _data, _pitch);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem)
|
||||
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem, uint16_t _flags)
|
||||
{
|
||||
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createIndexBuffer( (const bgfx::Memory*)_mem);
|
||||
handle.cpp = bgfx::createIndexBuffer( (const bgfx::Memory*)_mem, _flags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
@ -3204,7 +3228,7 @@ BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle)
|
||||
bgfx::destroyIndexBuffer(handle.cpp);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint8_t _flags)
|
||||
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags)
|
||||
{
|
||||
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
|
||||
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle;
|
||||
@ -3218,17 +3242,17 @@ BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle)
|
||||
bgfx::destroyVertexBuffer(handle.cpp);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num)
|
||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num, uint16_t _flags)
|
||||
{
|
||||
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createDynamicIndexBuffer(_num);
|
||||
handle.cpp = bgfx::createDynamicIndexBuffer(_num, _flags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem)
|
||||
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem, uint16_t _flags)
|
||||
{
|
||||
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createDynamicIndexBuffer( (const bgfx::Memory*)_mem);
|
||||
handle.cpp = bgfx::createDynamicIndexBuffer( (const bgfx::Memory*)_mem, _flags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
@ -3244,7 +3268,7 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand
|
||||
bgfx::destroyDynamicIndexBuffer(handle.cpp);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags)
|
||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags)
|
||||
{
|
||||
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
|
||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle;
|
||||
@ -3252,11 +3276,11 @@ BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl)
|
||||
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags)
|
||||
{
|
||||
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
|
||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createDynamicVertexBuffer( (const bgfx::Memory*)_mem, decl);
|
||||
handle.cpp = bgfx::createDynamicVertexBuffer( (const bgfx::Memory*)_mem, decl, _flags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
@ -3316,6 +3340,19 @@ BGFX_C_API const bgfx_instance_data_buffer_t* bgfx_alloc_instance_data_buffer(ui
|
||||
return (bgfx_instance_data_buffer_t*)bgfx::allocInstanceDataBuffer(_num, _stride);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num)
|
||||
{
|
||||
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createIndirectBuffer(_num);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle)
|
||||
{
|
||||
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::destroyIndirectBuffer(handle.cpp);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem)
|
||||
{
|
||||
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle;
|
||||
@ -3344,6 +3381,14 @@ BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh,
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders)
|
||||
{
|
||||
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } csh = { _csh };
|
||||
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createProgram(csh.cpp, _destroyShaders);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
|
||||
{
|
||||
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
|
||||
@ -3371,6 +3416,13 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_
|
||||
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)
|
||||
{
|
||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _numMips, 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)
|
||||
{
|
||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
|
||||
@ -3416,6 +3468,13 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width,
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
||||
handle.cpp = bgfx::createFrameBuffer(bgfx::BackbufferRatio::Enum(_ratio), bgfx::TextureFormat::Enum(_format), _textureFlags);
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, bgfx_texture_handle_t* _handles, bool _destroyTextures)
|
||||
{
|
||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
|
||||
@ -3585,6 +3644,18 @@ BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t*
|
||||
bgfx::setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _num);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
|
||||
{
|
||||
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
|
||||
{
|
||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_program(bgfx_program_handle_t _handle)
|
||||
{
|
||||
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
|
||||
@ -3610,6 +3681,12 @@ BGFX_C_API uint32_t bgfx_submit(uint8_t _id, int32_t _depth)
|
||||
return bgfx::submit(_id, _depth);
|
||||
}
|
||||
|
||||
BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth)
|
||||
{
|
||||
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
|
||||
return bgfx::submit(_id, indirectHandle.cpp, _start, _num, _depth);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format)
|
||||
{
|
||||
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler };
|
||||
@ -3624,10 +3701,47 @@ BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_ha
|
||||
bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) );
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
|
||||
BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access)
|
||||
{
|
||||
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_compute_vertex_buffer(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access)
|
||||
{
|
||||
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_compute_dynamic_index_buffer(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access)
|
||||
{
|
||||
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_compute_dynamic_vertex_buffer(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access)
|
||||
{
|
||||
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access)
|
||||
{
|
||||
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) );
|
||||
}
|
||||
|
||||
BGFX_C_API uint32_t bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags)
|
||||
{
|
||||
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
|
||||
bgfx::dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags);
|
||||
return bgfx::dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags);
|
||||
}
|
||||
|
||||
BGFX_C_API uint32_t bgfx_dispatch_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
|
||||
{
|
||||
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
|
||||
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
|
||||
return bgfx::dispatch(_id, handle.cpp, indirectHandle.cpp, _start, _num, _flags);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_discard()
|
||||
@ -3645,40 +3759,7 @@ BGFX_C_API bgfx_render_frame_t bgfx_render_frame()
|
||||
return bgfx_render_frame_t(bgfx::renderFrame() );
|
||||
}
|
||||
|
||||
#if BX_PLATFORM_ANDROID
|
||||
BGFX_C_API void bgfx_android_set_window(ANativeWindow* _window)
|
||||
BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd)
|
||||
{
|
||||
bgfx::androidSetWindow(_window);
|
||||
bgfx::setPlatformData(*(bgfx::PlatformData*)_pd);
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_IOS
|
||||
BGFX_C_API void bgfx_ios_set_eagl_layer(void* _layer)
|
||||
{
|
||||
bgfx::iosSetEaglLayer(_layer);
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX || BX_PLATFORM_RPI
|
||||
BGFX_C_API void bgfx_x11_set_display_window(::Display* _display, ::Window _window)
|
||||
{
|
||||
bgfx::x11SetDisplayWindow(_display, _window);
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_NACL
|
||||
BGFX_C_API bool bgfx_nacl_set_interfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, bgfx_post_swap_buffers_fn _postSwapBuffers)
|
||||
{
|
||||
return bgfx::naclSetInterfaces(_instance, _instInterface, _graphicsInterface, _postSwapBuffers);
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_OSX
|
||||
BGFX_C_API void bgfx_osx_set_ns_window(void* _window)
|
||||
{
|
||||
bgfx::osxSetNSWindow(_window);
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
BGFX_C_API void bgfx_win_set_hwnd(HWND _window)
|
||||
{
|
||||
bgfx::winSetHwnd(_window);
|
||||
}
|
||||
|
||||
#endif // BX_PLATFORM_*
|
||||
|
44
3rdparty/bgfx/src/bgfx_compute.sh
vendored
44
3rdparty/bgfx/src/bgfx_compute.sh
vendored
@ -44,10 +44,11 @@ vec2 unpackHalf2x16(uint _x)
|
||||
|
||||
#define SHARED groupshared
|
||||
|
||||
#define r32ui uint
|
||||
#define r32f float
|
||||
#define rg16f float2
|
||||
#define rgba8 float4
|
||||
#define r32ui uint
|
||||
#define r32f float
|
||||
#define rg16f float2
|
||||
#define rgba16f float4
|
||||
#define rgba8 float4
|
||||
|
||||
#define IMAGE2D_RO( _name, _format, _reg) Texture2D<_format> _name : register(t[_reg])
|
||||
#define UIMAGE2D_RO(_name, _format, _reg) Texture2D<_format> _name : register(t[_reg])
|
||||
@ -99,6 +100,13 @@ ivec2 imageSize(Texture2D _image)
|
||||
return result;
|
||||
}
|
||||
|
||||
ivec2 imageSize(Texture2D<uint> _image)
|
||||
{
|
||||
ivec2 result;
|
||||
_image.GetDimensions(result.x, result.y);
|
||||
return result;
|
||||
}
|
||||
|
||||
ivec2 imageSize(RWTexture2D<float4> _image)
|
||||
{
|
||||
ivec2 result;
|
||||
@ -186,6 +194,34 @@ uint atomicCompSwap(uint _mem, uint _compare, uint _data)
|
||||
|
||||
#endif // BGFX_SHADER_LANGUAGE_HLSL
|
||||
|
||||
#define dispatchIndirect(_buffer \
|
||||
, _offset \
|
||||
, _numX \
|
||||
, _numY \
|
||||
, _numZ \
|
||||
) \
|
||||
_buffer[_offset*2+0] = uvec4(_numX, _numY, _numZ, 0u)
|
||||
|
||||
#define drawIndirect(_buffer \
|
||||
, _offset \
|
||||
, _numVertices \
|
||||
, _numInstances \
|
||||
, _startVertex \
|
||||
, _startInstance \
|
||||
) \
|
||||
_buffer[_offset*2+0] = uvec4(_numVertices, _numInstances, _startVertex, _startInstance)
|
||||
|
||||
#define drawIndexedIndirect(_buffer \
|
||||
, _offset \
|
||||
, _numIndices \
|
||||
, _numInstances \
|
||||
, _startIndex \
|
||||
, _startVertex \
|
||||
, _startInstance \
|
||||
) \
|
||||
_buffer[_offset*2+0] = uvec4(_numIndices, _numInstances, _startIndex, _startInstance); \
|
||||
_buffer[_offset*2+1] = uvec4(_startInstance, 0u, 0u, 0u)
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // BGFX_COMPUTE_H_HEADER_GUARD
|
||||
|
170
3rdparty/bgfx/src/bgfx_p.h
vendored
170
3rdparty/bgfx/src/bgfx_p.h
vendored
@ -217,22 +217,7 @@ namespace stl
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
#if BX_PLATFORM_ANDROID
|
||||
extern ::ANativeWindow* g_bgfxAndroidWindow;
|
||||
#elif BX_PLATFORM_IOS
|
||||
extern void* g_bgfxEaglLayer;
|
||||
#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||
extern void* g_bgfxX11Display;
|
||||
extern uint32_t g_bgfxX11Window;
|
||||
extern void* g_bgfxGLX;
|
||||
#elif BX_PLATFORM_OSX
|
||||
extern void* g_bgfxNSWindow;
|
||||
extern void* g_bgfxNSGL;
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
extern ::HWND g_bgfxHwnd;
|
||||
#elif BX_PLATFORM_WINRT
|
||||
extern ::IUnknown* g_bgfxCoreWindow;
|
||||
#endif // BX_PLATFORM_*
|
||||
extern PlatformData g_platformData;
|
||||
|
||||
#if BGFX_CONFIG_MAX_DRAW_CALLS < (64<<10)
|
||||
typedef uint16_t RenderItemCount;
|
||||
@ -1087,6 +1072,8 @@ namespace bgfx
|
||||
m_instanceDataOffset = 0;
|
||||
m_instanceDataStride = 0;
|
||||
m_numInstances = 1;
|
||||
m_startIndirect = 0;
|
||||
m_numIndirect = UINT16_MAX;
|
||||
m_num = 1;
|
||||
m_flags = BGFX_SUBMIT_EYE_FIRST;
|
||||
m_scissor = UINT16_MAX;
|
||||
@ -1094,6 +1081,7 @@ namespace bgfx
|
||||
m_vertexDecl.idx = invalidHandle;
|
||||
m_indexBuffer.idx = invalidHandle;
|
||||
m_instanceDataBuffer.idx = invalidHandle;
|
||||
m_indirectBuffer.idx = invalidHandle;
|
||||
|
||||
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
|
||||
{
|
||||
@ -1115,6 +1103,8 @@ namespace bgfx
|
||||
uint32_t m_instanceDataOffset;
|
||||
uint16_t m_instanceDataStride;
|
||||
uint16_t m_numInstances;
|
||||
uint16_t m_startIndirect;
|
||||
uint16_t m_numIndirect;
|
||||
uint16_t m_num;
|
||||
uint16_t m_scissor;
|
||||
uint8_t m_submitFlags;
|
||||
@ -1123,6 +1113,7 @@ namespace bgfx
|
||||
VertexDeclHandle m_vertexDecl;
|
||||
IndexBufferHandle m_indexBuffer;
|
||||
VertexBufferHandle m_instanceDataBuffer;
|
||||
IndirectBufferHandle m_indirectBuffer;
|
||||
};
|
||||
|
||||
struct RenderCompute
|
||||
@ -1138,6 +1129,10 @@ namespace bgfx
|
||||
m_num = 0;
|
||||
m_submitFlags = BGFX_SUBMIT_EYE_FIRST;
|
||||
|
||||
m_indirectBuffer.idx = invalidHandle;
|
||||
m_startIndirect = 0;
|
||||
m_numIndirect = UINT16_MAX;
|
||||
|
||||
for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
|
||||
{
|
||||
m_bind[ii].m_idx = invalidHandle;
|
||||
@ -1148,10 +1143,13 @@ namespace bgfx
|
||||
uint32_t m_constBegin;
|
||||
uint32_t m_constEnd;
|
||||
uint32_t m_matrix;
|
||||
IndirectBufferHandle m_indirectBuffer;
|
||||
|
||||
uint16_t m_numX;
|
||||
uint16_t m_numY;
|
||||
uint16_t m_numZ;
|
||||
uint16_t m_startIndirect;
|
||||
uint16_t m_numIndirect;
|
||||
uint16_t m_num;
|
||||
uint8_t m_submitFlags;
|
||||
};
|
||||
@ -1187,7 +1185,7 @@ namespace bgfx
|
||||
uint32_t m_offset;
|
||||
uint32_t m_size;
|
||||
uint32_t m_startIndex;
|
||||
uint8_t m_flags;
|
||||
uint16_t m_flags;
|
||||
};
|
||||
|
||||
struct DynamicVertexBuffer
|
||||
@ -1199,7 +1197,7 @@ namespace bgfx
|
||||
uint32_t m_numVertices;
|
||||
uint16_t m_stride;
|
||||
VertexDeclHandle m_decl;
|
||||
uint8_t m_flags;
|
||||
uint16_t m_flags;
|
||||
};
|
||||
|
||||
BX_ALIGN_DECL_CACHE_LINE(struct) Frame
|
||||
@ -1464,7 +1462,25 @@ namespace bgfx
|
||||
}
|
||||
|
||||
uint32_t submit(uint8_t _id, int32_t _depth);
|
||||
|
||||
uint32_t submit(uint8_t _id, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth)
|
||||
{
|
||||
m_draw.m_startIndirect = _start;
|
||||
m_draw.m_numIndirect = _num;
|
||||
m_draw.m_indirectBuffer = _indirectHandle;
|
||||
return submit(_id, _depth);
|
||||
}
|
||||
|
||||
uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _ngx, uint16_t _ngy, uint16_t _ngz, uint8_t _flags);
|
||||
|
||||
uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
|
||||
{
|
||||
m_compute.m_indirectBuffer = _indirectHandle;
|
||||
m_compute.m_startIndirect = _start;
|
||||
m_compute.m_numIndirect = _num;
|
||||
return dispatch(_id, _handle, 0, 0, 0, _flags);
|
||||
}
|
||||
|
||||
void sort();
|
||||
|
||||
bool checkAvailTransientIndexBuffer(uint32_t _num)
|
||||
@ -1831,16 +1847,16 @@ namespace bgfx
|
||||
virtual RendererType::Enum getRendererType() const = 0;
|
||||
virtual const char* getRendererName() const = 0;
|
||||
virtual void flip(HMD& _hmd) = 0;
|
||||
virtual void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint8_t _flags) = 0;
|
||||
virtual void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) = 0;
|
||||
virtual void destroyIndexBuffer(IndexBufferHandle _handle) = 0;
|
||||
virtual void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) = 0;
|
||||
virtual void destroyVertexDecl(VertexDeclHandle _handle) = 0;
|
||||
virtual void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint8_t _flags) = 0;
|
||||
virtual void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) = 0;
|
||||
virtual void destroyVertexBuffer(VertexBufferHandle _handle) = 0;
|
||||
virtual void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint8_t _flags) = 0;
|
||||
virtual void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) = 0;
|
||||
virtual void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) = 0;
|
||||
virtual void destroyDynamicIndexBuffer(IndexBufferHandle _handle) = 0;
|
||||
virtual void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint8_t _flags) = 0;
|
||||
virtual void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) = 0;
|
||||
virtual void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) = 0;
|
||||
virtual void destroyDynamicVertexBuffer(VertexBufferHandle _handle) = 0;
|
||||
virtual void createShader(ShaderHandle _handle, Memory* _mem) = 0;
|
||||
@ -1894,6 +1910,7 @@ namespace bgfx
|
||||
, m_rendererInitialized(false)
|
||||
, m_exit(false)
|
||||
, m_flipAfterRender(false)
|
||||
, m_singleThreaded(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1936,7 +1953,7 @@ namespace bgfx
|
||||
{
|
||||
uint16_t textureIdx = m_textureHandle.getHandleAt(ii);
|
||||
const TextureRef& textureRef = m_textureRef[textureIdx];
|
||||
if (BackbufferRatio::None != textureRef.m_bbRatio)
|
||||
if (BackbufferRatio::Count != textureRef.m_bbRatio)
|
||||
{
|
||||
TextureHandle handle = { textureIdx };
|
||||
resizeTexture(handle
|
||||
@ -1978,7 +1995,7 @@ namespace bgfx
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(IndexBufferHandle createIndexBuffer(const Memory* _mem, uint8_t _flags) )
|
||||
BGFX_API_FUNC(IndexBufferHandle createIndexBuffer(const Memory* _mem, uint16_t _flags) )
|
||||
{
|
||||
IndexBufferHandle handle = { m_indexBufferHandle.alloc() };
|
||||
|
||||
@ -2019,7 +2036,7 @@ namespace bgfx
|
||||
return declHandle;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t flags) )
|
||||
BGFX_API_FUNC(VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) )
|
||||
{
|
||||
VertexBufferHandle handle = { m_vertexBufferHandle.alloc() };
|
||||
|
||||
@ -2035,7 +2052,7 @@ namespace bgfx
|
||||
cmdbuf.write(handle);
|
||||
cmdbuf.write(_mem);
|
||||
cmdbuf.write(declHandle);
|
||||
cmdbuf.write(flags);
|
||||
cmdbuf.write(_flags);
|
||||
}
|
||||
|
||||
return handle;
|
||||
@ -2062,7 +2079,7 @@ namespace bgfx
|
||||
m_vertexBufferHandle.free(_handle.idx);
|
||||
}
|
||||
|
||||
uint64_t allocDynamicIndexBuffer(uint32_t _size, uint8_t _flags)
|
||||
uint64_t allocDynamicIndexBuffer(uint32_t _size, uint16_t _flags)
|
||||
{
|
||||
uint64_t ptr = m_dynIndexBufferAllocator.alloc(_size);
|
||||
if (ptr == NonLocalAllocator::invalidBlock)
|
||||
@ -2086,7 +2103,7 @@ namespace bgfx
|
||||
return ptr;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint8_t _flags) )
|
||||
BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint16_t _flags) )
|
||||
{
|
||||
DynamicIndexBufferHandle handle = BGFX_INVALID_HANDLE;
|
||||
const uint32_t indexSize = 0 == (_flags & BGFX_BUFFER_INDEX32) ? 2 : 4;
|
||||
@ -2134,7 +2151,7 @@ namespace bgfx
|
||||
return handle;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint8_t _flags) )
|
||||
BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint16_t _flags) )
|
||||
{
|
||||
BX_CHECK(0 == (_flags & BGFX_BUFFER_COMPUTE_READ_WRITE), "Cannot initialize compute buffer from CPU.");
|
||||
const uint32_t indexSize = 0 == (_flags & BGFX_BUFFER_INDEX32) ? 2 : 4;
|
||||
@ -2211,7 +2228,7 @@ namespace bgfx
|
||||
m_dynamicIndexBufferHandle.free(_handle.idx);
|
||||
}
|
||||
|
||||
uint64_t allocDynamicVertexBuffer(uint32_t _size, uint8_t _flags)
|
||||
uint64_t allocDynamicVertexBuffer(uint32_t _size, uint16_t _flags)
|
||||
{
|
||||
uint64_t ptr = m_dynVertexBufferAllocator.alloc(_size);
|
||||
if (ptr == NonLocalAllocator::invalidBlock)
|
||||
@ -2236,7 +2253,7 @@ namespace bgfx
|
||||
return ptr;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags) )
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags) )
|
||||
{
|
||||
DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE;
|
||||
uint32_t size = bx::strideAlign16(_num*_decl.m_stride, _decl.m_stride);
|
||||
@ -2283,7 +2300,7 @@ namespace bgfx
|
||||
return handle;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint8_t _flags) )
|
||||
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) )
|
||||
{
|
||||
uint32_t numVertices = _mem->size/_decl.m_stride;
|
||||
BX_CHECK(numVertices <= UINT16_MAX, "Num vertices exceeds maximum (num %d, max %d).", numVertices, UINT16_MAX);
|
||||
@ -2388,7 +2405,8 @@ namespace bgfx
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer);
|
||||
cmdbuf.write(handle);
|
||||
cmdbuf.write(_size);
|
||||
cmdbuf.write(uint8_t(BGFX_BUFFER_NONE) );
|
||||
uint16_t flags = BGFX_BUFFER_NONE;
|
||||
cmdbuf.write(flags);
|
||||
|
||||
tib = (TransientIndexBuffer*)BX_ALLOC(g_allocator, sizeof(TransientIndexBuffer)+_size);
|
||||
tib->data = (uint8_t*)&tib[1];
|
||||
@ -2443,7 +2461,8 @@ namespace bgfx
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer);
|
||||
cmdbuf.write(handle);
|
||||
cmdbuf.write(_size);
|
||||
cmdbuf.write(false);
|
||||
uint16_t flags = BGFX_BUFFER_NONE;
|
||||
cmdbuf.write(flags);
|
||||
|
||||
tvb = (TransientVertexBuffer*)BX_ALLOC(g_allocator, sizeof(TransientVertexBuffer)+_size);
|
||||
tvb->data = (uint8_t*)&tvb[1];
|
||||
@ -2511,6 +2530,36 @@ namespace bgfx
|
||||
return idb;
|
||||
}
|
||||
|
||||
IndirectBufferHandle createIndirectBuffer(uint32_t _num)
|
||||
{
|
||||
BX_UNUSED(_num);
|
||||
IndirectBufferHandle handle = { m_vertexBufferHandle.alloc() };
|
||||
|
||||
BX_WARN(isValid(handle), "Failed to allocate draw indirect buffer handle.");
|
||||
if (isValid(handle) )
|
||||
{
|
||||
uint32_t size = _num * BGFX_CONFIG_DRAW_INDIRECT_STRIDE;
|
||||
uint16_t flags = BGFX_BUFFER_DRAW_INDIRECT;
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer);
|
||||
cmdbuf.write(handle);
|
||||
cmdbuf.write(size);
|
||||
cmdbuf.write(flags);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void destroyIndirectBuffer(IndirectBufferHandle _handle)
|
||||
{
|
||||
VertexBufferHandle handle = { _handle.idx };
|
||||
BGFX_CHECK_HANDLE("destroyDrawIndirectBuffer", m_vertexBufferHandle, handle);
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyDynamicVertexBuffer);
|
||||
cmdbuf.write(handle);
|
||||
m_submit->free(handle);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(ShaderHandle createShader(const Memory* _mem) )
|
||||
{
|
||||
bx::MemoryReader reader(_mem->data, _mem->size);
|
||||
@ -2810,7 +2859,7 @@ namespace bgfx
|
||||
void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height)
|
||||
{
|
||||
const TextureRef& textureRef = m_textureRef[_handle.idx];
|
||||
BX_CHECK(BackbufferRatio::None != textureRef.m_bbRatio, "");
|
||||
BX_CHECK(BackbufferRatio::Count != textureRef.m_bbRatio, "");
|
||||
|
||||
getTextureSizeFromRatio(BackbufferRatio::Enum(textureRef.m_bbRatio), _width, _height);
|
||||
|
||||
@ -3304,6 +3353,12 @@ namespace bgfx
|
||||
return m_submit->submit(_id, _depth);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(uint32_t submit(uint8_t _id, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth) )
|
||||
{
|
||||
BGFX_CHECK_HANDLE("submit", m_vertexBufferHandle, _indirectHandle);
|
||||
return m_submit->submit(_id, _indirectHandle, _start, _num, _depth);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) )
|
||||
{
|
||||
BGFX_CHECK_HANDLE("setBuffer", m_indexBufferHandle, _handle);
|
||||
@ -3330,6 +3385,13 @@ namespace bgfx
|
||||
m_submit->setBuffer(_stage, dvb.m_handle, _access);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access) )
|
||||
{
|
||||
BGFX_CHECK_HANDLE("setBuffer", m_vertexBufferHandle, _handle);
|
||||
VertexBufferHandle handle = { _handle.idx };
|
||||
m_submit->setBuffer(_stage, handle, _access);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) )
|
||||
{
|
||||
_format = TextureFormat::Count == _format ? TextureFormat::Enum(m_textureRef[_handle.idx].m_format) : _format;
|
||||
@ -3359,6 +3421,11 @@ namespace bgfx
|
||||
return m_submit->dispatch(_id, _handle, _numX, _numY, _numZ, _flags);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) )
|
||||
{
|
||||
return m_submit->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags);
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void discard() )
|
||||
{
|
||||
m_submit->discard();
|
||||
@ -3380,28 +3447,40 @@ namespace bgfx
|
||||
#if BGFX_CONFIG_MULTITHREADED
|
||||
void gameSemPost()
|
||||
{
|
||||
m_gameSem.post();
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
m_gameSem.post();
|
||||
}
|
||||
}
|
||||
|
||||
void gameSemWait()
|
||||
{
|
||||
int64_t start = bx::getHPCounter();
|
||||
bool ok = m_gameSem.wait();
|
||||
BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
|
||||
m_render->m_waitSubmit = bx::getHPCounter()-start;
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
int64_t start = bx::getHPCounter();
|
||||
bool ok = m_gameSem.wait();
|
||||
BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
|
||||
m_render->m_waitSubmit = bx::getHPCounter()-start;
|
||||
}
|
||||
}
|
||||
|
||||
void renderSemPost()
|
||||
{
|
||||
m_renderSem.post();
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
m_renderSem.post();
|
||||
}
|
||||
}
|
||||
|
||||
void renderSemWait()
|
||||
{
|
||||
int64_t start = bx::getHPCounter();
|
||||
bool ok = m_renderSem.wait();
|
||||
BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
|
||||
m_submit->m_waitRender = bx::getHPCounter() - start;
|
||||
if (!m_singleThreaded)
|
||||
{
|
||||
int64_t start = bx::getHPCounter();
|
||||
bool ok = m_renderSem.wait();
|
||||
BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
|
||||
m_submit->m_waitRender = bx::getHPCounter() - start;
|
||||
}
|
||||
}
|
||||
|
||||
bx::Semaphore m_renderSem;
|
||||
@ -3532,6 +3611,7 @@ namespace bgfx
|
||||
bool m_rendererInitialized;
|
||||
bool m_exit;
|
||||
bool m_flipAfterRender;
|
||||
bool m_singleThreaded;
|
||||
|
||||
typedef UpdateBatchT<256> TextureUpdateBatch;
|
||||
BX_ALIGN_DECL_CACHE_LINE(TextureUpdateBatch m_textureUpdateBatch);
|
||||
|
16
3rdparty/bgfx/src/bgfx_shader.sh
vendored
16
3rdparty/bgfx/src/bgfx_shader.sh
vendored
@ -199,7 +199,6 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord)
|
||||
|
||||
# define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg)
|
||||
# define texture2D(_sampler, _coord) tex2D(_sampler, _coord)
|
||||
# define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) )
|
||||
# define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
|
||||
|
||||
# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg)
|
||||
@ -208,12 +207,21 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord)
|
||||
|
||||
# define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg)
|
||||
# define texture3D(_sampler, _coord) tex3D(_sampler, _coord)
|
||||
# define texture3DLod(_sampler, _coord, _level) tex3Dlod(_sampler, vec4( (_coord).xyz, _level) )
|
||||
|
||||
# define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg])
|
||||
# define textureCube(_sampler, _coord) texCUBE(_sampler, _coord)
|
||||
# define textureCubeLod(_sampler, _coord, _level) texCUBElod(_sampler, vec4( (_coord).xyz, _level) )
|
||||
# endif //
|
||||
|
||||
# if BGFX_SHADER_LANGUAGE_HLSL == 2
|
||||
# define texture2DLod(_sampler, _coord, _level) tex2D(_sampler, (_coord).xy)
|
||||
# define texture3DLod(_sampler, _coord, _level) tex3D(_sampler, (_coord).xyz)
|
||||
# define textureCubeLod(_sampler, _coord, _level) texCUBE(_sampler, (_coord).xyz)
|
||||
# else
|
||||
# define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) )
|
||||
# define texture3DLod(_sampler, _coord, _level) tex3Dlod(_sampler, vec4( (_coord).xyz, _level) )
|
||||
# define textureCubeLod(_sampler, _coord, _level) texCUBElod(_sampler, vec4( (_coord).xyz, _level) )
|
||||
# endif // BGFX_SHADER_LANGUAGE_HLSL == 2
|
||||
|
||||
# endif // BGFX_SHADER_LANGUAGE_HLSL > 3
|
||||
|
||||
vec2 vec2_splat(float _x) { return vec2(_x, _x); }
|
||||
vec3 vec3_splat(float _x) { return vec3(_x, _x, _x); }
|
||||
|
2
3rdparty/bgfx/src/config.h
vendored
2
3rdparty/bgfx/src/config.h
vendored
@ -267,4 +267,6 @@
|
||||
# define BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE 16
|
||||
#endif // BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE
|
||||
|
||||
#define BGFX_CONFIG_DRAW_INDIRECT_STRIDE 32
|
||||
|
||||
#endif // BGFX_CONFIG_H_HEADER_GUARD
|
||||
|
11
3rdparty/bgfx/src/fs_clear0.bin.h
vendored
11
3rdparty/bgfx/src/fs_clear0.bin.h
vendored
@ -1,14 +1,13 @@
|
||||
static const uint8_t fs_clear0_glsl[130] =
|
||||
static const uint8_t fs_clear0_glsl[128] =
|
||||
{
|
||||
0x46, 0x53, 0x48, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_
|
||||
0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x07, 0x08, 0x00, 0x00, 0x08, // clear_color.....
|
||||
0x00, 0x5c, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .....uniform vec
|
||||
0x00, 0x5a, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .Z...uniform vec
|
||||
0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col
|
||||
0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, // or[8];.void main
|
||||
0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ().{. gl_FragD
|
||||
0x61, 0x74, 0x61, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // ata[0] = bgfx_cl
|
||||
0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[0];.}.
|
||||
0x0a, 0x00, // ..
|
||||
0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // ().{. gl_FragC
|
||||
0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // olor = bgfx_clea
|
||||
0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_color[0];.}...
|
||||
};
|
||||
static const uint8_t fs_clear0_dx9[204] =
|
||||
{
|
||||
|
2
3rdparty/bgfx/src/fs_clear0.sc
vendored
2
3rdparty/bgfx/src/fs_clear0.sc
vendored
@ -7,5 +7,5 @@ uniform vec4 bgfx_clear_color[8];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = bgfx_clear_color[0];
|
||||
gl_FragColor = bgfx_clear_color[0];
|
||||
}
|
||||
|
2
3rdparty/bgfx/src/glcontext_eagl.mm
vendored
2
3rdparty/bgfx/src/glcontext_eagl.mm
vendored
@ -18,7 +18,7 @@ namespace bgfx { namespace gl
|
||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
BX_UNUSED(_width, _height);
|
||||
CAEAGLLayer* layer = (CAEAGLLayer*)g_bgfxEaglLayer;
|
||||
CAEAGLLayer* layer = (CAEAGLLayer*)g_platformData.nwh;
|
||||
layer.opaque = true;
|
||||
|
||||
layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys
|
||||
|
304
3rdparty/bgfx/src/glcontext_egl.cpp
vendored
304
3rdparty/bgfx/src/glcontext_egl.cpp
vendored
@ -14,48 +14,46 @@
|
||||
# include <bcm_host.h>
|
||||
# endif // BX_PLATFORM_RPI
|
||||
|
||||
#ifndef EGL_CONTEXT_MAJOR_VERSION_KHR
|
||||
# define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
|
||||
#endif // EGL_CONTEXT_MAJOR_VERSION_KHR
|
||||
|
||||
#ifndef EGL_CONTEXT_MINOR_VERSION_KHR
|
||||
# define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
|
||||
#endif // EGL_CONTEXT_MINOR_VERSION_KHR
|
||||
|
||||
namespace bgfx { namespace gl
|
||||
{
|
||||
#ifndef EGL_CONTEXT_FLAG_NO_ERROR_BIT_KHR
|
||||
# define EGL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
|
||||
#endif // EGL_CONTEXT_FLAG_NO_ERROR_BIT_KHR
|
||||
|
||||
#if BGFX_USE_GL_DYNAMIC_LIB
|
||||
|
||||
typedef void (*EGLPROC)(void);
|
||||
|
||||
typedef EGLPROC (EGLAPIENTRY* PFNEGLGETPROCADDRESSPROC)(const char *procname);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
typedef EGLContext (EGLAPIENTRY* PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRY* PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
typedef EGLint (EGLAPIENTRY* PFNEGLGETERRORPROC)(void);
|
||||
typedef EGLDisplay (EGLAPIENTRY* PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
typedef EGLContext (EGLAPIENTRY* PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRY* PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
typedef EGLint (EGLAPIENTRY* PFNEGLGETERRORPROC)(void);
|
||||
typedef EGLDisplay (EGLAPIENTRY* PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
|
||||
typedef EGLPROC (EGLAPIENTRY* PFNEGLGETPROCADDRESSPROC)(const char *procname);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef const char* (EGLAPIENTRY* PGNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy);
|
||||
|
||||
#define EGL_IMPORT \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
|
||||
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \
|
||||
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \
|
||||
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); \
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers);
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
|
||||
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
|
||||
EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
|
||||
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate);
|
||||
|
||||
#define EGL_IMPORT_FUNC(_proto, _func) _proto _func
|
||||
EGL_IMPORT
|
||||
@ -100,22 +98,7 @@ EGL_IMPORT
|
||||
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
|
||||
# include "glimports.h"
|
||||
|
||||
static const EGLint s_contextAttrs[] =
|
||||
{
|
||||
# if BGFX_CONFIG_RENDERER_OPENGLES >= 30
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
|
||||
# if BGFX_CONFIG_RENDERER_OPENGLES >= 31
|
||||
EGL_CONTEXT_MINOR_VERSION_KHR, 1,
|
||||
# else
|
||||
// EGL_CONTEXT_MINOR_VERSION_KHR, 0,
|
||||
# endif // BGFX_CONFIG_RENDERER_OPENGLES >= 31
|
||||
# elif BGFX_CONFIG_RENDERER_OPENGLES
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 2,
|
||||
// EGL_CONTEXT_MINOR_VERSION_KHR, 0,
|
||||
# endif // BGFX_CONFIG_RENDERER_
|
||||
|
||||
EGL_NONE
|
||||
};
|
||||
static EGLint s_contextAttrs[16];
|
||||
|
||||
struct SwapChainGL
|
||||
{
|
||||
@ -178,85 +161,154 @@ EGL_IMPORT
|
||||
|
||||
m_eglLibrary = eglOpen();
|
||||
|
||||
BX_UNUSED(_width, _height);
|
||||
EGLNativeDisplayType ndt = EGL_DEFAULT_DISPLAY;
|
||||
EGLNativeWindowType nwh = (EGLNativeWindowType)NULL;
|
||||
# if BX_PLATFORM_WINDOWS
|
||||
ndt = GetDC(g_bgfxHwnd);
|
||||
nwh = g_bgfxHwnd;
|
||||
# elif BX_PLATFORM_LINUX
|
||||
ndt = (EGLNativeDisplayType)g_bgfxX11Display;
|
||||
nwh = (EGLNativeWindowType)g_bgfxX11Window;
|
||||
# endif // BX_PLATFORM_
|
||||
m_display = eglGetDisplay(ndt);
|
||||
BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
|
||||
|
||||
EGLint major = 0;
|
||||
EGLint minor = 0;
|
||||
EGLBoolean success = eglInitialize(m_display, &major, &minor);
|
||||
BGFX_FATAL(success && major >= 1 && minor >= 3, Fatal::UnableToInitialize, "Failed to initialize %d.%d", major, minor);
|
||||
|
||||
EGLint attrs[] =
|
||||
if (NULL == g_platformData.context)
|
||||
{
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
BX_UNUSED(_width, _height);
|
||||
EGLNativeDisplayType ndt = (EGLNativeDisplayType)g_platformData.ndt;
|
||||
EGLNativeWindowType nwh = (EGLNativeWindowType )g_platformData.nwh;
|
||||
|
||||
# if BX_PLATFORM_WINDOWS
|
||||
if (NULL == g_platformData.ndt)
|
||||
{
|
||||
ndt = GetDC( (HWND)g_platformData.nwh);
|
||||
}
|
||||
# endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
m_display = eglGetDisplay(ndt);
|
||||
BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
|
||||
|
||||
EGLint major = 0;
|
||||
EGLint minor = 0;
|
||||
EGLBoolean success = eglInitialize(m_display, &major, &minor);
|
||||
BGFX_FATAL(success && major >= 1 && minor >= 3, Fatal::UnableToInitialize, "Failed to initialize %d.%d", major, minor);
|
||||
|
||||
BX_TRACE("EGL info:");
|
||||
const char* clientApis = eglQueryString(m_display, EGL_CLIENT_APIS);
|
||||
BX_TRACE(" APIs: %s", clientApis); BX_UNUSED(clientApis);
|
||||
|
||||
const char* vendor = eglQueryString(m_display, EGL_VENDOR);
|
||||
BX_TRACE(" Vendor: %s", vendor); BX_UNUSED(vendor);
|
||||
|
||||
const char* version = eglQueryString(m_display, EGL_VERSION);
|
||||
BX_TRACE("Version: %s", version); BX_UNUSED(version);
|
||||
|
||||
const char* extensions = eglQueryString(m_display, EGL_EXTENSIONS);
|
||||
BX_TRACE("Supported EGL extensions:");
|
||||
dumpExtensions(extensions);
|
||||
|
||||
EGLint attrs[] =
|
||||
{
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
# else
|
||||
EGL_DEPTH_SIZE, 24,
|
||||
EGL_DEPTH_SIZE, 24,
|
||||
# endif // BX_PLATFORM_
|
||||
EGL_STENCIL_SIZE, 8,
|
||||
EGL_STENCIL_SIZE, 8,
|
||||
|
||||
EGL_NONE
|
||||
};
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
EGLint numConfig = 0;
|
||||
success = eglChooseConfig(m_display, attrs, &m_config, 1, &numConfig);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "eglChooseConfig");
|
||||
EGLint numConfig = 0;
|
||||
success = eglChooseConfig(m_display, attrs, &m_config, 1, &numConfig);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "eglChooseConfig");
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
EGLint format;
|
||||
eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format);
|
||||
ANativeWindow_setBuffersGeometry(g_bgfxAndroidWindow, _width, _height, format);
|
||||
nwh = g_bgfxAndroidWindow;
|
||||
|
||||
EGLint format;
|
||||
eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format);
|
||||
ANativeWindow_setBuffersGeometry( (ANativeWindow*)g_platformData.nwh, _width, _height, format);
|
||||
|
||||
# elif BX_PLATFORM_RPI
|
||||
DISPMANX_DISPLAY_HANDLE_T dispmanDisplay = vc_dispmanx_display_open(0);
|
||||
DISPMANX_UPDATE_HANDLE_T dispmanUpdate = vc_dispmanx_update_start(0);
|
||||
DISPMANX_DISPLAY_HANDLE_T dispmanDisplay = vc_dispmanx_display_open(0);
|
||||
DISPMANX_UPDATE_HANDLE_T dispmanUpdate = vc_dispmanx_update_start(0);
|
||||
|
||||
VC_RECT_T dstRect = { 0, 0, _width, _height };
|
||||
VC_RECT_T srcRect = { 0, 0, _width << 16, _height << 16 };
|
||||
VC_RECT_T dstRect = { 0, 0, _width, _height };
|
||||
VC_RECT_T srcRect = { 0, 0, _width << 16, _height << 16 };
|
||||
|
||||
DISPMANX_ELEMENT_HANDLE_T dispmanElement = vc_dispmanx_element_add(dispmanUpdate
|
||||
, dispmanDisplay
|
||||
, 0
|
||||
, &dstRect
|
||||
, 0
|
||||
, &srcRect
|
||||
, DISPMANX_PROTECTION_NONE
|
||||
, NULL
|
||||
, NULL
|
||||
, DISPMANX_NO_ROTATE
|
||||
);
|
||||
DISPMANX_ELEMENT_HANDLE_T dispmanElement = vc_dispmanx_element_add(dispmanUpdate
|
||||
, dispmanDisplay
|
||||
, 0
|
||||
, &dstRect
|
||||
, 0
|
||||
, &srcRect
|
||||
, DISPMANX_PROTECTION_NONE
|
||||
, NULL
|
||||
, NULL
|
||||
, DISPMANX_NO_ROTATE
|
||||
);
|
||||
|
||||
s_dispmanWindow.element = dispmanElement;
|
||||
s_dispmanWindow.width = _width;
|
||||
s_dispmanWindow.height = _height;
|
||||
nwh = &s_dispmanWindow;
|
||||
s_dispmanWindow.element = dispmanElement;
|
||||
s_dispmanWindow.width = _width;
|
||||
s_dispmanWindow.height = _height;
|
||||
nwh = &s_dispmanWindow;
|
||||
|
||||
vc_dispmanx_update_submit_sync(dispmanUpdate);
|
||||
vc_dispmanx_update_submit_sync(dispmanUpdate);
|
||||
# endif // BX_PLATFORM_ANDROID
|
||||
|
||||
m_surface = eglCreateWindowSurface(m_display, m_config, nwh, NULL);
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
m_surface = eglCreateWindowSurface(m_display, m_config, nwh, NULL);
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
|
||||
m_context = eglCreateContext(m_display, m_config, EGL_NO_CONTEXT, s_contextAttrs);
|
||||
BGFX_FATAL(m_context != EGL_NO_CONTEXT, Fatal::UnableToInitialize, "Failed to create context.");
|
||||
const bool hasEglKhrCreateContext = !!bx::findIdentifierMatch(extensions, "EGL_KHR_create_context");
|
||||
const bool hasEglKhrNoError = !!bx::findIdentifierMatch(extensions, "EGL_KHR_create_context_no_error");
|
||||
|
||||
success = eglMakeCurrent(m_display, m_surface, m_surface, m_context);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "Failed to set context.");
|
||||
m_current = NULL;
|
||||
for (uint32_t ii = 0; ii < 2; ++ii)
|
||||
{
|
||||
bx::StaticMemoryBlockWriter writer(s_contextAttrs, sizeof(s_contextAttrs) );
|
||||
|
||||
eglSwapInterval(m_display, 0);
|
||||
EGLint flags = 0;
|
||||
|
||||
if (hasEglKhrCreateContext)
|
||||
{
|
||||
bx::write(&writer, EGLint(EGL_CONTEXT_MAJOR_VERSION_KHR) );
|
||||
bx::write(&writer, EGLint(BGFX_CONFIG_RENDERER_OPENGLES / 10) );
|
||||
|
||||
bx::write(&writer, EGLint(EGL_CONTEXT_MINOR_VERSION_KHR) );
|
||||
bx::write(&writer, EGLint(BGFX_CONFIG_RENDERER_OPENGLES % 10) );
|
||||
|
||||
flags |= BGFX_CONFIG_DEBUG && hasEglKhrNoError ? 0
|
||||
| EGL_CONTEXT_FLAG_NO_ERROR_BIT_KHR
|
||||
: 0
|
||||
;
|
||||
|
||||
if (0 == ii)
|
||||
{
|
||||
flags |= BGFX_CONFIG_DEBUG ? 0
|
||||
| EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
|
||||
// | EGL_OPENGL_ES3_BIT_KHR
|
||||
: 0
|
||||
;
|
||||
|
||||
bx::write(&writer, EGLint(EGL_CONTEXT_FLAGS_KHR) );
|
||||
bx::write(&writer, flags);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bx::write(&writer, EGLint(EGL_CONTEXT_CLIENT_VERSION) );
|
||||
bx::write(&writer, 2);
|
||||
}
|
||||
|
||||
bx::write(&writer, EGLint(EGL_NONE) );
|
||||
|
||||
m_context = eglCreateContext(m_display, m_config, EGL_NO_CONTEXT, s_contextAttrs);
|
||||
if (NULL != m_context)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
BX_TRACE("Failed to create EGL context with EGL_CONTEXT_FLAGS_KHR (%08x).", flags);
|
||||
}
|
||||
|
||||
BGFX_FATAL(m_context != EGL_NO_CONTEXT, Fatal::UnableToInitialize, "Failed to create context.");
|
||||
|
||||
success = eglMakeCurrent(m_display, m_surface, m_surface, m_context);
|
||||
BGFX_FATAL(success, Fatal::UnableToInitialize, "Failed to set context.");
|
||||
m_current = NULL;
|
||||
|
||||
eglSwapInterval(m_display, 0);
|
||||
}
|
||||
|
||||
# if BX_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_canvas_size(_width, _height);
|
||||
@ -267,11 +319,14 @@ EGL_IMPORT
|
||||
|
||||
void GlContext::destroy()
|
||||
{
|
||||
eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(m_display, m_context);
|
||||
eglDestroySurface(m_display, m_surface);
|
||||
eglTerminate(m_display);
|
||||
m_context = NULL;
|
||||
if (NULL != m_display)
|
||||
{
|
||||
eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(m_display, m_context);
|
||||
eglDestroySurface(m_display, m_surface);
|
||||
eglTerminate(m_display);
|
||||
m_context = NULL;
|
||||
}
|
||||
|
||||
eglClose(m_eglLibrary);
|
||||
|
||||
@ -283,14 +338,21 @@ EGL_IMPORT
|
||||
void GlContext::resize(uint32_t _width, uint32_t _height, uint32_t _flags)
|
||||
{
|
||||
BX_UNUSED(_width, _height);
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
EGLint format;
|
||||
eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format);
|
||||
ANativeWindow_setBuffersGeometry(g_bgfxAndroidWindow, _width, _height, format);
|
||||
if (NULL != m_display)
|
||||
{
|
||||
EGLint format;
|
||||
eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format);
|
||||
ANativeWindow_setBuffersGeometry( (ANativeWindow*)g_platformData.nwh, _width, _height, format);
|
||||
}
|
||||
# endif // BX_PLATFORM_ANDROID
|
||||
|
||||
bool vsync = !!(_flags&BGFX_RESET_VSYNC);
|
||||
eglSwapInterval(m_display, vsync ? 1 : 0);
|
||||
if (NULL != m_display)
|
||||
{
|
||||
bool vsync = !!(_flags&BGFX_RESET_VSYNC);
|
||||
eglSwapInterval(m_display, vsync ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool GlContext::isSwapChainSupported()
|
||||
@ -317,7 +379,10 @@ EGL_IMPORT
|
||||
|
||||
if (NULL == _swapChain)
|
||||
{
|
||||
eglSwapBuffers(m_display, m_surface);
|
||||
if (NULL != m_display)
|
||||
{
|
||||
eglSwapBuffers(m_display, m_surface);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -333,7 +398,10 @@ EGL_IMPORT
|
||||
|
||||
if (NULL == _swapChain)
|
||||
{
|
||||
eglMakeCurrent(m_display, m_surface, m_surface, m_context);
|
||||
if (NULL != m_display)
|
||||
{
|
||||
eglMakeCurrent(m_display, m_surface, m_surface, m_context);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
1
3rdparty/bgfx/src/glcontext_egl.h
vendored
1
3rdparty/bgfx/src/glcontext_egl.h
vendored
@ -9,6 +9,7 @@
|
||||
#if BGFX_USE_EGL
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
namespace bgfx { namespace gl
|
||||
{
|
||||
|
54
3rdparty/bgfx/src/glcontext_glx.cpp
vendored
54
3rdparty/bgfx/src/glcontext_glx.cpp
vendored
@ -29,23 +29,23 @@ namespace bgfx { namespace gl
|
||||
SwapChainGL(::Window _window, XVisualInfo* _visualInfo, GLXContext _context)
|
||||
: m_window(_window)
|
||||
{
|
||||
m_context = glXCreateContext( (::Display*)g_bgfxX11Display, _visualInfo, _context, GL_TRUE);
|
||||
m_context = glXCreateContext( (::Display*)g_platformData.ndt, _visualInfo, _context, GL_TRUE);
|
||||
}
|
||||
|
||||
~SwapChainGL()
|
||||
{
|
||||
glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0);
|
||||
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
|
||||
glXMakeCurrent( (::Display*)g_platformData.ndt, 0, 0);
|
||||
glXDestroyContext( (::Display*)g_platformData.ndt, m_context);
|
||||
}
|
||||
|
||||
void makeCurrent()
|
||||
{
|
||||
glXMakeCurrent( (::Display*)g_bgfxX11Display, m_window, m_context);
|
||||
glXMakeCurrent( (::Display*)g_platformData.ndt, m_window, m_context);
|
||||
}
|
||||
|
||||
void swapBuffers()
|
||||
{
|
||||
glXSwapBuffers( (::Display*)g_bgfxX11Display, m_window);
|
||||
glXSwapBuffers( (::Display*)g_platformData.ndt, m_window);
|
||||
}
|
||||
|
||||
Window m_window;
|
||||
@ -56,14 +56,14 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
BX_UNUSED(_width, _height);
|
||||
|
||||
m_context = (GLXContext)g_bgfxGLX;
|
||||
m_context = (GLXContext)g_platformData.context;
|
||||
|
||||
if (NULL == g_bgfxGLX)
|
||||
if (NULL == g_platformData.context)
|
||||
{
|
||||
XLockDisplay( (::Display*)g_bgfxX11Display);
|
||||
XLockDisplay( (::Display*)g_platformData.ndt);
|
||||
|
||||
int major, minor;
|
||||
bool version = glXQueryVersion( (::Display*)g_bgfxX11Display, &major, &minor);
|
||||
bool version = glXQueryVersion( (::Display*)g_platformData.ndt, &major, &minor);
|
||||
BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
|
||||
BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
|
||||
, Fatal::UnableToInitialize
|
||||
@ -72,9 +72,9 @@ namespace bgfx { namespace gl
|
||||
, minor
|
||||
);
|
||||
|
||||
int32_t screen = DefaultScreen( (::Display*)g_bgfxX11Display);
|
||||
int32_t screen = DefaultScreen( (::Display*)g_platformData.ndt);
|
||||
|
||||
const char* extensions = glXQueryExtensionsString( (::Display*)g_bgfxX11Display, screen);
|
||||
const char* extensions = glXQueryExtensionsString( (::Display*)g_platformData.ndt, screen);
|
||||
BX_TRACE("GLX extensions:");
|
||||
dumpExtensions(extensions);
|
||||
|
||||
@ -96,13 +96,13 @@ namespace bgfx { namespace gl
|
||||
GLXFBConfig bestConfig = NULL;
|
||||
|
||||
int numConfigs;
|
||||
GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_bgfxX11Display, screen, attrsGlx, &numConfigs);
|
||||
GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_platformData.ndt, screen, attrsGlx, &numConfigs);
|
||||
|
||||
BX_TRACE("glX num configs %d", numConfigs);
|
||||
|
||||
for (int ii = 0; ii < numConfigs; ++ii)
|
||||
{
|
||||
m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_bgfxX11Display, configs[ii]);
|
||||
m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_platformData.ndt, configs[ii]);
|
||||
if (NULL != m_visualInfo)
|
||||
{
|
||||
BX_TRACE("---");
|
||||
@ -110,7 +110,7 @@ namespace bgfx { namespace gl
|
||||
for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
|
||||
{
|
||||
int value;
|
||||
glXGetFBConfigAttrib( (::Display*)g_bgfxX11Display, configs[ii], attrsGlx[attr], &value);
|
||||
glXGetFBConfigAttrib( (::Display*)g_platformData.ndt, configs[ii], attrsGlx[attr], &value);
|
||||
BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
|
||||
, ii
|
||||
, numConfigs
|
||||
@ -146,7 +146,7 @@ namespace bgfx { namespace gl
|
||||
BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
|
||||
|
||||
BX_TRACE("Create GL 2.1 context.");
|
||||
m_context = glXCreateContext( (::Display*)g_bgfxX11Display, m_visualInfo, 0, GL_TRUE);
|
||||
m_context = glXCreateContext( (::Display*)g_platformData.ndt, m_visualInfo, 0, GL_TRUE);
|
||||
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL >= 31
|
||||
@ -163,11 +163,11 @@ namespace bgfx { namespace gl
|
||||
0,
|
||||
};
|
||||
|
||||
GLXContext context = glXCreateContextAttribsARB( (::Display*)g_bgfxX11Display, bestConfig, 0, true, contextAttrs);
|
||||
GLXContext context = glXCreateContextAttribsARB( (::Display*)g_platformData.ndt, bestConfig, 0, true, contextAttrs);
|
||||
|
||||
if (NULL != context)
|
||||
{
|
||||
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
|
||||
glXDestroyContext( (::Display*)g_platformData.ndt, m_context);
|
||||
m_context = context;
|
||||
}
|
||||
}
|
||||
@ -175,19 +175,19 @@ namespace bgfx { namespace gl
|
||||
BX_UNUSED(bestConfig);
|
||||
#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
|
||||
|
||||
XUnlockDisplay( (::Display*)g_bgfxX11Display);
|
||||
XUnlockDisplay( (::Display*)g_platformData.ndt);
|
||||
}
|
||||
|
||||
import();
|
||||
|
||||
glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context);
|
||||
glXMakeCurrent( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, m_context);
|
||||
m_current = NULL;
|
||||
|
||||
glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalEXT");
|
||||
if (NULL != glXSwapIntervalEXT)
|
||||
{
|
||||
BX_TRACE("Using glXSwapIntervalEXT.");
|
||||
glXSwapIntervalEXT( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, 0);
|
||||
glXSwapIntervalEXT( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -210,15 +210,15 @@ namespace bgfx { namespace gl
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glXSwapBuffers( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window);
|
||||
glXSwapBuffers( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh);
|
||||
}
|
||||
|
||||
void GlContext::destroy()
|
||||
{
|
||||
glXMakeCurrent( (::Display*)g_bgfxX11Display, 0, 0);
|
||||
if (NULL == g_bgfxGLX)
|
||||
glXMakeCurrent( (::Display*)g_platformData.ndt, 0, 0);
|
||||
if (NULL == g_platformData.context)
|
||||
{
|
||||
glXDestroyContext( (::Display*)g_bgfxX11Display, m_context);
|
||||
glXDestroyContext( (::Display*)g_platformData.ndt, m_context);
|
||||
XFree(m_visualInfo);
|
||||
}
|
||||
m_context = NULL;
|
||||
@ -232,7 +232,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (NULL != glXSwapIntervalEXT)
|
||||
{
|
||||
glXSwapIntervalEXT( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, interval);
|
||||
glXSwapIntervalEXT( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, interval);
|
||||
}
|
||||
else if (NULL != glXSwapIntervalMESA)
|
||||
{
|
||||
@ -265,7 +265,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (NULL == _swapChain)
|
||||
{
|
||||
glXSwapBuffers( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window);
|
||||
glXSwapBuffers( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -281,7 +281,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (NULL == _swapChain)
|
||||
{
|
||||
glXMakeCurrent( (::Display*)g_bgfxX11Display, (::Window)g_bgfxX11Window, m_context);
|
||||
glXMakeCurrent( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, m_context);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
8
3rdparty/bgfx/src/glcontext_nsgl.mm
vendored
8
3rdparty/bgfx/src/glcontext_nsgl.mm
vendored
@ -65,10 +65,10 @@ namespace bgfx { namespace gl
|
||||
BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");
|
||||
|
||||
const AutoreleasePoolHolder pool;
|
||||
NSWindow* nsWindow = (NSWindow*)g_bgfxNSWindow;
|
||||
m_context = g_bgfxNSGL;
|
||||
NSWindow* nsWindow = (NSWindow*)g_platformData.nwh;
|
||||
m_context = g_platformData.context;
|
||||
|
||||
if (NULL == g_bgfxNSGL)
|
||||
if (NULL == g_platformData.context)
|
||||
{
|
||||
#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
|
||||
NSOpenGLPixelFormatAttribute profile =
|
||||
@ -120,7 +120,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
void GlContext::destroy()
|
||||
{
|
||||
if (NULL == g_bgfxNSGL)
|
||||
if (NULL == g_platformData.context)
|
||||
{
|
||||
NSOpenGLView* glView = (NSOpenGLView*)m_view;
|
||||
[glView release];
|
||||
|
20
3rdparty/bgfx/src/glcontext_wgl.cpp
vendored
20
3rdparty/bgfx/src/glcontext_wgl.cpp
vendored
@ -109,14 +109,14 @@ namespace bgfx { namespace gl
|
||||
wglGetProcAddress = (PFNWGLGETPROCADDRESSPROC)bx::dlsym(m_opengl32dll, "wglGetProcAddress");
|
||||
BGFX_FATAL(NULL != wglGetProcAddress, Fatal::UnableToInitialize, "Failed get wglGetProcAddress.");
|
||||
|
||||
// If g_bgfxHwnd is NULL, the assumption is that GL context was created
|
||||
// If g_platformHooks.nwh is NULL, the assumption is that GL context was created
|
||||
// by user (for example, using SDL, GLFW, etc.)
|
||||
BX_WARN(NULL != g_bgfxHwnd
|
||||
, "bgfx::winSetHwnd with valid window is not called. This might "
|
||||
BX_WARN(NULL != g_platformData.nwh
|
||||
, "bgfx::setPlatform with valid window is not called. This might "
|
||||
"be intentional when GL context is created by the user."
|
||||
);
|
||||
|
||||
if (NULL != g_bgfxHwnd)
|
||||
if (NULL != g_platformData.nwh)
|
||||
{
|
||||
wglMakeCurrent = (PFNWGLMAKECURRENTPROC)bx::dlsym(m_opengl32dll, "wglMakeCurrent");
|
||||
BGFX_FATAL(NULL != wglMakeCurrent, Fatal::UnableToInitialize, "Failed get wglMakeCurrent.");
|
||||
@ -127,7 +127,7 @@ namespace bgfx { namespace gl
|
||||
wglDeleteContext = (PFNWGLDELETECONTEXTPROC)bx::dlsym(m_opengl32dll, "wglDeleteContext");
|
||||
BGFX_FATAL(NULL != wglDeleteContext, Fatal::UnableToInitialize, "Failed get wglDeleteContext.");
|
||||
|
||||
m_hdc = GetDC(g_bgfxHwnd);
|
||||
m_hdc = GetDC( (HWND)g_platformData.nwh);
|
||||
BGFX_FATAL(NULL != m_hdc, Fatal::UnableToInitialize, "GetDC failed!");
|
||||
|
||||
// Dummy window to peek into WGL functionality.
|
||||
@ -188,7 +188,7 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
result = wglChoosePixelFormatARB(m_hdc, attrs, NULL, 1, &m_pixelFormat, &numFormats);
|
||||
if (0 == result
|
||||
|| 0 == numFormats)
|
||||
|| 0 == numFormats)
|
||||
{
|
||||
attrs[3] >>= 1;
|
||||
attrs[1] = attrs[3] == 0 ? 0 : 1;
|
||||
@ -212,7 +212,7 @@ namespace bgfx { namespace gl
|
||||
);
|
||||
|
||||
result = SetPixelFormat(m_hdc, m_pixelFormat, &m_pfd);
|
||||
// When window is created by SDL and SDL_WINDOW_OPENGL is set SetPixelFormat
|
||||
// When window is created by SDL and SDL_WINDOW_OPENGL is set, SetPixelFormat
|
||||
// will fail. Just warn and continue. In case it failed for some other reason
|
||||
// create context will fail and it will error out there.
|
||||
BX_WARN(result, "SetPixelFormat failed (last err: 0x%08x)!", GetLastError() );
|
||||
@ -272,14 +272,14 @@ namespace bgfx { namespace gl
|
||||
|
||||
void GlContext::destroy()
|
||||
{
|
||||
if (NULL != g_bgfxHwnd)
|
||||
if (NULL != g_platformData.nwh)
|
||||
{
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
wglDeleteContext(m_context);
|
||||
m_context = NULL;
|
||||
|
||||
ReleaseDC(g_bgfxHwnd, m_hdc);
|
||||
ReleaseDC( (HWND)g_platformData.nwh, m_hdc);
|
||||
m_hdc = NULL;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (NULL == _swapChain)
|
||||
{
|
||||
if (NULL != g_bgfxHwnd)
|
||||
if (NULL != g_platformData.nwh)
|
||||
{
|
||||
SwapBuffers(m_hdc);
|
||||
}
|
||||
|
34
3rdparty/bgfx/src/glimports.h
vendored
34
3rdparty/bgfx/src/glimports.h
vendored
@ -26,6 +26,7 @@
|
||||
#define GL_IMPORT_ANGLE(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## ANGLE)
|
||||
#define GL_IMPORT_ARB__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## ARB)
|
||||
#define GL_IMPORT_EXT__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## EXT)
|
||||
#define GL_IMPORT_KHR__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## KHR)
|
||||
#define GL_IMPORT_NV___(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## NV)
|
||||
#define GL_IMPORT_OES__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## OES)
|
||||
#define GL_IMPORT_____x(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## XXXXX)
|
||||
@ -94,15 +95,19 @@ typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint
|
||||
typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
|
||||
typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEIPROC) (GLenum cap, GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLFINISHPROC) ();
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHPROC) ();
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
@ -143,6 +148,8 @@ typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint progra
|
||||
typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
|
||||
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
@ -263,15 +270,19 @@ GL_IMPORT______(false, PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVert
|
||||
GL_IMPORT______(true, PFNGLDISPATCHCOMPUTEPROC, glDispatchCompute);
|
||||
GL_IMPORT______(true, PFNGLDISPATCHCOMPUTEINDIRECTPROC, glDispatchComputeIndirect);
|
||||
GL_IMPORT______(false, PFNGLDRAWARRAYSPROC, glDrawArrays);
|
||||
GL_IMPORT______(true, PFNGLDRAWARRAYSINDIRECTPROC, glDrawArraysIndirect);
|
||||
GL_IMPORT______(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced);
|
||||
GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
|
||||
GL_IMPORT______(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers);
|
||||
GL_IMPORT______(false, PFNGLDRAWELEMENTSPROC, glDrawElements);
|
||||
GL_IMPORT______(true, PFNGLDRAWELEMENTSINDIRECTPROC, glDrawElementsIndirect);
|
||||
GL_IMPORT______(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced);
|
||||
GL_IMPORT______(false, PFNGLENABLEPROC, glEnable);
|
||||
GL_IMPORT______(true, PFNGLENABLEIPROC, glEnablei);
|
||||
GL_IMPORT______(false, PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray);
|
||||
GL_IMPORT______(true, PFNGLENDQUERYPROC, glEndQuery);
|
||||
GL_IMPORT______(false, PFNGLFINISHPROC, glFinish);
|
||||
GL_IMPORT______(false, PFNGLFLUSHPROC, glFlush);
|
||||
GL_IMPORT______(true, PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer);
|
||||
GL_IMPORT______(true, PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D);
|
||||
GL_IMPORT______(false, PFNGLGENBUFFERSPROC, glGenBuffers);
|
||||
@ -312,6 +323,8 @@ GL_IMPORT______(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformL
|
||||
GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer);
|
||||
GL_IMPORT______(false, PFNGLLINKPROGRAMPROC, glLinkProgram);
|
||||
GL_IMPORT______(true, PFNGLMEMORYBARRIERPROC, glMemoryBarrier);
|
||||
GL_IMPORT______(true, PFNGLMULTIDRAWARRAYSINDIRECTPROC, glMultiDrawArraysIndirect);
|
||||
GL_IMPORT______(true, PFNGLMULTIDRAWELEMENTSINDIRECTPROC, glMultiDrawElementsIndirect);
|
||||
GL_IMPORT______(true, PFNGLOBJECTLABELPROC, glObjectLabel);
|
||||
GL_IMPORT______(true, PFNGLOBJECTPTRLABELPROC, glObjectPtrLabel);
|
||||
GL_IMPORT______(false, PFNGLPIXELSTOREIPROC, glPixelStorei);
|
||||
@ -390,6 +403,9 @@ GL_IMPORT_ARB__(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers
|
||||
|
||||
GL_IMPORT_ARB__(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer);
|
||||
|
||||
GL_IMPORT_ARB__(true, PFNGLMULTIDRAWARRAYSINDIRECTPROC, glMultiDrawArraysIndirect);
|
||||
GL_IMPORT_ARB__(true, PFNGLMULTIDRAWELEMENTSINDIRECTPROC, glMultiDrawElementsIndirect);
|
||||
|
||||
GL_IMPORT_EXT__(true, PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer);
|
||||
GL_IMPORT_EXT__(true, PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers);
|
||||
GL_IMPORT_EXT__(true, PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers);
|
||||
@ -419,6 +435,11 @@ GL_IMPORT______(true, PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC, glGetTranslat
|
||||
GL_IMPORT_ANGLE(true, PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer);
|
||||
GL_IMPORT_ANGLE(true, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
|
||||
|
||||
GL_IMPORT_KHR__(true, PFNGLDEBUGMESSAGECONTROLPROC, glDebugMessageControl);
|
||||
GL_IMPORT_KHR__(true, PFNGLDEBUGMESSAGEINSERTPROC, glDebugMessageInsert);
|
||||
GL_IMPORT_KHR__(true, PFNGLDEBUGMESSAGECALLBACKPROC, glDebugMessageCallback);
|
||||
GL_IMPORT_KHR__(true, PFNGLGETDEBUGMESSAGELOGPROC, glGetDebugMessageLog);
|
||||
|
||||
# if BGFX_CONFIG_RENDERER_OPENGLES < 30
|
||||
GL_IMPORT_OES__(true, PFNGLTEXIMAGE3DPROC, glTexImage3D);
|
||||
GL_IMPORT_OES__(true, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D);
|
||||
@ -433,6 +454,11 @@ GL_IMPORT_EXT__(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMa
|
||||
GL_IMPORT_EXT__(true, PFNGLPOPGROUPMARKEREXTPROC, glPopGroupMarker);
|
||||
GL_IMPORT_EXT__(true, PFNGLOBJECTLABELPROC, glObjectLabel);
|
||||
|
||||
GL_IMPORT_EXT__(true, PFNGLDRAWARRAYSINDIRECTPROC, glDrawArraysIndirect);
|
||||
GL_IMPORT_EXT__(true, PFNGLDRAWELEMENTSINDIRECTPROC, glDrawElementsIndirect);
|
||||
GL_IMPORT_EXT__(true, PFNGLMULTIDRAWARRAYSINDIRECTPROC, glMultiDrawArraysIndirect);
|
||||
GL_IMPORT_EXT__(true, PFNGLMULTIDRAWELEMENTSINDIRECTPROC, glMultiDrawElementsIndirect);
|
||||
|
||||
GL_IMPORT_OES__(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary);
|
||||
GL_IMPORT_OES__(true, PFNGLPROGRAMBINARYPROC, glProgramBinary);
|
||||
|
||||
@ -481,7 +507,7 @@ GL_IMPORT_NV___(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObj
|
||||
|
||||
GL_IMPORT (true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer, glDiscardFramebufferEXT);
|
||||
|
||||
#elif !BGFX_USE_GL_DYNAMIC_LIB
|
||||
# elif !BGFX_USE_GL_DYNAMIC_LIB
|
||||
GL_IMPORT______(true, PFNGLTEXIMAGE3DPROC, glTexImage3D);
|
||||
GL_IMPORT______(true, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D);
|
||||
GL_IMPORT______(true, PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D);
|
||||
@ -541,6 +567,11 @@ GL_IMPORT______(true, PFNGLBEGINQUERYPROC, glBeginQuery)
|
||||
GL_IMPORT______(true, PFNGLENDQUERYPROC, glEndQuery);
|
||||
GL_IMPORT______(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObjectui64v);
|
||||
|
||||
GL_IMPORT______(true, PFNGLDRAWARRAYSINDIRECTPROC, glDrawArraysIndirect);
|
||||
GL_IMPORT______(true, PFNGLDRAWELEMENTSINDIRECTPROC, glDrawElementsIndirect);
|
||||
GL_IMPORT______(true, PFNGLMULTIDRAWARRAYSINDIRECTPROC, glMultiDrawArraysIndirect);
|
||||
GL_IMPORT______(true, PFNGLMULTIDRAWELEMENTSINDIRECTPROC, glMultiDrawElementsIndirect);
|
||||
|
||||
GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer);
|
||||
|
||||
# endif // BGFX_CONFIG_RENDERER_OPENGLES < 30
|
||||
@ -552,6 +583,7 @@ GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateF
|
||||
#undef GL_IMPORT______
|
||||
#undef GL_IMPORT_ARB__
|
||||
#undef GL_IMPORT_EXT__
|
||||
#undef GL_IMPORT_KHR__
|
||||
#undef GL_IMPORT_NV___
|
||||
#undef GL_IMPORT_OES__
|
||||
#undef GL_IMPORT_____x
|
||||
|
188
3rdparty/bgfx/src/image.cpp
vendored
188
3rdparty/bgfx/src/image.cpp
vendored
@ -1251,33 +1251,42 @@ namespace bgfx
|
||||
#define DDS_G32R32F 115
|
||||
#define DDS_A32B32G32R32F 116
|
||||
|
||||
#define DDS_FORMAT_R32G32B32A32_FLOAT 2
|
||||
#define DDS_FORMAT_R32G32B32A32_UINT 3
|
||||
#define DDS_FORMAT_R16G16B16A16_FLOAT 10
|
||||
#define DDS_FORMAT_R16G16B16A16_UNORM 11
|
||||
#define DDS_FORMAT_R16G16B16A16_UINT 12
|
||||
#define DDS_FORMAT_R32G32_FLOAT 16
|
||||
#define DDS_FORMAT_R32G32_UINT 17
|
||||
#define DDS_FORMAT_R10G10B10A2_UNORM 24
|
||||
#define DDS_FORMAT_R16G16_FLOAT 34
|
||||
#define DDS_FORMAT_R16G16_UNORM 35
|
||||
#define DDS_FORMAT_R32_FLOAT 41
|
||||
#define DDS_FORMAT_R32_UINT 42
|
||||
#define DDS_FORMAT_R8G8_UNORM 49
|
||||
#define DDS_FORMAT_R16_FLOAT 54
|
||||
#define DDS_FORMAT_R16_UNORM 56
|
||||
#define DDS_FORMAT_R8_UNORM 61
|
||||
#define DDS_FORMAT_BC1_UNORM 71
|
||||
#define DDS_FORMAT_BC2_UNORM 74
|
||||
#define DDS_FORMAT_BC3_UNORM 77
|
||||
#define DDS_FORMAT_BC4_UNORM 80
|
||||
#define DDS_FORMAT_BC5_UNORM 83
|
||||
#define DDS_FORMAT_B5G6R5_UNORM 85
|
||||
#define DDS_FORMAT_B5G5R5A1_UNORM 86
|
||||
#define DDS_FORMAT_B8G8R8A8_UNORM 87
|
||||
#define DDS_FORMAT_BC6H_SF16 96
|
||||
#define DDS_FORMAT_BC7_UNORM 98
|
||||
#define DDS_FORMAT_B4G4R4A4_UNORM 115
|
||||
#define DDS_FORMAT_R32G32B32A32_FLOAT 2
|
||||
#define DDS_FORMAT_R32G32B32A32_UINT 3
|
||||
#define DDS_FORMAT_R16G16B16A16_FLOAT 10
|
||||
#define DDS_FORMAT_R16G16B16A16_UNORM 11
|
||||
#define DDS_FORMAT_R16G16B16A16_UINT 12
|
||||
#define DDS_FORMAT_R32G32_FLOAT 16
|
||||
#define DDS_FORMAT_R32G32_UINT 17
|
||||
#define DDS_FORMAT_R10G10B10A2_UNORM 24
|
||||
#define DDS_FORMAT_R11G11B10_FLOAT 26
|
||||
#define DDS_FORMAT_R8G8B8A8_UNORM 28
|
||||
#define DDS_FORMAT_R8G8B8A8_UNORM_SRGB 29
|
||||
#define DDS_FORMAT_R16G16_FLOAT 34
|
||||
#define DDS_FORMAT_R16G16_UNORM 35
|
||||
#define DDS_FORMAT_R32_FLOAT 41
|
||||
#define DDS_FORMAT_R32_UINT 42
|
||||
#define DDS_FORMAT_R8G8_UNORM 49
|
||||
#define DDS_FORMAT_R16_FLOAT 54
|
||||
#define DDS_FORMAT_R16_UNORM 56
|
||||
#define DDS_FORMAT_R8_UNORM 61
|
||||
#define DDS_FORMAT_R1_UNORM 66
|
||||
#define DDS_FORMAT_BC1_UNORM 71
|
||||
#define DDS_FORMAT_BC1_UNORM_SRGB 72
|
||||
#define DDS_FORMAT_BC2_UNORM 74
|
||||
#define DDS_FORMAT_BC2_UNORM_SRGB 75
|
||||
#define DDS_FORMAT_BC3_UNORM 77
|
||||
#define DDS_FORMAT_BC3_UNORM_SRGB 78
|
||||
#define DDS_FORMAT_BC4_UNORM 80
|
||||
#define DDS_FORMAT_BC5_UNORM 83
|
||||
#define DDS_FORMAT_B5G6R5_UNORM 85
|
||||
#define DDS_FORMAT_B5G5R5A1_UNORM 86
|
||||
#define DDS_FORMAT_B8G8R8A8_UNORM 87
|
||||
#define DDS_FORMAT_B8G8R8A8_UNORM_SRGB 91
|
||||
#define DDS_FORMAT_BC6H_SF16 96
|
||||
#define DDS_FORMAT_BC7_UNORM 98
|
||||
#define DDS_FORMAT_BC7_UNORM_SRGB 99
|
||||
#define DDS_FORMAT_B4G4R4A4_UNORM 115
|
||||
|
||||
#define DDSD_CAPS 0x00000001
|
||||
#define DDSD_HEIGHT 0x00000002
|
||||
@ -1318,70 +1327,80 @@ namespace bgfx
|
||||
{
|
||||
uint32_t m_format;
|
||||
TextureFormat::Enum m_textureFormat;
|
||||
bool m_srgb;
|
||||
};
|
||||
|
||||
static TranslateDdsFormat s_translateDdsFourccFormat[] =
|
||||
{
|
||||
{ DDS_DXT1, TextureFormat::BC1 },
|
||||
{ DDS_DXT2, TextureFormat::BC2 },
|
||||
{ DDS_DXT3, TextureFormat::BC2 },
|
||||
{ DDS_DXT4, TextureFormat::BC3 },
|
||||
{ DDS_DXT5, TextureFormat::BC3 },
|
||||
{ DDS_ATI1, TextureFormat::BC4 },
|
||||
{ DDS_BC4U, TextureFormat::BC4 },
|
||||
{ DDS_ATI2, TextureFormat::BC5 },
|
||||
{ DDS_BC5U, TextureFormat::BC5 },
|
||||
{ DDS_A16B16G16R16, TextureFormat::RGBA16 },
|
||||
{ DDS_A16B16G16R16F, TextureFormat::RGBA16F },
|
||||
{ DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8 },
|
||||
{ DDPF_INDEXED, TextureFormat::R8 },
|
||||
{ DDPF_LUMINANCE, TextureFormat::R8 },
|
||||
{ DDPF_ALPHA, TextureFormat::R8 },
|
||||
{ DDS_R16F, TextureFormat::R16F },
|
||||
{ DDS_R32F, TextureFormat::R32F },
|
||||
{ DDS_A8L8, TextureFormat::RG8 },
|
||||
{ DDS_G16R16, TextureFormat::RG16 },
|
||||
{ DDS_G16R16F, TextureFormat::RG16F },
|
||||
{ DDS_G32R32F, TextureFormat::RG32F },
|
||||
{ DDS_A8R8G8B8, TextureFormat::BGRA8 },
|
||||
{ DDS_A16B16G16R16, TextureFormat::RGBA16 },
|
||||
{ DDS_A16B16G16R16F, TextureFormat::RGBA16F },
|
||||
{ DDS_A32B32G32R32F, TextureFormat::RGBA32F },
|
||||
{ DDS_R5G6B5, TextureFormat::R5G6B5 },
|
||||
{ DDS_A4R4G4B4, TextureFormat::RGBA4 },
|
||||
{ DDS_A1R5G5B5, TextureFormat::RGB5A1 },
|
||||
{ DDS_A2B10G10R10, TextureFormat::RGB10A2 },
|
||||
{ DDS_DXT1, TextureFormat::BC1, false },
|
||||
{ DDS_DXT2, TextureFormat::BC2, false },
|
||||
{ DDS_DXT3, TextureFormat::BC2, false },
|
||||
{ DDS_DXT4, TextureFormat::BC3, false },
|
||||
{ DDS_DXT5, TextureFormat::BC3, false },
|
||||
{ DDS_ATI1, TextureFormat::BC4, false },
|
||||
{ DDS_BC4U, TextureFormat::BC4, false },
|
||||
{ DDS_ATI2, TextureFormat::BC5, false },
|
||||
{ DDS_BC5U, TextureFormat::BC5, false },
|
||||
{ DDS_A16B16G16R16, TextureFormat::RGBA16, false },
|
||||
{ DDS_A16B16G16R16F, TextureFormat::RGBA16F, false },
|
||||
{ DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8, false },
|
||||
{ DDPF_INDEXED, TextureFormat::R8, false },
|
||||
{ DDPF_LUMINANCE, TextureFormat::R8, false },
|
||||
{ DDPF_ALPHA, TextureFormat::R8, false },
|
||||
{ DDS_R16F, TextureFormat::R16F, false },
|
||||
{ DDS_R32F, TextureFormat::R32F, false },
|
||||
{ DDS_A8L8, TextureFormat::RG8, false },
|
||||
{ DDS_G16R16, TextureFormat::RG16, false },
|
||||
{ DDS_G16R16F, TextureFormat::RG16F, false },
|
||||
{ DDS_G32R32F, TextureFormat::RG32F, false },
|
||||
{ DDS_A8R8G8B8, TextureFormat::BGRA8, false },
|
||||
{ DDS_A16B16G16R16, TextureFormat::RGBA16, false },
|
||||
{ DDS_A16B16G16R16F, TextureFormat::RGBA16F, false },
|
||||
{ DDS_A32B32G32R32F, TextureFormat::RGBA32F, false },
|
||||
{ DDS_R5G6B5, TextureFormat::R5G6B5, false },
|
||||
{ DDS_A4R4G4B4, TextureFormat::RGBA4, false },
|
||||
{ DDS_A1R5G5B5, TextureFormat::RGB5A1, false },
|
||||
{ DDS_A2B10G10R10, TextureFormat::RGB10A2, false },
|
||||
};
|
||||
|
||||
static TranslateDdsFormat s_translateDxgiFormat[] =
|
||||
{
|
||||
{ DDS_FORMAT_BC1_UNORM, TextureFormat::BC1 },
|
||||
{ DDS_FORMAT_BC2_UNORM, TextureFormat::BC2 },
|
||||
{ DDS_FORMAT_BC3_UNORM, TextureFormat::BC3 },
|
||||
{ DDS_FORMAT_BC4_UNORM, TextureFormat::BC4 },
|
||||
{ DDS_FORMAT_BC5_UNORM, TextureFormat::BC5 },
|
||||
{ DDS_FORMAT_BC6H_SF16, TextureFormat::BC6H },
|
||||
{ DDS_FORMAT_BC7_UNORM, TextureFormat::BC7 },
|
||||
{ DDS_FORMAT_BC1_UNORM, TextureFormat::BC1, false },
|
||||
{ DDS_FORMAT_BC1_UNORM_SRGB, TextureFormat::BC1, true },
|
||||
{ DDS_FORMAT_BC2_UNORM, TextureFormat::BC2, false },
|
||||
{ DDS_FORMAT_BC2_UNORM_SRGB, TextureFormat::BC2, true },
|
||||
{ DDS_FORMAT_BC3_UNORM, TextureFormat::BC3, false },
|
||||
{ DDS_FORMAT_BC3_UNORM_SRGB, TextureFormat::BC3, true },
|
||||
{ DDS_FORMAT_BC4_UNORM, TextureFormat::BC4, false },
|
||||
{ DDS_FORMAT_BC5_UNORM, TextureFormat::BC5, false },
|
||||
{ DDS_FORMAT_BC6H_SF16, TextureFormat::BC6H, false },
|
||||
{ DDS_FORMAT_BC7_UNORM, TextureFormat::BC7, false },
|
||||
{ DDS_FORMAT_BC7_UNORM_SRGB, TextureFormat::BC7, true },
|
||||
|
||||
{ DDS_FORMAT_R8_UNORM, TextureFormat::R8 },
|
||||
{ DDS_FORMAT_R16_UNORM, TextureFormat::R16 },
|
||||
{ DDS_FORMAT_R16_FLOAT, TextureFormat::R16F },
|
||||
{ DDS_FORMAT_R32_UINT, TextureFormat::R32 },
|
||||
{ DDS_FORMAT_R32_FLOAT, TextureFormat::R32F },
|
||||
{ DDS_FORMAT_R8G8_UNORM, TextureFormat::RG8 },
|
||||
{ DDS_FORMAT_R16G16_UNORM, TextureFormat::RG16 },
|
||||
{ DDS_FORMAT_R16G16_FLOAT, TextureFormat::RG16F },
|
||||
{ DDS_FORMAT_R32G32_UINT, TextureFormat::RG32 },
|
||||
{ DDS_FORMAT_R32G32_FLOAT, TextureFormat::RG32F },
|
||||
{ DDS_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8 },
|
||||
{ DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16 },
|
||||
{ DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
|
||||
{ DDS_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32 },
|
||||
{ DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
|
||||
{ DDS_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5 },
|
||||
{ DDS_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4 },
|
||||
{ DDS_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1 },
|
||||
{ DDS_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2 },
|
||||
{ DDS_FORMAT_R1_UNORM, TextureFormat::R1, false },
|
||||
{ DDS_FORMAT_R8_UNORM, TextureFormat::R8, false },
|
||||
{ DDS_FORMAT_R16_UNORM, TextureFormat::R16, false },
|
||||
{ DDS_FORMAT_R16_FLOAT, TextureFormat::R16F, false },
|
||||
{ DDS_FORMAT_R32_UINT, TextureFormat::R32, false },
|
||||
{ DDS_FORMAT_R32_FLOAT, TextureFormat::R32F, false },
|
||||
{ DDS_FORMAT_R8G8_UNORM, TextureFormat::RG8, false },
|
||||
{ DDS_FORMAT_R16G16_UNORM, TextureFormat::RG16, false },
|
||||
{ DDS_FORMAT_R16G16_FLOAT, TextureFormat::RG16F, false },
|
||||
{ DDS_FORMAT_R32G32_UINT, TextureFormat::RG32, false },
|
||||
{ DDS_FORMAT_R32G32_FLOAT, TextureFormat::RG32F, false },
|
||||
{ DDS_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8, false },
|
||||
{ DDS_FORMAT_B8G8R8A8_UNORM_SRGB, TextureFormat::BGRA8, true },
|
||||
{ DDS_FORMAT_R8G8B8A8_UNORM, TextureFormat::RGBA8, false },
|
||||
{ DDS_FORMAT_R8G8B8A8_UNORM_SRGB, TextureFormat::RGBA8, true },
|
||||
{ DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16, false },
|
||||
{ DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F, false },
|
||||
{ DDS_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32, false },
|
||||
{ DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F, false },
|
||||
{ DDS_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5, false },
|
||||
{ DDS_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4, false },
|
||||
{ DDS_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1, false },
|
||||
{ DDS_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2, false },
|
||||
{ DDS_FORMAT_R11G11B10_FLOAT, TextureFormat::R11G11B10F, false },
|
||||
};
|
||||
|
||||
struct TranslateDdsPixelFormat
|
||||
@ -1496,6 +1515,7 @@ namespace bgfx
|
||||
|
||||
TextureFormat::Enum format = TextureFormat::Unknown;
|
||||
bool hasAlpha = pixelFlags & DDPF_ALPHAPIXELS;
|
||||
bool srgb = false;
|
||||
|
||||
if (dxgiFormat == 0)
|
||||
{
|
||||
@ -1534,6 +1554,7 @@ namespace bgfx
|
||||
if (s_translateDxgiFormat[ii].m_format == dxgiFormat)
|
||||
{
|
||||
format = s_translateDxgiFormat[ii].m_textureFormat;
|
||||
srgb = s_translateDxgiFormat[ii].m_srgb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1550,6 +1571,7 @@ namespace bgfx
|
||||
_imageContainer.m_hasAlpha = hasAlpha;
|
||||
_imageContainer.m_cubeMap = cubeMap;
|
||||
_imageContainer.m_ktx = false;
|
||||
_imageContainer.m_srgb = srgb;
|
||||
|
||||
return TextureFormat::Unknown != format;
|
||||
}
|
||||
@ -1873,6 +1895,7 @@ namespace bgfx
|
||||
_imageContainer.m_hasAlpha = hasAlpha;
|
||||
_imageContainer.m_cubeMap = numFaces > 1;
|
||||
_imageContainer.m_ktx = false;
|
||||
_imageContainer.m_srgb = colorSpace > 0;
|
||||
|
||||
return TextureFormat::Unknown != format;
|
||||
}
|
||||
@ -1918,6 +1941,7 @@ namespace bgfx
|
||||
_imageContainer.m_hasAlpha = false;
|
||||
_imageContainer.m_cubeMap = tc.m_cubeMap;
|
||||
_imageContainer.m_ktx = false;
|
||||
_imageContainer.m_srgb = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
1
3rdparty/bgfx/src/image.h
vendored
1
3rdparty/bgfx/src/image.h
vendored
@ -23,6 +23,7 @@ namespace bgfx
|
||||
bool m_hasAlpha;
|
||||
bool m_cubeMap;
|
||||
bool m_ktx;
|
||||
bool m_srgb;
|
||||
};
|
||||
|
||||
struct ImageMip
|
||||
|
9
3rdparty/bgfx/src/ovr.cpp
vendored
9
3rdparty/bgfx/src/ovr.cpp
vendored
@ -65,6 +65,7 @@ namespace bgfx
|
||||
break;
|
||||
#endif // BGFX_CONFIG_RENDERER_OPENGL
|
||||
|
||||
case ovrRenderAPI_None:
|
||||
default:
|
||||
BX_CHECK(false, "You should not be here!");
|
||||
break;
|
||||
@ -117,6 +118,7 @@ namespace bgfx
|
||||
| ovrDistortionCap_TimeWarp
|
||||
| ovrDistortionCap_Overdrive
|
||||
| ovrDistortionCap_NoRestore
|
||||
| ovrDistortionCap_HqDistortion
|
||||
, eyeFov
|
||||
, m_erd
|
||||
);
|
||||
@ -174,6 +176,13 @@ ovrError:
|
||||
m_texture[1].Header.RenderViewport = rect;
|
||||
|
||||
m_timing = ovrHmd_BeginFrame(m_hmd, 0);
|
||||
#if OVR_VERSION > OVR_VERSION_042
|
||||
m_pose[0] = ovrHmd_GetHmdPosePerEye(m_hmd, ovrEye_Left);
|
||||
m_pose[1] = ovrHmd_GetHmdPosePerEye(m_hmd, ovrEye_Right);
|
||||
#else
|
||||
m_pose[0] = ovrHmd_GetEyePose(m_hmd, ovrEye_Left);
|
||||
m_pose[1] = ovrHmd_GetEyePose(m_hmd, ovrEye_Right);
|
||||
#endif // OVR_VERSION > OVR_VERSION_042
|
||||
}
|
||||
}
|
||||
|
||||
|
5
3rdparty/bgfx/src/renderdoc.cpp
vendored
5
3rdparty/bgfx/src/renderdoc.cpp
vendored
@ -56,6 +56,7 @@ namespace bgfx
|
||||
}
|
||||
|
||||
#define RENDERDOC_IMPORT \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_Shutdown); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetLogFile); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_GetCapture); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetCaptureOptions); \
|
||||
@ -67,7 +68,8 @@ namespace bgfx
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_MaskOverlayBits); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetFocusToggleKeys); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_SetCaptureKeys); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_InitRemoteAccess);
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_InitRemoteAccess); \
|
||||
RENDERDOC_IMPORT_FUNC(RENDERDOC_UnloadCrashHandler);
|
||||
|
||||
#define RENDERDOC_IMPORT_FUNC(_func) p##_func _func
|
||||
RENDERDOC_IMPORT
|
||||
@ -129,6 +131,7 @@ RENDERDOC_IMPORT
|
||||
{
|
||||
if (NULL != _renderdocdll)
|
||||
{
|
||||
RENDERDOC_Shutdown();
|
||||
bx::dlclose(_renderdocdll);
|
||||
}
|
||||
}
|
||||
|
15
3rdparty/bgfx/src/renderer.h
vendored
15
3rdparty/bgfx/src/renderer.h
vendored
@ -12,12 +12,19 @@ namespace bgfx
|
||||
{
|
||||
struct ViewState
|
||||
{
|
||||
ViewState() { }
|
||||
ViewState(Frame* _render, bool _hmdEnabled)
|
||||
: m_alphaRef(0.0f)
|
||||
, m_invViewCached(UINT16_MAX)
|
||||
, m_invProjCached(UINT16_MAX)
|
||||
, m_invViewProjCached(UINT16_MAX)
|
||||
{
|
||||
reset(_render, _hmdEnabled);
|
||||
}
|
||||
|
||||
void reset(Frame* _render, bool _hmdEnabled)
|
||||
{
|
||||
m_alphaRef = 0.0f;
|
||||
m_invViewCached = UINT16_MAX;
|
||||
m_invProjCached = UINT16_MAX;
|
||||
m_invViewProjCached = UINT16_MAX;
|
||||
|
||||
m_view[0] = _render->m_view;
|
||||
m_view[1] = m_viewTmp[1];
|
||||
|
||||
|
1333
3rdparty/bgfx/src/renderer_d3d11.cpp
vendored
1333
3rdparty/bgfx/src/renderer_d3d11.cpp
vendored
File diff suppressed because it is too large
Load Diff
54
3rdparty/bgfx/src/renderer_d3d11.h
vendored
54
3rdparty/bgfx/src/renderer_d3d11.h
vendored
@ -19,10 +19,10 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wpragmas");
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4005) // warning C4005: '' : macro redefinition
|
||||
#define D3D11_NO_HELPERS
|
||||
#if BX_PLATFORM_WINRT
|
||||
#include <d3d11_2.h>
|
||||
# include <d3d11_2.h>
|
||||
#else
|
||||
#include <d3d11.h>
|
||||
#endif
|
||||
# include <d3d11.h>
|
||||
#endif // BX_PLATFORM_WINRT
|
||||
BX_PRAGMA_DIAGNOSTIC_POP()
|
||||
|
||||
#include "renderer.h"
|
||||
@ -75,21 +75,8 @@ BX_PRAGMA_DIAGNOSTIC_POP()
|
||||
# define D3D11_REQ_MAXANISOTROPY 16
|
||||
# endif // D3D11_REQ_MAXANISOTROPY
|
||||
|
||||
# ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT
|
||||
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT
|
||||
{
|
||||
DXGI_FORMAT InFormat;
|
||||
UINT OutFormatSupport;
|
||||
} D3D11_FEATURE_DATA_FORMAT_SUPPORT;
|
||||
# endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT
|
||||
typedef void ID3D11InfoQueue;
|
||||
|
||||
# ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT2
|
||||
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2
|
||||
{
|
||||
DXGI_FORMAT InFormat;
|
||||
UINT OutFormatSupport2;
|
||||
} D3D11_FEATURE_DATA_FORMAT_SUPPORT2;
|
||||
# endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT2
|
||||
#endif // __MINGW32__
|
||||
|
||||
namespace bgfx { namespace d3d11
|
||||
@ -105,7 +92,7 @@ namespace bgfx { namespace d3d11
|
||||
{
|
||||
}
|
||||
|
||||
void create(uint32_t _size, void* _data, uint8_t _flags, uint16_t _stride = 0, bool _vertex = false);
|
||||
void create(uint32_t _size, void* _data, uint16_t _flags, uint16_t _stride = 0, bool _vertex = false);
|
||||
void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false);
|
||||
|
||||
void destroy()
|
||||
@ -124,7 +111,7 @@ namespace bgfx { namespace d3d11
|
||||
ID3D11ShaderResourceView* m_srv;
|
||||
ID3D11UnorderedAccessView* m_uav;
|
||||
uint32_t m_size;
|
||||
uint8_t m_flags;
|
||||
uint16_t m_flags;
|
||||
bool m_dynamic;
|
||||
};
|
||||
|
||||
@ -137,7 +124,7 @@ namespace bgfx { namespace d3d11
|
||||
{
|
||||
}
|
||||
|
||||
void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint8_t _flags);
|
||||
void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags);
|
||||
|
||||
VertexDeclHandle m_decl;
|
||||
};
|
||||
@ -310,6 +297,33 @@ namespace bgfx { namespace d3d11
|
||||
TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
|
||||
};
|
||||
|
||||
struct TimerQueryD3D11
|
||||
{
|
||||
TimerQueryD3D11()
|
||||
: m_control(BX_COUNTOF(m_frame) )
|
||||
{
|
||||
}
|
||||
|
||||
void postReset();
|
||||
void preReset();
|
||||
void begin();
|
||||
void end();
|
||||
bool get();
|
||||
|
||||
struct Frame
|
||||
{
|
||||
ID3D11Query* m_disjoint;
|
||||
ID3D11Query* m_start;
|
||||
ID3D11Query* m_end;
|
||||
};
|
||||
|
||||
uint64_t m_elapsed;
|
||||
uint64_t m_frequency;
|
||||
|
||||
Frame m_frame[4];
|
||||
bx::RingBufferControl m_control;
|
||||
};
|
||||
|
||||
} /* namespace d3d11 */ } // namespace bgfx
|
||||
|
||||
#endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD
|
||||
|
200
3rdparty/bgfx/src/renderer_d3d9.cpp
vendored
200
3rdparty/bgfx/src/renderer_d3d9.cpp
vendored
@ -272,6 +272,8 @@ namespace bgfx { namespace d3d9
|
||||
RendererContextD3D9()
|
||||
: m_d3d9(NULL)
|
||||
, m_device(NULL)
|
||||
, m_flushQuery(NULL)
|
||||
, m_swapChain(NULL)
|
||||
, m_captureTexture(NULL)
|
||||
, m_captureSurface(NULL)
|
||||
, m_captureResolve(NULL)
|
||||
@ -316,7 +318,7 @@ namespace bgfx { namespace d3d9
|
||||
m_params.Windowed = true;
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(g_bgfxHwnd, &rect);
|
||||
GetWindowRect( (HWND)g_platformData.nwh, &rect);
|
||||
m_params.BackBufferWidth = rect.right-rect.left;
|
||||
m_params.BackBufferHeight = rect.bottom-rect.top;
|
||||
|
||||
@ -356,8 +358,11 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
BGFX_FATAL(m_d3d9, Fatal::UnableToInitialize, "Unable to create Direct3D.");
|
||||
|
||||
m_adapter = D3DADAPTER_DEFAULT;
|
||||
m_deviceType = D3DDEVTYPE_HAL;
|
||||
m_adapter = D3DADAPTER_DEFAULT;
|
||||
m_deviceType = BGFX_PCI_ID_SOFTWARE_RASTERIZER == g_caps.vendorId
|
||||
? D3DDEVTYPE_REF
|
||||
: D3DDEVTYPE_HAL
|
||||
;
|
||||
|
||||
uint8_t numGPUs = uint8_t(bx::uint32_min(BX_COUNTOF(g_caps.gpu), m_d3d9->GetAdapterCount() ) );
|
||||
for (uint32_t ii = 0; ii < numGPUs; ++ii)
|
||||
@ -402,7 +407,10 @@ namespace bgfx { namespace d3d9
|
||||
DX_CHECK(m_d3d9->GetAdapterIdentifier(m_adapter, 0, &m_identifier) );
|
||||
m_amd = m_identifier.VendorId == BGFX_PCI_ID_AMD;
|
||||
m_nvidia = m_identifier.VendorId == BGFX_PCI_ID_NVIDIA;
|
||||
g_caps.vendorId = (uint16_t)m_identifier.VendorId;
|
||||
g_caps.vendorId = 0 == m_identifier.VendorId
|
||||
? BGFX_PCI_ID_SOFTWARE_RASTERIZER
|
||||
: (uint16_t)m_identifier.VendorId
|
||||
;
|
||||
g_caps.deviceId = (uint16_t)m_identifier.DeviceId;
|
||||
|
||||
uint32_t behaviorFlags[] =
|
||||
@ -417,7 +425,7 @@ namespace bgfx { namespace d3d9
|
||||
#if 0 // BGFX_CONFIG_RENDERER_DIRECT3D9EX
|
||||
DX_CHECK(m_d3d9->CreateDeviceEx(m_adapter
|
||||
, m_deviceType
|
||||
, g_bgfxHwnd
|
||||
, g_platformHooks.nwh
|
||||
, behaviorFlags[ii]
|
||||
, &m_params
|
||||
, NULL
|
||||
@ -426,7 +434,7 @@ namespace bgfx { namespace d3d9
|
||||
#else
|
||||
DX_CHECK(m_d3d9->CreateDevice(m_adapter
|
||||
, m_deviceType
|
||||
, g_bgfxHwnd
|
||||
, (HWND)g_platformData.nwh
|
||||
, behaviorFlags[ii]
|
||||
, &m_params
|
||||
, &m_device
|
||||
@ -524,6 +532,14 @@ namespace bgfx { namespace d3d9
|
||||
, s_textureFormat[ii].m_fmt
|
||||
) ) ? BGFX_CAPS_FORMAT_TEXTURE_COLOR : BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
||||
|
||||
support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
|
||||
, m_deviceType
|
||||
, adapterFormat
|
||||
, D3DUSAGE_QUERY_SRGBREAD
|
||||
, D3DRTYPE_TEXTURE
|
||||
, s_textureFormat[ii].m_fmt
|
||||
) ) ? BGFX_CAPS_FORMAT_TEXTURE_COLOR_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
||||
|
||||
support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
|
||||
, m_deviceType
|
||||
, adapterFormat
|
||||
@ -532,6 +548,14 @@ namespace bgfx { namespace d3d9
|
||||
, s_textureFormat[ii].m_fmt
|
||||
) ) ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX : BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
||||
|
||||
support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
|
||||
, m_deviceType
|
||||
, adapterFormat
|
||||
, isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET
|
||||
, D3DRTYPE_TEXTURE
|
||||
, s_textureFormat[ii].m_fmt
|
||||
) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
||||
|
||||
g_caps.formats[ii] = support;
|
||||
}
|
||||
}
|
||||
@ -671,7 +695,7 @@ namespace bgfx { namespace d3d9
|
||||
return BGFX_RENDERER_DIRECT3D9_NAME;
|
||||
}
|
||||
|
||||
void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint8_t _flags) BX_OVERRIDE
|
||||
void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE
|
||||
{
|
||||
m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags);
|
||||
}
|
||||
@ -691,7 +715,7 @@ namespace bgfx { namespace d3d9
|
||||
m_vertexDecls[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint8_t /*_flags*/) BX_OVERRIDE
|
||||
void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t /*_flags*/) BX_OVERRIDE
|
||||
{
|
||||
m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle);
|
||||
}
|
||||
@ -701,7 +725,7 @@ namespace bgfx { namespace d3d9
|
||||
m_vertexBuffers[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint8_t _flags) BX_OVERRIDE
|
||||
void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE
|
||||
{
|
||||
m_indexBuffers[_handle.idx].create(_size, NULL, _flags);
|
||||
}
|
||||
@ -716,7 +740,7 @@ namespace bgfx { namespace d3d9
|
||||
m_indexBuffers[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint8_t /*_flags*/) BX_OVERRIDE
|
||||
void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t /*_flags*/) BX_OVERRIDE
|
||||
{
|
||||
VertexDeclHandle decl = BGFX_INVALID_HANDLE;
|
||||
m_vertexBuffers[_handle.idx].create(_size, NULL, decl);
|
||||
@ -860,11 +884,11 @@ namespace bgfx { namespace d3d9
|
||||
) );
|
||||
|
||||
RECT rc;
|
||||
GetClientRect(g_bgfxHwnd, &rc);
|
||||
GetClientRect( (HWND)g_platformData.nwh, &rc);
|
||||
POINT point;
|
||||
point.x = rc.left;
|
||||
point.y = rc.top;
|
||||
ClientToScreen(g_bgfxHwnd, &point);
|
||||
ClientToScreen( (HWND)g_platformData.nwh, &point);
|
||||
uint8_t* data = (uint8_t*)rect.pBits;
|
||||
uint32_t bytesPerPixel = rect.Pitch/dm.Width;
|
||||
|
||||
@ -1070,6 +1094,8 @@ namespace bgfx { namespace d3d9
|
||||
DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
|
||||
}
|
||||
DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) );
|
||||
|
||||
DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_flags & BGFX_RESET_SRGB_BACKBUFFER) ));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1091,6 +1117,8 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
IDirect3DSurface9* depthStencil = frameBuffer.m_depthStencil;
|
||||
DX_CHECK(m_device->SetDepthStencilSurface(NULL != depthStencil ? depthStencil : m_backBufferDepthStencil) );
|
||||
|
||||
DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE) );
|
||||
}
|
||||
|
||||
m_fbh = _fbh;
|
||||
@ -1146,7 +1174,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
void flip(HMD& /*_hmd*/) BX_OVERRIDE
|
||||
{
|
||||
if (NULL != m_device)
|
||||
if (NULL != m_swapChain)
|
||||
{
|
||||
#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
|
||||
if (NULL != m_deviceEx)
|
||||
@ -1160,7 +1188,7 @@ namespace bgfx { namespace d3d9
|
||||
HRESULT hr;
|
||||
if (0 == ii)
|
||||
{
|
||||
hr = m_swapChain->Present(NULL, NULL, g_bgfxHwnd, NULL, 0);
|
||||
hr = m_swapChain->Present(NULL, NULL, (HWND)g_platformData.nwh, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1220,6 +1248,9 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
capturePreReset();
|
||||
|
||||
DX_RELEASE(m_flushQuery, 0);
|
||||
m_gpuTimer.preReset();
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii)
|
||||
{
|
||||
m_indexBuffers[ii].preReset();
|
||||
@ -1247,6 +1278,9 @@ namespace bgfx { namespace d3d9
|
||||
DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_backBufferColor) );
|
||||
DX_CHECK(m_device->GetDepthStencilSurface(&m_backBufferDepthStencil) );
|
||||
|
||||
DX_CHECK(m_device->CreateQuery(D3DQUERYTYPE_EVENT, &m_flushQuery) );
|
||||
m_gpuTimer.postReset();
|
||||
|
||||
capturePostReset();
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii)
|
||||
@ -1281,7 +1315,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
void setSamplerState(uint8_t _stage, uint32_t _flags, bool _vertex = false)
|
||||
{
|
||||
const uint32_t flags = _flags&( (~BGFX_TEXTURE_RESERVED_MASK) | BGFX_TEXTURE_SAMPLER_BITS_MASK);
|
||||
const uint32_t flags = _flags&( (~BGFX_TEXTURE_RESERVED_MASK) | BGFX_TEXTURE_SAMPLER_BITS_MASK | BGFX_TEXTURE_SRGB);
|
||||
BX_CHECK(_stage < BX_COUNTOF(m_samplerFlags), "");
|
||||
if (m_samplerFlags[_stage][_vertex] != flags)
|
||||
{
|
||||
@ -1303,6 +1337,7 @@ namespace bgfx { namespace d3d9
|
||||
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MAGFILTER, magFilter) );
|
||||
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MIPFILTER, mipFilter) );
|
||||
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, m_maxAnisotropy) );
|
||||
DX_CHECK(device->SetSamplerState(stage, D3DSAMP_SRGBTEXTURE, 0 != (flags & BGFX_TEXTURE_SRGB)) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1579,22 +1614,29 @@ namespace bgfx { namespace d3d9
|
||||
DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) );
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) );
|
||||
|
||||
if (BGFX_CLEAR_DEPTH & _clear.m_flags)
|
||||
if (BGFX_CLEAR_COLOR & _clear.m_flags)
|
||||
{
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) );
|
||||
DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE
|
||||
, D3DCOLORWRITEENABLE_RED
|
||||
| D3DCOLORWRITEENABLE_GREEN
|
||||
| D3DCOLORWRITEENABLE_BLUE
|
||||
| D3DCOLORWRITEENABLE_ALPHA
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, 0) );
|
||||
}
|
||||
|
||||
if (BGFX_CLEAR_DEPTH & _clear.m_flags)
|
||||
{
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) );
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, TRUE) );
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS) );
|
||||
}
|
||||
else
|
||||
{
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE) );
|
||||
DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, 0) );
|
||||
DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, FALSE) );
|
||||
}
|
||||
|
||||
@ -1699,8 +1741,10 @@ namespace bgfx { namespace d3d9
|
||||
IDirect3DDevice9Ex* m_deviceEx;
|
||||
#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
|
||||
|
||||
IDirect3D9* m_d3d9;
|
||||
IDirect3D9* m_d3d9;
|
||||
IDirect3DDevice9* m_device;
|
||||
IDirect3DQuery9* m_flushQuery;
|
||||
TimerQueryD3D9 m_gpuTimer;
|
||||
D3DPOOL m_pool;
|
||||
|
||||
IDirect3DSwapChain9* m_swapChain;
|
||||
@ -1772,7 +1816,7 @@ namespace bgfx { namespace d3d9
|
||||
s_renderD3D9 = NULL;
|
||||
}
|
||||
|
||||
void IndexBufferD3D9::create(uint32_t _size, void* _data, uint8_t _flags)
|
||||
void IndexBufferD3D9::create(uint32_t _size, void* _data, uint16_t _flags)
|
||||
{
|
||||
m_size = _size;
|
||||
m_flags = _flags;
|
||||
@ -2416,6 +2460,11 @@ namespace bgfx { namespace d3d9
|
||||
createTexture(textureWidth, textureHeight, numMips);
|
||||
}
|
||||
|
||||
if (imageContainer.m_srgb)
|
||||
{
|
||||
m_flags |= BGFX_TEXTURE_SRGB;
|
||||
}
|
||||
|
||||
BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s."
|
||||
, this - s_renderD3D9->m_textures
|
||||
, getName( (TextureFormat::Enum)m_textureFormat)
|
||||
@ -2867,6 +2916,84 @@ namespace bgfx { namespace d3d9
|
||||
) );
|
||||
}
|
||||
|
||||
void TimerQueryD3D9::postReset()
|
||||
{
|
||||
IDirect3DDevice9* device = s_renderD3D9->m_device;
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii)
|
||||
{
|
||||
Frame& frame = m_frame[ii];
|
||||
DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMPDISJOINT, &frame.m_disjoint) );
|
||||
DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &frame.m_start) );
|
||||
DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &frame.m_end) );
|
||||
DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMPFREQ, &frame.m_freq) );
|
||||
}
|
||||
|
||||
m_elapsed = 0;
|
||||
m_frequency = 1;
|
||||
m_control.reset();
|
||||
}
|
||||
|
||||
void TimerQueryD3D9::preReset()
|
||||
{
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii)
|
||||
{
|
||||
Frame& frame = m_frame[ii];
|
||||
DX_RELEASE(frame.m_disjoint, 0);
|
||||
DX_RELEASE(frame.m_start, 0);
|
||||
DX_RELEASE(frame.m_end, 0);
|
||||
DX_RELEASE(frame.m_freq, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void TimerQueryD3D9::begin()
|
||||
{
|
||||
while (0 == m_control.reserve(1) )
|
||||
{
|
||||
get();
|
||||
}
|
||||
|
||||
Frame& frame = m_frame[m_control.m_current];
|
||||
frame.m_disjoint->Issue(D3DISSUE_BEGIN);
|
||||
frame.m_start->Issue(D3DISSUE_END);
|
||||
}
|
||||
|
||||
void TimerQueryD3D9::end()
|
||||
{
|
||||
Frame& frame = m_frame[m_control.m_current];
|
||||
frame.m_end->Issue(D3DISSUE_END);
|
||||
frame.m_freq->Issue(D3DISSUE_END);
|
||||
m_control.commit(1);
|
||||
}
|
||||
|
||||
bool TimerQueryD3D9::get()
|
||||
{
|
||||
if (0 != m_control.available() )
|
||||
{
|
||||
Frame& frame = m_frame[m_control.m_read];
|
||||
|
||||
uint64_t freq;
|
||||
HRESULT hr = frame.m_freq->GetData(&freq, sizeof(freq), 0);
|
||||
if (S_OK == hr)
|
||||
{
|
||||
m_control.consume(1);
|
||||
|
||||
uint64_t start;
|
||||
DX_CHECK(frame.m_start->GetData(&start, sizeof(start), 0) );
|
||||
|
||||
uint64_t end;
|
||||
DX_CHECK(frame.m_end->GetData(&end, sizeof(end), 0) );
|
||||
|
||||
m_frequency = freq;
|
||||
m_elapsed = end - start;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RendererContextD3D9::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter)
|
||||
{
|
||||
IDirect3DDevice9* device = m_device;
|
||||
@ -2880,6 +3007,11 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
device->BeginScene();
|
||||
|
||||
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
||||
{
|
||||
m_gpuTimer.begin();
|
||||
}
|
||||
|
||||
if (0 < _render->m_iboffset)
|
||||
{
|
||||
TransientIndexBuffer* ib = _render->m_transientIb;
|
||||
@ -3404,6 +3536,12 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
if (0 < _render->m_num)
|
||||
{
|
||||
if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) )
|
||||
{
|
||||
m_flushQuery->Issue(D3DISSUE_END);
|
||||
m_flushQuery->GetData(NULL, 0, D3DGETDATA_FLUSH);
|
||||
}
|
||||
|
||||
captureElapsed = -bx::getHPCounter();
|
||||
capture();
|
||||
captureElapsed += bx::getHPCounter();
|
||||
@ -3428,6 +3566,20 @@ namespace bgfx { namespace d3d9
|
||||
{
|
||||
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
|
||||
|
||||
static uint32_t maxGpuLatency = 0;
|
||||
static double maxGpuElapsed = 0.0f;
|
||||
double elapsedGpuMs = 0.0;
|
||||
|
||||
m_gpuTimer.end();
|
||||
|
||||
while (m_gpuTimer.get() )
|
||||
{
|
||||
double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency);
|
||||
elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs;
|
||||
maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed;
|
||||
}
|
||||
maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1);
|
||||
|
||||
TextVideoMem& tvm = m_textVideoMem;
|
||||
|
||||
static int64_t next = now;
|
||||
@ -3465,12 +3617,18 @@ namespace bgfx { namespace d3d9
|
||||
);
|
||||
|
||||
double elapsedCpuMs = double(elapsed)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms]"
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms] %c GPU %3.4f [ms] (latency %d)"
|
||||
, _render->m_num
|
||||
, statsKeyType[0]
|
||||
, statsKeyType[1]
|
||||
, elapsedCpuMs
|
||||
, elapsedCpuMs > maxGpuElapsed ? '>' : '<'
|
||||
, maxGpuElapsed
|
||||
, maxGpuLatency
|
||||
);
|
||||
maxGpuLatency = 0;
|
||||
maxGpuElapsed = 0.0;
|
||||
|
||||
for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii)
|
||||
{
|
||||
tvm.printf(10, pos++, 0x8e, " %9s: %7d (#inst: %5d), submitted: %7d"
|
||||
|
32
3rdparty/bgfx/src/renderer_d3d9.h
vendored
32
3rdparty/bgfx/src/renderer_d3d9.h
vendored
@ -135,7 +135,7 @@ namespace bgfx { namespace d3d9
|
||||
{
|
||||
}
|
||||
|
||||
void create(uint32_t _size, void* _data, uint8_t _flags);
|
||||
void create(uint32_t _size, void* _data, uint16_t _flags);
|
||||
void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false)
|
||||
{
|
||||
void* buffer;
|
||||
@ -164,7 +164,7 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
IDirect3DIndexBuffer9* m_ptr;
|
||||
uint32_t m_size;
|
||||
uint8_t m_flags;
|
||||
uint16_t m_flags;
|
||||
bool m_dynamic;
|
||||
};
|
||||
|
||||
@ -389,6 +389,34 @@ namespace bgfx { namespace d3d9
|
||||
bool m_needResolve;
|
||||
};
|
||||
|
||||
struct TimerQueryD3D9
|
||||
{
|
||||
TimerQueryD3D9()
|
||||
: m_control(BX_COUNTOF(m_frame) )
|
||||
{
|
||||
}
|
||||
|
||||
void postReset();
|
||||
void preReset();
|
||||
void begin();
|
||||
void end();
|
||||
bool get();
|
||||
|
||||
struct Frame
|
||||
{
|
||||
IDirect3DQuery9* m_disjoint;
|
||||
IDirect3DQuery9* m_start;
|
||||
IDirect3DQuery9* m_end;
|
||||
IDirect3DQuery9* m_freq;
|
||||
};
|
||||
|
||||
uint64_t m_elapsed;
|
||||
uint64_t m_frequency;
|
||||
|
||||
Frame m_frame[4];
|
||||
bx::RingBufferControl m_control;
|
||||
};
|
||||
|
||||
} /* namespace d3d9 */ } // namespace bgfx
|
||||
|
||||
#endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD
|
||||
|
706
3rdparty/bgfx/src/renderer_gl.cpp
vendored
706
3rdparty/bgfx/src/renderer_gl.cpp
vendored
File diff suppressed because it is too large
Load Diff
112
3rdparty/bgfx/src/renderer_gl.h
vendored
112
3rdparty/bgfx/src/renderer_gl.h
vendored
@ -305,6 +305,22 @@ typedef uint64_t GLuint64;
|
||||
# define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
|
||||
#endif // GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT
|
||||
# define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
|
||||
#endif // GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT
|
||||
# define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
|
||||
#endif // GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT
|
||||
# define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
|
||||
#endif // GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT
|
||||
# define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
|
||||
#endif // GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
|
||||
# define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
|
||||
#endif // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
|
||||
@ -321,6 +337,30 @@ typedef uint64_t GLuint64;
|
||||
# define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
|
||||
#endif // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
|
||||
|
||||
#ifndef GL_SRGB8_ALPHA8
|
||||
# define GL_SRGB8_ALPHA8 0x8C43
|
||||
#endif // GL_SRGB8_ALPHA8
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
|
||||
# define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
|
||||
#endif // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
|
||||
# define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
|
||||
#endif // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
|
||||
# define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
|
||||
#endif // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB8_ETC2
|
||||
# define GL_COMPRESSED_SRGB8_ETC2 0x9275
|
||||
#endif // GL_COMPRESSED_SRGB8_ETC2
|
||||
|
||||
#ifndef GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
|
||||
# define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
|
||||
#endif // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
|
||||
|
||||
#ifndef GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
|
||||
# define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
|
||||
#endif // GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
|
||||
@ -582,6 +622,53 @@ typedef uint64_t GLuint64;
|
||||
# define GL_LOCATION 0x930E
|
||||
#endif // GL_LOCATION
|
||||
|
||||
// _KHR or _ARB...
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
|
||||
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
|
||||
#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
|
||||
#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
|
||||
#define GL_DEBUG_SOURCE_API 0x8246
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
|
||||
#define GL_DEBUG_SOURCE_APPLICATION 0x824A
|
||||
#define GL_DEBUG_SOURCE_OTHER 0x824B
|
||||
#define GL_DEBUG_TYPE_ERROR 0x824C
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
|
||||
#define GL_DEBUG_TYPE_PORTABILITY 0x824F
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
|
||||
#define GL_DEBUG_TYPE_OTHER 0x8251
|
||||
#define GL_DEBUG_TYPE_MARKER 0x8268
|
||||
#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
|
||||
#define GL_DEBUG_TYPE_POP_GROUP 0x826A
|
||||
#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
|
||||
#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
|
||||
#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
|
||||
#define GL_MAX_LABEL_LENGTH 0x82E8
|
||||
#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
|
||||
#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
|
||||
#define GL_DEBUG_LOGGED_MESSAGES 0x9145
|
||||
#define GL_DEBUG_SEVERITY_HIGH 0x9146
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
|
||||
#define GL_DEBUG_SEVERITY_LOW 0x9148
|
||||
|
||||
#ifndef GL_DEPTH_CLAMP
|
||||
# define GL_DEPTH_CLAMP 0x864F
|
||||
#endif // GL_DEPTH_CLAMP
|
||||
|
||||
#ifndef GL_TEXTURE_CUBE_MAP_SEAMLESS
|
||||
# define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
|
||||
#endif // GL_TEXTURE_CUBE_MAP_SEAMLESS
|
||||
|
||||
#ifndef GL_DRAW_INDIRECT_BUFFER
|
||||
# define GL_DRAW_INDIRECT_BUFFER 0x8F3F
|
||||
#endif // GL_DRAW_INDIRECT_BUFFER
|
||||
|
||||
#ifndef GL_DISPATCH_INDIRECT_BUFFER
|
||||
# define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
|
||||
#endif // GL_DISPATCH_INDIRECT_BUFFER
|
||||
|
||||
#if BX_PLATFORM_NACL
|
||||
# include "glcontext_ppapi.h"
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
@ -782,7 +869,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
struct IndexBufferGL
|
||||
{
|
||||
void create(uint32_t _size, void* _data, uint8_t _flags)
|
||||
void create(uint32_t _size, void* _data, uint16_t _flags)
|
||||
{
|
||||
m_size = _size;
|
||||
m_flags = _flags;
|
||||
@ -820,37 +907,40 @@ namespace bgfx { namespace gl
|
||||
GLuint m_id;
|
||||
uint32_t m_size;
|
||||
VaoCacheRef m_vcref;
|
||||
uint8_t m_flags;
|
||||
uint16_t m_flags;
|
||||
};
|
||||
|
||||
struct VertexBufferGL
|
||||
{
|
||||
void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle)
|
||||
void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags)
|
||||
{
|
||||
m_size = _size;
|
||||
m_decl = _declHandle;
|
||||
const bool drawIndirect = 0 != (_flags & BGFX_BUFFER_DRAW_INDIRECT);
|
||||
|
||||
m_target = drawIndirect ? GL_DRAW_INDIRECT_BUFFER : GL_ARRAY_BUFFER;
|
||||
|
||||
GL_CHECK(glGenBuffers(1, &m_id) );
|
||||
BX_CHECK(0 != m_id, "Failed to generate buffer id.");
|
||||
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, m_id) );
|
||||
GL_CHECK(glBufferData(GL_ARRAY_BUFFER
|
||||
GL_CHECK(glBindBuffer(m_target, m_id) );
|
||||
GL_CHECK(glBufferData(m_target
|
||||
, _size
|
||||
, _data
|
||||
, (NULL==_data) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW
|
||||
) );
|
||||
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
|
||||
GL_CHECK(glBindBuffer(m_target, 0) );
|
||||
}
|
||||
|
||||
void update(uint32_t _offset, uint32_t _size, void* _data)
|
||||
{
|
||||
BX_CHECK(0 != m_id, "Updating invalid vertex buffer.");
|
||||
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, m_id) );
|
||||
GL_CHECK(glBufferSubData(GL_ARRAY_BUFFER
|
||||
GL_CHECK(glBindBuffer(m_target, m_id) );
|
||||
GL_CHECK(glBufferSubData(m_target
|
||||
, _offset
|
||||
, _size
|
||||
, _data
|
||||
) );
|
||||
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
|
||||
GL_CHECK(glBindBuffer(m_target, 0) );
|
||||
}
|
||||
|
||||
void destroy();
|
||||
@ -861,6 +951,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
|
||||
GLuint m_id;
|
||||
GLenum m_target;
|
||||
uint32_t m_size;
|
||||
VertexDeclHandle m_decl;
|
||||
VaoCacheRef m_vcref;
|
||||
@ -880,7 +971,7 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
}
|
||||
|
||||
bool init(GLenum _target, uint32_t _width, uint32_t _height, uint8_t _format, uint8_t _numMips, uint32_t _flags);
|
||||
bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _format, uint8_t _numMips, uint32_t _flags);
|
||||
void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
|
||||
void destroy();
|
||||
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
|
||||
@ -896,6 +987,7 @@ namespace bgfx { namespace gl
|
||||
uint32_t m_currentFlags;
|
||||
uint32_t m_width;
|
||||
uint32_t m_height;
|
||||
uint32_t m_depth;
|
||||
uint8_t m_numMips;
|
||||
uint8_t m_requestedFormat;
|
||||
uint8_t m_textureFormat;
|
||||
|
4
3rdparty/bgfx/tools/shaderc/shaderc.cpp
vendored
4
3rdparty/bgfx/tools/shaderc/shaderc.cpp
vendored
@ -640,7 +640,7 @@ void help(const char* _error = NULL)
|
||||
" -i <include path> Include path (for multiple paths use semicolon).\n"
|
||||
" -o <file path> Output file path.\n"
|
||||
" --bin2c <file path> Generate C header file.\n"
|
||||
" --depends <file path> Generate makefile style depends file.\n"
|
||||
" --depends Generate makefile style depends file.\n"
|
||||
" --platform <platform> Target platform.\n"
|
||||
" android\n"
|
||||
" asm.js\n"
|
||||
@ -1390,7 +1390,7 @@ int main(int _argc, const char* _argv[])
|
||||
strins(const_cast<char*>(brace+1), "\nvec4 bgfx_VoidFrag;\n");
|
||||
}
|
||||
|
||||
const bool hasFragCoord = NULL != strstr(input, "gl_FragCoord") || hlsl > 3;
|
||||
const bool hasFragCoord = NULL != strstr(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2;
|
||||
const bool hasFragDepth = NULL != strstr(input, "gl_FragDepth");
|
||||
const bool hasFrontFacing = NULL != strstr(input, "gl_FrontFacing");
|
||||
const bool hasPrimitiveId = NULL != strstr(input, "gl_PrimitiveID");
|
||||
|
9
3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp
vendored
9
3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp
vendored
@ -7,6 +7,7 @@
|
||||
|
||||
#if SHADERC_CONFIG_HLSL
|
||||
|
||||
#define INITGUID
|
||||
#include <d3dcompiler.h>
|
||||
#include <d3d11shader.h>
|
||||
|
||||
@ -14,12 +15,6 @@
|
||||
# define D3D_SVF_USED 2
|
||||
#endif // D3D_SVF_USED
|
||||
|
||||
#ifndef IID_ID3D11ShaderReflection
|
||||
// In case MinGW is missing IID...
|
||||
static const GUID GUID_ID3D11ShaderReflection = { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } };
|
||||
# define IID_ID3D11ShaderReflection GUID_ID3D11ShaderReflection
|
||||
#endif // IID_ID3D11ShaderReflection
|
||||
|
||||
struct CTHeader
|
||||
{
|
||||
uint32_t Size;
|
||||
@ -525,7 +520,7 @@ bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::stri
|
||||
while (!reader.isEof() )
|
||||
{
|
||||
std::string line = reader.getLine();
|
||||
for (UniformNameList::const_iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it)
|
||||
for (UniformNameList::iterator it = unusedUniforms.begin(), itEnd = unusedUniforms.end(); it != itEnd; ++it)
|
||||
{
|
||||
size_t index = line.find("uniform ");
|
||||
if (index == std::string::npos)
|
||||
|
21
3rdparty/bx/include/bx/float4_ni.h
vendored
21
3rdparty/bx/include/bx/float4_ni.h
vendored
@ -15,7 +15,7 @@ namespace bx
|
||||
const float4_t xAyB = float4_shuf_xAyB(_a, _b);
|
||||
const float4_t zCwD = float4_shuf_zCwD(_a, _b);
|
||||
const float4_t result = float4_shuf_xyAB(xAyB, zCwD);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ namespace bx
|
||||
const float4_t xAyB = float4_shuf_xAyB(_a, _b);
|
||||
const float4_t zCwD = float4_shuf_zCwD(_a, _b);
|
||||
const float4_t result = float4_shuf_zwCD(xAyB, zCwD);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ namespace bx
|
||||
const float4_t one = float4_splat(1.0f);
|
||||
const float4_t sqrt = float4_sqrt(_a);
|
||||
const float4_t result = float4_div(one, sqrt);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ namespace bx
|
||||
const float4_t three = float4_splat(3.0f);
|
||||
const float4_t three_sub_iter1 = float4_sub(three, iter1);
|
||||
const float4_t result = float4_mul(half_rsqrt, three_sub_iter1);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ namespace bx
|
||||
const float4_t expfpart = float4_logexp_detail::float4_exppoly(fpart);
|
||||
|
||||
const float4_t result = float4_mul(expipart, expfpart);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -401,12 +401,21 @@ namespace bx
|
||||
|
||||
BX_FLOAT4_INLINE float4_t float4_cross3_ni(float4_t _a, float4_t _b)
|
||||
{
|
||||
// a.yzx * b.zxy - a.zxy * b.yzx == (a * b.yzx - a.yzx * b).yzx
|
||||
#if 0
|
||||
const float4_t a_yzxw = float4_swiz_yzxw(_a);
|
||||
const float4_t a_zxyw = float4_swiz_zxyw(_a);
|
||||
const float4_t b_zxyw = float4_swiz_zxyw(_b);
|
||||
const float4_t b_yzxw = float4_swiz_yzxw(_b);
|
||||
const float4_t tmp = float4_mul(a_yzxw, b_zxyw);
|
||||
const float4_t result = float4_nmsub(a_zxyw, b_yzxw, tmp);
|
||||
#else
|
||||
const float4_t a_yzxw = float4_swiz_yzxw(_a);
|
||||
const float4_t b_yzxw = float4_swiz_yzxw(_b);
|
||||
const float4_t tmp0 = float4_mul(_a, b_yzxw);
|
||||
const float4_t tmp1 = float4_nmsub(a_yzxw, _b, tmp0);
|
||||
const float4_t result = float4_swiz_yzxw(tmp1);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -416,7 +425,7 @@ namespace bx
|
||||
const float4_t dot3 = float4_dot3(_a, _a);
|
||||
const float4_t invSqrt = float4_rsqrt(dot3);
|
||||
const float4_t result = float4_mul(_a, invSqrt);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
4
3rdparty/bx/include/bx/macros.h
vendored
4
3rdparty/bx/include/bx/macros.h
vendored
@ -62,7 +62,7 @@
|
||||
# define BX_THREAD /* not supported right now */
|
||||
# else
|
||||
# if (__GNUC__ == 4) && (__GNUC_MINOR__ <= 2)
|
||||
# define BX_THREAD /* not supported right now */
|
||||
# define BX_THREAD /* not supported right now */
|
||||
# else
|
||||
# define BX_THREAD __thread
|
||||
# endif // __GNUC__ <= 4.2
|
||||
@ -179,7 +179,7 @@
|
||||
# define BX_TYPE_IS_POD(t) (!__is_class(t) || __is_pod(t))
|
||||
#else
|
||||
# define BX_TYPE_IS_POD(t) false
|
||||
#endif
|
||||
#endif
|
||||
///
|
||||
#define BX_CLASS_NO_DEFAULT_CTOR(_class) \
|
||||
private: _class()
|
||||
|
20
3rdparty/bx/include/bx/readerwriter.h
vendored
20
3rdparty/bx/include/bx/readerwriter.h
vendored
@ -96,6 +96,26 @@ namespace bx
|
||||
return _writer->write(_data, _size);
|
||||
}
|
||||
|
||||
/// Write repeat the same value.
|
||||
inline int32_t writeRep(WriterI* _writer, uint8_t _byte, int32_t _size)
|
||||
{
|
||||
const uint32_t tmp0 = uint32_sels(64 - _size, 64, _size);
|
||||
const uint32_t tmp1 = uint32_sels(256 - _size, 256, tmp0);
|
||||
const uint32_t blockSize = uint32_sels(1024 - _size, 1024, tmp1);
|
||||
uint8_t* temp = (uint8_t*)alloca(blockSize);
|
||||
memset(temp, _byte, blockSize);
|
||||
|
||||
int32_t size = 0;
|
||||
while (0 < _size)
|
||||
{
|
||||
int32_t bytes = write(_writer, temp, uint32_min(blockSize, _size) );
|
||||
size += bytes;
|
||||
_size -= bytes;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/// Write value.
|
||||
template<typename Ty>
|
||||
inline int32_t write(WriterI* _writer, const Ty& _value)
|
||||
|
14
3rdparty/bx/include/bx/ringbuffer.h
vendored
14
3rdparty/bx/include/bx/ringbuffer.h
vendored
@ -83,6 +83,13 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_current = 0;
|
||||
m_write = 0;
|
||||
m_read = 0;
|
||||
}
|
||||
|
||||
const uint32_t m_size;
|
||||
uint32_t m_current;
|
||||
uint32_t m_write;
|
||||
@ -164,6 +171,13 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_current = 0;
|
||||
m_write = 0;
|
||||
m_read = 0;
|
||||
}
|
||||
|
||||
const uint32_t m_size;
|
||||
uint32_t m_current;
|
||||
uint32_t m_write;
|
||||
|
23
3rdparty/bx/include/bx/uint32_t.h
vendored
23
3rdparty/bx/include/bx/uint32_t.h
vendored
@ -85,6 +85,11 @@ namespace bx
|
||||
return _a & _b;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_andc(uint32_t _a, uint32_t _b)
|
||||
{
|
||||
return _a & ~_b;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_xor(uint32_t _a, uint32_t _b)
|
||||
{
|
||||
return _a ^ _b;
|
||||
@ -95,16 +100,16 @@ namespace bx
|
||||
return !_a != !_b;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_andc(uint32_t _a, uint32_t _b)
|
||||
{
|
||||
return _a & ~_b;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_or(uint32_t _a, uint32_t _b)
|
||||
{
|
||||
return _a | _b;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_orc(uint32_t _a, uint32_t _b)
|
||||
{
|
||||
return _a | ~_b;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_sll(uint32_t _a, int _sa)
|
||||
{
|
||||
return _a << _sa;
|
||||
@ -271,6 +276,14 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_iclamp(uint32_t _a, uint32_t _min, uint32_t _max)
|
||||
{
|
||||
const uint32_t tmp = uint32_imax(_a, _min);
|
||||
const uint32_t result = uint32_imin(tmp, _max);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max)
|
||||
{
|
||||
const uint32_t inc = uint32_inc(_val);
|
||||
|
838
3rdparty/bx/include/compat/msvc/dirent.h
vendored
Normal file
838
3rdparty/bx/include/compat/msvc/dirent.h
vendored
Normal file
@ -0,0 +1,838 @@
|
||||
/*
|
||||
* dirent.h - dirent API for Microsoft Visual Studio
|
||||
*
|
||||
* Copyright (C) 2006-2012 Toni Ronkko
|
||||
*
|
||||
* 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 TONI RONKKO 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.
|
||||
*
|
||||
* $Id: dirent.h,v 1.20 2014/03/19 17:52:23 tronkko Exp $
|
||||
*/
|
||||
#ifndef DIRENT_H
|
||||
#define DIRENT_H
|
||||
|
||||
/*
|
||||
* Define architecture flags so we don't need to include windows.h.
|
||||
* Avoiding windows.h makes it simpler to use windows sockets in conjunction
|
||||
* with dirent.h.
|
||||
*/
|
||||
#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)
|
||||
# define _X86_
|
||||
#endif
|
||||
#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_AMD64)
|
||||
#define _AMD64_
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Indicates that d_type field is available in dirent structure */
|
||||
#define _DIRENT_HAVE_D_TYPE
|
||||
|
||||
/* Indicates that d_namlen field is available in dirent structure */
|
||||
#define _DIRENT_HAVE_D_NAMLEN
|
||||
|
||||
/* Entries missing from MSVC 6.0 */
|
||||
#if !defined(FILE_ATTRIBUTE_DEVICE)
|
||||
# define FILE_ATTRIBUTE_DEVICE 0x40
|
||||
#endif
|
||||
|
||||
/* File type and permission flags for stat() */
|
||||
#if !defined(S_IFMT)
|
||||
# define S_IFMT _S_IFMT /* File type mask */
|
||||
#endif
|
||||
#if !defined(S_IFDIR)
|
||||
# define S_IFDIR _S_IFDIR /* Directory */
|
||||
#endif
|
||||
#if !defined(S_IFCHR)
|
||||
# define S_IFCHR _S_IFCHR /* Character device */
|
||||
#endif
|
||||
#if !defined(S_IFFIFO)
|
||||
# define S_IFFIFO _S_IFFIFO /* Pipe */
|
||||
#endif
|
||||
#if !defined(S_IFREG)
|
||||
# define S_IFREG _S_IFREG /* Regular file */
|
||||
#endif
|
||||
#if !defined(S_IREAD)
|
||||
# define S_IREAD _S_IREAD /* Read permission */
|
||||
#endif
|
||||
#if !defined(S_IWRITE)
|
||||
# define S_IWRITE _S_IWRITE /* Write permission */
|
||||
#endif
|
||||
#if !defined(S_IEXEC)
|
||||
# define S_IEXEC _S_IEXEC /* Execute permission */
|
||||
#endif
|
||||
#if !defined(S_IFIFO)
|
||||
# define S_IFIFO _S_IFIFO /* Pipe */
|
||||
#endif
|
||||
#if !defined(S_IFBLK)
|
||||
# define S_IFBLK 0 /* Block device */
|
||||
#endif
|
||||
#if !defined(S_IFLNK)
|
||||
# define S_IFLNK 0 /* Link */
|
||||
#endif
|
||||
#if !defined(S_IFSOCK)
|
||||
# define S_IFSOCK 0 /* Socket */
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define S_IRUSR S_IREAD /* Read user */
|
||||
# define S_IWUSR S_IWRITE /* Write user */
|
||||
# define S_IXUSR 0 /* Execute user */
|
||||
# define S_IRGRP 0 /* Read group */
|
||||
# define S_IWGRP 0 /* Write group */
|
||||
# define S_IXGRP 0 /* Execute group */
|
||||
# define S_IROTH 0 /* Read others */
|
||||
# define S_IWOTH 0 /* Write others */
|
||||
# define S_IXOTH 0 /* Execute others */
|
||||
#endif
|
||||
|
||||
/* Maximum length of file name */
|
||||
#if !defined(PATH_MAX)
|
||||
# define PATH_MAX MAX_PATH
|
||||
#endif
|
||||
#if !defined(FILENAME_MAX)
|
||||
# define FILENAME_MAX MAX_PATH
|
||||
#endif
|
||||
#if !defined(NAME_MAX)
|
||||
# define NAME_MAX FILENAME_MAX
|
||||
#endif
|
||||
|
||||
/* File type flags for d_type */
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_REG S_IFREG
|
||||
#define DT_DIR S_IFDIR
|
||||
#define DT_FIFO S_IFIFO
|
||||
#define DT_SOCK S_IFSOCK
|
||||
#define DT_CHR S_IFCHR
|
||||
#define DT_BLK S_IFBLK
|
||||
#define DT_LNK S_IFLNK
|
||||
|
||||
/* Macros for converting between st_mode and d_type */
|
||||
#define IFTODT(mode) ((mode) & S_IFMT)
|
||||
#define DTTOIF(type) (type)
|
||||
|
||||
/*
|
||||
* File type macros. Note that block devices, sockets and links cannot be
|
||||
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
|
||||
* only defined for compatibility. These macros should always return false
|
||||
* on Windows.
|
||||
*/
|
||||
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
||||
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
|
||||
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
|
||||
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
|
||||
|
||||
/* Return the exact length of d_namlen without zero terminator */
|
||||
#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
|
||||
|
||||
/* Return number of bytes needed to store d_namlen */
|
||||
#define _D_ALLOC_NAMLEN(p) (PATH_MAX)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Wide-character version */
|
||||
struct _wdirent {
|
||||
long d_ino; /* Always zero */
|
||||
unsigned short d_reclen; /* Structure size */
|
||||
size_t d_namlen; /* Length of name without \0 */
|
||||
int d_type; /* File type */
|
||||
wchar_t d_name[PATH_MAX]; /* File name */
|
||||
};
|
||||
typedef struct _wdirent _wdirent;
|
||||
|
||||
struct _WDIR {
|
||||
struct _wdirent ent; /* Current directory entry */
|
||||
WIN32_FIND_DATAW data; /* Private file data */
|
||||
int cached; /* True if data is valid */
|
||||
HANDLE handle; /* Win32 search handle */
|
||||
wchar_t *patt; /* Initial directory name */
|
||||
};
|
||||
typedef struct _WDIR _WDIR;
|
||||
|
||||
static _WDIR *_wopendir (const wchar_t *dirname);
|
||||
static struct _wdirent *_wreaddir (_WDIR *dirp);
|
||||
static int _wclosedir (_WDIR *dirp);
|
||||
static void _wrewinddir (_WDIR* dirp);
|
||||
|
||||
|
||||
/* For compatibility with Symbian */
|
||||
#define wdirent _wdirent
|
||||
#define WDIR _WDIR
|
||||
#define wopendir _wopendir
|
||||
#define wreaddir _wreaddir
|
||||
#define wclosedir _wclosedir
|
||||
#define wrewinddir _wrewinddir
|
||||
|
||||
|
||||
/* Multi-byte character versions */
|
||||
struct dirent {
|
||||
long d_ino; /* Always zero */
|
||||
unsigned short d_reclen; /* Structure size */
|
||||
size_t d_namlen; /* Length of name without \0 */
|
||||
int d_type; /* File type */
|
||||
char d_name[PATH_MAX]; /* File name */
|
||||
};
|
||||
typedef struct dirent dirent;
|
||||
|
||||
struct DIR {
|
||||
struct dirent ent;
|
||||
struct _WDIR *wdirp;
|
||||
};
|
||||
typedef struct DIR DIR;
|
||||
|
||||
static DIR *opendir (const char *dirname);
|
||||
static struct dirent *readdir (DIR *dirp);
|
||||
static int closedir (DIR *dirp);
|
||||
static void rewinddir (DIR* dirp);
|
||||
|
||||
|
||||
/* Internal utility functions */
|
||||
static WIN32_FIND_DATAW *dirent_first (_WDIR *dirp);
|
||||
static WIN32_FIND_DATAW *dirent_next (_WDIR *dirp);
|
||||
|
||||
static int dirent_mbstowcs_s(
|
||||
size_t *pReturnValue,
|
||||
wchar_t *wcstr,
|
||||
size_t sizeInWords,
|
||||
const char *mbstr,
|
||||
size_t count);
|
||||
|
||||
static int dirent_wcstombs_s(
|
||||
size_t *pReturnValue,
|
||||
char *mbstr,
|
||||
size_t sizeInBytes,
|
||||
const wchar_t *wcstr,
|
||||
size_t count);
|
||||
|
||||
static void dirent_set_errno (int error);
|
||||
|
||||
/*
|
||||
* Open directory stream DIRNAME for read and return a pointer to the
|
||||
* internal working area that is used to retrieve individual directory
|
||||
* entries.
|
||||
*/
|
||||
static _WDIR*
|
||||
_wopendir(
|
||||
const wchar_t *dirname)
|
||||
{
|
||||
_WDIR *dirp = NULL;
|
||||
int error;
|
||||
|
||||
/* Must have directory name */
|
||||
if (dirname == NULL || dirname[0] == '\0') {
|
||||
dirent_set_errno (ENOENT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allocate new _WDIR structure */
|
||||
dirp = (_WDIR*) malloc (sizeof (struct _WDIR));
|
||||
if (dirp != NULL) {
|
||||
DWORD n;
|
||||
|
||||
/* Reset _WDIR structure */
|
||||
dirp->handle = INVALID_HANDLE_VALUE;
|
||||
dirp->patt = NULL;
|
||||
dirp->cached = 0;
|
||||
|
||||
/* Compute the length of full path plus zero terminator */
|
||||
n = GetFullPathNameW (dirname, 0, NULL, NULL);
|
||||
|
||||
/* Allocate room for absolute directory name and search pattern */
|
||||
dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
|
||||
if (dirp->patt) {
|
||||
|
||||
/*
|
||||
* Convert relative directory name to an absolute one. This
|
||||
* allows rewinddir() to function correctly even when current
|
||||
* working directory is changed between opendir() and rewinddir().
|
||||
*/
|
||||
n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
|
||||
if (n > 0) {
|
||||
wchar_t *p;
|
||||
|
||||
/* Append search pattern \* to the directory name */
|
||||
p = dirp->patt + n;
|
||||
if (dirp->patt < p) {
|
||||
switch (p[-1]) {
|
||||
case '\\':
|
||||
case '/':
|
||||
case ':':
|
||||
/* Directory ends in path separator, e.g. c:\temp\ */
|
||||
/*NOP*/;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Directory name doesn't end in path separator */
|
||||
*p++ = '\\';
|
||||
}
|
||||
}
|
||||
*p++ = '*';
|
||||
*p = '\0';
|
||||
|
||||
/* Open directory stream and retrieve the first entry */
|
||||
if (dirent_first (dirp)) {
|
||||
/* Directory stream opened successfully */
|
||||
error = 0;
|
||||
} else {
|
||||
/* Cannot retrieve first entry */
|
||||
error = 1;
|
||||
dirent_set_errno (ENOENT);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Cannot retrieve full path name */
|
||||
dirent_set_errno (ENOENT);
|
||||
error = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Cannot allocate memory for search pattern */
|
||||
error = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Cannot allocate _WDIR structure */
|
||||
error = 1;
|
||||
}
|
||||
|
||||
/* Clean up in case of error */
|
||||
if (error && dirp) {
|
||||
_wclosedir (dirp);
|
||||
dirp = NULL;
|
||||
}
|
||||
|
||||
return dirp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read next directory entry. The directory entry is returned in dirent
|
||||
* structure in the d_name field. Individual directory entries returned by
|
||||
* this function include regular files, sub-directories, pseudo-directories
|
||||
* "." and ".." as well as volume labels, hidden files and system files.
|
||||
*/
|
||||
static struct _wdirent*
|
||||
_wreaddir(
|
||||
_WDIR *dirp)
|
||||
{
|
||||
WIN32_FIND_DATAW *datap;
|
||||
struct _wdirent *entp;
|
||||
|
||||
/* Read next directory entry */
|
||||
datap = dirent_next (dirp);
|
||||
if (datap) {
|
||||
size_t n;
|
||||
DWORD attr;
|
||||
|
||||
/* Pointer to directory entry to return */
|
||||
entp = &dirp->ent;
|
||||
|
||||
/*
|
||||
* Copy file name as wide-character string. If the file name is too
|
||||
* long to fit in to the destination buffer, then truncate file name
|
||||
* to PATH_MAX characters and zero-terminate the buffer.
|
||||
*/
|
||||
n = 0;
|
||||
while (n + 1 < PATH_MAX && datap->cFileName[n] != 0) {
|
||||
entp->d_name[n] = datap->cFileName[n];
|
||||
n++;
|
||||
}
|
||||
dirp->ent.d_name[n] = 0;
|
||||
|
||||
/* Length of file name excluding zero terminator */
|
||||
entp->d_namlen = n;
|
||||
|
||||
/* File type */
|
||||
attr = datap->dwFileAttributes;
|
||||
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
|
||||
entp->d_type = DT_CHR;
|
||||
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
||||
entp->d_type = DT_DIR;
|
||||
} else {
|
||||
entp->d_type = DT_REG;
|
||||
}
|
||||
|
||||
/* Reset dummy fields */
|
||||
entp->d_ino = 0;
|
||||
entp->d_reclen = sizeof (struct _wdirent);
|
||||
|
||||
} else {
|
||||
|
||||
/* Last directory entry read */
|
||||
entp = NULL;
|
||||
|
||||
}
|
||||
|
||||
return entp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close directory stream opened by opendir() function. This invalidates the
|
||||
* DIR structure as well as any directory entry read previously by
|
||||
* _wreaddir().
|
||||
*/
|
||||
static int
|
||||
_wclosedir(
|
||||
_WDIR *dirp)
|
||||
{
|
||||
int ok;
|
||||
if (dirp) {
|
||||
|
||||
/* Release search handle */
|
||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||
FindClose (dirp->handle);
|
||||
dirp->handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
/* Release search pattern */
|
||||
if (dirp->patt) {
|
||||
free (dirp->patt);
|
||||
dirp->patt = NULL;
|
||||
}
|
||||
|
||||
/* Release directory structure */
|
||||
free (dirp);
|
||||
ok = /*success*/0;
|
||||
|
||||
} else {
|
||||
/* Invalid directory stream */
|
||||
dirent_set_errno (EBADF);
|
||||
ok = /*failure*/-1;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewind directory stream such that _wreaddir() returns the very first
|
||||
* file name again.
|
||||
*/
|
||||
static void
|
||||
_wrewinddir(
|
||||
_WDIR* dirp)
|
||||
{
|
||||
if (dirp) {
|
||||
/* Release existing search handle */
|
||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||
FindClose (dirp->handle);
|
||||
}
|
||||
|
||||
/* Open new search handle */
|
||||
dirent_first (dirp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get first directory entry (internal) */
|
||||
static WIN32_FIND_DATAW*
|
||||
dirent_first(
|
||||
_WDIR *dirp)
|
||||
{
|
||||
WIN32_FIND_DATAW *datap;
|
||||
|
||||
/* Open directory and retrieve the first entry */
|
||||
dirp->handle = FindFirstFileW (dirp->patt, &dirp->data);
|
||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||
|
||||
/* a directory entry is now waiting in memory */
|
||||
datap = &dirp->data;
|
||||
dirp->cached = 1;
|
||||
|
||||
} else {
|
||||
|
||||
/* Failed to re-open directory: no directory entry in memory */
|
||||
dirp->cached = 0;
|
||||
datap = NULL;
|
||||
|
||||
}
|
||||
return datap;
|
||||
}
|
||||
|
||||
/* Get next directory entry (internal) */
|
||||
static WIN32_FIND_DATAW*
|
||||
dirent_next(
|
||||
_WDIR *dirp)
|
||||
{
|
||||
WIN32_FIND_DATAW *p;
|
||||
|
||||
/* Get next directory entry */
|
||||
if (dirp->cached != 0) {
|
||||
|
||||
/* A valid directory entry already in memory */
|
||||
p = &dirp->data;
|
||||
dirp->cached = 0;
|
||||
|
||||
} else if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||
|
||||
/* Get the next directory entry from stream */
|
||||
if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) {
|
||||
/* Got a file */
|
||||
p = &dirp->data;
|
||||
} else {
|
||||
/* The very last entry has been processed or an error occured */
|
||||
FindClose (dirp->handle);
|
||||
dirp->handle = INVALID_HANDLE_VALUE;
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* End of directory stream reached */
|
||||
p = NULL;
|
||||
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open directory stream using plain old C-string.
|
||||
*/
|
||||
static DIR*
|
||||
opendir(
|
||||
const char *dirname)
|
||||
{
|
||||
struct DIR *dirp;
|
||||
int error;
|
||||
|
||||
/* Must have directory name */
|
||||
if (dirname == NULL || dirname[0] == '\0') {
|
||||
dirent_set_errno (ENOENT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allocate memory for DIR structure */
|
||||
dirp = (DIR*) malloc (sizeof (struct DIR));
|
||||
if (dirp) {
|
||||
wchar_t wname[PATH_MAX];
|
||||
size_t n;
|
||||
|
||||
/* Convert directory name to wide-character string */
|
||||
error = dirent_mbstowcs_s (&n, wname, PATH_MAX, dirname, PATH_MAX);
|
||||
if (!error) {
|
||||
|
||||
/* Open directory stream using wide-character name */
|
||||
dirp->wdirp = _wopendir (wname);
|
||||
if (dirp->wdirp) {
|
||||
/* Directory stream opened */
|
||||
error = 0;
|
||||
} else {
|
||||
/* Failed to open directory stream */
|
||||
error = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Cannot convert file name to wide-character string. This
|
||||
* occurs if the string contains invalid multi-byte sequences or
|
||||
* the output buffer is too small to contain the resulting
|
||||
* string.
|
||||
*/
|
||||
error = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Cannot allocate DIR structure */
|
||||
error = 1;
|
||||
}
|
||||
|
||||
/* Clean up in case of error */
|
||||
if (error && dirp) {
|
||||
free (dirp);
|
||||
dirp = NULL;
|
||||
}
|
||||
|
||||
return dirp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read next directory entry.
|
||||
*
|
||||
* When working with text consoles, please note that file names returned by
|
||||
* readdir() are represented in the default ANSI code page while any output to
|
||||
* console is typically formatted on another code page. Thus, non-ASCII
|
||||
* characters in file names will not usually display correctly on console. The
|
||||
* problem can be fixed in two ways: (1) change the character set of console
|
||||
* to 1252 using chcp utility and use Lucida Console font, or (2) use
|
||||
* _cprintf function when writing to console. The _cprinf() will re-encode
|
||||
* ANSI strings to the console code page so many non-ASCII characters will
|
||||
* display correcly.
|
||||
*/
|
||||
static struct dirent*
|
||||
readdir(
|
||||
DIR *dirp)
|
||||
{
|
||||
WIN32_FIND_DATAW *datap;
|
||||
struct dirent *entp;
|
||||
|
||||
/* Read next directory entry */
|
||||
datap = dirent_next (dirp->wdirp);
|
||||
if (datap) {
|
||||
size_t n;
|
||||
int error;
|
||||
|
||||
/* Attempt to convert file name to multi-byte string */
|
||||
error = dirent_wcstombs_s(
|
||||
&n, dirp->ent.d_name, PATH_MAX, datap->cFileName, PATH_MAX);
|
||||
|
||||
/*
|
||||
* If the file name cannot be represented by a multi-byte string,
|
||||
* then attempt to use old 8+3 file name. This allows traditional
|
||||
* Unix-code to access some file names despite of unicode
|
||||
* characters, although file names may seem unfamiliar to the user.
|
||||
*
|
||||
* Be ware that the code below cannot come up with a short file
|
||||
* name unless the file system provides one. At least
|
||||
* VirtualBox shared folders fail to do this.
|
||||
*/
|
||||
if (error && datap->cAlternateFileName[0] != '\0') {
|
||||
error = dirent_wcstombs_s(
|
||||
&n, dirp->ent.d_name, PATH_MAX,
|
||||
datap->cAlternateFileName, PATH_MAX);
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
DWORD attr;
|
||||
|
||||
/* Initialize directory entry for return */
|
||||
entp = &dirp->ent;
|
||||
|
||||
/* Length of file name excluding zero terminator */
|
||||
entp->d_namlen = n - 1;
|
||||
|
||||
/* File attributes */
|
||||
attr = datap->dwFileAttributes;
|
||||
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
|
||||
entp->d_type = DT_CHR;
|
||||
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
||||
entp->d_type = DT_DIR;
|
||||
} else {
|
||||
entp->d_type = DT_REG;
|
||||
}
|
||||
|
||||
/* Reset dummy fields */
|
||||
entp->d_ino = 0;
|
||||
entp->d_reclen = sizeof (struct dirent);
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Cannot convert file name to multi-byte string so construct
|
||||
* an errornous directory entry and return that. Note that
|
||||
* we cannot return NULL as that would stop the processing
|
||||
* of directory entries completely.
|
||||
*/
|
||||
entp = &dirp->ent;
|
||||
entp->d_name[0] = '?';
|
||||
entp->d_name[1] = '\0';
|
||||
entp->d_namlen = 1;
|
||||
entp->d_type = DT_UNKNOWN;
|
||||
entp->d_ino = 0;
|
||||
entp->d_reclen = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* No more directory entries */
|
||||
entp = NULL;
|
||||
}
|
||||
|
||||
return entp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close directory stream.
|
||||
*/
|
||||
static int
|
||||
closedir(
|
||||
DIR *dirp)
|
||||
{
|
||||
int ok;
|
||||
if (dirp) {
|
||||
|
||||
/* Close wide-character directory stream */
|
||||
ok = _wclosedir (dirp->wdirp);
|
||||
dirp->wdirp = NULL;
|
||||
|
||||
/* Release multi-byte character version */
|
||||
free (dirp);
|
||||
|
||||
} else {
|
||||
|
||||
/* Invalid directory stream */
|
||||
dirent_set_errno (EBADF);
|
||||
ok = /*failure*/-1;
|
||||
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewind directory stream to beginning.
|
||||
*/
|
||||
static void
|
||||
rewinddir(
|
||||
DIR* dirp)
|
||||
{
|
||||
/* Rewind wide-character string directory stream */
|
||||
_wrewinddir (dirp->wdirp);
|
||||
}
|
||||
|
||||
/* Convert multi-byte string to wide character string */
|
||||
static int
|
||||
dirent_mbstowcs_s(
|
||||
size_t *pReturnValue,
|
||||
wchar_t *wcstr,
|
||||
size_t sizeInWords,
|
||||
const char *mbstr,
|
||||
size_t count)
|
||||
{
|
||||
int error;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
|
||||
/* Microsoft Visual Studio 2005 or later */
|
||||
error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count);
|
||||
|
||||
#else
|
||||
|
||||
/* Older Visual Studio or non-Microsoft compiler */
|
||||
size_t n;
|
||||
|
||||
/* Convert to wide-character string (or count characters) */
|
||||
n = mbstowcs (wcstr, mbstr, sizeInWords);
|
||||
if (!wcstr || n < count) {
|
||||
|
||||
/* Zero-terminate output buffer */
|
||||
if (wcstr && sizeInWords) {
|
||||
if (n >= sizeInWords) {
|
||||
n = sizeInWords - 1;
|
||||
}
|
||||
wcstr[n] = 0;
|
||||
}
|
||||
|
||||
/* Length of resuting multi-byte string WITH zero terminator */
|
||||
if (pReturnValue) {
|
||||
*pReturnValue = n + 1;
|
||||
}
|
||||
|
||||
/* Success */
|
||||
error = 0;
|
||||
|
||||
} else {
|
||||
|
||||
/* Could not convert string */
|
||||
error = 1;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Convert wide-character string to multi-byte string */
|
||||
static int
|
||||
dirent_wcstombs_s(
|
||||
size_t *pReturnValue,
|
||||
char *mbstr,
|
||||
size_t sizeInBytes, /* max size of mbstr */
|
||||
const wchar_t *wcstr,
|
||||
size_t count)
|
||||
{
|
||||
int error;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
|
||||
/* Microsoft Visual Studio 2005 or later */
|
||||
error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count);
|
||||
|
||||
#else
|
||||
|
||||
/* Older Visual Studio or non-Microsoft compiler */
|
||||
size_t n;
|
||||
|
||||
/* Convert to multi-byte string (or count the number of bytes needed) */
|
||||
n = wcstombs (mbstr, wcstr, sizeInBytes);
|
||||
if (!mbstr || n < count) {
|
||||
|
||||
/* Zero-terminate output buffer */
|
||||
if (mbstr && sizeInBytes) {
|
||||
if (n >= sizeInBytes) {
|
||||
n = sizeInBytes - 1;
|
||||
}
|
||||
mbstr[n] = '\0';
|
||||
}
|
||||
|
||||
/* Lenght of resulting multi-bytes string WITH zero-terminator */
|
||||
if (pReturnValue) {
|
||||
*pReturnValue = n + 1;
|
||||
}
|
||||
|
||||
/* Success */
|
||||
error = 0;
|
||||
|
||||
} else {
|
||||
|
||||
/* Cannot convert string */
|
||||
error = 1;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Set errno variable */
|
||||
static void
|
||||
dirent_set_errno(
|
||||
int error)
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
|
||||
/* Microsoft Visual Studio 2005 and later */
|
||||
_set_errno (error);
|
||||
|
||||
#else
|
||||
|
||||
/* Non-Microsoft compiler or older Microsoft compiler */
|
||||
errno = error;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*DIRENT_H*/
|
||||
|
1
3rdparty/bx/include/tinystl/string.h
vendored
1
3rdparty/bx/include/tinystl/string.h
vendored
@ -27,6 +27,7 @@
|
||||
#ifndef TINYSTL_STRING_H
|
||||
#define TINYSTL_STRING_H
|
||||
|
||||
#include <string.h> // strlen
|
||||
#include "stddef.h"
|
||||
#include "hash.h"
|
||||
|
||||
|
19
3rdparty/bx/scripts/toolchain.lua
vendored
19
3rdparty/bx/scripts/toolchain.lua
vendored
@ -46,6 +46,8 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "vs2015-xp", "Visual Studio 2015 targeting XP" },
|
||||
{ "winphone8", "Windows Phone 8.0" },
|
||||
{ "winphone81", "Windows Phone 8.1" },
|
||||
{ "winstore81", "Windows Store 8.1" },
|
||||
{ "winstore82", "Universal Windows App" }
|
||||
},
|
||||
}
|
||||
|
||||
@ -281,9 +283,22 @@ function toolchain(_buildDir, _libDir)
|
||||
|
||||
elseif "winphone81" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = "v120_wp81"
|
||||
premake.vstudio.storeapp = "8.1"
|
||||
platforms { "ARM" }
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-winphone81"))
|
||||
|
||||
elseif "winstore81" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = "v120"
|
||||
premake.vstudio.storeapp = "8.1"
|
||||
platforms { "ARM" }
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-winstore81"))
|
||||
|
||||
elseif "winstore82" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = "v140"
|
||||
premake.vstudio.storeapp = "8.2"
|
||||
platforms { "ARM" }
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-winstore82"))
|
||||
|
||||
elseif ("vs2012-xp") == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = ("v110_xp")
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
|
||||
@ -334,7 +349,7 @@ function toolchain(_buildDir, _libDir)
|
||||
}
|
||||
targetsuffix "Release"
|
||||
|
||||
configuration { "vs*", "x86" }
|
||||
configuration { "vs*", "x32" }
|
||||
flags {
|
||||
"EnableSSE2",
|
||||
}
|
||||
@ -397,7 +412,7 @@ function toolchain(_buildDir, _libDir)
|
||||
targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
|
||||
objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
|
||||
|
||||
configuration { "winphone8*" }
|
||||
configuration { "winphone8* or winstore8*" }
|
||||
removeflags {
|
||||
"StaticRuntime",
|
||||
"NoExceptions",
|
||||
|
5
3rdparty/bx/tests/float4_t.cpp
vendored
5
3rdparty/bx/tests/float4_t.cpp
vendored
@ -228,6 +228,11 @@ TEST(float4_arithmetic)
|
||||
, float4_madd(float4_ld(0.0f, 1.0f, 2.0f, 3.0f), float4_ld(4.0f, 5.0f, 6.0f, 7.0f), float4_ld(8.0f, 9.0f, 10.0f, 11.0f) )
|
||||
, 8.0f, 14.0f, 22.0f, 32.0f
|
||||
);
|
||||
|
||||
float4_check_float("cross3"
|
||||
, float4_cross3(float4_ld(1.0f, 0.0f, 0.0f, 0.0f), float4_ld(0.0f, 1.0f, 0.0f, 0.0f) )
|
||||
, 0.0f, 0.0f, 1.0f, 0.0f
|
||||
);
|
||||
}
|
||||
|
||||
TEST(float4)
|
||||
|
BIN
3rdparty/bx/tools/bin/darwin/genie
vendored
BIN
3rdparty/bx/tools/bin/darwin/genie
vendored
Binary file not shown.
BIN
3rdparty/bx/tools/bin/linux/genie
vendored
BIN
3rdparty/bx/tools/bin/linux/genie
vendored
Binary file not shown.
BIN
3rdparty/bx/tools/bin/windows/genie.exe
vendored
BIN
3rdparty/bx/tools/bin/windows/genie.exe
vendored
Binary file not shown.
Loading…
Reference in New Issue
Block a user