| Previous | 199869 Revisions | Next |
| r36409 Friday 13th March, 2015 at 16:40:15 UTC by Miodrag Milanović |
|---|
| updated 3rd party (nw) |
| [3rdparty/bgfx/3rdparty/ocornut-imgui] | imgui.cpp |
| [3rdparty/bgfx/examples/common/entry] | entry.cpp |
| [3rdparty/bgfx/examples/common/imgui] | imgui.cpp ocornut_imgui.cpp |
| [3rdparty/bgfx/examples/common/nanovg] | nanovg.h nanovg_bgfx.cpp |
| [3rdparty/bgfx/src] | image.cpp image.h renderer_d3d11.cpp renderer_gl.cpp |
| [3rdparty/bx/tools/bin/darwin] | genie |
| [3rdparty/bx/tools/bin/linux] | genie |
| [3rdparty/bx/tools/bin/windows] | genie.exe |
| [3rdparty/genie] | README.md makefile |
| [3rdparty/genie/build/gmake.darwin] | genie.make |
| [3rdparty/genie/build/gmake.linux] | genie.make |
| [3rdparty/genie/build/gmake.windows] | genie.make |
| [3rdparty/genie/scripts] | genie.lua |
| [3rdparty/genie/src/actions/make] | make_cpp.lua |
| [3rdparty/genie/src/host] | scripts.c |
| [3rdparty/mongoose] | mongoose.c mongoose.h |
| r244920 | r244921 | |
|---|---|---|
| 5618 | 5618 | // From the moment we focused we are ignoring the content of 'buf' |
| 5619 | 5619 | ImFormatString(edit_state.InitialText, IM_ARRAYSIZE(edit_state.InitialText), "%s", buf); |
| 5620 | 5620 | const char* buf_end = NULL; |
| 5621 | edit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL, &buf_end); | |
| 5622 | edit_state.CurLenA = buf_end - buf; // We can't get the result from ImFormatString() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. | |
| 5621 | edit_state.CurLenW = (int)ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL, &buf_end); | |
| 5622 | edit_state.CurLenA = (int)(buf_end - buf); // We can't get the result from ImFormatString() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. | |
| 5623 | 5623 | edit_state.Width = w; |
| 5624 | 5624 | edit_state.InputCursorScreenPos = ImVec2(-1.f,-1.f); |
| 5625 | 5625 | edit_state.CursorAnimReset(); |
| r244920 | r244921 | |
|---|---|---|
| 60 | 60 | |
| 61 | 61 | switch (_key) |
| 62 | 62 | { |
| 63 | case Key::Esc: { return 0x1b; } break; | |
| 64 | case Key::Return: { return 0x0d; } break; | |
| 65 | case Key::Tab: { return 0x09; } break; | |
| 66 | case Key::Space: { return 0xa0; } break; | |
| 67 | case Key::Backspace: { return 0x08; } break; | |
| 68 | case Key::Plus: { return 0x2b; } break; | |
| 69 | case Key::Minus: { return 0x2d; } break; | |
| 70 | default: { return '\0'; } break; | |
| 63 | case Key::Esc: return 0x1b; | |
| 64 | case Key::Return: return '\n'; | |
| 65 | case Key::Tab: return '\t'; | |
| 66 | case Key::Space: return ' '; | |
| 67 | case Key::Backspace: return 0x08; | |
| 68 | case Key::Plus: return '+'; | |
| 69 | case Key::Minus: return '-'; | |
| 70 | default: break; | |
| 71 | 71 | } |
| 72 | ||
| 73 | return '\0'; | |
| 72 | 74 | } |
| 73 | 75 | |
| 74 | 76 | bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv) |
| r244920 | r244921 | |
|---|---|---|
| 813 | 813 | void beginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, uint8_t _view) |
| 814 | 814 | { |
| 815 | 815 | IMGUI_beginFrame(_mx, _my, _button, _width, _height, _inputChar, _view); |
| 816 | nvgViewId(m_nvg, _view); | |
| 816 | 817 | |
| 817 | 818 | m_view = _view; |
| 818 | 819 | m_viewWidth = _width; |
| r244920 | r244921 | |
|---|---|---|
| 165 | 165 | |
| 166 | 166 | ImGui::NewFrame(); |
| 167 | 167 | |
| 168 | ImGui::ShowTestWindow(); | |
| 168 | //ImGui::ShowTestWindow(); //Debug only. | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | void endFrame() |
| r244920 | r244921 | |
|---|---|---|
| 599 | 599 | typedef struct NVGparams NVGparams; |
| 600 | 600 | |
| 601 | 601 | NVGcontext* nvgCreate(int edgeaa, unsigned char viewid); |
| 602 | void nvgViewId(struct NVGcontext* ctx, unsigned char viewid); | |
| 602 | 603 | void nvgDelete(struct NVGcontext* ctx); |
| 603 | 604 | |
| 604 | 605 | // Contructor and destructor, called by the render back-end. |
| r244920 | r244921 | |
|---|---|---|
| 1051 | 1051 | return NULL; |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | void nvgViewId(struct NVGcontext* ctx, unsigned char viewid) | |
| 1055 | { | |
| 1056 | struct NVGparams* params = nvgInternalParams(ctx); | |
| 1057 | struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; | |
| 1058 | gl->viewid = uint8_t(viewid); | |
| 1059 | } | |
| 1060 | ||
| 1054 | 1061 | void nvgDelete(struct NVGcontext* ctx) |
| 1055 | 1062 | { |
| 1056 | 1063 | nvgDeleteInternal(ctx); |
| r244920 | r244921 | |
|---|---|---|
| 19 | 19 | // | | | | +----- min blocks x |
| 20 | 20 | // | | | | | +-- min blocks y |
| 21 | 21 | // | | | | | | |
| 22 | { 4, 4, 4, 8, 1, 1 }, // BC1 | |
| 23 | { 8, 4, 4, 16, 1, 1 }, // BC2 | |
| 24 | { 8, 4, 4, 16, 1, 1 }, // BC3 | |
| 25 | { 4, 4, 4, 8, 1, 1 }, // BC4 | |
| 26 | { 8, 4, 4, 16, 1, 1 }, // BC5 | |
| 27 | { 8, 4, 4, 16, 1, 1 }, // BC6H | |
| 28 | { 8, 4, 4, 16, 1, 1 }, // BC7 | |
| 29 | { 4, 4, 4, 8, 1, 1 }, // ETC1 | |
| 30 | { 4, 4, 4, 8, 1, 1 }, // ETC2 | |
| 31 | { 8, 4, 4, 16, 1, 1 }, // ETC2A | |
| 32 | { 4, 4, 4, 8, 1, 1 }, // ETC2A1 | |
| 33 | { 2, 8, 4, 8, 2, 2 }, // PTC12 | |
| 34 | { 4, 4, 4, 8, 2, 2 }, // PTC14 | |
| 35 | { 2, 8, 4, 8, 2, 2 }, // PTC12A | |
| 36 | { 4, 4, 4, 8, 2, 2 }, // PTC14A | |
| 37 | { 2, 8, 4, 8, 2, 2 }, // PTC22 | |
| 38 | { 4, 4, 4, 8, 2, 2 }, // PTC24 | |
| 39 | { 0, 0, 0, 0, 1, 1 }, // Unknown | |
| 40 | { 1, 8, 1, 1, 1, 1 }, // R1 | |
| 41 | { 8, 1, 1, 1, 1, 1 }, // R8 | |
| 42 | { 16, 1, 1, 2, 1, 1 }, // R16 | |
| 43 | { 16, 1, 1, 2, 1, 1 }, // R16F | |
| 44 | { 32, 1, 1, 4, 1, 1 }, // R32 | |
| 45 | { 32, 1, 1, 4, 1, 1 }, // R32F | |
| 46 | { 16, 1, 1, 2, 1, 1 }, // RG8 | |
| 47 | { 32, 1, 1, 4, 1, 1 }, // RG16 | |
| 48 | { 32, 1, 1, 4, 1, 1 }, // RG16F | |
| 49 | { 64, 1, 1, 8, 1, 1 }, // RG32 | |
| 50 | { 64, 1, 1, 8, 1, 1 }, // RG32F | |
| 51 | { 32, 1, 1, 4, 1, 1 }, // BGRA8 | |
| 52 | { 32, 1, 1, 4, 1, 1 }, // RGBA8 | |
| 53 | { 64, 1, 1, 8, 1, 1 }, // RGBA16 | |
| 54 | { 64, 1, 1, 8, 1, 1 }, // RGBA16F | |
| 55 | { 128, 1, 1, 16, 1, 1 }, // RGBA32 | |
| 56 | { 128, 1, 1, 16, 1, 1 }, // RGBA32F | |
| 57 | { 16, 1, 1, 2, 1, 1 }, // R5G6B5 | |
| 58 | { 16, 1, 1, 2, 1, 1 }, // RGBA4 | |
| 59 | { 16, 1, 1, 2, 1, 1 }, // RGB5A1 | |
| 60 | { 32, 1, 1, 4, 1, 1 }, // RGB10A2 | |
| 61 | { 32, 1, 1, 4, 1, 1 }, // R11G11B10F | |
| 62 | { 0, 0, 0, 0, 1, 1 }, // UnknownDepth | |
| 63 | { 16, 1, 1, 2, 1, 1 }, // D16 | |
| 64 | { 24, 1, 1, 3, 1, 1 }, // D24 | |
| 65 | { 32, 1, 1, 4, 1, 1 }, // D24S8 | |
| 66 | { 32, 1, 1, 4, 1, 1 }, // D32 | |
| 67 | { 16, 1, 1, 2, 1, 1 }, // D16F | |
| 68 | { 24, 1, 1, 3, 1, 1 }, // D24F | |
| 69 | { 32, 1, 1, 4, 1, 1 }, // D32F | |
| 70 | { 8, 1, 1, 1, 1, 1 }, // D0S8 | |
| 22 | { 4, 4, 4, 8, 1, 1, 0, 0 }, // BC1 | |
| 23 | { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC2 | |
| 24 | { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC3 | |
| 25 | { 4, 4, 4, 8, 1, 1, 0, 0 }, // BC4 | |
| 26 | { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC5 | |
| 27 | { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC6H | |
| 28 | { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC7 | |
| 29 | { 4, 4, 4, 8, 1, 1, 0, 0 }, // ETC1 | |
| 30 | { 4, 4, 4, 8, 1, 1, 0, 0 }, // ETC2 | |
| 31 | { 8, 4, 4, 16, 1, 1, 0, 0 }, // ETC2A | |
| 32 | { 4, 4, 4, 8, 1, 1, 0, 0 }, // ETC2A1 | |
| 33 | { 2, 8, 4, 8, 2, 2, 0, 0 }, // PTC12 | |
| 34 | { 4, 4, 4, 8, 2, 2, 0, 0 }, // PTC14 | |
| 35 | { 2, 8, 4, 8, 2, 2, 0, 0 }, // PTC12A | |
| 36 | { 4, 4, 4, 8, 2, 2, 0, 0 }, // PTC14A | |
| 37 | { 2, 8, 4, 8, 2, 2, 0, 0 }, // PTC22 | |
| 38 | { 4, 4, 4, 8, 2, 2, 0, 0 }, // PTC24 | |
| 39 | { 0, 0, 0, 0, 1, 1, 0, 0 }, // Unknown | |
| 40 | { 1, 8, 1, 1, 1, 1, 0, 0 }, // R1 | |
| 41 | { 8, 1, 1, 1, 1, 1, 0, 0 }, // R8 | |
| 42 | { 16, 1, 1, 2, 1, 1, 0, 0 }, // R16 | |
| 43 | { 16, 1, 1, 2, 1, 1, 0, 0 }, // R16F | |
| 44 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // R32 | |
| 45 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // R32F | |
| 46 | { 16, 1, 1, 2, 1, 1, 0, 0 }, // RG8 | |
| 47 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // RG16 | |
| 48 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // RG16F | |
| 49 | { 64, 1, 1, 8, 1, 1, 0, 0 }, // RG32 | |
| 50 | { 64, 1, 1, 8, 1, 1, 0, 0 }, // RG32F | |
| 51 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // BGRA8 | |
| 52 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // RGBA8 | |
| 53 | { 64, 1, 1, 8, 1, 1, 0, 0 }, // RGBA16 | |
| 54 | { 64, 1, 1, 8, 1, 1, 0, 0 }, // RGBA16F | |
| 55 | { 128, 1, 1, 16, 1, 1, 0, 0 }, // RGBA32 | |
| 56 | { 128, 1, 1, 16, 1, 1, 0, 0 }, // RGBA32F | |
| 57 | { 16, 1, 1, 2, 1, 1, 0, 0 }, // R5G6B5 | |
| 58 | { 16, 1, 1, 2, 1, 1, 0, 0 }, // RGBA4 | |
| 59 | { 16, 1, 1, 2, 1, 1, 0, 0 }, // RGB5A1 | |
| 60 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // RGB10A2 | |
| 61 | { 32, 1, 1, 4, 1, 1, 0, 0 }, // R11G11B10F | |
| 62 | { 0, 0, 0, 0, 1, 1, 0, 0 }, // UnknownDepth | |
| 63 | { 16, 1, 1, 2, 1, 1, 16, 0 }, // D16 | |
| 64 | { 24, 1, 1, 3, 1, 1, 24, 0 }, // D24 | |
| 65 | { 32, 1, 1, 4, 1, 1, 24, 8 }, // D24S8 | |
| 66 | { 32, 1, 1, 4, 1, 1, 32, 0 }, // D32 | |
| 67 | { 16, 1, 1, 2, 1, 1, 16, 0 }, // D16F | |
| 68 | { 24, 1, 1, 3, 1, 1, 24, 0 }, // D24F | |
| 69 | { 32, 1, 1, 4, 1, 1, 32, 0 }, // D32F | |
| 70 | { 8, 1, 1, 1, 1, 1, 0, 8 }, // D0S8 | |
| 71 | 71 | }; |
| 72 | 72 | BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) ); |
| 73 | 73 |
| r244920 | r244921 | |
|---|---|---|
| 45 | 45 | uint8_t blockSize; |
| 46 | 46 | uint8_t minBlockX; |
| 47 | 47 | uint8_t minBlockY; |
| 48 | uint8_t depthBits; | |
| 49 | uint8_t stencilBits; | |
| 48 | 50 | }; |
| 49 | 51 | |
| 50 | 52 | /// |
| r244920 | r244921 | |
|---|---|---|
| 201 | 201 | { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC22 |
| 202 | 202 | { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC24 |
| 203 | 203 | { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // Unknown |
| 204 | { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN }, // R1 | |
| 204 | { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R1 | |
| 205 | // { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN }, // R1 | |
| 205 | 206 | { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN }, // R8 |
| 206 | 207 | { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN }, // R16 |
| 207 | 208 | { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN }, // R16F |
| r244920 | r244921 | |
| 728 | 729 | |
| 729 | 730 | for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) |
| 730 | 731 | { |
| 731 | g_caps.formats[ii] = DXGI_FORMAT_UNKNOWN == s_textureFormat[ii].m_fmt ? 0 : 1; | |
| 732 | uint8_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE; | |
| 733 | ||
| 734 | if (DXGI_FORMAT_UNKNOWN != s_textureFormat[ii].m_fmt) | |
| 735 | { | |
| 736 | D3D11_FEATURE_DATA_FORMAT_SUPPORT data; // D3D11_FEATURE_DATA_FORMAT_SUPPORT2 | |
| 737 | data.InFormat = s_textureFormat[ii].m_fmt; | |
| 738 | DX_CHECK(m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) ) ); | |
| 739 | support |= 0 != (data.OutFormatSupport & (0 | |
| 740 | | D3D11_FORMAT_SUPPORT_TEXTURE2D | |
| 741 | | D3D11_FORMAT_SUPPORT_TEXTURE3D | |
| 742 | | D3D11_FORMAT_SUPPORT_TEXTURECUBE | |
| 743 | ) ) | |
| 744 | ? BGFX_CAPS_FORMAT_TEXTURE_COLOR | |
| 745 | : BGFX_CAPS_FORMAT_TEXTURE_NONE | |
| 746 | ; | |
| 747 | ||
| 748 | support |= 0 != (data.OutFormatSupport & (0 | |
| 749 | | D3D11_FORMAT_SUPPORT_BUFFER | |
| 750 | | D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER | |
| 751 | | D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER | |
| 752 | ) ) | |
| 753 | ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX | |
| 754 | : BGFX_CAPS_FORMAT_TEXTURE_NONE | |
| 755 | ; | |
| 756 | } | |
| 757 | ||
| 758 | g_caps.formats[ii] = support; | |
| 732 | 759 | } |
| 733 | 760 | |
| 734 | 761 | // Init reserved part of view name. |
| r244920 | r244921 | |
|---|---|---|
| 4072 | 4072 | } |
| 4073 | 4073 | |
| 4074 | 4074 | GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx; |
| 4075 | if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) | |
| 4075 | TextureFormat::Enum format = (TextureFormat::Enum)texture.m_textureFormat; | |
| 4076 | if (isDepth(format) ) | |
| 4076 | 4077 | { |
| 4077 | attachment = GL_DEPTH_ATTACHMENT; | |
| 4078 | const ImageBlockInfo& info = getBlockInfo(format); | |
| 4079 | if (0 < info.stencilBits) | |
| 4080 | { | |
| 4081 | attachment = GL_DEPTH_STENCIL_ATTACHMENT; | |
| 4082 | } | |
| 4083 | else if (0 == info.depthBits) | |
| 4084 | { | |
| 4085 | attachment = GL_STENCIL_ATTACHMENT; | |
| 4086 | } | |
| 4087 | else | |
| 4088 | { | |
| 4089 | attachment = GL_DEPTH_ATTACHMENT; | |
| 4090 | } | |
| 4078 | 4091 | } |
| 4079 | 4092 | else |
| 4080 | 4093 | { |
| r244920 | r244921 |
|---|
| Previous | 199869 Revisions | Next |