Update BGFX and BX packages and update MAME code to support new API (nw)

Generated missing shaders (nw)
This commit is contained in:
Miodrag Milanovic 2016-09-03 13:30:42 +02:00
parent d8cd5ca134
commit d193abb0ad
92 changed files with 4250 additions and 1561 deletions

View File

@ -303,9 +303,9 @@ D3DReflect(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
HRESULT WINAPI
D3DReflectLibrary(__in_bcount(SrcDataSize) LPCVOID pSrcData,
__in SIZE_T SrcDataSize,
__in REFIID riid,
__out LPVOID * ppReflector);
SIZE_T SrcDataSize,
REFIID riid,
LPVOID * ppReflector);
//----------------------------------------------------------------------------
// D3DDisassemble:
@ -350,7 +350,7 @@ D3DDisassembleRegion(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
// Shader linking and Function Linking Graph (FLG) APIs
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DCreateLinker(__out interface ID3D11Linker ** ppLinker);
D3DCreateLinker(interface ID3D11Linker ** ppLinker);
HRESULT WINAPI
D3DLoadModule(_In_ LPCVOID pSrcData,

View File

@ -80,7 +80,7 @@
- read the FAQ below this section!
- your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs.
- call and read ImGui::ShowTestWindow() for demo code demonstrating most features.
- see examples/ folder for standalone sample applications. Prefer reading examples/opengl_example/ first as it is the simplest.
- see examples/ folder for standalone sample applications. Prefer reading examples/opengl2_example/ first as it is the simplest.
you may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
- customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
@ -949,21 +949,30 @@ const char* ImStristr(const char* haystack, const char* haystack_end, const char
return NULL;
}
// MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size).
// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.
int ImFormatString(char* buf, int buf_size, const char* fmt, ...)
{
IM_ASSERT(buf_size > 0);
va_list args;
va_start(args, fmt);
int w = vsnprintf(buf, buf_size, fmt, args);
va_end(args);
buf[buf_size-1] = 0;
return (w == -1) ? buf_size : w;
if (w == -1 || w >= buf_size)
w = buf_size - 1;
buf[w] = 0;
return w;
}
int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args)
{
IM_ASSERT(buf_size > 0);
int w = vsnprintf(buf, buf_size, fmt, args);
buf[buf_size-1] = 0;
return (w == -1) ? buf_size : w;
if (w == -1 || w >= buf_size)
w = buf_size - 1;
buf[w] = 0;
return w;
}
// Pass data_size==0 for zero-terminated strings
@ -4258,10 +4267,9 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window->DC.AllowKeyboardFocus = true;
window->DC.ButtonRepeat = false;
window->DC.ItemWidthStack.resize(0);
window->DC.TextWrapPosStack.resize(0);
window->DC.AllowKeyboardFocusStack.resize(0);
window->DC.ButtonRepeatStack.resize(0);
window->DC.ColorEditMode = ImGuiColorEditMode_UserSelect;
window->DC.TextWrapPosStack.resize(0);
window->DC.ColumnsCurrent = 0;
window->DC.ColumnsCount = 1;
window->DC.ColumnsStartPosY = window->DC.CursorPos.y;
@ -4269,6 +4277,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window->DC.TreeDepth = 0;
window->DC.StateStorage = &window->StateStorage;
window->DC.GroupStack.resize(0);
window->DC.ColorEditMode = ImGuiColorEditMode_UserSelect;
window->MenuColumns.Update(3, style.ItemSpacing.x, !window_was_active);
if (window->AutoFitFramesX > 0)

View File

@ -1670,7 +1670,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
}
ImGui::LogFinish();
}
ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY"); ImGui::PopItemWidth();
ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0"); ImGui::PopItemWidth();
ImGui::SameLine(); ImGui::Checkbox("Only Modified Fields", &output_only_modified);
static ImGuiColorEditMode edit_mode = ImGuiColorEditMode_RGB;

View File

@ -44,3 +44,4 @@ namespace ImGui
#include "widgets/file_list.h"
#include "widgets/memory_editor.h"
#include "widgets/gizmo.h"

View File

@ -74,3 +74,4 @@ namespace ImGui
#include "widgets/file_list.inl"
#include "widgets/memory_editor.inl"
#include "widgets/gizmo.inl"

View File

@ -1,3 +1,4 @@
#include <bx/bx.h>
#include <dirent.h>
#include <sys/stat.h>
@ -15,6 +16,9 @@ namespace ImGui
void ImFileList::ChDir(const char* path)
{
#if BX_PLATFORM_NACL
BX_UNUSED(path);
#else
DIR* dir = opendir(path);
if (NULL != dir)
{
@ -43,6 +47,7 @@ namespace ImGui
closedir(dir);
}
#endif // BX_PLATFORM_NACL
}
void ImFileList::Draw()

View File

@ -0,0 +1,123 @@
// https://github.com/CedricGuillemet/ImGuizmo
// v 1.0 WIP
//
// The MIT License(MIT)
//
// Copyright(c) 2016 Cedric Guillemet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -------------------------------------------------------------------------------------------
// History :
// 2016/09/01 Mogwai changed to Manipulate. Draw debug cube. Fixed inverted scale. Mixing scale and translation/rotation gives bad results.
// 2016/08/31 First version
//
// -------------------------------------------------------------------------------------------
// Example
//
// static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::TRANSLATE);
// static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::LOCAL);
//
// // Maya shortcut keys
// if (ImGui::IsKeyPressed(90)) // w Key
// mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
// if (ImGui::IsKeyPressed(69)) // e Key
// mCurrentGizmoOperation = ImGuizmo::ROTATE;
// if (ImGui::IsKeyPressed(82)) // r Key
// mCurrentGizmoOperation = ImGuizmo::SCALE;
//
// if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE))
// mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
// ImGui::SameLine();
// if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE))
// mCurrentGizmoOperation = ImGuizmo::ROTATE;
// ImGui::SameLine();
// if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE))
// mCurrentGizmoOperation = ImGuizmo::SCALE;
//
// float matrixTranslation[3], matrixRotation[3], matrixScale[3];
// ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
// ImGui::InputFloat3("Tr", matrixTranslation, 3);
// ImGui::InputFloat3("Rt", matrixRotation, 3);
// ImGui::InputFloat3("Sc", matrixScale, 3);
// ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
//
// if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL))
// mCurrentGizmoMode = ImGuizmo::LOCAL;
// ImGui::SameLine();
// if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD))
// mCurrentGizmoMode = ImGuizmo::WORLD;
//
// ImGuizmo::Mogwai(gCurrentCamera->mView.m16, gCurrentCamera->mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, gizmoMatrix.m16);
//
#pragma once
namespace ImGuizmo
{
// call BeginFrame right after ImGui_XXXX_NewFrame();
void BeginFrame();
// return true if mouse cursor is over any gizmo control (axis, plan or screen component)
bool IsOver();
// return true if mouse IsOver or if the gizmo is in moving state
bool IsUsing();
// enable/disable the gizmo. Stay in the state until next call to Enable.
// gizmo is rendered with gray half transparent color when disabled
void Enable(bool enable);
// helper functions for manualy editing translation/rotation/scale with an input float
// translation, rotation and scale float points to 3 floats each
// Angles are in degrees (more suitable for human editing)
// example:
// float matrixTranslation[3], matrixRotation[3], matrixScale[3];
// ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
// ImGui::InputFloat3("Tr", matrixTranslation, 3);
// ImGui::InputFloat3("Rt", matrixRotation, 3);
// ImGui::InputFloat3("Sc", matrixScale, 3);
// ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
//
// These functions have some numerical stability issues for now. Use with caution.
void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale);
void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix);
// Render a cube with face color corresponding to face normal. Usefull for debug/tests
void DrawCube(const float *view, const float *projection, float *matrix);
// call it when you want a gizmo
// Needs view and projection matrices.
// matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional
// translation is applied in world space
enum OPERATION
{
TRANSLATE,
ROTATE,
SCALE
};
enum MODE
{
LOCAL,
WORLD
};
void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0);
};

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@ Languages:
* [Haskell language API bindings](https://github.com/haskell-game/bgfx)
* [Java language API bindings](https://github.com/enleeten/twilight-bgfx)
* [Lua language API bindings](https://github.com/excessive/lua-bgfx)
* [Nim language API bindings](https://github.com/Halsys/nim-bgfx)
* [Python language API bindings](https://github.com/jnadro/pybgfx#pybgf)
* [Rust language API bindings](https://github.com/rhoot/bgfx-rs)
* [Swift language API bindings](https://github.com/stuartcarnie/SwiftBGFX)
@ -160,6 +161,14 @@ base on a far island.
alt="Dead Venture - Gameplay Teaser (iOS / Android)"
width="640" height="480" border="0" /></a>
https://github.com/degenerated1123/REGoth - Open source reimplementation of the
zEngine, used by the game "Gothic" and "Gothic II".
<a href="http://www.youtube.com/watch?feature=player_embedded&v=8bLAGttYYpY
" target="_blank"><img src="http://img.youtube.com/vi/8bLAGttYYpY/0.jpg"
alt="REGoth Engine"
width="640" height="480" border="0" /></a>
[License (BSD 2-clause)](https://bkaradzic.github.io/bgfx/license.html)
-----------------------------------------------------------------------

View File

@ -96,7 +96,7 @@ static const uint16_t s_m_cubeIndices[36] =
static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _side, uint32_t _x, uint32_t _y, uint32_t _width, uint32_t _height, uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff)
{
bgfx::TextureInfo ti;
bgfx::calcTextureSize(ti, _width, _height, 1, 1, false, bgfx::TextureFormat::BGRA8);
bgfx::calcTextureSize(ti, _width, _height, 1, false, false, 1, bgfx::TextureFormat::BGRA8);
const bgfx::Memory* mem = bgfx::alloc(ti.storageSize);
uint8_t* data = (uint8_t*)mem->data;
@ -109,17 +109,17 @@ static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _sid
data += 4;
}
bgfx::updateTextureCube(_handle, _side, 0, _x, _y, _width, _height, mem);
bgfx::updateTextureCube(_handle, 0, _side, 0, _x, _y, _width, _height, mem);
}
static const uint32_t m_textureside = 512;
static const uint32_t m_texture2dSize = 256;
static const uint16_t textureside = 512;
static const uint32_t texture2dSize = 256;
class ExampleUpdate : public entry::AppI
{
public:
ExampleUpdate()
: m_cube(m_textureside)
: m_cube(textureside)
{
}
@ -186,17 +186,17 @@ public:
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R8]) )
{
m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8);
m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8);
}
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R16F]) )
{
m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f);
m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f);
}
if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R32F]) )
{
m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, 0, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f);
m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f);
}
}
@ -222,25 +222,35 @@ public:
// Create time uniform.
u_time = bgfx::createUniform("u_time", bgfx::UniformType::Vec4);
m_textureCube[0] = bgfx::createTextureCube(m_textureside, 1
m_textureCube[0] = bgfx::createTextureCube(
textureside
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
if (m_blitSupported)
{
m_textureCube[1] = bgfx::createTextureCube(m_textureside, 1
m_textureCube[1] = bgfx::createTextureCube(
textureside
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT|BGFX_TEXTURE_BLIT_DST
);
}
m_texture2d = bgfx::createTexture2D(m_texture2dSize, m_texture2dSize, 1
m_texture2d = bgfx::createTexture2D(
texture2dSize
, texture2dSize
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT
);
m_texture2dData = (uint8_t*)malloc(m_texture2dSize*m_texture2dSize*4);
m_texture2dData = (uint8_t*)malloc(texture2dSize*texture2dSize*4);
m_rr = rand()%255;
m_gg = rand()%255;
@ -331,8 +341,8 @@ public:
{
PackCube face;
uint32_t bw = bx::uint16_max(1, rand()%(m_textureside/4) );
uint32_t bh = bx::uint16_max(1, rand()%(m_textureside/4) );
uint32_t bw = bx::uint16_max(1, rand()%(textureside/4) );
uint32_t bh = bx::uint16_max(1, rand()%(textureside/4) );
if (m_cube.find(bw, bh, face) )
{
@ -373,14 +383,14 @@ public:
{
// Fill rect.
const uint32_t pitch = m_texture2dSize*4;
const uint32_t pitch = texture2dSize*4;
const uint16_t tw = rand()%m_texture2dSize;
const uint16_t th = rand()%m_texture2dSize;
const uint16_t tx = rand()%(m_texture2dSize-tw);
const uint16_t ty = rand()%(m_texture2dSize-th);
const uint16_t tw = rand()% texture2dSize;
const uint16_t th = rand()% texture2dSize;
const uint16_t tx = rand()%(texture2dSize-tw);
const uint16_t ty = rand()%(texture2dSize-th);
uint8_t* dst = &m_texture2dData[(ty*m_texture2dSize+tx)*4];
uint8_t* dst = &m_texture2dData[(ty*texture2dSize+tx)*4];
uint8_t* next = dst + pitch;
// Using makeRef to pass texture memory without copying.
@ -399,7 +409,7 @@ public:
// Pitch here makes possible to pass data from source to destination
// without need for m_textures and allocated memory to be the same size.
bgfx::updateTexture2D(m_texture2d, 0, tx, ty, tw, th, mem, pitch);
bgfx::updateTexture2D(m_texture2d, 0, 0, tx, ty, tw, th, mem, pitch);
}
}

View File

@ -203,8 +203,8 @@ class ExampleHDR : public entry::AppI
m_mesh = meshLoad("meshes/bunny.bin");
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
m_lum[0] = bgfx::createFrameBuffer(128, 128, bgfx::TextureFormat::BGRA8);
@ -219,7 +219,7 @@ class ExampleHDR : public entry::AppI
m_lumBgra8 = 0;
if ( (BGFX_CAPS_TEXTURE_BLIT|BGFX_CAPS_TEXTURE_READ_BACK) == (bgfx::getCaps()->supported & (BGFX_CAPS_TEXTURE_BLIT|BGFX_CAPS_TEXTURE_READ_BACK) ) )
{
m_rb = bgfx::createTexture2D(1, 1, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_READ_BACK);
m_rb = bgfx::createTexture2D(1, 1, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_READ_BACK);
}
else
{
@ -305,8 +305,8 @@ class ExampleHDR : public entry::AppI
bgfx::destroyFrameBuffer(m_fbh);
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, ( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT)|BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<<BGFX_TEXTURE_RT_MSAA_SHIFT) );
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
}

View File

@ -65,7 +65,7 @@ class ExampleLod : public entry::AppI
stippleTex->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4;
}
m_textureStipple = bgfx::createTexture2D(8, 4, 1
m_textureStipple = bgfx::createTexture2D(8, 4, false, 1
, bgfx::TextureFormat::R8
, BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT
, stippleTex

View File

@ -1884,8 +1884,8 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT),
bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT),
bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
@ -2078,8 +2078,8 @@ int _main_(int _argc, char** _argv)
bgfx::destroyFrameBuffer(s_stencilFb);
fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT);
fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
fbtextures[0] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT);
fbtextures[1] = bgfx::createTexture2D(viewState.m_width, viewState.m_height, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY);
s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}

View File

@ -140,7 +140,7 @@ int _main_(int _argc, char** _argv)
progShadow = loadProgram("vs_sms_shadow", "fs_sms_shadow");
progMesh = loadProgram("vs_sms_mesh", "fs_sms_mesh");
shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT | BGFX_TEXTURE_COMPARE_LEQUAL);
shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT | BGFX_TEXTURE_COMPARE_LEQUAL);
bgfx::TextureHandle fbtextures[] = { shadowMapTexture };
shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@ -151,11 +151,11 @@ int _main_(int _argc, char** _argv)
progShadow = loadProgram("vs_sms_shadow_pd", "fs_sms_shadow_pd");
progMesh = loadProgram("vs_sms_mesh", "fs_sms_mesh_pd");
shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT);
shadowMapTexture = bgfx::createTexture2D(shadowMapSize, shadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT);
bgfx::TextureHandle fbtextures[] =
{
shadowMapTexture,
bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
bgfx::createTexture2D(shadowMapSize, shadowMapSize, false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY),
};
shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}

View File

@ -1944,8 +1944,8 @@ int _main_(int _argc, char** _argv)
{
bgfx::TextureHandle fbtextures[] =
{
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
};
s_rtShadowMap[ii] = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@ -3108,8 +3108,8 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
};
s_rtShadowMap[0] = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}
@ -3123,8 +3123,8 @@ int _main_(int _argc, char** _argv)
bgfx::TextureHandle fbtextures[] =
{
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT),
bgfx::createTexture2D(currentShadowMapSize, currentShadowMapSize, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT),
};
s_rtShadowMap[ii] = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
}

View File

@ -553,8 +553,8 @@ int _main_(int _argc, char** _argv)
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
, mouseState.m_mz
, width
, height
, uint16_t(width)
, uint16_t(height)
);
static int32_t rightScrollArea = 0;
@ -564,10 +564,16 @@ int _main_(int _argc, char** _argv)
imguiIndent();
imguiBool("IBL Diffuse", settings.m_doDiffuseIbl);
imguiBool("IBL Specular", settings.m_doSpecularIbl);
currentLightProbe = LightProbe::Enum(imguiTabs(currentLightProbe, true, ImguiAlign::LeftIndented, 16, 2, 2
, "Bolonga"
, "Kyoto"
) );
currentLightProbe = LightProbe::Enum(imguiTabs(
uint8_t(currentLightProbe)
, true
, ImguiAlign::LeftIndented
, 16
, 2
, 2
, "Bolonga"
, "Kyoto"
) );
if (imguiCube(lightProbes[currentLightProbe].m_tex, settings.m_lod, settings.m_crossCubemapPreview, true) )
{
settings.m_crossCubemapPreview = ImguiCubemap::Enum( (settings.m_crossCubemapPreview+1) % ImguiCubemap::Count);
@ -592,14 +598,21 @@ int _main_(int _argc, char** _argv)
imguiIndent();
{
int32_t selection;
if (0.0f == settings.m_bgType) { selection = 0; }
else if (7.0f == settings.m_bgType) { selection = 2; }
else { selection = 1; }
selection = imguiTabs(selection, true, ImguiAlign::LeftIndented, 16, 2, 3
, "Skybox"
, "Radiance"
, "Irradiance"
);
if (0.0f == settings.m_bgType) { selection = UINT8_C(0); }
else if (7.0f == settings.m_bgType) { selection = UINT8_C(2); }
else { selection = UINT8_C(1); }
selection = imguiTabs(
uint8_t(selection)
, true
, ImguiAlign::LeftIndented
, 16
, 2
, 3
, "Skybox"
, "Radiance"
, "Irradiance"
);
if (0 == selection) { settings.m_bgType = 0.0f; }
else if (2 == selection) { settings.m_bgType = 7.0f; }
else { settings.m_bgType = settings.m_radianceSlider; }
@ -622,7 +635,7 @@ int _main_(int _argc, char** _argv)
imguiLabel("Mesh:");
imguiIndent();
settings.m_meshSelection = imguiChoose(settings.m_meshSelection, "Bunny", "Orbs");
settings.m_meshSelection = uint8_t(imguiChoose(settings.m_meshSelection, "Bunny", "Orbs") );
imguiUnindent();
const bool isBunny = (0 == settings.m_meshSelection);
@ -719,8 +732,8 @@ int _main_(int _argc, char** _argv)
bgfx::setViewTransform(1, view, proj);
// View rect.
bgfx::setViewRect(0, 0, 0, width, height);
bgfx::setViewRect(1, 0, 0, width, height);
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height) );
bgfx::setViewRect(1, 0, 0, uint16_t(width), uint16_t(height) );
// Env rotation.
const float amount = bx::fmin(deltaTimeSec/0.12f, 1.0f);

View File

@ -264,8 +264,8 @@ class ExampleOIT : public entry::AppI
bgfx::destroyFrameBuffer(m_fbh);
}
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT);
m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT);
m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT);
m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true);
}
@ -417,7 +417,7 @@ class ExampleOIT : public entry::AppI
| BGFX_STATE_DEPTH_TEST_ALWAYS
| BGFX_STATE_MSAA
;
bgfx::ProgramHandle program = BGFX_INVALID_HANDLE;
switch (m_mode)
{

View File

@ -432,9 +432,9 @@ class ExampleDeferred : public entry::AppI
| BGFX_TEXTURE_U_CLAMP
| BGFX_TEXTURE_V_CLAMP
;
m_gbufferTex[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[2] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::D24, samplerFlags);
m_gbufferTex[0] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[1] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[2] = bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D24, samplerFlags);
m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true);
if (bgfx::isValid(m_lightBuffer) )

View File

@ -857,7 +857,7 @@ void VectorDisplay::genLinetex() // generate
| BGFX_TEXTURE_MAG_POINT
;
m_lineTexId = bgfx::createTexture2D(TEXTURE_SIZE, TEXTURE_SIZE, 1, bgfx::TextureFormat::BGRA8, flags, mem);
m_lineTexId = bgfx::createTexture2D(TEXTURE_SIZE, TEXTURE_SIZE, false, 1, bgfx::TextureFormat::BGRA8, flags, mem);
}
static const int8_t simplex[95][112] =

View File

@ -274,11 +274,11 @@ class ExampleTerrain : public entry::AppI
if (!bgfx::isValid(m_heightTexture) )
{
m_heightTexture = bgfx::createTexture2D(s_terrainSize, s_terrainSize, 1, bgfx::TextureFormat::R8);
m_heightTexture = bgfx::createTexture2D(s_terrainSize, s_terrainSize, false, 1, bgfx::TextureFormat::R8);
}
mem = bgfx::makeRef(&m_terrain.m_heightMap[0], sizeof(uint8_t) * s_terrainSize * s_terrainSize);
bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
break;
}
}

View File

@ -103,7 +103,7 @@ class ExamplePicking : public entry::AppI
m_timeOffset = bx::getHPCounter();
// Set up ID buffer, which has a color target and depth buffer
m_pickingRT = bgfx::createTexture2D(ID_DIM, ID_DIM, 1, bgfx::TextureFormat::RGBA8, 0
m_pickingRT = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::RGBA8, 0
| BGFX_TEXTURE_RT
| BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
@ -111,7 +111,7 @@ class ExamplePicking : public entry::AppI
| BGFX_TEXTURE_U_CLAMP
| BGFX_TEXTURE_V_CLAMP
);
m_pickingRTDepth = bgfx::createTexture2D(ID_DIM, ID_DIM, 1, bgfx::TextureFormat::D24S8, 0
m_pickingRTDepth = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::D24S8, 0
| BGFX_TEXTURE_RT
| BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
@ -124,7 +124,7 @@ class ExamplePicking : public entry::AppI
// Impossible to read directly from a render target, you *must* blit to a CPU texture
// first. Algorithm Overview: Render on GPU -> Blit to CPU texture -> Read from CPU
// texture.
m_blitTex = bgfx::createTexture2D(ID_DIM, ID_DIM, 1, bgfx::TextureFormat::RGBA8, 0
m_blitTex = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::RGBA8, 0
| BGFX_TEXTURE_BLIT_DST
| BGFX_TEXTURE_READ_BACK
| BGFX_TEXTURE_MIN_POINT

View File

@ -304,13 +304,13 @@ public:
;
// Make gbuffer and related textures
m_gbufferTex[GBUFFER_RT_NORMAL] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[GBUFFER_RT_COLOR] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[GBUFFER_RT_DEPTH] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::D24, samplerFlags);
m_gbufferTex[GBUFFER_RT_NORMAL] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[GBUFFER_RT_COLOR] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_gbufferTex[GBUFFER_RT_DEPTH] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::D24, samplerFlags);
m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true);
// Make light buffer
m_lightBufferTex = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
m_lightBufferTex = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags);
bgfx::TextureHandle lightBufferRTs[] = {
m_lightBufferTex
};
@ -328,8 +328,9 @@ public:
// Reflective shadow map
m_shadowBufferTex[SHADOW_RT_RSM] = bgfx::createTexture2D(
SHADOW_MAP_DIM
SHADOW_MAP_DIM
, SHADOW_MAP_DIM
, false
, 1
, bgfx::TextureFormat::BGRA8,
rsmFlags
@ -337,8 +338,9 @@ public:
// Typical shadow map
m_shadowBufferTex[SHADOW_RT_DEPTH] = bgfx::createTexture2D(
SHADOW_MAP_DIM
SHADOW_MAP_DIM
, SHADOW_MAP_DIM
, false
, 1
, bgfx::TextureFormat::D16,
BGFX_TEXTURE_RT/* | BGFX_TEXTURE_COMPARE_LEQUAL*/

View File

@ -240,6 +240,8 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
break;
case LCT_PALETTE:
format = bgfx::TextureFormat::R8;
bpp = 8;
break;
}
break;
@ -304,7 +306,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
if (NULL != out)
{
handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), 1
handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), false, 1
, format
, _flags
, bgfx::copy(out, width*height*bpp/8)
@ -318,6 +320,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath,
, uint16_t(height)
, 0
, false
, false
, 1
, format
);

View File

@ -273,6 +273,7 @@ Atlas::Atlas(uint16_t _textureSize, uint16_t _maxRegionsCount)
memset(m_textureBuffer, 0, _textureSize * _textureSize * 6 * 4);
m_textureHandle = bgfx::createTextureCube(_textureSize
, false
, 1
, bgfx::TextureFormat::BGRA8
);
@ -296,6 +297,7 @@ Atlas::Atlas(uint16_t _textureSize, const uint8_t* _textureBuffer, uint16_t _reg
memcpy(m_textureBuffer, _textureBuffer, getTextureBufferSize() );
m_textureHandle = bgfx::createTextureCube(_textureSize
, false
, 1
, bgfx::TextureFormat::BGRA8
, BGFX_TEXTURE_NONE
@ -441,7 +443,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
}
}
bgfx::updateTextureCube(m_textureHandle, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
bgfx::updateTextureCube(m_textureHandle, 0, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
}
}

View File

@ -17,6 +17,7 @@
#include <android/looper.h>
#include <android/window.h>
#include <android_native_app_glue.h>
#include <android/native_window.h>
extern "C"
{
@ -28,6 +29,18 @@ extern "C"
namespace entry
{
///
inline void androidSetWindow(::ANativeWindow* _window)
{
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
struct GamepadRemap
{
uint16_t m_keyCode;
@ -142,7 +155,7 @@ namespace entry
if (m_window != m_app->window)
{
m_window = m_app->window;
bgfx::androidSetWindow(m_window);
androidSetWindow(m_window);
int32_t width = ANativeWindow_getWidth(m_window);
int32_t height = ANativeWindow_getHeight(m_window);

View File

@ -7,8 +7,21 @@
#if ENTRY_CONFIG_USE_GLFW
#if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
# define GLFW_EXPOSE_NATIVE_X11
# define GLFW_EXPOSE_NATIVE_GLX
#elif BX_PLATFORM_OSX
# define GLFW_EXPOSE_NATIVE_COCOA
# define GLFW_EXPOSE_NATIVE_NSGL
#elif BX_PLATFORM_WINDOWS
# define GLFW_EXPOSE_NATIVE_WIN32
# define GLFW_EXPOSE_NATIVE_WGL
#endif //
#define GLFW_DLL
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#include <bgfx/bgfxplatform.h>
#include "dbg.h"
@ -17,6 +30,27 @@
namespace entry
{
inline void glfwSetWindow(GLFWwindow* _window)
{
bgfx::PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
pd.ndt = glfwGetX11Display();
pd.nwh = (void*)(uintptr_t)glfwGetGLXWindow(_window);
pd.context = glfwGetGLXContext(_window);
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = glfwGetCocoaWindow(_window);
pd.context = glfwGetNSGLContext(_window);
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = glfwGetWin32Window(_window);
pd.context = NULL;
# endif // BX_PLATFORM_WINDOWS
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
static void errorCb(int _error, const char* _description)
{
DBG("GLFW error %d: %s", _error, _description);
@ -38,7 +72,7 @@ namespace entry
glfwSetKeyCallback(m_window, keyCb);
bgfx::glfwSetWindow(m_window);
glfwSetWindow(m_window);
int result = main(_argc, _argv);
glfwDestroyWindow(m_window);

View File

@ -46,6 +46,18 @@
namespace entry
{
///
inline void osxSetNSWindow(void* _window, void* _nsgl = NULL)
{
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = _nsgl;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
static WindowHandle s_defaultWindow = { 0 }; // TODO: Add support for more windows
static uint8_t s_translateKey[256];
@ -460,7 +472,7 @@ namespace entry
m_window[0] = window;
m_windowFrame = [window frame];
bgfx::osxSetNSWindow(window);
osxSetNSWindow(window);
MainThreadEntry mte;
mte.m_argc = _argc;

View File

@ -15,10 +15,10 @@
#include <SDL2/SDL.h>
BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG()
BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wextern-c-compat")
#include <SDL2/SDL_syswm.h>
BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
BX_PRAGMA_DIAGNOSTIC_POP()
#include <bgfx/bgfxplatform.h>
#if defined(None) // X11 defines this...
@ -35,6 +35,37 @@ BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
namespace entry
{
inline bool sdlSetWindow(SDL_Window* _window)
{
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);
if (!SDL_GetWindowWMInfo(_window, &wmi) )
{
return false;
}
bgfx::PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
pd.ndt = wmi.info.x11.display;
pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = wmi.info.win.window;
# elif BX_PLATFORM_STEAMLINK
pd.ndt = wmi.info.vivante.display;
pd.nwh = wmi.info.vivante.window;
# endif // BX_PLATFORM_
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
return true;
}
static uint8_t translateKeyModifiers(uint16_t _sdl)
{
uint8_t modifiers = 0;
@ -446,7 +477,7 @@ namespace entry
s_userEventStart = SDL_RegisterEvents(7);
bgfx::sdlSetWindow(m_window[0]);
sdlSetWindow(m_window[0]);
bgfx::renderFrame();
m_thread.init(MainThreadEntry::threadFunc, &m_mte);
@ -789,8 +820,8 @@ namespace entry
void* nwh = sdlNativeWindowHandle(m_window[handle.idx]);
if (NULL != nwh)
{
m_eventQueue.postWindowEvent(handle, nwh);
m_eventQueue.postSizeEvent(handle, msg->m_width, msg->m_height);
m_eventQueue.postWindowEvent(handle, nwh);
}
delete msg;

View File

@ -30,6 +30,18 @@
namespace entry
{
///
inline void winSetHwnd(::HWND _window)
{
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
typedef DWORD (WINAPI* PFN_XINPUT_GET_STATE)(DWORD dwUserIndex, XINPUT_STATE* pState);
typedef void (WINAPI* PFN_XINPUT_ENABLE)(BOOL enable); // 1.4+
@ -434,13 +446,13 @@ namespace entry
int32_t run(int _argc, char** _argv)
{
SetDllDirectory(".");
SetDllDirectoryA(".");
s_xinput.init();
HINSTANCE instance = (HINSTANCE)GetModuleHandle(NULL);
WNDCLASSEX wnd;
WNDCLASSEXA wnd;
memset(&wnd, 0, sizeof(wnd) );
wnd.cbSize = sizeof(wnd);
wnd.style = CS_HREDRAW | CS_VREDRAW;
@ -471,7 +483,7 @@ namespace entry
| ENTRY_WINDOW_FLAG_FRAME
;
bgfx::winSetHwnd(m_hwnd[0]);
winSetHwnd(m_hwnd[0]);
adjust(m_hwnd[0], ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT, true);
clear(m_hwnd[0]);

View File

@ -9,6 +9,7 @@
#include <bgfx/bgfxplatform.h>
#include <bx/thread.h>
#include <Unknwn.h>
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
@ -26,6 +27,18 @@ static char* g_emptyArgs[] = { "" };
static entry::WindowHandle g_defaultWindow = { 0 };
static entry::EventQueue g_eventQueue;
///
inline void winrtSetWindow(::IUnknown* _window)
{
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
ref class App sealed : public IFrameworkView
{
public:
@ -56,7 +69,7 @@ public:
window->Closed += ref new
TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);
bgfx::winrtSetWindow(reinterpret_cast<IUnknown*>(window) );
winrtSetWindow(reinterpret_cast<IUnknown*>(window) );
}
virtual void Load(String^ entryPoint)

View File

@ -24,6 +24,18 @@
namespace entry
{
///
inline void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL)
{
bgfx::PlatformData pd;
pd.ndt = _display;
pd.nwh = (void*)(uintptr_t)_window;
pd.context = _glx;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
#define JS_EVENT_BUTTON 0x01 /* button pressed/released */
#define JS_EVENT_AXIS 0x02 /* joystick moved */
#define JS_EVENT_INIT 0x80 /* initial state of device */
@ -387,7 +399,7 @@ namespace entry
);
//
bgfx::x11SetDisplayWindow(m_display, m_window[0]);
x11SetDisplayWindow(m_display, m_window[0]);
MainThreadEntry mte;
mte.m_argc = _argc;

View File

@ -466,7 +466,7 @@ FontManager::FontManager(Atlas* _atlas)
init();
}
FontManager::FontManager(uint32_t _textureSideWidth)
FontManager::FontManager(uint16_t _textureSideWidth)
: m_ownAtlas(true)
, m_atlas(new Atlas(_textureSideWidth) )
{
@ -546,8 +546,8 @@ FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_
CachedFont& font = m_cachedFonts[fontIdx];
font.trueTypeFont = ttf;
font.fontInfo = ttf->getFontInfo();
font.fontInfo.fontType = _fontType;
font.fontInfo.pixelSize = _pixelSize;
font.fontInfo.fontType = int16_t(_fontType);
font.fontInfo.pixelSize = uint16_t(_pixelSize);
font.cachedGlyphs.clear();
font.masterFontHandle.idx = bx::HandleAlloc::invalid;
@ -561,15 +561,15 @@ FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle,
CachedFont& baseFont = m_cachedFonts[_baseFontHandle.idx];
FontInfo& fontInfo = baseFont.fontInfo;
FontInfo newFontInfo = fontInfo;
newFontInfo.pixelSize = _pixelSize;
newFontInfo.scale = (float)_pixelSize / (float) fontInfo.pixelSize;
newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
FontInfo newFontInfo = fontInfo;
newFontInfo.pixelSize = uint16_t(_pixelSize);
newFontInfo.scale = (float)_pixelSize / (float) fontInfo.pixelSize;
newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
newFontInfo.descender = (newFontInfo.descender * newFontInfo.scale);
newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
newFontInfo.maxAdvanceWidth = (newFontInfo.maxAdvanceWidth * newFontInfo.scale);
newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
newFontInfo.maxAdvanceWidth = (newFontInfo.maxAdvanceWidth * newFontInfo.scale);
newFontInfo.underlineThickness = (newFontInfo.underlineThickness * newFontInfo.scale);
newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
uint16_t fontIdx = m_fontHandles.alloc();
BX_CHECK(fontIdx != bx::HandleAlloc::invalid, "Invalid handle used");

View File

@ -33,7 +33,7 @@ struct FontInfo
float descender;
/// The spacing in pixels between one row's descent and the next row's ascent.
float lineGap;
/// This field gives the maximum horizontal cursor advance for all glyphs in the font.
/// This field gives the maximum horizontal cursor advance for all glyphs in the font.
float maxAdvanceWidth;
/// The thickness of the under/hover/strike-trough line in pixels.
float underlineThickness;
@ -100,12 +100,12 @@ struct GlyphInfo
float offset_y;
/// For horizontal text layouts, this is the unscaled horizontal
/// distance in pixels used to increment the pen position when the
/// distance in pixels used to increment the pen position when the
/// glyph is drawn as part of a string of text.
float advance_x;
/// For vertical text layouts, this is the unscaled vertical distance
/// in pixels used to increment the pen position when the glyph is
/// in pixels used to increment the pen position when the glyph is
/// drawn as part of a string of text.
float advance_y;
@ -125,7 +125,7 @@ public:
/// Create the font manager and create the texture cube as BGRA8 with
/// linear filtering.
FontManager(uint32_t _textureSideWidth = 512);
FontManager(uint16_t _textureSideWidth = 512);
~FontManager();
@ -135,7 +135,7 @@ public:
return m_atlas;
}
/// Load a TrueType font from a given buffer. The buffer is copied and
/// Load a TrueType font from a given buffer. The buffer is copied and
/// thus can be freed or reused after this call.
///
/// @return invalid handle if the loading fail
@ -155,7 +155,7 @@ public:
/// Preload a set of glyphs from a TrueType file.
///
/// @return True if every glyph could be preloaded, false otherwise if
/// @return True if every glyph could be preloaded, false otherwise if
/// the Font is a baked font, this only do validation on the characters.
bool preloadGlyph(FontHandle _handle, const wchar_t* _string);
@ -167,7 +167,7 @@ public:
/// @remark the handle is required to be valid
const FontInfo& getFontInfo(FontHandle _handle) const;
/// Return the rendering informations about the glyph region. Load the
/// Return the rendering informations about the glyph region. Load the
/// glyph from a TrueType font if possible
///
const GlyphInfo* getGlyphInfo(FontHandle _handle, CodePoint _codePoint);

View File

@ -410,7 +410,15 @@ struct Imgui
const ImguiFontHandle handle = { m_fontHandle.alloc() };
const bgfx::Memory* mem = bgfx::alloc(m_textureWidth * m_textureHeight);
stbtt_BakeFontBitmap( (uint8_t*)_data, 0, _fontSize, mem->data, m_textureWidth, m_textureHeight, 32, 96, m_fonts[handle.idx].m_cdata);
m_fonts[handle.idx].m_texture = bgfx::createTexture2D(m_textureWidth, m_textureHeight, 1, bgfx::TextureFormat::R8, BGFX_TEXTURE_NONE, mem);
m_fonts[handle.idx].m_texture = bgfx::createTexture2D(
m_textureWidth
, m_textureHeight
, false
, 1
, bgfx::TextureFormat::R8
, BGFX_TEXTURE_NONE
, mem
);
m_fonts[handle.idx].m_size = _fontSize;
#else
const ImguiFontHandle handle = { bgfx::invalidHandle };
@ -448,7 +456,15 @@ struct Imgui
}
}
return bgfx::createTexture2D(uint16_t(_width), uint16_t(_height), 0, bgfx::TextureFormat::BGRA8, 0, mem);
return bgfx::createTexture2D(
uint16_t(_width)
, uint16_t(_height)
, false
, 1
, bgfx::TextureFormat::BGRA8
, 0
, mem
);
}
ImguiFontHandle create(float _fontSize, bx::AllocatorI* _allocator)

View File

@ -473,8 +473,10 @@ struct OcornutImguiContext
io.Fonts->GetTexDataAsRGBA32(&data, &width, &height);
m_texture = bgfx::createTexture2D( (uint16_t)width
m_texture = bgfx::createTexture2D(
(uint16_t)width
, (uint16_t)height
, false
, 1
, bgfx::TextureFormat::BGRA8
, 0
@ -652,6 +654,7 @@ struct OcornutImguiContext
#endif // defined(SCI_NAMESPACE)
ImGui::NewFrame();
ImGuizmo::BeginFrame();
ImGui::PushStyleVar(ImGuiStyleVar_ViewId, (float)_viewId);
#if 0

View File

@ -1,4 +1,4 @@
static const uint8_t fs_nanovg_fill_glsl[3095] =
static const uint8_t fs_nanovg_fill_glsl[2928] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, // FSH........u_sci
0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, // ssorMat.......u_
@ -9,7 +9,7 @@ static const uint8_t fs_nanovg_fill_glsl[3095] =
0x6c, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, // le.......u_exten
0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, // tRadius.......u_
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, 0x5f, 0x74, // params.......s_t
0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, // ex......z...vary
0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd3, 0x0a, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, // ex..........vary
0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, // ing highp vec2 v
0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // _position;.varyi
0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, // ng highp vec2 v_
@ -62,140 +62,129 @@ static const uint8_t fs_nanovg_fill_glsl[3095] =
0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, // coord0.y));. if
0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, // ((u_params.w ==
0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, // 0.0)) {. hig
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x3b, // hp vec4 color_6;
0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, // . highp vec3
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // tmpvar_7;. tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, // pvar_7.z = 1.0;.
0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x78, 0x79, 0x20, // tmpvar_7.xy
0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // = v_position;.
0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, // highp vec2 tmp
0x76, 0x61, 0x72, 0x5f, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // var_8;. tmpva
0x72, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, // r_8 = (abs((u_pa
0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // intMat * tmpvar_
0x37, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2d, 0x20, 0x28, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, // 7).xy) - (u_exte
0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x20, 0x2d, 0x20, 0x75, 0x5f, // ntRadius.xy - u_
0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x7a, 0x29, // extentRadius.zz)
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // );. highp vec
0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 2 tmpvar_9;.
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, // tmpvar_9 = max (
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // tmpvar_8, 0.0);.
0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, // highp vec4 t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // mpvar_10;. tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x75, // pvar_10 = mix (u
0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x75, 0x5f, 0x6f, 0x75, 0x74, // _innerCol, u_out
0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x0a, // erCol, clamp ((.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x0a, 0x20, // (((min (.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, // max (tmpv
0x61, 0x72, 0x5f, 0x38, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // ar_8.x, tmpvar_8
0x2e, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, // .y). , 0.0)
0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // + sqrt(.
0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2c, 0x20, // dot (tmpvar_9,
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_9).
0x29, 0x29, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, // )) - u_extentRad
0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ius.z) + (u_para
0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, // ms.x * 0.5)).
0x20, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x2c, // / u_params.x),
0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 0.0, 1.0));.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, // color_6.xyz = t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, // mpvar_10.xyz;.
0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x74, // color_6.w = (t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, // mpvar_10.w * (tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // pvar_5 * tmpvar_
0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // 2));. result_
0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x7d, // 1 = color_6;. }
0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, // else {. if (
0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, // (u_params.w == 1
0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, // .0)) {. low
0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x3b, // p vec4 color_11;
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // . highp vec
0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 3 tmpvar_12;.
0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x7a, 0x20, 0x3d, // tmpvar_12.z =
0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // 1.0;. tmpv
0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, // ar_12.xy = v_pos
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, // ition;. low
0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, // p vec4 tmpvar_13
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ;. tmpvar_1
0x33, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, // 3 = texture2D (s
0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // _tex, ((u_paintM
0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x2e, // at * tmpvar_12).
0x78, 0x79, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, // xy / u_extentRad
0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ius.xy));.
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // color_11 = tmpva
0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // r_13;. lowp
0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, // vec4 tmpvar_14;
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, // . if ((u_pa
0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, // rams.z == 0.0))
0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // {. tmpvar
0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, // _14 = tmpvar_13;
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // . } else {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, // lowp vec
0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 4 tmpvar_15;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, // tmpvar_15.x
0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, // yz = vec3(1.0, 1
0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0, 1.0);.
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x77, 0x20, 0x3d, 0x20, // tmpvar_15.w =
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, // tmpvar_13.x;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, // tmpvar_14 =
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_15;.
0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // };. color
0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _11.xyz = tmpvar
0x5f, 0x31, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, // _14.xyz;. c
0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, // olor_11.w = (tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, // var_14.w * (tmpv
0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, // ar_5 * tmpvar_2)
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // );. result_
0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, // 1 = color_11;.
0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // } else {.
0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // if ((u_params.w
0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // == 2.0)) {.
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x76, // result_1 = v
0x65, 0x63, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, // ec4(1.0, 1.0, 1.
0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, // 0, 1.0);. }
0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // else {.
0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, // if ((u_params.w
0x3d, 0x3d, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 3.0)) {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, // lowp vec4 c
0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // olor_16;.
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, // hp vec3 tmpvar_6
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x2e, 0x7a, // ;. tmpvar_6.z
0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // = 1.0;. tmpv
0x61, 0x72, 0x5f, 0x36, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ar_6.xy = v_posi
0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // tion;. highp
0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x3b, 0x0a, 0x20, // vec2 tmpvar_7;.
0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x28, 0x61, // tmpvar_7 = (a
0x62, 0x73, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, // bs((u_paintMat *
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2d, // tmpvar_6).xy) -
0x20, 0x28, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, // (u_extentRadius
0x2e, 0x78, 0x79, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, // .xy - u_extentRa
0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x7a, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x68, // dius.zz));. h
0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ighp vec2 tmpvar
0x5f, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // _8;. tmpvar_8
0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, // = max (tmpvar_7
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, // , 0.0);. resu
0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x75, 0x5f, 0x69, // lt_1 = (mix (u_i
0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, // nnerCol, u_outer
0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, // Col, clamp (.
0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ((((.
0x6d, 0x69, 0x6e, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // min (max (tmpvar
0x5f, 0x37, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x79, // _7.x, tmpvar_7.y
0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2b, // ), 0.0). +
0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x64, // . sqrt(d
0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2c, 0x20, 0x74, 0x6d, // ot (tmpvar_8, tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, // pvar_8)). )
0x20, 0x2d, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, // - u_extentRadiu
0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // s.z) + (u_params
0x2e, 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x70, // .x * 0.5)) / u_p
0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, // arams.x). , 0
0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, // .0, 1.0)) * (tmp
0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // var_5 * tmpvar_2
0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, // ));. } else {.
0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // if ((u_params
0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, // .w == 1.0)) {.
0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, // lowp vec4 co
0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, // lor_9;. hig
0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // hp vec3 tmpvar_1
0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 0;. tmpvar_
0x31, 0x30, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 10.z = 1.0;.
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x3d, // tmpvar_10.xy =
0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, // v_position;.
0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // lowp vec4 tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // var_17;.
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x20, 0x3d, 0x20, 0x74, 0x65, // tmpvar_17 = te
0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // xture2D (s_tex,
0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, // v_texcoord0);.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, // color_16
0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_17;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, // lowp vec
0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 4 tmpvar_18;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, // if ((u_pa
0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, // rams.z == 0.0))
0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // {. tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_18 = tmpvar
0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, // _17;. }
0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // else {.
0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // var_11;. tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // pvar_11 = textur
0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x28, 0x75, 0x5f, // e2D (s_tex, ((u_
0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // paintMat * tmpva
0x72, 0x5f, 0x31, 0x30, 0x29, 0x2e, 0x78, 0x79, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, // r_10).xy / u_ext
0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x3b, 0x0a, // entRadius.xy));.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, // color_9 =
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_11;.
0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, // if ((u_params.z
0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // == 1.0)) {.
0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, // lowp vec4 tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_19;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x2e, 0x78, // tmpvar_19.x
0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, // yz = vec3(1.0, 1
0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0, 1.0);.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x2e, // tmpvar_19.
0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x78, 0x3b, // w = tmpvar_17.x;
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // . tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_18 = tmpvar_
0x31, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // 19;. };
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // . color
0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _16.xyz = tmpvar
0x5f, 0x31, 0x38, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _18.xyz;.
0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, // color_16.w =
0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x74, // (tmpvar_18.w * t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_2);.
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, // result_1 = (
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6e, 0x6e, // color_16 * u_inn
0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // erCol);.
0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // };. };.
0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // };. };. gl_Fra
0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // gColor = result_
0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}...
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_12;.
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_12.xyz =
0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, // (tmpvar_11.xyz
0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x29, 0x3b, 0x0a, // * tmpvar_11.w);.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // tmpvar_1
0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, // 2.w = tmpvar_11.
0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // w;. color
0x5f, 0x39, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, // _9 = tmpvar_12;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, // };. i
0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, // f ((u_params.z =
0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 2.0)) {.
0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // color_9 = colo
0x72, 0x5f, 0x39, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_9.xxxx;.
0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, // };. color_9
0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x75, 0x5f, // = (color_9 * u_
0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // innerCol);.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, // color_9 = (colo
0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, // r_9 * (tmpvar_5
0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // * tmpvar_2));.
0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, // result_1 = c
0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, // olor_9;. } el
0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, // se {. if ((
0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, // u_params.w == 2.
0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, // 0)) {. re
0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x31, 0x2e, // sult_1 = vec4(1.
0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // 0, 1.0, 1.0, 1.0
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, // );. } else
0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, // {. if ((u
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x33, 0x2e, 0x30, // _params.w == 3.0
0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, // )) {. l
0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // owp vec4 color_1
0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, // 3;. low
0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // p vec4 tmpvar_14
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ;. tmpv
0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // ar_14 = texture2
0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // D (s_tex, v_texc
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // oord0);.
0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // color_13 = tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // var_14;.
0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // if ((u_params.
0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // z == 1.0)) {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, // lowp ve
0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, // c4 tmpvar_15;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // tmpvar
0x5f, 0x31, 0x35, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _15.xyz = (tmpva
0x72, 0x5f, 0x31, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // r_14.xyz * tmpva
0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_14.w);.
0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x77, // tmpvar_15.w
0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x3b, 0x0a, // = tmpvar_14.w;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // colo
0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, // r_13 = tmpvar_15
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, // ;. };.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x75, 0x5f, // if ((u_
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, // params.z == 2.0)
0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ) {.
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_13 = color
0x5f, 0x31, 0x33, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _13.xxxx;.
0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // };.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, // color_13 = (col
0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // or_13 * tmpvar_2
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, // );. res
0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // ult_1 = (color_1
0x33, 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, // 3 * u_innerCol);
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // . };.
0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, // };. };. };
0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor
0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = result_1;.}...
};
static const uint8_t fs_nanovg_fill_dx9[1547] =
static const uint8_t fs_nanovg_fill_dx9[1595] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // 0......u_extentR
@ -206,7 +195,7 @@ static const uint8_t fs_nanovg_fill_dx9[1547] =
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, // _params.......u_
0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, // scissorExtScale.
0x01, 0x08, 0x00, 0x01, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, // ......u_scissorM
0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0x70, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at......p.......
0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x03, 0x00, 0xa0, 0x05, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // at..............
0x64, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x00, 0x03, // d.CTAB....W.....
0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x01, // ..............P.
0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xc4, 0x00, // ................
@ -234,68 +223,71 @@ static const uint8_t fs_nanovg_fill_dx9[1547] =
0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, // 10.0.10011.16384
0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // ..Q..........?..
0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, // .@.......?Q.....
0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, // .........?..@@..
0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........@@......
0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, // ................
0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, // ................
0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U...........
0x01, 0x80, 0x00, 0x00, 0x00, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, // ........U.......
0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x01, 0x80, 0x01, 0x00, 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ....U...........
0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x06, 0x80, 0x04, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U.......
0x06, 0x80, 0x03, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xd0, 0xa0, 0x06, 0x00, // ................
0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x01, 0x00, // ................
0x02, 0x80, 0x09, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, // ....U...........
0xe9, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0c, 0x80, 0x01, 0x00, // ................
0x44, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0c, 0x80, 0x00, 0x00, // D...U...........
0x44, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // D...............
0x0c, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x44, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ........D.......
0x0c, 0x80, 0x01, 0x00, 0xe4, 0x8b, 0x08, 0x00, 0x44, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, // ........D.......
0x07, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x1c, 0x80, 0x01, 0x00, // ................
0xe4, 0x80, 0x08, 0x00, 0xe4, 0xa1, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ................
0x04, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x23, 0x00, 0x00, 0x02, 0x02, 0x00, // ..........#.....
0x0c, 0x80, 0x0a, 0x00, 0xb4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x01, 0x00, // ......B.........
0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0f, 0x80, 0x03, 0x00, // ................
0x00, 0x80, 0x0c, 0x00, 0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x03, 0x00, // ....@.....X.....
0x0f, 0x80, 0x02, 0x00, 0xff, 0x81, 0x03, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, // ................
0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xff, 0x80, 0x29, 0x00, // ..............).
0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x04, 0x00, // ........U.......
0x0f, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, // ......*.........
0x04, 0x80, 0x0c, 0x00, 0xaa, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, // ......).........
0xaa, 0x80, 0x42, 0x00, 0x00, 0x03, 0x05, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, // ..B.............
0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x06, 0x00, 0x0f, 0x80, 0x05, 0x00, 0x00, 0x80, 0x0c, 0x00, // ................
0x40, 0xa0, 0x0c, 0x00, 0x15, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x05, 0x00, 0x0f, 0x80, 0x02, 0x00, // @.....X.........
0xff, 0x81, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, // ................
0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x05, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, // ................
0x0f, 0x80, 0x05, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........*.....
0x00, 0x02, 0x04, 0x00, 0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..........+...+.
0x00, 0x00, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, // ..X.............
0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x09, 0x00, // ................
0xaa, 0xa1, 0x09, 0x00, 0x60, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, // ....`...........
0xe4, 0x8b, 0x02, 0x00, 0xf4, 0x81, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0a, 0x80, 0x00, 0x00, // ................
0xa4, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x02, 0x00, // ......Z.........
0xed, 0x80, 0x02, 0x00, 0xed, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, // ................
0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................
0xff, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, // ............U...
0xaa, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x55, 0x80, 0x0c, 0x00, // ............U...
0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, // ................
0x55, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x09, 0x00, // U...........U...
0xaa, 0xa1, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x02, 0x00, // ................
0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, // ....U...........
0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x12, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, // ................
0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, // U...............
0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ................
0x00, 0x04, 0x03, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x06, 0x00, // ........U.......
0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, // ................
0xff, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xaa, 0x81, 0x03, 0x00, // ..X.............
0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x01, 0x00, // ................
0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, // ....U...........
0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x03, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x03, 0x80, 0x00, 0x00, 0xe4, 0x8b, 0x08, 0x00, 0xe4, 0xa1, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // ................
0x0b, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x13, 0x80, 0x00, 0x00, // ................
0xe4, 0x80, 0x08, 0x00, 0xee, 0xa1, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x01, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ....U...........
0x02, 0x80, 0x01, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, // ........U.......
0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x8c, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, // ........U.......
0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, // ........U...U...
0x00, 0x03, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, // ........U.......
0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x90, 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, // ........U.......
0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x23, 0x00, // ........U.....#.
0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x0a, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
0x03, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, // ........U.......
0x03, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
0x00, 0x03, 0x02, 0x00, 0x03, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xe4, 0xa0, 0x02, 0x00, // ................
0x00, 0x03, 0x02, 0x00, 0x0c, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x09, 0x00, 0x44, 0xa0, 0x02, 0x00, // ............D...
0x00, 0x03, 0x02, 0x00, 0x0c, 0x80, 0x02, 0x00, 0xe4, 0x81, 0x02, 0x00, 0x44, 0x8b, 0x0b, 0x00, // ............D...
0x00, 0x03, 0x03, 0x00, 0x03, 0x80, 0x02, 0x00, 0xee, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, // ..............Z.
0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0x80, 0x0c, 0x00, // ................
0x00, 0xa0, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, // ................
0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x01, 0x00, // ................
0x04, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0xff, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
0x04, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x02, 0x00, 0xaa, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x09, 0x00, 0xaa, 0xa1, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
0x08, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, 0x80, 0x06, 0x00, // ................
0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x0a, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x18, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................
0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x06, 0x00, 0x00, 0x02, 0x03, 0x00, // ........U.......
0x01, 0x80, 0x09, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x03, 0x00, 0x02, 0x80, 0x09, 0x00, // ................
0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x05, 0x80, 0x02, 0x00, 0xd4, 0x80, 0x03, 0x00, // U...............
0xd4, 0x80, 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe8, 0x80, 0x00, 0x08, // ..B.............
0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0d, 0x80, 0x01, 0x00, 0x77, 0x81, 0x0a, 0x00, // ............w...
0xa7, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xff, 0x80, 0x02, 0x00, // ................
0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, // ..X.............
0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x02, 0x00, 0x0e, 0x80, 0x01, 0x00, // ......X.........
0xff, 0x8c, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, // ................
0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, // ....U.....).....
0xff, 0xa0, 0x01, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x0f, 0x80, 0x0b, 0x00, // ....U...........
0xff, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x0c, 0x00, // ..*.............
0x55, 0xa0, 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x55, 0x80, 0x42, 0x00, // U.).........U.B.
0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, // ................
0x00, 0x03, 0x05, 0x00, 0x07, 0x80, 0x04, 0x00, 0xff, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x58, 0x00, // ..............X.
0x00, 0x04, 0x04, 0x00, 0x07, 0x80, 0x01, 0x00, 0xaa, 0x8c, 0x05, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................
0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0e, 0x80, 0x01, 0x00, 0xff, 0x8c, 0x04, 0x00, // ..X.............
0x00, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x00, 0x00, // ................
0x00, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x0f, 0x80, 0x04, 0x00, // ................
0xe4, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, // ......*.........
0x0f, 0x80, 0x0c, 0x00, 0x00, 0xa0, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x58, 0x00, // ......+...+...X.
0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x8c, 0x02, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................
0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x02, 0x00, // ................
0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x81, 0x07, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ................
0x00, 0x04, 0x02, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xff, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x06, 0x00, // ................
0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x02, 0x00, // ............U...
0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xaa, 0x81, 0x02, 0x00, // ..X.............
0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...........
};
static const uint8_t fs_nanovg_fill_dx11[2298] =
static const uint8_t fs_nanovg_fill_dx11[2362] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x08, 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, // FSH........u_sci
0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x13, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x75, 0x5f, // ssorMat.......u_
@ -306,9 +298,9 @@ static const uint8_t fs_nanovg_fill_dx11[2298] =
0x6c, 0x65, 0x12, 0x00, 0x80, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, // le.......u_exten
0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x12, 0x00, 0x90, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, // tRadius.......u_
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x05, 0x73, 0x5f, 0x74, // params.......s_t
0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x5c, 0x08, 0x44, 0x58, 0x42, 0x43, 0xd1, 0x0d, // ex0.......DXBC..
0x44, 0xc2, 0xc4, 0x7b, 0x60, 0xde, 0xb6, 0xfb, 0x34, 0x0f, 0x88, 0x9d, 0xbc, 0x6e, 0x01, 0x00, // D..{`...4....n..
0x00, 0x00, 0x5c, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..........,.....
0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x9c, 0x08, 0x44, 0x58, 0x42, 0x43, 0x21, 0x36, // ex0.......DXBC!6
0x2a, 0x19, 0x73, 0x28, 0xce, 0xe0, 0xff, 0xcd, 0x27, 0x27, 0x8e, 0x5c, 0x18, 0x73, 0x01, 0x00, // *.s(....''...s..
0x00, 0x00, 0x9c, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..........,.....
0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, // ......ISGNh.....
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ......P.........
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, // ................
@ -319,8 +311,8 @@ static const uint8_t fs_nanovg_fill_dx11[2298] =
0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, // RD....OSGN,.....
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... .........
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, // ..............SV
0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x84, 0x07, // _TARGET...SHDR..
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xe1, 0x01, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@.......Y...F.
0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xc4, 0x07, // _TARGET...SHDR..
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@.......Y...F.
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, // .........Z....`
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, // ......X....p....
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, // ..UU..b...2.....
@ -390,61 +382,65 @@ static const uint8_t fs_nanovg_fill_dx11[2298] =
0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ...
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8...B.....
0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // ................
0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, // ..8.... ......*.
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ......:.......6.
0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..r ......F.....
0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........B.....
0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, // ..:. ..........@
0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x1f, 0x00, 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, // .....?....*.....
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, // ..8...........V.
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ........ .......
0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, // ..2.............
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, // ...............
0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc2, 0x00, // ................
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, // ................
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x08, 0xc2, 0x00, // ...............
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, // ................
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, // .........E.....
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, // ..............F~
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, // .......`........
0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x80, 0x20, 0x00, 0x00, 0x00, // ..B.......*. ...
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, // .......@......6.
0x00, 0x05, 0x12, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ...........@....
0x80, 0x3f, 0x36, 0x00, 0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, // .?6.............
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......7.........
0x00, 0x00, 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..........F.....
0x00, 0x00, 0x06, 0x0c, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00, // ..........8...".
0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0a, // ..8.... ........
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, // ......F.........
0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, // ......B.......:.
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ..........@....
0x80, 0x3f, 0x1f, 0x00, 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // .?....*.......8.
0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, // ..........V.....
0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x32, 0x00, // .... .........2.
0x00, 0x0a, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, // ............ ...
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0e, // ................
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, // ................
0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, // ............ ...
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x08, 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, // ................
0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, // ............ ...
0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......E.........
0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..........F~....
0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x0b, 0xc2, 0x00, // ...`............
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ........ .......
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@............
0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, // .?...@8...r.....
0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..........F.....
0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0a, // ..7...r.........
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, // ......F.......F.
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xe2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......7.........
0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x01, 0x00, // ................
0x00, 0x00, 0x56, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, // ..V.......8.....
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......F.......F.
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00, // .........8...".
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ................
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, // ......8.... ....
0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, // ..........:.....
0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..6...r ......F.
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, // ..............".
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......:. .......
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, // ...@.....@......
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......6.... ....
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // ...@.....?...?..
0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, // .?...?........".
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......:. .......
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, // ...@....@@......
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, // ......E.........
0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..........F~....
0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, // ...`..........".
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......*. .......
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x00, // ...@......6.....
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x36, 0x00, // .......@.....?6.
0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, // ................
0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, // ..7...........V.
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x0c, // ......F.........
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x01, 0x00, // ......8.........
0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, // ..........:.....
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......8.... ....
0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..V.......F.....
0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........".....
0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, // ..:. ..........@
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // .....@..........
0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ..6.... .......@
0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // .....?...?...?..
0x80, 0x3f, 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, // .?........".....
0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, // ..:. ..........@
0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x1f, 0x00, 0x04, 0x03, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // ....@@..........
0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x1a, // ..E.............
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......`
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x0b, 0x62, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........b.....
0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x40, // .... ..........@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .........?...@..
0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf6, 0x0f, // ..8...r.........
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, // ......F.......7.
0x00, 0x09, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, // ..r.......V.....
0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..F.......F.....
0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xe2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0a, // ..7.............
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x0e, // ..............V.
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8.........
0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..........F.....
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..8.... ......F.
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // ......F. .......
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // ......F. .......
0x00, 0x00, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, // ................
0x00, 0x01, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0xb0, 0x00, // ..>.......
};
static const uint8_t fs_nanovg_fill_mtl[3540] =
static const uint8_t fs_nanovg_fill_mtl[3466] =
{
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xc5, 0x0d, 0x00, 0x00, 0x75, 0x73, // FSH...........us
0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x7b, 0x0d, 0x00, 0x00, 0x75, 0x73, // FSH.......{...us
0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me
0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat
0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput {
@ -533,137 +529,132 @@ static const uint8_t fs_nanovg_fill_mtl[3540] =
0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // float2 tmpvar
0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, // _9;. tmpvar_9
0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // = max (tmpvar_8
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // , 0.0);. floa
0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, // t4 tmpvar_10;.
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x6d, 0x69, // tmpvar_10 = mi
0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, // x (_mtl_u.u_inne
0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, // rCol, _mtl_u.u_o
0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, // uterCol, clamp (
0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, // (. (((min (
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, // . max (tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_8.x, tmpvar
0x5f, 0x38, 0x2e, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, 0x2e, // _8.y). , 0.
0x30, 0x29, 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // 0) + sqrt(.
0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, // dot (tmpvar_9
0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, // , tmpvar_9).
0x20, 0x20, 0x29, 0x29, 0x20, 0x2d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // )) - _mtl_u.u_
0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, // extentRadius.z)
0x2b, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // + (_mtl_u.u_para
0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, // ms.x * 0.5)).
0x20, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, // / _mtl_u.u_par
0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // ams.x), 0.0, 1.0
0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x2e, // ));. color_6.
0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, // xyz = tmpvar_10.
0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, // xyz;. color_6
0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, // .w = (tmpvar_10.
0x77, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, // w * (tmpvar_5 *
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_2));.
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // result_1 = half4
0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, // (color_6);. } e
0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, // lse {. if ((_
0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // mtl_u.u_params.w
0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // == 1.0)) {.
0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, // half4 color_11
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, // ;. float3 t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_12;.
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, // tmpvar_12.z = 1.
0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 0;. tmpvar_
0x31, 0x32, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // 12.xy = _mtl_i.v
0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // _position;.
0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float2 tmpvar_1
0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 3;. tmpvar_
0x31, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // 13 = ((_mtl_u.u_
0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // paintMat * tmpva
0x72, 0x5f, 0x31, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // r_12).xy / _mtl_
0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, // u.u_extentRadius
0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // .xy);. half
0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 4 tmpvar_14;.
0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x68, // tmpvar_14 = h
0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // alf4(s_tex.sampl
0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // e(_mtlsmp_s_tex,
0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // (float2)(tmpvar
0x5f, 0x31, 0x33, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // _13)));. co
0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_11 = tmpvar_
0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, // 14;. half4
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_15;.
0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // if ((_mtl_u.u_p
0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, // arams.z == 0.0))
0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // {. tmpva
0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // r_15 = tmpvar_14
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, // ;. } else {
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, // . half4 t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_16;.
0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, // tmpvar_16.xyz
0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x31, // = half3(float3(1
0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, // .0, 1.0, 1.0));.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // tmpvar_1
0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, // 6.w = tmpvar_14.
0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // x;. tmpva
0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, // r_15 = tmpvar_16
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // ;. };.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // color_11.xyz =
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, // tmpvar_15.xyz;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x20, // color_11.w
0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // = ((half)((float
0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, // )tmpvar_15.w * (
0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // tmpvar_5 * tmpva
0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, // r_2)));. re
0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // sult_1 = color_1
0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // 1;. } else {.
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // , 0.0);. colo
0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // r_6 = (mix (_mtl
0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x5f, // _u.u_innerCol, _
0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, // mtl_u.u_outerCol
0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // , clamp (.
0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x6e, // ((((. min
0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, // (max (tmpvar_8.
0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, 0x79, 0x29, 0x2c, 0x20, // x, tmpvar_8.y),
0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2b, 0x20, 0x0a, 0x20, // 0.0). + .
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x64, 0x6f, 0x74, 0x20, // sqrt(dot
0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // (tmpvar_9, tmpva
0x72, 0x5f, 0x39, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x2d, 0x20, // r_9)). ) -
0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // _mtl_u.u_extentR
0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // adius.z) + (_mtl
0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, // _u.u_params.x *
0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // 0.5)) / _mtl_u.u
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2c, // _params.x). ,
0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, // 0.0, 1.0)) * (t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // mpvar_5 * tmpvar
0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // _2));. result
0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _1 = half4(color
0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // _6);. } else {.
0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u.
0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, // u_params.w == 1.
0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // 0)) {. half
0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 4 color_10;.
0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_
0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // 11;. tmpvar
0x5f, 0x31, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, // _11.z = 1.0;.
0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x20, // tmpvar_11.xy
0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.v_posit
0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // ion;. float
0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 2 tmpvar_12;.
0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x28, // tmpvar_12 = (
0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // (_mtl_u.u_paintM
0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x29, 0x2e, // at * tmpvar_11).
0x78, 0x79, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, // xy / _mtl_u.u_ex
0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, // tentRadius.xy);.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // half4 tmpv
0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // ar_13;. tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, // var_13 = half4(s
0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // _tex.sample(_mtl
0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // smp_s_tex, (floa
0x74, 0x32, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x29, 0x29, // t2)(tmpvar_12)))
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, // ;. color_10
0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_13;.
0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u.
0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, // u_params.z == 1.
0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 0)) {. ha
0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, // lf4 tmpvar_14;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // tmpvar_14
0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // .xyz = (tmpvar_1
0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 3.xyz * tmpvar_1
0x33, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // 3.w);. tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // pvar_14.w = tmpv
0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_13.w;.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // color_10 = tmpv
0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, // ar_14;. };.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // if ((_mtl_
0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, // u.u_params.w ==
0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, // u.u_params.z ==
0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 2.0)) {.
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // result_1 = half4
0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // (float4(1.0, 1.0
0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // , 1.0, 1.0));.
0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // } else {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // if ((_mtl_u
0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x33, // .u_params.w == 3
0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0)) {.
0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x3b, // half4 color_17;
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // . half4
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_18;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x20, // tmpvar_18
0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, // = half4(s_tex.sa
0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, // mple(_mtlsmp_s_t
0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, // ex, (float2)(_mt
0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, // l_i.v_texcoord0)
0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // ));. co
0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_17 = tmpvar_
0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 18;. ha
0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x3b, 0x0a, 0x20, // lf4 tmpvar_19;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, // if ((_m
0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, // tl_u.u_params.z
0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 0.0)) {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, // tmpvar_19
0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_18;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, // } else {
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, // . hal
0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x30, 0x3b, 0x0a, 0x20, 0x20, // f4 tmpvar_20;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // tmpvar
0x5f, 0x32, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, // _20.xyz = half3(
0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, // float3(1.0, 1.0,
0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 1.0));.
0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x30, 0x2e, 0x77, 0x20, // tmpvar_20.w
0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x38, 0x2e, 0x78, 0x3b, 0x0a, 0x20, // = tmpvar_18.x;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // tmpva
0x72, 0x5f, 0x31, 0x39, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x30, // r_19 = tmpvar_20
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, // ;. };.
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_10 = color
0x5f, 0x31, 0x30, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _10.xxxx;.
0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // };. color_1
0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, // 0 = ((half4)((fl
0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x2a, 0x20, // oat4)color_10 *
0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, // _mtl_u.u_innerCo
0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // l));. color
0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, // _10 = ((half4)((
0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, // float4)color_10
0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, // * (tmpvar_5 * tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_2)));.
0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // result_1 = colo
0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, // r_10;. } else
0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, // {. if ((_m
0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, // tl_u.u_params.w
0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 2.0)) {.
0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, // result_1 = ha
0x6c, 0x66, 0x34, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, // lf4(float4(1.0,
0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, // 1.0, 1.0, 1.0));
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // . } else {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, // if ((_mt
0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, // l_u.u_params.w =
0x3d, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 3.0)) {.
0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // half4 color_
0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 15;. ha
0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, // lf4 tmpvar_16;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // tmpvar_
0x31, 0x36, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // 16 = half4(s_tex
0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // .sample(_mtlsmp_
0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, // s_tex, (float2)(
0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // _mtl_i.v_texcoor
0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // d0)));.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // color_15 = tmpv
0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_16;.
0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // if ((_mtl_u.u_p
0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, // arams.z == 1.0))
0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, // {. h
0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, // alf4 tmpvar_17;.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpv
0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, // ar_17.xyz = (tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, // var_16.xyz * tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // var_16.w);.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, // tmpvar_17
0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, // .w = tmpvar_16.w
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // ;. co
0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_15 = tmpvar_
0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // 17;. };
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, // . if ((
0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params.
0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // z == 2.0)) {.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // color_1
0x37, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 7.xyz = tmpvar_1
0x39, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 9.xyz;.
0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, // color_17.w = ((
0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, 0x74, 0x6d, 0x70, // half)((float)tmp
0x76, 0x61, 0x72, 0x5f, 0x31, 0x39, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // var_19.w * tmpva
0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_2));.
0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, // result_1 = ((ha
0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, // lf4)((float4)col
0x6f, 0x72, 0x5f, 0x31, 0x37, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // or_17 * _mtl_u.u
0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // _innerCol));.
0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // };. };
0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // . };. };. _
0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol
0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // or = result_1;.
0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;.
0x7d, 0x0a, 0x0a, 0x00, // }...
0x35, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x78, 0x78, // 5 = color_15.xxx
0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, // x;. };.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // color_
0x31, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, // 15 = ((half4)((f
0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x2a, // loat4)color_15 *
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // tmpvar_2));.
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, // result_1
0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, // = ((half4)((floa
0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x2a, 0x20, 0x5f, 0x6d, // t4)color_15 * _m
0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, // tl_u.u_innerCol)
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // );. };.
0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // };. };.
0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // };. _mtl_o.gl_F
0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // ragColor = resul
0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // t_1;. return _m
0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}...
};

View File

@ -61,7 +61,7 @@ void main()
float d = clamp( (sdroundrect(pt, u_extent, u_radius) + u_feather*0.5) / u_feather, 0.0, 1.0);
vec4 color = mix(u_innerCol, u_outerCol, d);
// Combine alpha
color.w *= strokeAlpha * scissor;
color *= strokeAlpha * scissor;
result = color;
}
else if (u_type == 1.0) // Image
@ -69,9 +69,12 @@ void main()
// Calculate color from texture
vec2 pt = mul(u_paintMat, vec3(v_position, 1.0) ).xy / u_extent;
vec4 color = texture2D(s_tex, pt);
color = u_texType == 0.0 ? color : vec4(1.0, 1.0, 1.0, color.x);
if (u_texType == 1.0) color = vec4(color.xyz * color.w, color.w);
if (u_texType == 2.0) color = color.xxxx;
// Apply color tint and alpha
color *= u_innerCol;
// Combine alpha
color.w *= strokeAlpha * scissor;
color *= strokeAlpha * scissor;
result = color;
}
else if (u_type == 2.0) // Stencil fill
@ -81,8 +84,9 @@ void main()
else if (u_type == 3.0) // Textured tris
{
vec4 color = texture2D(s_tex, v_texcoord0.xy);
color = u_texType == 0.0 ? color : vec4(1.0, 1.0, 1.0, color.x);
color.w *= scissor;
if (u_texType == 1.0) color = vec4(color.xyz * color.w, color.w);
if (u_texType == 2.0) color = color.xxxx;
color *= scissor;
result = color * u_innerCol;
}

View File

@ -110,6 +110,7 @@ enum NVGpointFlags
};
struct NVGstate {
NVGcompositeOperationState compositeOperation;
NVGpaint fill;
NVGpaint stroke;
float strokeWidth;
@ -247,6 +248,76 @@ static void nvg__setDevicePixelRatio(NVGcontext* ctx, float ratio)
ctx->devicePxRatio = ratio;
}
static NVGcompositeOperationState nvg__compositeOperationState(int op)
{
// NVG_SOURCE_OVER
int sfactor = NVG_ONE;
int dfactor = NVG_ONE_MINUS_SRC_ALPHA;
if (op == NVG_SOURCE_IN)
{
sfactor = NVG_DST_ALPHA;
dfactor = NVG_ZERO;
}
else if (op == NVG_SOURCE_OUT)
{
sfactor = NVG_ONE_MINUS_DST_ALPHA;
dfactor = NVG_ZERO;
}
else if (op == NVG_ATOP)
{
sfactor = NVG_DST_ALPHA;
dfactor = NVG_ONE_MINUS_SRC_ALPHA;
}
else if (op == NVG_DESTINATION_OVER)
{
sfactor = NVG_ONE_MINUS_DST_ALPHA;
dfactor = NVG_ONE;
}
else if (op == NVG_DESTINATION_IN)
{
sfactor = NVG_ZERO;
dfactor = NVG_SRC_ALPHA;
}
else if (op == NVG_DESTINATION_OUT)
{
sfactor = NVG_ZERO;
dfactor = NVG_ONE_MINUS_SRC_ALPHA;
}
else if (op == NVG_DESTINATION_ATOP)
{
sfactor = NVG_ONE_MINUS_DST_ALPHA;
dfactor = NVG_SRC_ALPHA;
}
else if (op == NVG_LIGHTER)
{
sfactor = NVG_ONE;
dfactor = NVG_ONE;
}
else if (op == NVG_COPY)
{
sfactor = NVG_ONE;
dfactor = NVG_ZERO;
}
else if (op == NVG_XOR)
{
sfactor = NVG_ONE_MINUS_DST_ALPHA;
dfactor = NVG_ONE_MINUS_SRC_ALPHA;
}
NVGcompositeOperationState state;
state.srcRGB = sfactor;
state.dstRGB = dfactor;
state.srcAlpha = sfactor;
state.dstAlpha = dfactor;
return state;
}
static NVGstate* nvg__getState(NVGcontext* ctx)
{
return &ctx->states[ctx->nstates-1];
}
NVGcontext* nvgCreateInternal(NVGparams* params)
{
FONSparams fontParams;
@ -354,7 +425,8 @@ void nvgCancelFrame(NVGcontext* ctx)
void nvgEndFrame(NVGcontext* ctx)
{
ctx->params.renderFlush(ctx->params.userPtr);
NVGstate* state = nvg__getState(ctx);
ctx->params.renderFlush(ctx->params.userPtr, state->compositeOperation);
if (ctx->fontImageIdx != 0) {
int fontImage = ctx->fontImages[ctx->fontImageIdx];
int i, j, iw, ih;
@ -477,12 +549,6 @@ NVGcolor nvgHSLA(float h, float s, float l, unsigned char a)
return col;
}
static NVGstate* nvg__getState(NVGcontext* ctx)
{
return &ctx->states[ctx->nstates-1];
}
void nvgTransformIdentity(float* t)
{
t[0] = 1.0f; t[1] = 0.0f;
@ -615,6 +681,7 @@ void nvgReset(NVGcontext* ctx)
nvg__setPaintColor(&state->fill, nvgRGBA(255,255,255,255));
nvg__setPaintColor(&state->stroke, nvgRGBA(0,0,0,255));
state->compositeOperation = nvg__compositeOperationState(NVG_SOURCE_OVER);
state->strokeWidth = 1.0f;
state->miterLimit = 10.0f;
state->lineCap = NVG_BUTT;
@ -983,6 +1050,30 @@ void nvgResetScissor(NVGcontext* ctx)
state->scissor.extent[1] = -1.0f;
}
// Global composite operation.
void nvgGlobalCompositeOperation(NVGcontext* ctx, int op)
{
NVGstate* state = nvg__getState(ctx);
state->compositeOperation = nvg__compositeOperationState(op);
}
void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor)
{
nvgGlobalCompositeBlendFuncSeparate(ctx, sfactor, dfactor, sfactor, dfactor);
}
void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)
{
NVGcompositeOperationState op;
op.srcRGB = srcRGB;
op.dstRGB = dstRGB;
op.srcAlpha = srcAlpha;
op.dstAlpha = dstAlpha;
NVGstate* state = nvg__getState(ctx);
state->compositeOperation = op;
}
static int nvg__ptEquals(float x1, float y1, float x2, float y2, float tol)
{
float dx = x2 - x1;

View File

@ -81,10 +81,46 @@ enum NVGalign {
// Vertical align
NVG_ALIGN_TOP = 1<<3, // Align text vertically to top.
NVG_ALIGN_MIDDLE = 1<<4, // Align text vertically to middle.
NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
};
enum NVGblendFactor {
NVG_ZERO = 1<<0,
NVG_ONE = 1<<1,
NVG_SRC_COLOR = 1<<2,
NVG_ONE_MINUS_SRC_COLOR = 1<<3,
NVG_DST_COLOR = 1<<4,
NVG_ONE_MINUS_DST_COLOR = 1<<5,
NVG_SRC_ALPHA = 1<<6,
NVG_ONE_MINUS_SRC_ALPHA = 1<<7,
NVG_DST_ALPHA = 1<<8,
NVG_ONE_MINUS_DST_ALPHA = 1<<9,
NVG_SRC_ALPHA_SATURATE = 1<<10,
};
enum NVGcompositeOperation {
NVG_SOURCE_OVER,
NVG_SOURCE_IN,
NVG_SOURCE_OUT,
NVG_ATOP,
NVG_DESTINATION_OVER,
NVG_DESTINATION_IN,
NVG_DESTINATION_OUT,
NVG_DESTINATION_ATOP,
NVG_LIGHTER,
NVG_COPY,
NVG_XOR,
};
struct NVGcompositeOperationState {
int srcRGB;
int dstRGB;
int srcAlpha;
int dstAlpha;
};
typedef struct NVGcompositeOperationState NVGcompositeOperationState;
struct NVGglyphPosition {
const char* str; // Position of the glyph in the input string.
float x; // The x-coordinate of the logical glyph position.
@ -125,6 +161,22 @@ void nvgCancelFrame(NVGcontext* ctx);
// Ends drawing flushing remaining render state.
void nvgEndFrame(NVGcontext* ctx);
//
// Composite operation
//
// The composite operations in NanoVG are modeled after HTML Canvas API, and
// the blend func is based on OpenGL (see corresponding manuals for more info).
// The colors in the blending state have premultiplied alpha.
// Sets the composite operation. The op parameter should be one of NVGcompositeOperation.
void nvgGlobalCompositeOperation(NVGcontext* ctx, int op);
// Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor.
void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor);
// Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor.
void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
//
// Color utils
//
@ -185,7 +237,7 @@ void nvgReset(NVGcontext* ctx);
// Solid color is simply defined as a color value, different kinds of paints can be created
// using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
//
// Current render style can be saved and restored using nvgSave() and nvgRestore().
// Current render style can be saved and restored using nvgSave() and nvgRestore().
// Sets current stroke style to a solid color.
void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
@ -215,7 +267,7 @@ void nvgLineCap(NVGcontext* ctx, int cap);
void nvgLineJoin(NVGcontext* ctx, int join);
// Sets the transparency applied to all rendered shapes.
// Alreade transparent paths will get proportionally more transparent as well.
// Already transparent paths will get proportionally more transparent as well.
void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
//
@ -233,7 +285,7 @@ void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
// Apart from nvgResetTransform(), each transformation function first creates
// specific transformation matrix and pre-multiplies the current transformation by it.
//
// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
// Resets current transform to a identity matrix.
void nvgResetTransform(NVGcontext* ctx);
@ -347,7 +399,7 @@ NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float
NVGcolor icol, NVGcolor ocol);
// Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
// drop shadows or hilights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
// the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
@ -369,8 +421,8 @@ NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey
//
// Scissoring
//
// Scissoring allows you to clip the rendering into a rectangle. This is useful for varius
// user interface cases like rendering a text edit or a timeline.
// Scissoring allows you to clip the rendering into a rectangle. This is useful for various
// user interface cases like rendering a text edit or a timeline.
// Sets the current scissor rectangle.
// The scissor rectangle is transformed by the current transform.
@ -425,7 +477,7 @@ void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float rad
// Closes current sub-path with a line segment.
void nvgClosePath(NVGcontext* ctx);
// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
void nvgPathWinding(NVGcontext* ctx, int dir);
// Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
@ -442,7 +494,7 @@ void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r
// Creates new ellipse shaped sub-path.
void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry);
// Creates new circle shaped sub-path.
// Creates new circle shaped sub-path.
void nvgCircle(NVGcontext* ctx, float cx, float cy, float r);
// Fills the current path with current fill style.
@ -489,7 +541,7 @@ void nvgStroke(NVGcontext* ctx);
// Returns handle to the font.
int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename);
// Creates image by loading it from the specified memory chunk.
// Creates font by loading it from the specified memory chunk.
// Returns handle to the font.
int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData);
@ -505,7 +557,7 @@ void nvgFontBlur(NVGcontext* ctx, float blur);
// Sets the letter spacing of current text style.
void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);
// Sets the text align of current text style, see NVGalign for options.
@ -592,7 +644,7 @@ struct NVGparams {
int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio);
void (*renderCancel)(void* uptr);
void (*renderFlush)(void* uptr);
void (*renderFlush)(void* uptr, NVGcompositeOperationState compositeOperation);
void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);
void (*renderStroke)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths);
void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGscissor* scissor, const NVGvertex* verts, int nverts);

View File

@ -31,6 +31,7 @@
#include <bx/bx.h>
#include <bx/allocator.h>
#include <bx/crtimpl.h>
#include <bx/uint32_t.h>
BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244); // warning C4244: '=' : conversion from '' to '', possible loss of data
@ -269,7 +270,7 @@ namespace
const bgfx::Memory* mem = bgfx::alloc(4*4*4);
uint32_t* bgra8 = (uint32_t*)mem->data;
memset(bgra8, 0, 4*4*4);
gl->texMissing = bgfx::createTexture2D(4, 4, 0, bgfx::TextureFormat::BGRA8, 0, mem);
gl->texMissing = bgfx::createTexture2D(4, 4, false, 1, bgfx::TextureFormat::BGRA8, 0, mem);
gl->u_scissorMat = bgfx::createUniform("u_scissorMat", bgfx::UniformType::Mat3);
gl->u_paintMat = bgfx::createUniform("u_paintMat", bgfx::UniformType::Mat3);
@ -326,8 +327,10 @@ namespace
mem = bgfx::copy(_rgba, tex->height * pitch);
}
tex->id = bgfx::createTexture2D(tex->width
tex->id = bgfx::createTexture2D(
tex->width
, tex->height
, false
, 1
, NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8
, BGFX_TEXTURE_NONE
@ -335,14 +338,16 @@ namespace
if (NULL != mem)
{
bgfx::updateTexture2D(tex->id
, 0
, 0
, 0
, tex->width
, tex->height
, mem
);
bgfx::updateTexture2D(
tex->id
, 0
, 0
, 0
, 0
, tex->width
, tex->height
, mem
);
}
return bgfx::isValid(tex->id) ? tex->id.idx : 0;
@ -366,15 +371,17 @@ namespace
uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1;
uint32_t pitch = tex->width * bytesPerPixel;
bgfx::updateTexture2D(tex->id
, 0
, x
, y
, w
, h
, bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
, pitch
);
bgfx::updateTexture2D(
tex->id
, 0
, 0
, x
, y
, w
, h
, bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
, pitch
);
return 1;
}
@ -395,29 +402,6 @@ namespace
return 1;
}
static void glnvg__xformIdentity(float* t)
{
t[0] = 1.0f; t[1] = 0.0f;
t[2] = 0.0f; t[3] = 1.0f;
t[4] = 0.0f; t[5] = 0.0f;
}
static void glnvg__xformInverse(float* inv, float* t)
{
double invdet, det = (double)t[0] * t[3] - (double)t[2] * t[1];
if (det > -1e-6 && det < 1e-6) {
glnvg__xformIdentity(t);
return;
}
invdet = 1.0 / det;
inv[0] = (float)(t[3] * invdet);
inv[2] = (float)(-t[2] * invdet);
inv[4] = (float)( ((double)t[2] * t[5] - (double)t[3] * t[4]) * invdet);
inv[1] = (float)(-t[1] * invdet);
inv[3] = (float)(t[0] * invdet);
inv[5] = (float)( ((double)t[1] * t[4] - (double)t[0] * t[5]) * invdet);
}
static void glnvg__xformToMat3x4(float* m3, float* t)
{
m3[0] = t[0];
@ -434,6 +418,14 @@ namespace
m3[11] = 0.0f;
}
static NVGcolor glnvg__premulColor(NVGcolor c)
{
c.r *= c.a;
c.g *= c.a;
c.b *= c.a;
return c;
}
static int glnvg__convertPaint(struct GLNVGcontext* gl, struct GLNVGfragUniforms* frag, struct NVGpaint* paint,
struct NVGscissor* scissor, float width, float fringe)
{
@ -442,13 +434,10 @@ namespace
memset(frag, 0, sizeof(*frag) );
frag->innerCol = paint->innerColor;
frag->outerCol = paint->outerColor;
frag->innerCol = glnvg__premulColor(paint->innerColor);
frag->outerCol = glnvg__premulColor(paint->outerColor);
glnvg__xformInverse(invxform, paint->xform);
glnvg__xformToMat3x4(frag->paintMat, invxform);
if (scissor->extent[0] < 0.5f || scissor->extent[1] < 0.5f)
if (scissor->extent[0] < -0.5f || scissor->extent[1] < -0.5f)
{
memset(frag->scissorMat, 0, sizeof(frag->scissorMat) );
frag->scissorExt[0] = 1.0f;
@ -458,7 +447,7 @@ namespace
}
else
{
glnvg__xformInverse(invxform, scissor->xform);
nvgTransformInverse(invxform, scissor->xform);
glnvg__xformToMat3x4(frag->scissorMat, invxform);
frag->scissorExt[0] = scissor->extent[0];
frag->scissorExt[1] = scissor->extent[1];
@ -476,8 +465,12 @@ namespace
{
return 0;
}
nvgTransformInverse(invxform, paint->xform);
frag->type = NSVG_SHADER_FILLIMG;
frag->texType = tex->type == NVG_TEXTURE_RGBA ? 0.0f : 1.0f;
if (tex->type == NVG_TEXTURE_RGBA)
frag->texType = (tex->flags & NVG_IMAGE_PREMULTIPLIED) ? 0.0f : 1.0f;
else
frag->texType = 2.0f;
gl->th = tex->id;
}
else
@ -485,8 +478,11 @@ namespace
frag->type = NSVG_SHADER_FILLGRAD;
frag->radius = paint->radius;
frag->feather = paint->feather;
nvgTransformInverse(invxform, paint->xform);
}
glnvg__xformToMat3x4(frag->paintMat, invxform);
return 1;
}
@ -548,7 +544,6 @@ namespace
static void nvgRenderViewport(void* _userPtr, int width, int height, float devicePixelRatio)
{
struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr;
gl->state = 0;
gl->view[0] = (float)width;
gl->view[1] = (float)height;
bgfx::setViewRect(gl->m_viewId, 0, 0, width * devicePixelRatio, height * devicePixelRatio);
@ -705,7 +700,38 @@ namespace
}
}
static void nvgRenderFlush(void* _userPtr)
static const uint64_t s_blend[] =
{
BGFX_STATE_BLEND_ZERO,
BGFX_STATE_BLEND_ONE,
BGFX_STATE_BLEND_SRC_COLOR,
BGFX_STATE_BLEND_INV_SRC_COLOR,
BGFX_STATE_BLEND_DST_COLOR,
BGFX_STATE_BLEND_INV_DST_COLOR,
BGFX_STATE_BLEND_SRC_ALPHA,
BGFX_STATE_BLEND_INV_SRC_ALPHA,
BGFX_STATE_BLEND_DST_ALPHA,
BGFX_STATE_BLEND_INV_DST_ALPHA,
BGFX_STATE_BLEND_SRC_ALPHA_SAT,
};
static uint64_t glnvg_convertBlendFuncFactor(int factor)
{
const uint32_t numtz = bx::uint32_cnttz(factor);
const uint32_t idx = bx::uint32_min(numtz, BX_COUNTOF(s_blend)-1);
return s_blend[idx];
}
static uint64_t glnvg__blendCompositeOperation(NVGcompositeOperationState op)
{
return BGFX_STATE_BLEND_FUNC_SEPARATE(
glnvg_convertBlendFuncFactor(op.srcRGB),
glnvg_convertBlendFuncFactor(op.dstRGB),
glnvg_convertBlendFuncFactor(op.srcAlpha),
glnvg_convertBlendFuncFactor(op.dstAlpha));
}
static void nvgRenderFlush(void* _userPtr, NVGcompositeOperationState compositeOperation)
{
struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr;
@ -723,12 +749,7 @@ namespace
memcpy(gl->tvb.data, gl->verts, gl->nverts * sizeof(struct NVGvertex) );
if (0 == gl->state)
{
gl->state = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA);
}
gl->state |= 0
gl->state = glnvg__blendCompositeOperation(compositeOperation)
| BGFX_STATE_RGB_WRITE
| BGFX_STATE_ALPHA_WRITE
;
@ -1089,13 +1110,6 @@ void nvgDelete(struct NVGcontext* ctx)
nvgDeleteInternal(ctx);
}
void nvgState(struct NVGcontext* ctx, uint64_t state)
{
struct NVGparams* params = nvgInternalParams(ctx);
struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr;
gl->state = state;
}
uint8_t nvgViewId(struct NVGcontext* ctx)
{
struct NVGparams* params = nvgInternalParams(ctx);
@ -1121,8 +1135,7 @@ NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int width,
int height, int imageFlags) {
NVGLUframebuffer* framebuffer = new NVGLUframebuffer;
framebuffer->ctx = ctx;
framebuffer->image = nvgCreateImageRGBA(ctx, width, height,
imageFlags, NULL);
framebuffer->image = nvgCreateImageRGBA(ctx, width, height, imageFlags | NVG_IMAGE_PREMULTIPLIED, NULL);
bgfx::TextureHandle texture = nvglImageHandle(ctx, framebuffer->image);
if (!bgfx::isValid(texture)) {
nvgluDeleteFramebuffer(framebuffer);
@ -1156,9 +1169,9 @@ void nvgluBindFramebuffer(NVGLUframebuffer* framebuffer) {
void nvgluDeleteFramebuffer(NVGLUframebuffer* framebuffer) {
if (framebuffer == NULL)
return;
if (framebuffer->image >= 0)
nvgDeleteImage(framebuffer->ctx, framebuffer->image);
if (bgfx::isValid(framebuffer->handle))
bgfx::destroyFrameBuffer(framebuffer->handle);
if (framebuffer->image > 0)
nvgDeleteImage(framebuffer->ctx, framebuffer->image);
delete framebuffer;
}

View File

@ -23,7 +23,6 @@ typedef struct NVGLUframebuffer NVGLUframebuffer;
NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator);
NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId);
void nvgDelete(struct NVGcontext* ctx);
void nvgState(struct NVGcontext* ctx, uint64_t state);
uint8_t nvgViewId(struct NVGcontext* ctx);
void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId);

View File

@ -127,7 +127,7 @@ public:
void reset(uint16_t _side)
{
for (uint32_t ii = 0; ii < 6; ++ii)
for (uint8_t ii = 0; ii < 6; ++ii)
{
m_mru[ii] = ii;
m_ra[ii].reset(_side, _side);

View File

@ -615,6 +615,7 @@ namespace bgfx
uint16_t width; //!< Texture width.
uint16_t height; //!< Texture height.
uint16_t depth; //!< Texture depth.
uint16_t numLayers; //!< Number of layers in texture array.
uint8_t numMips; //!< Number of MIP maps.
uint8_t bitsPerPixel; //!< Format bits per pixel.
bool cubeMap; //!< Texture is cubemap.
@ -841,7 +842,7 @@ namespace bgfx
/// @param[in] _dstSize Destination index buffer in bytes. It must be
/// large enough to contain output indices. If destination size is
/// insufficient index buffer will be truncated.
/// @param[in]_indices Source indices.
/// @param[in] _indices Source indices.
/// @param[in] _numIndices Number of input indices.
/// @param[in] _index32 Set to `true` if input indices are 32-bit.
///
@ -1102,20 +1103,35 @@ namespace bgfx
///
void dbgTextClear(uint8_t _attr = 0, bool _small = false);
/// Print into internal debug text buffer.
/// Print into internal debug text character-buffer (VGA-compatible text mode).
///
/// @param[in] _x, _y 2D position from top-left.
/// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom
/// 4-bits represent foreground color from standard VGA text palette.
/// @param[in] _format `printf` style format.
///
/// @attention C99 equivalent is `bgfx_dbg_text_printf`.
///
void dbgTextPrintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
/// Print into internal debug text character-buffer (VGA-compatible text mode).
///
/// @param[in] _x, _y 2D position from top-left.
/// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom
/// 4-bits represent foreground color from standard VGA text palette.
/// @param[in] _format `printf` style format.
/// @param[in] _argList additional arguments for format string
///
/// @attention C99 equivalent is `bgfx_dbg_text_vprintf`.
///
void dbgTextPrintfVargs(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList);
/// Draw image into internal debug text buffer.
///
/// @param[in] _x X position from top-left.
/// @param[in] _y Y position from top-left.
/// @param[in] _width Image width.
/// @param[in] _height Image height.
/// @param[in] _data Raw image data (character/attribute raw encoding).
/// @param[in] _pitch Image pitch in bytes.
/// @param[in] _x, _y 2D position from top-left.
/// @param[in] _width, _height Image width and height.
/// @param[in] _data Raw image data (character/attribute raw encoding).
/// @param[in] _pitch Image pitch in bytes.
///
/// @attention C99 equivalent is `bgfx_dbg_text_image`.
///
@ -1510,6 +1526,15 @@ namespace bgfx
/// Calculate amount of memory required for texture.
///
/// @param[out] _info Resulting texture info structure.
/// @param[in] _width Width.
/// @param[in] _height Height.
/// @param[in] _depth Depth.
/// @param[in] _cubeMap Indicates that texture contains cubemap.
/// @param[in] _hasMips Indicates that texture contains full mip-map chain.
/// @param[in] _numLayers Number of layers in texture array.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
///
/// @attention C99 equivalent is `bgfx_calc_texture_size`.
///
void calcTextureSize(
@ -1518,7 +1543,8 @@ namespace bgfx
, uint16_t _height
, uint16_t _depth
, bool _cubeMap
, uint8_t _numMips
, bool _hasMips
, uint16_t _numLayers
, TextureFormat::Enum _format
);
@ -1549,7 +1575,9 @@ namespace bgfx
///
/// @param[in] _width Width.
/// @param[in] _height Height.
/// @param[in] _numMips Number of mip-maps.
/// @param[in] _hasMips Indicates that texture contains full mip-map chain.
/// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps
/// `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@ -1559,13 +1587,16 @@ namespace bgfx
/// sampling.
///
/// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable.
/// When `_numLayers` is more than 1, expected memory layout is texture and all mips together
/// for each array element.
///
/// @attention C99 equivalent is `bgfx_create_texture_2d`.
///
TextureHandle createTexture2D(
uint16_t _width
, uint16_t _height
, uint8_t _numMips
, bool _hasMips
, uint16_t _numLayers
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
, const Memory* _mem = NULL
@ -1576,7 +1607,9 @@ namespace bgfx
///
/// @param[in] _ratio Frame buffer size in respect to back-buffer size. See:
/// `BackbufferRatio::Enum`.
/// @param[in] _numMips Number of mip-maps.
/// @param[in] _hasMips Indicates that texture contains full mip-map chain.
/// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps
/// `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@ -1589,7 +1622,8 @@ namespace bgfx
///
TextureHandle createTexture2D(
BackbufferRatio::Enum _ratio
, uint8_t _numMips
, bool _hasMips
, uint16_t _numLayers
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
);
@ -1599,7 +1633,7 @@ namespace bgfx
/// @param[in] _width Width.
/// @param[in] _height Height.
/// @param[in] _depth Depth.
/// @param[in] _numMips Number of mip-maps.
/// @param[in] _hasMips Indicates that texture contains full mip-map chain.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@ -1616,7 +1650,7 @@ namespace bgfx
uint16_t _width
, uint16_t _height
, uint16_t _depth
, uint8_t _numMips
, bool _hasMips
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
, const Memory* _mem = NULL
@ -1625,7 +1659,9 @@ namespace bgfx
/// Create Cube texture.
///
/// @param[in] _size Cube side size.
/// @param[in] _numMips Number of mip-maps.
/// @param[in] _hasMips Indicates that texture contains full mip-map chain.
/// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps
/// `BGFX_CAPS_TEXTURE_CUBE_ARRAY` flag is not set.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
@ -1635,12 +1671,15 @@ namespace bgfx
/// sampling.
///
/// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable.
/// When `_numLayers` is more than 1, expected memory layout is cubemap texture and all mips
/// together for each array element.
///
/// @attention C99 equivalent is `bgfx_create_texture_cube`.
///
TextureHandle createTextureCube(
uint16_t _size
, uint8_t _numMips
, bool _hasMips
, uint16_t _numLayers
, TextureFormat::Enum _format
, uint32_t _flags = BGFX_TEXTURE_NONE
, const Memory* _mem = NULL
@ -1649,6 +1688,7 @@ namespace bgfx
/// Update 2D texture.
///
/// @param[in] _handle Texture handle.
/// @param[in] _layer Layers in texture array.
/// @param[in] _mip Mip level.
/// @param[in] _x X offset in texture.
/// @param[in] _y Y offset in texture.
@ -1662,6 +1702,7 @@ namespace bgfx
///
void updateTexture2D(
TextureHandle _handle
, uint16_t _layer
, uint8_t _mip
, uint16_t _x
, uint16_t _y
@ -1700,6 +1741,7 @@ namespace bgfx
/// Update Cube texture.
///
/// @param[in] _handle Texture handle.
/// @param[in] _layer Layers in texture array.
/// @param[in] _side Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`,
/// where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z.
///
@ -1733,6 +1775,7 @@ namespace bgfx
///
void updateTextureCube(
TextureHandle _handle
, uint16_t _layer
, uint8_t _side
, uint8_t _mip
, uint16_t _x
@ -1850,7 +1893,7 @@ namespace bgfx
///
/// @returns Handle to frame buffer object.
///
/// @attention C99 equivalent is `bgfx_create_frame_buffer_from_handles`.
/// @attention C99 equivalent is `bgfx_create_frame_buffer_from_attachment`.
///
FrameBufferHandle createFrameBuffer(
uint8_t _num

View File

@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(17)
#define BGFX_API_VERSION UINT32_C(20)
///
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
@ -386,6 +386,8 @@
#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000040000) //!< Occlusion query is supported.
#define BGFX_CAPS_ALPHA_TO_COVERAGE UINT64_C(0x0000000000080000) //!< Alpha to coverage is supported.
#define BGFX_CAPS_CONSERVATIVE_RASTER UINT64_C(0x0000000000100000) //!< Conservative rasterization is supported.
#define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000200000) //!< 2D texture array is supported.
#define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000400000) //!< Cubemap texture array is supported.
///
#define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT16_C(0x0000) //!< Texture format is not supported.

View File

@ -129,61 +129,7 @@ namespace bgfx
} // namespace bgfx
#if BX_PLATFORM_ANDROID
# include <android/native_window.h>
namespace bgfx
{
///
inline void androidSetWindow(::ANativeWindow* _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_IOS
namespace bgfx
{
///
inline void iosSetEaglLayer(void* _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_BSD || BX_PLATFORM_LINUX || BX_PLATFORM_RPI
namespace bgfx
{
///
inline void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL)
{
PlatformData pd;
pd.ndt = _display;
pd.nwh = (void*)(uintptr_t)_window;
pd.context = _glx;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_NACL
#if BX_PLATFORM_NACL
# include <ppapi/c/ppb_graphics_3d.h>
# include <ppapi/c/ppb_instance.h>
@ -196,144 +142,6 @@ namespace bgfx
} // namespace bgfx
#elif BX_PLATFORM_OSX
namespace bgfx
{
///
inline void osxSetNSWindow(void* _window, void* _nsgl = NULL)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = _nsgl;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_WINDOWS
# include <windows.h>
namespace bgfx
{
///
inline void winSetHwnd(::HWND _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT
# include <Unknwn.h>
namespace bgfx
{
///
inline void winrtSetWindow(::IUnknown* _window)
{
PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#endif // BX_PLATFORM_
#if defined(_SDL_syswm_h)
// If SDL_syswm.h is included before bgfxplatform.h we can enable SDL window
// interop convenience code.
namespace bgfx
{
///
inline bool sdlSetWindow(SDL_Window* _window)
{
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);
if (!SDL_GetWindowWMInfo(_window, &wmi) )
{
return false;
}
PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
pd.ndt = wmi.info.x11.display;
pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = wmi.info.win.window;
# elif BX_PLATFORM_STEAMLINK
pd.ndt = wmi.info.vivante.display;
pd.nwh = wmi.info.vivante.window;
# endif // BX_PLATFORM_
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
return true;
}
} // namespace bgfx
#elif defined(_glfw3_h_)
// If GLFW/glfw3.h is included before bgfxplatform.h we can enable GLFW3
// window interop convenience code.
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
# define GLFW_EXPOSE_NATIVE_X11
# define GLFW_EXPOSE_NATIVE_GLX
# elif BX_PLATFORM_OSX
# define GLFW_EXPOSE_NATIVE_COCOA
# define GLFW_EXPOSE_NATIVE_NSGL
# elif BX_PLATFORM_WINDOWS
# define GLFW_EXPOSE_NATIVE_WIN32
# define GLFW_EXPOSE_NATIVE_WGL
# endif //
# include <GLFW/glfw3native.h>
namespace bgfx
{
inline void glfwSetWindow(GLFWwindow* _window)
{
PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
pd.ndt = glfwGetX11Display();
pd.nwh = (void*)(uintptr_t)glfwGetGLXWindow(_window);
pd.context = glfwGetGLXContext(_window);
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = glfwGetCocoaWindow(_window);
pd.context = glfwGetNSGLContext(_window);
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = glfwGetWin32Window(_window);
pd.context = NULL;
# endif // BX_PLATFORM_WINDOWS
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
setPlatformData(pd);
}
} // namespace bgfx
#endif // defined(_SDL_H)
#endif // BGFX_PLATFORM_H_HEADER_GUARD

View File

@ -382,6 +382,7 @@ typedef struct bgfx_texture_info
uint16_t width;
uint16_t height;
uint16_t depth;
uint16_t numLayers;
uint8_t numMips;
uint8_t bitsPerPixel;
bool cubeMap;
@ -565,6 +566,9 @@ BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small);
/**/
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
/**/
BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList);
/**/
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
@ -653,31 +657,31 @@ BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle);
/**/
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format);
/**/
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
/**/
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
/**/
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags);
/**/
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
/**/
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
/**/
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
/**/
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
/**/
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
/**/
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data);
@ -694,6 +698,9 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width,
/**/
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);
/**/
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures);
/**/
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures);

View File

@ -98,6 +98,7 @@ typedef struct bgfx_interface_vtbl
void (*set_debug)(uint32_t _debug);
void (*dbg_text_clear)(uint8_t _attr, bool _small);
void (*dbg_text_printf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
void (*dbg_text_vprintf)(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList);
void (*dbg_text_image)(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch);
bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags);
void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle);
@ -127,15 +128,15 @@ typedef struct bgfx_interface_vtbl
bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders);
void (*destroy_program)(bgfx_program_handle_t _handle);
void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format);
void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format);
bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags);
bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags);
bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
void (*destroy_texture)(bgfx_texture_handle_t _handle);
bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags);
bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags);

View File

@ -352,14 +352,14 @@ namespace bgfx
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) );
tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = NULL;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = 0;
tc.m_numLayers = 1;
tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) );
tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
rci->destroyTexture(_handle);
@ -472,7 +472,7 @@ namespace bgfx
uint8_t* rgba = mem->data;
charsetFillTexture(vga8x8, rgba, 8, pitch, bpp);
charsetFillTexture(vga8x16, &rgba[8*pitch], 16, pitch, bpp);
m_texture = createTexture2D(width, height, 1, TextureFormat::R8
m_texture = createTexture2D(width, height, false, 1, TextureFormat::R8
, BGFX_TEXTURE_MIN_POINT
| BGFX_TEXTURE_MAG_POINT
| BGFX_TEXTURE_MIP_POINT
@ -1101,6 +1101,8 @@ namespace bgfx
CAPS_FLAGS(BGFX_CAPS_OCCLUSION_QUERY),
CAPS_FLAGS(BGFX_CAPS_ALPHA_TO_COVERAGE),
CAPS_FLAGS(BGFX_CAPS_CONSERVATIVE_RASTER),
CAPS_FLAGS(BGFX_CAPS_TEXTURE_2D_ARRAY),
CAPS_FLAGS(BGFX_CAPS_TEXTURE_CUBE_ARRAY),
#undef CAPS_FLAGS
};
@ -2882,7 +2884,7 @@ error:
s_ctx->destroyProgram(_handle);
}
void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, TextureFormat::Enum _format)
void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format)
{
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
const uint8_t bpp = blockInfo.bitsPerPixel;
@ -2894,15 +2896,15 @@ error:
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
_depth = bx::uint16_max(1, _depth);
_numMips = uint8_t(bx::uint16_max(1, _numMips) );
const uint8_t numMips = calcNumMips(_hasMips, _width, _height, _depth);
const uint32_t sides = _cubeMap ? 6 : 1;
uint32_t width = _width;
uint32_t height = _height;
uint32_t depth = _depth;
uint32_t sides = _cubeMap ? 6 : 1;
uint32_t size = 0;
for (uint32_t lod = 0; lod < _numMips; ++lod)
for (uint32_t lod = 0; lod < numMips; ++lod)
{
width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth);
height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight);
@ -2915,12 +2917,15 @@ error:
depth >>= 1;
}
size *= _numLayers;
_info.format = _format;
_info.width = _width;
_info.height = _height;
_info.depth = _depth;
_info.numMips = _numMips;
_info.cubeMap = _cubeMap;
_info.numMips = numMips;
_info.numLayers = _numLayers;
_info.cubeMap = _cubeMap;
_info.storageSize = size;
_info.bitsPerPixel = bpp;
}
@ -2950,7 +2955,7 @@ error:
_height = bx::uint16_max(1, _height);
}
static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BGFX_CHECK_MAIN_THREAD();
@ -2961,6 +2966,12 @@ error:
, "Format %s is not supported for 2D texture. Use bgfx::getCaps to check available texture formats."
, getName(_format)
);
BX_CHECK(false
|| 1 >= _numLayers
|| 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_2D_ARRAY)
, "_numLayers is %d. Texture 2D array is not supported! Use bgfx::getCaps to check BGFX_CAPS_TEXTURE_2D_ARRAY backend renderer capabilities."
, _numLayers
);
if (BackbufferRatio::Count != _ratio)
{
@ -2969,13 +2980,14 @@ error:
getTextureSizeFromRatio(_ratio, _width, _height);
}
_numMips = calcNumMips(_numMips, _width, _height);
const uint8_t numMips = calcNumMips(_hasMips, _width, _height);
_numLayers = bx::uint16_max(_numLayers, 1);
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& NULL != _mem)
{
TextureInfo ti;
calcTextureSize(ti, _width, _height, 1, false, _numMips, _format);
calcTextureSize(ti, _width, _height, 1, false, _hasMips, _numLayers, _format);
BX_CHECK(ti.storageSize == _mem->size
, "createTexture2D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
, ti.storageSize
@ -2991,32 +3003,32 @@ error:
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = _numMips;
tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = _mem;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = 0;
tc.m_numLayers = _numLayers;
tc.m_numMips = numMips;
tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, _ratio);
}
TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
TextureHandle createTexture2D(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BX_CHECK(_width > 0 && _height > 0, "Invalid texture size (width %d, height %d).", _width, _height);
return createTexture2D(BackbufferRatio::Count, _width, _height, _numMips, _format, _flags, _mem);
return createTexture2D(BackbufferRatio::Count, _width, _height, _hasMips, _numLayers, _format, _flags, _mem);
}
TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags)
TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags)
{
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
return createTexture2D(_ratio, 0, 0, _numMips, _format, _flags, NULL);
return createTexture2D(_ratio, 0, 0, _hasMips, _numLayers, _format, _flags, NULL);
}
TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_3D, "Texture3D is not supported!");
@ -3025,13 +3037,13 @@ error:
, getName(_format)
);
_numMips = calcNumMips(_numMips, _width, _height, _depth);
const uint8_t numMips = calcNumMips(_hasMips, _width, _height, _depth);
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& NULL != _mem)
{
TextureInfo ti;
calcTextureSize(ti, _width, _height, _depth, false, _numMips, _format);
calcTextureSize(ti, _width, _height, _depth, false, _hasMips, 1, _format);
BX_CHECK(ti.storageSize == _mem->size
, "createTexture3D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
, ti.storageSize
@ -3047,34 +3059,41 @@ error:
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = _depth;
tc.m_numMips = _numMips;
tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = _mem;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = _depth;
tc.m_numLayers = 1;
tc.m_numMips = numMips;
tc.m_format = _format;
tc.m_cubeMap = false;
tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
}
TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 != (g_caps.formats[_format] & (BGFX_CAPS_FORMAT_TEXTURE_CUBE|BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED|BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB) )
, "Format %s is not supported for cube texture. Use bgfx::getCaps to check available texture formats."
, getName(_format)
);
BX_CHECK(false
|| 1 >= _numLayers
|| 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_CUBE_ARRAY)
, "_numLayers is %d. Texture cube array is not supported! Use bgfx::getCaps to check BGFX_CAPS_TEXTURE_CUBE_ARRAY backend renderer capabilities."
, _numLayers
);
_numMips = calcNumMips(_numMips, _size, _size);
const uint8_t numMips = calcNumMips(_hasMips, _size, _size);
_numLayers = bx::uint16_max(_numLayers, 1);
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& NULL != _mem)
{
TextureInfo ti;
calcTextureSize(ti, _size, _size, 1, true, _numMips, _format);
calcTextureSize(ti, _size, _size, 1, true, _hasMips, _numLayers, _format);
BX_CHECK(ti.storageSize == _mem->size
, "createTextureCube: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
, ti.storageSize
@ -3090,14 +3109,14 @@ error:
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _size;
tc.m_height = _size;
tc.m_sides = 6;
tc.m_depth = 0;
tc.m_numMips = _numMips;
tc.m_format = _format;
tc.m_cubeMap = true;
tc.m_mem = _mem;
tc.m_width = _size;
tc.m_height = _size;
tc.m_depth = 0;
tc.m_numLayers = _numLayers;
tc.m_numMips = numMips;
tc.m_format = _format;
tc.m_cubeMap = true;
tc.m_mem = _mem;
bx::write(&writer, tc);
return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count);
@ -3109,7 +3128,7 @@ error:
s_ctx->destroyTexture(_handle);
}
void updateTexture2D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
void updateTexture2D(TextureHandle _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(NULL != _mem, "_mem can't be NULL");
@ -3120,7 +3139,7 @@ error:
}
else
{
s_ctx->updateTexture(_handle, 0, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
s_ctx->updateTexture(_handle, 0, _mip, _x, _y, _layer, _width, _height, 1, _pitch, _mem);
}
}
@ -3142,7 +3161,7 @@ error:
}
}
void updateTextureCube(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
void updateTextureCube(TextureHandle _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(NULL != _mem, "_mem can't be NULL");
@ -3154,7 +3173,7 @@ error:
}
else
{
s_ctx->updateTexture(_handle, _side, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
s_ctx->updateTexture(_handle, _side, _mip, _x, _y, _layer, _width, _height, 1, _pitch, _mem);
}
}
@ -3177,7 +3196,7 @@ error:
FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags)
{
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
TextureHandle th = createTexture2D(_width, _height, 1, _format, _textureFlags);
TextureHandle th = createTexture2D(_width, _height, false, 1, _format, _textureFlags);
return createFrameBuffer(1, &th, true);
}
@ -3185,7 +3204,7 @@ error:
{
BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio.");
_textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
TextureHandle th = createTexture2D(_ratio, 1, _format, _textureFlags);
TextureHandle th = createTexture2D(_ratio, false, 1, _format, _textureFlags);
return createFrameBuffer(1, &th, true);
}
@ -3971,6 +3990,11 @@ BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, co
va_end(argList);
}
BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList)
{
bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, _argList);
}
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch)
{
bgfx::dbgTextImage(_x, _y, _width, _height, _data, _pitch);
@ -4156,10 +4180,10 @@ BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
bgfx::destroyProgram(handle.cpp);
}
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips, bgfx_texture_format_t _format)
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format)
{
bgfx::TextureInfo& info = *(bgfx::TextureInfo*)_info;
bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _numMips, bgfx::TextureFormat::Enum(_format) );
bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format) );
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
@ -4170,38 +4194,38 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem,
return handle.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
handle.cpp = bgfx::createTexture2D(_width, _height, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
handle.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
return handle.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags)
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _numMips, bgfx::TextureFormat::Enum(_format), _flags);
handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags);
return handle.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
return handle.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
handle.cpp = bgfx::createTextureCube(_size, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
handle.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
return handle.c;
}
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::updateTexture2D(handle.cpp, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
bgfx::updateTexture2D(handle.cpp, _layer, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
}
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem)
@ -4210,10 +4234,10 @@ BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _m
bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory*)_mem);
}
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::updateTextureCube(handle.cpp, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
}
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data)
@ -4248,6 +4272,13 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backb
return handle.c;
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTextures);
return handle.c;
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
@ -4655,6 +4686,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
BGFX_IMPORT_FUNC(set_debug) \
BGFX_IMPORT_FUNC(dbg_text_clear) \
BGFX_IMPORT_FUNC(dbg_text_printf) \
BGFX_IMPORT_FUNC(dbg_text_vprintf) \
BGFX_IMPORT_FUNC(dbg_text_image) \
BGFX_IMPORT_FUNC(create_index_buffer) \
BGFX_IMPORT_FUNC(destroy_index_buffer) \

View File

@ -320,8 +320,8 @@ namespace bgfx
TextureFormat::Enum m_format;
uint16_t m_width;
uint16_t m_height;
uint16_t m_sides;
uint16_t m_depth;
uint16_t m_numLayers;
uint8_t m_numMips;
bool m_cubeMap;
const Memory* m_mem;
@ -364,9 +364,9 @@ namespace bgfx
;
}
inline uint8_t calcNumMips(uint8_t _numMips, uint16_t _width, uint16_t _height, uint16_t _depth = 1)
inline uint8_t calcNumMips(bool _hasMips, uint16_t _width, uint16_t _height, uint16_t _depth = 1)
{
if (1 < _numMips)
if (_hasMips)
{
const uint32_t max = bx::uint32_max(bx::uint32_max(_width, _height), _depth);
const uint32_t num = 1 + uint32_t(bx::flog2(float(max) ) );
@ -3097,7 +3097,8 @@ namespace bgfx
, (uint16_t)imageContainer.m_height
, (uint16_t)imageContainer.m_depth
, imageContainer.m_cubeMap
, imageContainer.m_numMips
, imageContainer.m_numMips > 1
, imageContainer.m_numLayers
, TextureFormat::Enum(imageContainer.m_format)
);
}
@ -3170,7 +3171,7 @@ namespace bgfx
BX_CHECK(BackbufferRatio::Count != textureRef.m_bbRatio, "");
getTextureSizeFromRatio(BackbufferRatio::Enum(textureRef.m_bbRatio), _width, _height);
_numMips = calcNumMips(_numMips, _width, _height);
_numMips = calcNumMips(1 < _numMips, _width, _height);
BX_TRACE("Resize %3d: %4dx%d %s"
, _handle.idx
@ -3214,7 +3215,19 @@ namespace bgfx
}
}
BGFX_API_FUNC(void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _pitch, const Memory* _mem) )
BGFX_API_FUNC(void updateTexture(
TextureHandle _handle
, uint8_t _side
, uint8_t _mip
, uint16_t _x
, uint16_t _y
, uint16_t _z
, uint16_t _width
, uint16_t _height
, uint16_t _depth
, uint16_t _pitch
, const Memory* _mem
) )
{
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateTexture);
cmdbuf.write(_handle);
@ -3223,7 +3236,7 @@ namespace bgfx
Rect rect;
rect.m_x = _x;
rect.m_y = _y;
rect.m_width = _width;
rect.m_width = _width;
rect.m_height = _height;
cmdbuf.write(rect);
cmdbuf.write(_z);

View File

@ -98,6 +98,12 @@ struct BgfxUSampler2D
Texture2D<uvec4> m_texture;
};
struct BgfxSampler2DArray
{
SamplerState m_sampler;
Texture2DArray m_texture;
};
struct BgfxSampler2DShadow
{
SamplerComparisonState m_sampler;
@ -153,6 +159,16 @@ vec4 bgfxTexture2DProj(BgfxSampler2D _sampler, vec4 _coord)
return _sampler.m_texture.Sample(_sampler.m_sampler, coord);
}
vec4 bgfxTexture2DArray(BgfxSampler2DArray _sampler, vec3 _coord)
{
return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
}
vec4 bgfxTexture2DArrayLod(BgfxSampler2DArray _sampler, vec3 _coord, float _lod)
{
return _sampler.m_texture.SampleLevel(_sampler.m_sampler, _coord, _lod);
}
float bgfxShadow2D(BgfxSampler2DShadow _sampler, vec3 _coord)
{
return _sampler.m_texture.SampleCmpLevelZero(_sampler.m_sampler, _coord.xy, _coord.z);
@ -238,6 +254,14 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod)
# define texture2DLod(_sampler, _coord, _level) bgfxTexture2DLod(_sampler, _coord, _level)
# define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
# define SAMPLER2DARRAY(_name, _reg) \
uniform SamplerState _name ## Sampler : register(s[_reg]); \
uniform Texture2DArray _name ## Texture : register(t[_reg]); \
static BgfxSampler2DArray _name = { _name ## Sampler, _name ## Texture }
# define sampler2DArray BgfxSampler2DArray
# define texture2DArray(_sampler, _coord) bgfxTexture2DArray(_sampler, _coord)
# define texture2DArrayLod(_sampler, _coord, _lod) bgfxTexture2DArrayLod(_sampler, _coord, _lod)
# define SAMPLER2DMS(_name, _reg) \
uniform Texture2DMS<vec4> _name ## Texture : register(t[_reg]); \
static BgfxSampler2DMS _name = { _name ## Texture }
@ -380,50 +404,26 @@ vec4 mod(vec4 _a, vec4 _b) { return _a - _b * floor(_a / _b); }
# define atan2(_x, _y) atan(_x, _y)
# define mul(_a, _b) ( (_a) * (_b) )
# define saturate(_x) clamp(_x, 0.0, 1.0)
# define SAMPLER2D(_name, _reg) uniform sampler2D _name
# define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name
# define SAMPLER3D(_name, _reg) uniform sampler3D _name
# define SAMPLERCUBE(_name, _reg) uniform samplerCube _name
# define SAMPLER2D(_name, _reg) uniform sampler2D _name
# define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name
# define SAMPLER3D(_name, _reg) uniform sampler3D _name
# define SAMPLERCUBE(_name, _reg) uniform samplerCube _name
# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name
# define SAMPLER2DARRAY(_name, _reg) uniform sampler2DArray _name
# define SAMPLER2DMSARRAY(_name, _reg) uniform sampler2DMSArray _name
# define SAMPLERCUBEARRAY(_name, _reg) uniform samplerCubeArray _name
# define SAMPLER2DARRAYSHADOW(_name, _reg) uniform sampler2DArrayShadow _name
# if BGFX_SHADER_LANGUAGE_GLSL >= 130
# define ISAMPLER2D(_name, _reg) uniform isampler2D _name
# define USAMPLER2D(_name, _reg) uniform usampler2D _name
# define ISAMPLER3D(_name, _reg) uniform isampler3D _name
# define USAMPLER3D(_name, _reg) uniform usampler3D _name
vec4 bgfxTexture2D(sampler2D _sampler, vec2 _coord)
{
return texture(_sampler, _coord);
}
ivec4 bgfxTexture2D(isampler2D _sampler, vec2 _coord)
{
return texture(_sampler, _coord);
}
uvec4 bgfxTexture2D(usampler2D _sampler, vec2 _coord)
{
return texture(_sampler, _coord);
}
vec4 bgfxTexture3D(sampler3D _sampler, vec3 _coord)
{
return texture(_sampler, _coord);
}
ivec4 bgfxTexture3D(isampler3D _sampler, vec3 _coord)
{
return texture(_sampler, _coord);
}
uvec4 bgfxTexture3D(usampler3D _sampler, vec3 _coord)
{
return texture(_sampler, _coord);
}
# define texture2D(_sampler, _coord) bgfxTexture2D(_sampler, _coord)
# define texture3D(_sampler, _coord) bgfxTexture3D(_sampler, _coord)
# define texture2D(_sampler, _coord) texture(_sampler, _coord)
# define texture2DArray(_sampler, _coord) texture(_sampler, _coord)
# define texture3D(_sampler, _coord) texture(_sampler, _coord)
# endif // BGFX_SHADER_LANGUAGE_GLSL >= 130
vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_vec, _mtx); }

View File

@ -101,7 +101,24 @@ namespace bgfx { namespace gl
NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
[pixelFormat release];
[nsWindow setContentView:glView];
// GLFW creates a helper contentView that handles things like keyboard and drag and
// drop events. We don't want to clobber that view if it exists. Instead we just
// add ourselves as a subview and make the view resize automatically.
NSView *contentView = [nsWindow contentView];
if( contentView != nil )
{
[glView setAutoresizingMask:( NSViewHeightSizable |
NSViewWidthSizable |
NSViewMinXMargin |
NSViewMaxXMargin |
NSViewMinYMargin |
NSViewMaxYMargin )];
[contentView addSubview:glView];
}
else
{
[nsWindow setContentView:glView];
}
NSOpenGLContext* glContext = [glView openGLContext];
BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
@ -109,6 +126,12 @@ namespace bgfx { namespace gl
[glContext makeCurrentContext];
GLint interval = 0;
[glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
// When initializing NSOpenGLView programatically (as we are), this sometimes doesn't
// get hooked up properly (especially when there are existing window elements). This ensures
// we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when
// trying to glClear() for the first time.
[glContext setView:glView];
m_view = glView;
m_context = glContext;

View File

@ -5,8 +5,10 @@
#include "hmd_openvr.h"
BX_PRAGMA_DIAGNOSTIC_PUSH()
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-variable")
#include <openvr/openvr_capi.h>
BX_PRAGMA_DIAGNOSTIC_POP()
namespace bgfx
{

View File

@ -263,7 +263,7 @@ namespace bgfx
return numMips;
}
uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, uint8_t _numMips)
uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, uint8_t _numMips)
{
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
const uint8_t bpp = blockInfo.bitsPerPixel;
@ -275,7 +275,6 @@ namespace bgfx
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
_depth = bx::uint16_max(1, _depth);
_numMips = uint8_t(bx::uint16_max(1, _numMips) );
uint32_t width = _width;
uint32_t height = _height;
@ -296,7 +295,7 @@ namespace bgfx
depth >>= 1;
}
return size;
return size * _numLayers;
}
void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst)
@ -2493,7 +2492,7 @@ namespace bgfx
}
}
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _generateMips)
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, bool _generateMips)
{
const ImageBlockInfo& blockInfo = getBlockInfo(_format);
const uint16_t blockWidth = blockInfo.blockWidth;
@ -2501,27 +2500,29 @@ namespace bgfx
const uint16_t minBlockX = blockInfo.minBlockX;
const uint16_t minBlockY = blockInfo.minBlockY;
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
_depth = bx::uint16_max(1, _depth);
_width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth);
_height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
_depth = bx::uint16_max(1, _depth);
_numLayers = bx::uint16_max(1, _numLayers);
const uint8_t numMips = _generateMips ? imageGetNumMips(_format, _width, _height) : 1;
uint32_t size = imageGetSize(_format, _width, _height, 0, false, numMips);
uint32_t size = imageGetSize(_format, _width, _height, _depth, _numLayers, _cubeMap, numMips);
const Memory* image = alloc(size);
_imageContainer.m_data = image->data;
_imageContainer.m_format = _format;
_imageContainer.m_size = image->size;
_imageContainer.m_offset = 0;
_imageContainer.m_width = _width;
_imageContainer.m_height = _height;
_imageContainer.m_depth = _depth;
_imageContainer.m_numMips = numMips;
_imageContainer.m_hasAlpha = false;
_imageContainer.m_cubeMap = _cubeMap;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = false;
_imageContainer.m_data = image->data;
_imageContainer.m_format = _format;
_imageContainer.m_size = image->size;
_imageContainer.m_offset = 0;
_imageContainer.m_width = _width;
_imageContainer.m_height = _height;
_imageContainer.m_depth = _depth;
_imageContainer.m_numLayers = _numLayers;
_imageContainer.m_numMips = numMips;
_imageContainer.m_hasAlpha = false;
_imageContainer.m_cubeMap = _cubeMap;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = false;
return image;
}
@ -2792,6 +2793,7 @@ namespace bgfx
bx::skip(_reader, 4); // reserved
uint32_t dxgiFormat = 0;
uint32_t arraySize = 1;
if (DDPF_FOURCC == pixelFlags
&& DDS_DX10 == fourcc)
{
@ -2803,7 +2805,6 @@ namespace bgfx
uint32_t miscFlags;
bx::read(_reader, miscFlags);
uint32_t arraySize;
bx::read(_reader, arraySize);
uint32_t miscFlags2;
@ -2872,19 +2873,20 @@ namespace bgfx
}
}
_imageContainer.m_data = NULL;
_imageContainer.m_size = 0;
_imageContainer.m_offset = (uint32_t)bx::seek(_reader);
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
_imageContainer.m_format = format;
_imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1);
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = cubeMap;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = srgb;
_imageContainer.m_data = NULL;
_imageContainer.m_size = 0;
_imageContainer.m_offset = (uint32_t)bx::seek(_reader);
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
_imageContainer.m_format = format;
_imageContainer.m_numLayers = uint16_t(arraySize);
_imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1);
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = cubeMap;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = srgb;
return TextureFormat::Unknown != format;
}
@ -3178,19 +3180,20 @@ namespace bgfx
}
}
_imageContainer.m_data = NULL;
_imageContainer.m_size = 0;
_imageContainer.m_offset = (uint32_t)offset;
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
_imageContainer.m_format = format;
_imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = numFaces > 1;
_imageContainer.m_ktx = true;
_imageContainer.m_ktxLE = fromLittleEndian;
_imageContainer.m_srgb = false;
_imageContainer.m_data = NULL;
_imageContainer.m_size = 0;
_imageContainer.m_offset = (uint32_t)offset;
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
_imageContainer.m_format = format;
_imageContainer.m_numLayers = uint16_t(bx::uint32_max(numberOfArrayElements, 1) );
_imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = numFaces > 1;
_imageContainer.m_ktx = true;
_imageContainer.m_ktxLE = fromLittleEndian;
_imageContainer.m_srgb = false;
return TextureFormat::Unknown != format;
}
@ -3327,19 +3330,20 @@ namespace bgfx
}
}
_imageContainer.m_data = NULL;
_imageContainer.m_size = 0;
_imageContainer.m_offset = (uint32_t)offset;
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
_imageContainer.m_format = format;
_imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = numFaces > 1;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = colorSpace > 0;
_imageContainer.m_data = NULL;
_imageContainer.m_size = 0;
_imageContainer.m_offset = (uint32_t)offset;
_imageContainer.m_width = width;
_imageContainer.m_height = height;
_imageContainer.m_depth = depth;
_imageContainer.m_format = format;
_imageContainer.m_numLayers = 1;
_imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) );
_imageContainer.m_hasAlpha = hasAlpha;
_imageContainer.m_cubeMap = numFaces > 1;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = colorSpace > 0;
return TextureFormat::Unknown != format;
}
@ -3378,15 +3382,16 @@ namespace bgfx
_imageContainer.m_data = tc.m_mem->data;
_imageContainer.m_size = tc.m_mem->size;
}
_imageContainer.m_width = tc.m_width;
_imageContainer.m_height = tc.m_height;
_imageContainer.m_depth = tc.m_depth;
_imageContainer.m_numMips = tc.m_numMips;
_imageContainer.m_hasAlpha = false;
_imageContainer.m_cubeMap = tc.m_cubeMap;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = false;
_imageContainer.m_width = tc.m_width;
_imageContainer.m_height = tc.m_height;
_imageContainer.m_depth = tc.m_depth;
_imageContainer.m_numLayers = tc.m_numLayers;
_imageContainer.m_numMips = tc.m_numMips;
_imageContainer.m_hasAlpha = false;
_imageContainer.m_cubeMap = tc.m_cubeMap;
_imageContainer.m_ktx = false;
_imageContainer.m_ktxLE = false;
_imageContainer.m_srgb = false;
return true;
}
@ -3763,7 +3768,7 @@ namespace bgfx
}
}
bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip)
bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip)
{
uint32_t offset = _imageContainer.m_offset;
TextureFormat::Enum format = TextureFormat::Enum(_imageContainer.m_format);
@ -3790,6 +3795,7 @@ namespace bgfx
}
const uint8_t* data = (const uint8_t*)_data;
const uint16_t numSides = _imageContainer.m_numLayers * (_imageContainer.m_cubeMap ? 6 : 1);
if (_imageContainer.m_ktx)
{
@ -3799,7 +3805,7 @@ namespace bgfx
for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod)
{
uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE);
uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE) / _imageContainer.m_numLayers;
offset += sizeof(uint32_t);
width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth);
@ -3809,7 +3815,7 @@ namespace bgfx
uint32_t size = width*height*depth*bpp/8;
BX_CHECK(size == imageSize, "KTX: Image size mismatch %d (expected %d).", size, imageSize);
for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
for (uint16_t side = 0; side < numSides; ++side)
{
if (side == _side
&& lod == _lod)
@ -3838,7 +3844,7 @@ namespace bgfx
}
else
{
for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
for (uint16_t side = 0; side < numSides; ++side)
{
uint32_t width = _imageContainer.m_width;
uint32_t height = _imageContainer.m_height;
@ -3932,19 +3938,19 @@ namespace bgfx
int32_t size = 0;
size += bx::write(_writer, "\xabKTX 11\xbb\r\n\x1a\n", 12, _err);
size += bx::write(_writer, UINT32_C(0x04030201), _err);
size += bx::write(_writer, UINT32_C(0), _err); // glType
size += bx::write(_writer, UINT32_C(1), _err); // glTypeSize
size += bx::write(_writer, UINT32_C(0), _err); // glFormat
size += bx::write(_writer, uint32_t(0x04030201), _err);
size += bx::write(_writer, uint32_t(0), _err); // glType
size += bx::write(_writer, uint32_t(1), _err); // glTypeSize
size += bx::write(_writer, uint32_t(0), _err); // glFormat
size += bx::write(_writer, tfi.m_internalFmt, _err); // glInternalFormat
size += bx::write(_writer, tfi.m_fmt, _err); // glBaseInternalFormat
size += bx::write(_writer, _width, _err);
size += bx::write(_writer, _height, _err);
size += bx::write(_writer, _depth, _err);
size += bx::write(_writer, UINT32_C(0), _err); // numberOfArrayElements
size += bx::write(_writer, _cubeMap ? UINT32_C(6) : UINT32_C(0), _err);
size += bx::write(_writer, uint32_t(0), _err); // numberOfArrayElements
size += bx::write(_writer, _cubeMap ? uint32_t(6) : uint32_t(0), _err);
size += bx::write(_writer, uint32_t(_numMips), _err);
size += bx::write(_writer, UINT32_C(0), _err); // Meta-data size.
size += bx::write(_writer, uint32_t(0), _err); // Meta-data size.
BX_WARN(size == 64, "KTX: Failed to write header size %d (expected: %d).", size, 64);
return size;

View File

@ -19,6 +19,7 @@ namespace bgfx
uint32_t m_width;
uint32_t m_height;
uint32_t m_depth;
uint16_t m_numLayers;
uint8_t m_numMips;
bool m_hasAlpha;
bool m_cubeMap;
@ -294,10 +295,23 @@ namespace bgfx
TextureFormat::Enum getFormat(const char* _name);
/// Returns number of mip-maps required for complete mip-map chain.
uint8_t imageGetNumMips(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0);
uint8_t imageGetNumMips(
TextureFormat::Enum _format
, uint16_t _width
, uint16_t _height
, uint16_t _depth = 0
);
/// Returns image size.
uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, uint8_t _numMips = 0);
uint32_t imageGetSize(
TextureFormat::Enum _format
, uint16_t _width
, uint16_t _height
, uint16_t _depth = 0
, uint16_t _numLayers = 1
, bool _cubeMap = false
, uint8_t _numMips = 1
);
///
void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst);
@ -342,7 +356,16 @@ namespace bgfx
bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height);
///
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _generateMips = false);
const Memory* imageAlloc(
ImageContainer& _imageContainer
, TextureFormat::Enum _format
, uint16_t _width
, uint16_t _height
, uint16_t _depth = 0
, uint16_t _numLayers = 1
, bool _cubeMap = false
, bool _generateMips = false
);
///
void imageFree(const Memory* _memory);
@ -372,7 +395,7 @@ namespace bgfx
void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format);
///
bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip);
bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip);
} // namespace bgfx

View File

@ -96,6 +96,14 @@ namespace bgfx
# define PIX_ENDEVENT()
#endif // BGFX_CONFIG_DEBUG_PIX
#define D3DCOLOR_FRAME D3DCOLOR_RGBA(0xff, 0xd7, 0xc9, 0xff)
#define D3DCOLOR_VIEW D3DCOLOR_RGBA(0xe4, 0xb4, 0x8e, 0xff)
#define D3DCOLOR_VIEW_L D3DCOLOR_RGBA(0xf9, 0xee, 0xe5, 0xff)
#define D3DCOLOR_VIEW_R D3DCOLOR_RGBA(0xe8, 0xd3, 0xc0, 0xff)
#define D3DCOLOR_DRAW D3DCOLOR_RGBA(0xc6, 0xe5, 0xb9, 0xff)
#define D3DCOLOR_COMPUTE D3DCOLOR_RGBA(0xa7, 0xdb, 0xd8, 0xff)
#define D3DCOLOR_MARKER D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff)
inline int getRefCount(IUnknown* _interface)
{
_interface->AddRef();

View File

@ -1251,6 +1251,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
| ( (m_featureLevel >= D3D_FEATURE_LEVEL_9_2) ? BGFX_CAPS_OCCLUSION_QUERY : 0)
| BGFX_CAPS_ALPHA_TO_COVERAGE
| ( (m_deviceInterfaceVersion >= 3) ? BGFX_CAPS_CONSERVATIVE_RASTER : 0)
| BGFX_CAPS_TEXTURE_2D_ARRAY
| BGFX_CAPS_TEXTURE_CUBE_ARRAY
);
m_timerQuerySupport = m_featureLevel >= D3D_FEATURE_LEVEL_10_0;
@ -1850,14 +1852,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = 0;
tc.m_numLayers = 1;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@ -2030,7 +2032,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
uint32_t size = _size*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
PIX_SETMARKER(D3DCOLOR_MARKER, name);
}
}
@ -4117,23 +4119,23 @@ BX_PRAGMA_DIAGNOSTIC_POP();
{
for (uint32_t ii = 0; ii < count; ++ii)
{
uint8_t nameSize;
uint8_t nameSize = 0;
bx::read(&reader, nameSize);
char name[256];
char name[256] = { '\0' };
bx::read(&reader, &name, nameSize);
name[nameSize] = '\0';
uint8_t type;
uint8_t type = 0;
bx::read(&reader, type);
uint8_t num;
uint8_t num = 0;
bx::read(&reader, num);
uint16_t regIndex;
uint16_t regIndex = 0;
bx::read(&reader, regIndex);
uint16_t regCount;
uint16_t regCount = 0;
bx::read(&reader, regCount);
const char* kind = "invalid";
@ -4211,7 +4213,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create compute shader.");
}
uint8_t numAttrs;
uint8_t numAttrs = 0;
bx::read(&reader, numAttrs);
memset(m_attrMask, 0, sizeof(m_attrMask) );
@ -4257,6 +4259,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
const uint16_t numLayers = imageContainer.m_numLayers;
m_flags = _flags;
m_width = textureWidth;
@ -4282,7 +4285,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
m_numMips = numMips;
uint32_t numSrd = numMips*(imageContainer.m_cubeMap ? 6 : 1);
const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
const uint32_t numSrd = numSides * numMips;
D3D11_SUBRESOURCE_DATA* srd = (D3D11_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D11_SUBRESOURCE_DATA) );
uint32_t kk = 0;
@ -4290,10 +4294,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s%s."
BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s%s%s."
, getHandle()
, getName( (TextureFormat::Enum)m_textureFormat)
, getName( (TextureFormat::Enum)m_requestedFormat)
, numLayers
, textureWidth
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
@ -4301,7 +4306,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
, swizzle ? " (swizzle BGRA8 -> RGBA8)" : ""
);
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
for (uint16_t side = 0; side < numSides; ++side)
{
uint32_t width = textureWidth;
uint32_t height = textureHeight;
@ -4403,6 +4408,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
desc.Width = textureWidth;
desc.Height = textureHeight;
desc.MipLevels = numMips;
desc.ArraySize = numSides;
desc.Format = format;
desc.SampleDesc = msaa;
desc.Usage = kk == 0 || blit ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
@ -4439,22 +4445,46 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (imageContainer.m_cubeMap)
{
desc.ArraySize = 6;
desc.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE;
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
srvd.TextureCube.MipLevels = numMips;
}
else
{
desc.ArraySize = 1;
if (msaaSample)
if (1 < numLayers)
{
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY;
srvd.TextureCubeArray.MipLevels = numMips;
srvd.TextureCubeArray.NumCubes = numLayers;
}
else
{
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvd.Texture2D.MipLevels = numMips;
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
srvd.TextureCube.MipLevels = numMips;
}
}
else
{
if (msaaSample)
{
if (1 < numLayers)
{
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY;
srvd.Texture2DMSArray.ArraySize = numLayers;
}
else
{
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
}
}
else
{
if (1 < numLayers)
{
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
srvd.Texture2DArray.MipLevels = numMips;
srvd.Texture2DArray.ArraySize = numLayers;
}
else
{
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvd.Texture2D.MipLevels = numMips;
}
}
}
@ -4510,7 +4540,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
&& 0 != kk)
{
kk = 0;
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
for (uint16_t side = 0; side < numSides; ++side)
{
for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
{
@ -4552,10 +4582,22 @@ BX_PRAGMA_DIAGNOSTIC_POP();
box.top = _rect.m_y;
box.right = box.left + _rect.m_width;
box.bottom = box.top + _rect.m_height;
box.front = _z;
box.back = box.front + _depth;
const uint32_t subres = _mip + (_side * m_numMips);
uint32_t layer = 0;
if (TextureD3D11::Texture3D == m_type)
{
box.front = _z;
box.back = box.front + _depth;
}
else
{
layer = _z * (TextureD3D11::TextureCube == m_type ? 6 : 1);
box.front = 0;
box.back = 1;
}
const uint32_t subres = _mip + ( (layer + _side) * m_numMips);
const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
const uint32_t rectpitch = _rect.m_width*bpp/8;
const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch;
@ -5104,7 +5146,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
renderDocTriggerCapture();
}
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
BGFX_GPU_PROFILER_BEGIN_DYNAMIC("rendererSubmit");
ID3D11DeviceContext* deviceCtx = m_deviceCtx;
@ -5255,7 +5297,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L' ';
viewNameW[4] = eye ? L'R' : L'L';
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
PIX_BEGINEVENT(0 == ( (view*2+eye)&1)
? D3DCOLOR_VIEW_L
: D3DCOLOR_VIEW_R
, viewNameW
);
}
if (m_ovr.isEnabled() )
@ -5276,7 +5322,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L' ';
viewNameW[4] = L' ';
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
PIX_BEGINEVENT(D3DCOLOR_VIEW, viewNameW);
}
}
@ -5387,7 +5433,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L'C';
PIX_ENDEVENT();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
PIX_BEGINEVENT(D3DCOLOR_COMPUTE, viewNameW);
}
deviceCtx->IASetVertexBuffers(0, 2, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero);
@ -5539,7 +5585,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L' ';
PIX_ENDEVENT();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
programIdx = invalidHandle;
@ -5988,7 +6034,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
wchar_t* viewNameW = s_viewNameW[view];
viewNameW[3] = L'C';
PIX_ENDEVENT();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
invalidateCompute();
@ -6058,7 +6104,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
TextVideoMem& tvm = m_textVideoMem;
@ -6192,7 +6238,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
}
else if (_render->m_debug & BGFX_DEBUG_TEXT)
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);

View File

@ -1008,6 +1008,8 @@ namespace bgfx { namespace d3d12
| BGFX_CAPS_TEXTURE_READ_BACK
| BGFX_CAPS_OCCLUSION_QUERY
| BGFX_CAPS_ALPHA_TO_COVERAGE
| BGFX_CAPS_TEXTURE_2D_ARRAY
| BGFX_CAPS_TEXTURE_CUBE_ARRAY
);
g_caps.maxTextureSize = 16384;
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
@ -1476,14 +1478,14 @@ namespace bgfx { namespace d3d12
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = 0;
tc.m_numLayers = 1;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@ -3844,23 +3846,23 @@ data.NumQualityLevels = 0;
{
for (uint32_t ii = 0; ii < count; ++ii)
{
uint8_t nameSize;
uint8_t nameSize = 0;
bx::read(&reader, nameSize);
char name[256];
char name[256] = {};
bx::read(&reader, &name, nameSize);
name[nameSize] = '\0';
uint8_t type;
uint8_t type = 0;
bx::read(&reader, type);
uint8_t num;
uint8_t num = 0;
bx::read(&reader, num);
uint16_t regIndex;
uint16_t regIndex = 0;
bx::read(&reader, regIndex);
uint16_t regCount;
uint16_t regCount = 0;
bx::read(&reader, regCount);
const char* kind = "invalid";
@ -3920,7 +3922,7 @@ data.NumQualityLevels = 0;
m_code = copy(code, shaderSize);
uint8_t numAttrs;
uint8_t numAttrs = 0;
bx::read(&reader, numAttrs);
memset(m_attrMask, 0, sizeof(m_attrMask) );
@ -3961,6 +3963,7 @@ data.NumQualityLevels = 0;
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
const uint16_t numLayers = imageContainer.m_numLayers;
m_flags = _flags;
m_width = textureWidth;
@ -3985,9 +3988,8 @@ data.NumQualityLevels = 0;
}
m_numMips = numMips;
const uint16_t numSides = imageContainer.m_cubeMap ? 6 : 1;
uint32_t numSrd = numMips*numSides;
const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
const uint32_t numSrd = numSides * numMips;
D3D12_SUBRESOURCE_DATA* srd = (D3D12_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D12_SUBRESOURCE_DATA) );
uint32_t kk = 0;
@ -4185,15 +4187,63 @@ data.NumQualityLevels = 0;
switch (m_type)
{
case Texture2D:
case TextureCube:
resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
m_srvd.ViewDimension = 1 < msaa.Count ? D3D12_SRV_DIMENSION_TEXTURE2DMS : D3D12_SRV_DIMENSION_TEXTURE2D;
m_srvd.Texture2D.MostDetailedMip = 0;
m_srvd.Texture2D.MipLevels = numMips;
m_srvd.Texture2D.ResourceMinLODClamp = 0.0f;
if (imageContainer.m_cubeMap)
{
if (1 < numLayers)
{
m_srvd.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBEARRAY;
m_srvd.TextureCubeArray.MostDetailedMip = 0;
m_srvd.TextureCubeArray.MipLevels = numMips;
m_srvd.TextureCubeArray.ResourceMinLODClamp = 0.0f;
m_srvd.TextureCubeArray.NumCubes = numLayers;
}
else
{
m_srvd.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE;
m_srvd.TextureCube.MostDetailedMip = 0;
m_srvd.TextureCube.MipLevels = numMips;
m_srvd.TextureCube.ResourceMinLODClamp = 0.0f;
}
}
else
{
if (1 < numLayers)
{
m_srvd.ViewDimension = 1 < msaa.Count
? D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY
: D3D12_SRV_DIMENSION_TEXTURE2DARRAY
;
m_srvd.Texture2DArray.MostDetailedMip = 0;
m_srvd.Texture2DArray.MipLevels = numMips;
m_srvd.Texture2DArray.ResourceMinLODClamp = 0.0f;
m_srvd.Texture2DArray.ArraySize = numLayers;
}
else
{
m_srvd.ViewDimension = 1 < msaa.Count
? D3D12_SRV_DIMENSION_TEXTURE2DMS
: D3D12_SRV_DIMENSION_TEXTURE2D
;
m_srvd.Texture2D.MostDetailedMip = 0;
m_srvd.Texture2D.MipLevels = numMips;
m_srvd.Texture2D.ResourceMinLODClamp = 0.0f;
}
}
m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
m_uavd.Texture2D.MipSlice = 0;
m_uavd.Texture2D.PlaneSlice = 0;
if (1 < numLayers)
{
m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
m_uavd.Texture2DArray.MipSlice = 0;
m_uavd.Texture2DArray.PlaneSlice = 0;
}
else
{
m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
m_uavd.Texture2D.MipSlice = 0;
m_uavd.Texture2D.PlaneSlice = 0;
}
break;
case Texture3D:
@ -4208,18 +4258,6 @@ data.NumQualityLevels = 0;
m_uavd.Texture3D.FirstWSlice = 0;
m_uavd.Texture3D.WSize = 0;
break;
case TextureCube:
resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
m_srvd.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBE;
m_srvd.TextureCube.MostDetailedMip = 0;
m_srvd.TextureCube.MipLevels = numMips;
m_srvd.TextureCube.ResourceMinLODClamp = 0.0f;
m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
m_uavd.Texture2D.MipSlice = 0;
m_uavd.Texture2D.PlaneSlice = 0;
break;
}
m_ptr = createCommittedResource(device, HeapProperty::Default, &resourceDesc, clearValue);
@ -4697,7 +4735,7 @@ data.NumQualityLevels = 0;
void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter)
{
// PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
updateResolution(_render->m_resolution);
@ -5133,7 +5171,7 @@ data.NumQualityLevels = 0;
// wchar_t* viewNameW = s_viewNameW[view];
// viewNameW[3] = L' ';
// PIX_ENDEVENT();
// PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
// PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
}
commandListChanged = true;
@ -5433,7 +5471,7 @@ data.NumQualityLevels = 0;
if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
{
// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
TextVideoMem& tvm = m_textVideoMem;
@ -5599,7 +5637,7 @@ data.NumQualityLevels = 0;
}
else if (_render->m_debug & BGFX_DEBUG_TEXT)
{
// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);

View File

@ -1031,14 +1031,14 @@ namespace bgfx { namespace d3d9
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = 0;
tc.m_numLayers = 1;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy(true);
@ -1191,7 +1191,7 @@ namespace bgfx { namespace d3d9
uint32_t size = _size*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
PIX_SETMARKER(D3DCOLOR_MARKER, name);
#endif // BGFX_CONFIG_DEBUG_PIX
BX_UNUSED(_marker, _size);
}
@ -2393,23 +2393,23 @@ namespace bgfx { namespace d3d9
{
for (uint32_t ii = 0; ii < count; ++ii)
{
uint8_t nameSize;
uint8_t nameSize = 0;
bx::read(&reader, nameSize);
char name[256];
char name[256] = {};
bx::read(&reader, &name, nameSize);
name[nameSize] = '\0';
uint8_t type;
uint8_t type = 0;
bx::read(&reader, type);
uint8_t num;
uint8_t num = 0;
bx::read(&reader, num);
uint16_t regIndex;
uint16_t regIndex = 0;
bx::read(&reader, regIndex);
uint16_t regCount;
uint16_t regCount = 0;
bx::read(&reader, regCount);
const char* kind = "invalid";
@ -3522,7 +3522,7 @@ namespace bgfx { namespace d3d9
{
IDirect3DDevice9* device = m_device;
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
updateResolution(_render->m_resolution);
@ -3633,7 +3633,7 @@ namespace bgfx { namespace d3d9
currentState.m_stencil = newStencil;
PIX_ENDEVENT();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[key.m_view]);
if (item > 0)
{
BGFX_PROFILER_END();
@ -4224,7 +4224,7 @@ namespace bgfx { namespace d3d9
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
TextVideoMem& tvm = m_textVideoMem;
@ -4314,7 +4314,7 @@ namespace bgfx { namespace d3d9
}
else if (_render->m_debug & BGFX_DEBUG_TEXT)
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
blit(this, _textVideoMemBlitter, _render->m_textVideoMem);

File diff suppressed because it is too large Load Diff

View File

@ -624,6 +624,14 @@ typedef uint64_t GLuint64;
# define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
#endif // GL_UNSIGNED_INT_SAMPLER_2D
#ifndef GL_INT_SAMPLER_2D_ARRAY
# define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
#endif // GL_INT_SAMPLER_2D_ARRAY
#ifndef GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
# define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
#endif // GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
#ifndef GL_INT_SAMPLER_3D
# define GL_INT_SAMPLER_3D 0x8DCB
#endif // GL_INT_SAMPLER_3D
@ -656,6 +664,14 @@ typedef uint64_t GLuint64;
# define GL_SAMPLER_2D_SHADOW 0x8B62
#endif // GL_SAMPLER_2D_SHADOW
#ifndef GL_SAMPLER_2D_ARRAY
# define GL_SAMPLER_2D_ARRAY 0x8DC1
#endif // GL_SAMPLER_2D_ARRAY
#ifndef GL_SAMPLER_2D_ARRAY_SHADOW
# define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
#endif // GL_SAMPLER_2D_ARRAY_SHADOW
#ifndef GL_TEXTURE_MAX_LEVEL
# define GL_TEXTURE_MAX_LEVEL 0x813D
#endif // GL_TEXTURE_MAX_LEVEL
@ -863,6 +879,18 @@ typedef uint64_t GLuint64;
# define GL_CLAMP_TO_BORDER 0x812D
#endif // GL_CLAMP_TO_BORDER
#ifndef GL_TEXTURE_2D_ARRAY
# define GL_TEXTURE_2D_ARRAY 0x8C1A
#endif // GL_TEXTURE_2D_ARRAY
#ifndef GL_TEXTURE_2D_MULTISAMPLE_ARRAY
# define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
#endif // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
#ifndef GL_TEXTURE_CUBE_MAP_ARRAY
# define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
#endif // GL_TEXTURE_CUBE_MAP_ARRAY
#ifndef GL_TEXTURE_CUBE_MAP_SEAMLESS
# define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
#endif // GL_TEXTURE_CUBE_MAP_SEAMLESS
@ -883,6 +911,10 @@ typedef uint64_t GLuint64;
# define GL_MAX_NAME_LENGTH 0x92F6
#endif // GL_MAX_NAME_LENGTH
#ifndef GL_DEBUG_SEVERITY_NOTIFICATION
# define GL_DEBUG_SEVERITY_NOTIFICATION 0x826b
#endif // GL_DEBUG_SEVERITY_NOTIFICATION
#if BX_PLATFORM_NACL
# include "glcontext_ppapi.h"
#elif BX_PLATFORM_WINDOWS
@ -1236,6 +1268,14 @@ namespace bgfx { namespace gl
void commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]);
void resolve() const;
bool isCubeMap() const
{
return 0
|| GL_TEXTURE_CUBE_MAP == m_target
|| GL_TEXTURE_CUBE_MAP_ARRAY == m_target
;
}
GLuint m_id;
GLuint m_rbo;
GLenum m_target;

View File

@ -87,6 +87,7 @@ namespace bgfx { namespace mtl
destinationSlice:_destinationSlice destinationLevel:_destinationLevel destinationOrigin:_destinationOrigin];
}
#if BX_PLATFORM_OSX
void synchronizeTexture(id<MTLTexture> _texture, NSUInteger _slice, NSUInteger _level)
{
[m_obj synchronizeTexture:_texture slice:_slice level:_level];
@ -96,6 +97,7 @@ namespace bgfx { namespace mtl
{
[m_obj synchronizeResource:_resource];
}
#endif // BX_PLATFORM_OSX
void endEncoding()
{

View File

@ -310,9 +310,9 @@ namespace bgfx { namespace mtl
{ MTLPixelFormatRG32Sint, MTLPixelFormatInvalid }, // RG32I
{ MTLPixelFormatRG32Uint, MTLPixelFormatInvalid }, // RG32U
{ MTLPixelFormatRG32Float, MTLPixelFormatInvalid }, // RG32F
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8I
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8U
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8I
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8U
{ MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8S
{ MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid }, // RGB9E5F
{ MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB }, // BGRA8
@ -474,26 +474,27 @@ namespace bgfx { namespace mtl
m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor);
g_caps.supported |= (0
| BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader
| BGFX_CAPS_TEXTURE_COMPARE_ALL
| BGFX_CAPS_TEXTURE_3D
| BGFX_CAPS_VERTEX_ATTRIB_HALF
| BGFX_CAPS_VERTEX_ATTRIB_UINT10
| BGFX_CAPS_INSTANCING
| BGFX_CAPS_FRAGMENT_DEPTH
| BGFX_CAPS_BLEND_INDEPENDENT
//| BGFX_CAPS_COMPUTE // TODO: api/hw supports it but metal compute shaders are not yet supported
| BGFX_CAPS_INDEX32
//| BGFX_CAPS_DRAW_INDIRECT // TODO: support on iOS9+gpu family3+ and on macOS
| BGFX_CAPS_TEXTURE_BLIT
| BGFX_CAPS_TEXTURE_READ_BACK
| BGFX_CAPS_OCCLUSION_QUERY
| BGFX_CAPS_ALPHA_TO_COVERAGE
);
| BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader
| BGFX_CAPS_TEXTURE_COMPARE_ALL
| BGFX_CAPS_TEXTURE_3D
| BGFX_CAPS_VERTEX_ATTRIB_HALF
| BGFX_CAPS_VERTEX_ATTRIB_UINT10
| BGFX_CAPS_INSTANCING
| BGFX_CAPS_FRAGMENT_DEPTH
| BGFX_CAPS_BLEND_INDEPENDENT
// | BGFX_CAPS_COMPUTE // TODO: api/hw supports it but metal compute shaders are not yet supported
| BGFX_CAPS_INDEX32
// | BGFX_CAPS_DRAW_INDIRECT // TODO: support on iOS9+gpu family3+ and on macOS
| BGFX_CAPS_TEXTURE_BLIT
| BGFX_CAPS_TEXTURE_READ_BACK
| BGFX_CAPS_OCCLUSION_QUERY
| BGFX_CAPS_ALPHA_TO_COVERAGE
| BGFX_CAPS_TEXTURE_2D_ARRAY // supported on all platforms
);
if (BX_ENABLED(BX_PLATFORM_IOS) )
{
if ( iOSVersionEqualOrGreater("9.0.0") )
if (iOSVersionEqualOrGreater("9.0.0") )
{
g_caps.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192;
}
@ -501,20 +502,30 @@ namespace bgfx { namespace mtl
{
g_caps.maxTextureSize = 4096;
}
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
} else if (BX_ENABLED(BX_PLATFORM_OSX) )
g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS));
}
else if (BX_ENABLED(BX_PLATFORM_OSX) )
{
g_caps.maxTextureSize = 16384;
g_caps.maxTextureSize = 16384;
g_caps.maxFBAttachments = 8;
g_caps.supported |= BGFX_CAPS_TEXTURE_CUBE_ARRAY;
}
//todo: vendor id, device id, gpu enum
m_hasPixelFormatDepth32Float_Stencil8 = (BX_ENABLED(BX_PLATFORM_OSX) ||
( BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") ) );
m_macOS11Runtime = (BX_ENABLED(BX_PLATFORM_OSX) && macOSVersionEqualOrGreater(10,11,0) );
m_iOS9Runtime = (BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") );
m_hasPixelFormatDepth32Float_Stencil8 = false
|| BX_ENABLED(BX_PLATFORM_OSX)
|| (BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") )
;
m_macOS11Runtime = true
&& BX_ENABLED(BX_PLATFORM_OSX)
&& macOSVersionEqualOrGreater(10,11,0)
;
m_iOS9Runtime = true
&& BX_ENABLED(BX_PLATFORM_IOS)
&& iOSVersionEqualOrGreater("9.0.0")
;
if (BX_ENABLED(BX_PLATFORM_OSX) )
{
@ -809,14 +820,14 @@ namespace bgfx { namespace mtl
bx::write(&writer, magic);
TextureCreate tc;
tc.m_width = _width;
tc.m_height = _height;
tc.m_sides = 0;
tc.m_depth = 0;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
tc.m_width = _width;
tc.m_height = _height;
tc.m_depth = 0;
tc.m_numLayers = 1;
tc.m_numMips = _numMips;
tc.m_format = TextureFormat::Enum(texture.m_requestedFormat);
tc.m_cubeMap = false;
tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
@ -2384,8 +2395,9 @@ namespace bgfx { namespace mtl
const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod);
const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
const uint16_t numLayers = imageContainer.m_numLayers;
m_flags = _flags;
m_flags = _flags;
m_width = textureWidth;
m_height = textureHeight;
m_depth = imageContainer.m_depth;
@ -2396,7 +2408,20 @@ namespace bgfx { namespace mtl
TextureDescriptor desc = s_renderMtl->m_textureDescriptor;
if (imageContainer.m_cubeMap)
if (1 < numLayers)
{
if (imageContainer.m_cubeMap)
{
desc.textureType = MTLTextureTypeCubeArray;
}
else
{
desc.textureType = MTLTextureType2DArray;
}
desc.arrayLength = numLayers;
}
else if (imageContainer.m_cubeMap)
{
desc.textureType = MTLTextureTypeCube;
}
@ -2410,23 +2435,28 @@ namespace bgfx { namespace mtl
}
m_numMips = numMips;
const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1);
const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s."
, this - s_renderMtl->m_textures
, getName( (TextureFormat::Enum)m_textureFormat)
, getName( (TextureFormat::Enum)m_requestedFormat)
, textureWidth
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
, 0 != (_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
);
const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY);
const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK);
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb;
BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s RT[%c], WO[%c], CW[%c], sRGB[%c]"
, this - s_renderMtl->m_textures
, getName( (TextureFormat::Enum)m_textureFormat)
, getName( (TextureFormat::Enum)m_requestedFormat)
, numLayers
, textureWidth
, textureHeight
, imageContainer.m_cubeMap ? "x6" : ""
, renderTarget ? 'x' : '.'
, writeOnly ? 'x' : '.'
, computeWrite ? 'x' : '.'
, srgb ? 'x' : '.'
);
const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
int sampleCount = s_msaa[msaaQuality];
@ -2455,7 +2485,7 @@ namespace bgfx { namespace mtl
if (s_renderMtl->m_iOS9Runtime || s_renderMtl->m_macOS11Runtime)
{
desc.cpuCacheMode = MTLCPUCacheModeDefaultCache;
desc.cpuCacheMode = MTLCPUCacheModeDefaultCache;
desc.storageMode = (MTLStorageMode)(writeOnly||isDepth(TextureFormat::Enum(m_textureFormat))
? 2 /*MTLStorageModePrivate*/
@ -2493,7 +2523,7 @@ namespace bgfx { namespace mtl
temp = (uint8_t*)BX_ALLOC(g_allocator, textureWidth*textureHeight*4);
}
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
for (uint8_t side = 0; side < numSides; ++side)
{
uint32_t width = textureWidth;
uint32_t height = textureHeight;
@ -3023,23 +3053,29 @@ namespace bgfx { namespace mtl
uint32_t width = bx::uint32_min(srcWidth, dstWidth);
uint32_t height = bx::uint32_min(srcHeight, dstHeight);
uint32_t depth = bx::uint32_min(srcDepth, dstDepth);
#if BX_PLATFORM_OSX
bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK);
#endif // BX_PLATFORM_OSX
if ( MTLTextureType3D == src.m_ptr.textureType())
{
m_blitCommandEncoder.copyFromTexture(src.m_ptr, 0, 0, MTLOriginMake(blit.m_srcX, blit.m_srcY, blit.m_srcZ), MTLSizeMake(width, height, bx::uint32_imax(depth, 1)),
dst.m_ptr, 0, 0, MTLOriginMake(blit.m_dstX, blit.m_dstY, blit.m_dstZ));
#if BX_PLATFORM_OSX
if (m_macOS11Runtime &&readBack) {
m_blitCommandEncoder.synchronizeResource(dst.m_ptr);
}
#endif // BX_PLATFORM_OSX
}
else
{
m_blitCommandEncoder.copyFromTexture(src.m_ptr, blit.m_srcZ, blit.m_srcMip, MTLOriginMake(blit.m_srcX, blit.m_srcY, 0), MTLSizeMake(width, height, 1),
dst.m_ptr, blit.m_dstZ, blit.m_dstMip, MTLOriginMake(blit.m_dstX, blit.m_dstY, 0));
#if BX_PLATFORM_OSX
if (m_macOS11Runtime && readBack) {
m_blitCommandEncoder.synchronizeTexture(dst.m_ptr, 0, blit.m_dstMip);
}
#endif // BX_PLATFORM_OSX
}
}

View File

@ -1000,7 +1000,7 @@ namespace bgfx
break;
}
for (uint32_t ii = 0; ii < _operand.numAddrModes; ++ii)
for (uint32_t ii = 0, num = bx::uint32_min(_operand.numAddrModes, BX_COUNTOF(_operand.addrMode) ); ii < num; ++ii)
{
switch (_operand.addrMode[ii])
{
@ -1526,7 +1526,7 @@ namespace bgfx
);
}
for (uint32_t jj = first; jj < operand.numAddrModes; ++jj)
for (uint32_t jj = first, num = bx::uint32_min(operand.numAddrModes, BX_COUNTOF(operand.addrMode) ); jj < num; ++jj)
{
switch (operand.addrMode[jj])
{

View File

@ -23,6 +23,7 @@ namespace bgfx
static const char* s_ARB_shader_texture_lod[] =
{
"texture2DLod",
"texture2DArrayLod", // BK - interacts with ARB_texture_array.
"texture2DProjLod",
"texture3DLod",
"texture3DProjLod",
@ -89,6 +90,14 @@ namespace bgfx
NULL
};
static const char* s_textureArray[] =
{
"texture2DArray",
"texture2DArrayLod",
"shadow2DArray",
NULL
};
static const char* s_ARB_texture_multisample[] =
{
"sampler2DMS",
@ -1760,11 +1769,12 @@ namespace bgfx
{
std::string code;
const bool usesTextureLod = !!bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
const bool usesGpuShader5 = !!bx::findIdentifierMatch(input, s_ARB_gpu_shader5);
const bool usesPacking = !!bx::findIdentifierMatch(input, s_ARB_shading_language_packing);
const bool usesTextureMS = !!bx::findIdentifierMatch(input, s_ARB_texture_multisample);
const bool usesTexelFetch = !!bx::findIdentifierMatch(input, s_texelFetch);
const bool usesGpuShader5 = !!bx::findIdentifierMatch(input, s_ARB_gpu_shader5);
const bool usesTexelFetch = !!bx::findIdentifierMatch(input, s_texelFetch);
const bool usesTextureLod = !!bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
const bool usesTextureMS = !!bx::findIdentifierMatch(input, s_ARB_texture_multisample);
const bool usesTextureArray = !!bx::findIdentifierMatch(input, s_textureArray);
const bool usesPacking = !!bx::findIdentifierMatch(input, s_ARB_shading_language_packing);
if (0 == essl)
{
@ -1782,15 +1792,6 @@ namespace bgfx
bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile);
}
if (130 > glsl)
{
bx::stringPrintf(code,
"#define ivec2 vec2\n"
"#define ivec3 vec3\n"
"#define ivec4 vec4\n"
);
}
if (usesGpuShader5)
{
bx::stringPrintf(code
@ -1805,11 +1806,6 @@ namespace bgfx
);
}
bx::stringPrintf(code
, "#define bgfxShadow2D shadow2D\n"
"#define bgfxShadow2DProj shadow2DProj\n"
);
if (usesTextureLod
&& 130 > glsl)
{
@ -1824,15 +1820,30 @@ namespace bgfx
, "#extension GL_ARB_texture_multisample : enable\n"
);
}
if (usesTextureArray)
{
bx::stringPrintf(code
, "#extension GL_EXT_texture_array : enable\n"
);
}
if (130 > glsl)
{
bx::stringPrintf(code,
"#define ivec2 vec2\n"
"#define ivec3 vec3\n"
"#define ivec4 vec4\n"
);
}
bx::stringPrintf(code
, "#define bgfxShadow2D shadow2D\n"
"#define bgfxShadow2DProj shadow2DProj\n"
);
}
else
{
bx::stringPrintf(code,
"#define ivec2 vec2\n"
"#define ivec3 vec3\n"
"#define ivec4 vec4\n"
);
// Pretend that all extensions are available.
// This will be stripped later.
if (usesTextureLod)
@ -1888,6 +1899,19 @@ namespace bgfx
"#define gl_FragDepth gl_FragDepthEXT\n"
);
}
if (usesTextureArray)
{
bx::stringPrintf(code
, "#extension GL_EXT_texture_array : enable\n"
);
}
bx::stringPrintf(code,
"#define ivec2 vec2\n"
"#define ivec3 vec3\n"
"#define ivec4 vec4\n"
);
}
code += preprocessor.m_preprocessed;

View File

@ -622,7 +622,7 @@ int main(int _argc, const char* _argv[])
if (normalMap)
{
output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, 1, false, mips);
ImageMip dstMip;
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
@ -686,7 +686,7 @@ int main(int _argc, const char* _argv[])
}
else if (8 != getBlockInfo(imageContainer.m_format).rBits)
{
output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, 1, false, mips);
ImageMip dstMip;
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);
@ -746,7 +746,7 @@ int main(int _argc, const char* _argv[])
}
else
{
output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, false, mips);
output = imageAlloc(imageContainer, format, mip.m_width, mip.m_height, 0, 1, false, mips);
ImageMip dstMip;
imageGetRawData(imageContainer, 0, 0, NULL, 0, dstMip);

View File

@ -0,0 +1,112 @@
static const uint8_t fs_texture_array_glsl[329] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color.......u_pa
0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1a, 0x01, 0x00, 0x00, 0x76, 0x61, // rams..........va
0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // rying vec4 v_col
0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, // or0;.varying vec
0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, // 2 v_texcoord0;.u
0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // niform sampler2D
0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // Array s_texColor
0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, // ;.uniform vec4 u
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // _params;.void ma
0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, // in ().{. vec3 t
0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1;. tmpva
0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // r_1.xy = v_texco
0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ord0;. tmpvar_1
0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, // .z = u_params.y;
0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor
0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, // = (texture2DArra
0x79, 0x4c, 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // yLod (s_texColor
0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, // , tmpvar_1, u_pa
0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // rams.x) * v_colo
0x72, 0x30, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r0);.}...
};
static const uint8_t fs_texture_array_dx11[488] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par
0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC
0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb8, 0x01, 0x44, 0x58, 0x42, 0x43, // olor0.......DXBC
0x81, 0x20, 0x2f, 0xf0, 0x22, 0x82, 0x15, 0xc5, 0x5c, 0x50, 0xb5, 0xdb, 0x71, 0x0a, 0x7d, 0x9a, // . /."....P..q.}.
0x01, 0x00, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, // ............,...
0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, // ........ISGNl...
0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P.......
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................
0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........b.......
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................
0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // SV_POSITION.COLO
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, // R.TEXCOORD..OSGN
0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ,........... ...
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET...
0x53, 0x48, 0x44, 0x52, 0xdc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, // SHDR....@...7...
0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // Y...F. .........
0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x04, // Z....`......X@..
0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, // .p......UU..b...
0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ........b...2...
0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, // h.......6...2...
0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, // ....F.......6...
0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // B......... .....
0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...........
0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~......
0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .`........ .....
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....8.... ......
0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // F.......F.......
0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // >.......
};
static const uint8_t fs_texture_array_mtl[811] =
{
0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH...........us
0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me
0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat
0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput {
0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 v_colo
0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x74, // r0;. float2 v_t
0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, // excoord0;.};.str
0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // uct xlatMtlShade
0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // rOutput {. half
0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // 4 gl_FragColor;.
0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt
0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform {
0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // . float4 u_para
0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // ms;.};.fragment
0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut
0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain
0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn
0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta
0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan
0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU
0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [
0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. ,
0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x5f, 0x61, 0x72, 0x72, // texture2d_arr
0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ay<float> s_texC
0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, // olor [[texture(0
0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, // )]], sampler _mt
0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // lsmp_s_texColor
0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, // [[sampler(0)]]).
0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // {. xlatMtlShade
0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // rOutput _mtl_o;.
0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_
0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, // 1;. tmpvar_1.xy
0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // = _mtl_i.v_texc
0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // oord0;. tmpvar_
0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // 1.z = _mtl_u.u_p
0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // arams.y;. half4
0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp
0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, // var_2 = half4(s_
0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, // texColor.sample(
0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // _mtlsmp_s_texCol
0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x28, 0x74, 0x6d, // or, (float2)((tm
0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x28, 0x75, 0x69, // pvar_1).xy), (ui
0x6e, 0x74, 0x29, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x7a, // nt)((tmpvar_1).z
0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // ), level(_mtl_u.
0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, // u_params.x)));.
0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // _mtl_o.gl_FragC
0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, // olor = ((half4)(
0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // (float4)tmpvar_2
0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // * _mtl_i.v_colo
0x72, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // r0));. return _
0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}...
};

View File

@ -0,0 +1,20 @@
$input v_texcoord0, v_color0
/*
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include <bgfx_shader.sh>
SAMPLER2DARRAY(s_texColor, 0);
uniform vec4 u_params;
#define u_textureLod u_params.x
#define u_textureLayer u_params.y
void main()
{
vec4 color = texture2DArrayLod(s_texColor, vec3(v_texcoord0, u_textureLayer), u_textureLod);
gl_FragColor = color * v_color0;
}

View File

@ -19,6 +19,7 @@
#include "vs_texture.bin.h"
#include "fs_texture.bin.h"
#include "fs_texture_array.bin.h"
#include "vs_texture_cube.bin.h"
#include "fs_texture_cube.bin.h"
@ -82,6 +83,9 @@ static const InputBinding s_bindingView[] =
{ entry::Key::PageUp, entry::Modifier::None, 1, NULL, "view file-pgup" },
{ entry::Key::PageDown, entry::Modifier::None, 1, NULL, "view file-pgdown" },
{ entry::Key::Left, entry::Modifier::None, 1, NULL, "view layer prev" },
{ entry::Key::Right, entry::Modifier::None, 1, NULL, "view layer next" },
{ entry::Key::KeyR, entry::Modifier::None, 1, NULL, "view rgb r" },
{ entry::Key::KeyG, entry::Modifier::None, 1, NULL, "view rgb g" },
{ entry::Key::KeyB, entry::Modifier::None, 1, NULL, "view rgb b" },
@ -112,6 +116,7 @@ struct View
: m_fileIndex(0)
, m_scaleFn(0)
, m_mip(0)
, m_layer(0)
, m_abgr(UINT32_MAX)
, m_zoom(1.0f)
, m_filter(true)
@ -156,6 +161,35 @@ struct View
m_mip = 0;
}
}
if (0 == strcmp(_argv[1], "layer") )
{
if (_argc >= 3)
{
uint32_t layer = m_layer;
if (0 == strcmp(_argv[2], "next") )
{
++layer;
}
else if (0 == strcmp(_argv[2], "prev") )
{
--layer;
}
else if (0 == strcmp(_argv[2], "last") )
{
layer = INT32_MAX;
}
else
{
layer = atoi(_argv[2]);
}
m_layer = bx::uint32_iclamp(layer, 0, m_info.numLayers-1);
}
else
{
m_layer = 0;
}
}
else if (0 == strcmp(_argv[1], "zoom") )
{
if (_argc >= 3)
@ -296,6 +330,7 @@ struct View
uint32_t m_fileIndex;
uint32_t m_scaleFn;
uint32_t m_mip;
uint32_t m_layer;
uint32_t m_abgr;
float m_zoom;
bool m_filter;
@ -522,7 +557,7 @@ void associate()
bx::Error err;
if (bx::open(&writer, temp, false, &err) )
{
bx::write(&writer, str.c_str(), str.length(), &err);
bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
bx::close(&writer);
if (err.isOk() )
@ -553,7 +588,7 @@ void associate()
bx::Error err;
if (bx::open(&writer, "/tmp/texturev.sh", false, &err) )
{
bx::write(&writer, str.c_str(), str.length(), &err);
bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
bx::close(&writer);
if (err.isOk() )
@ -611,37 +646,53 @@ int _main_(int _argc, char** _argv)
const bgfx::Memory* vs_texture;
const bgfx::Memory* fs_texture;
const bgfx::Memory* fs_texture_array;
const bgfx::Memory* vs_texture_cube;
const bgfx::Memory* fs_texture_cube;
switch (bgfx::getRendererType())
{
case bgfx::RendererType::Direct3D9:
vs_texture = bgfx::makeRef(vs_texture_dx9, sizeof(vs_texture_dx9) );
fs_texture = bgfx::makeRef(fs_texture_dx9, sizeof(fs_texture_dx9) );
vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx9, sizeof(vs_texture_cube_dx9) );
fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx9, sizeof(fs_texture_cube_dx9) );
vs_texture = bgfx::makeRef(vs_texture_dx9, sizeof(vs_texture_dx9) );
fs_texture = bgfx::makeRef(fs_texture_dx9, sizeof(fs_texture_dx9) );
fs_texture_array = NULL;
vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx9, sizeof(vs_texture_cube_dx9) );
fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx9, sizeof(fs_texture_cube_dx9) );
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vs_texture = bgfx::makeRef(vs_texture_dx11, sizeof(vs_texture_dx11) );
fs_texture = bgfx::makeRef(fs_texture_dx11, sizeof(fs_texture_dx11) );
vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx11, sizeof(vs_texture_cube_dx11) );
fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx11, sizeof(fs_texture_cube_dx11) );
vs_texture = bgfx::makeRef(vs_texture_dx11, sizeof(vs_texture_dx11) );
fs_texture = bgfx::makeRef(fs_texture_dx11, sizeof(fs_texture_dx11) );
fs_texture_array = bgfx::makeRef(fs_texture_array_dx11, sizeof(fs_texture_dx11) );
vs_texture_cube = bgfx::makeRef(vs_texture_cube_dx11, sizeof(vs_texture_cube_dx11) );
fs_texture_cube = bgfx::makeRef(fs_texture_cube_dx11, sizeof(fs_texture_cube_dx11) );
break;
default:
vs_texture = bgfx::makeRef(vs_texture_glsl, sizeof(vs_texture_glsl) );
fs_texture = bgfx::makeRef(fs_texture_glsl, sizeof(fs_texture_glsl) );
vs_texture_cube = bgfx::makeRef(vs_texture_cube_glsl, sizeof(vs_texture_cube_glsl) );
fs_texture_cube = bgfx::makeRef(fs_texture_cube_glsl, sizeof(fs_texture_cube_glsl) );
vs_texture = bgfx::makeRef(vs_texture_glsl, sizeof(vs_texture_glsl) );
fs_texture = bgfx::makeRef(fs_texture_glsl, sizeof(fs_texture_glsl) );
fs_texture_array = bgfx::makeRef(fs_texture_array_glsl, sizeof(fs_texture_array_glsl) );
fs_texture = bgfx::makeRef(fs_texture_glsl, sizeof(fs_texture_glsl) );
vs_texture_cube = bgfx::makeRef(vs_texture_cube_glsl, sizeof(vs_texture_cube_glsl) );
fs_texture_cube = bgfx::makeRef(fs_texture_cube_glsl, sizeof(fs_texture_cube_glsl) );
break;
}
bgfx::ShaderHandle vsTexture = bgfx::createShader(vs_texture);
bgfx::ShaderHandle fsTexture = bgfx::createShader(fs_texture);
bgfx::ProgramHandle textureProgram = bgfx::createProgram(
bgfx::createShader(vs_texture)
, bgfx::createShader(fs_texture)
vsTexture
, fsTexture
, true
);
bgfx::ProgramHandle textureArrayProgram = bgfx::createProgram(
vsTexture
, NULL != fs_texture_array
? bgfx::createShader(fs_texture_array)
: fsTexture
, true
);
@ -658,9 +709,10 @@ int _main_(int _argc, char** _argv)
float speed = 0.37f;
float time = 0.0f;
Interpolator mip(0.0);
Interpolator zoom(1.0);
Interpolator scale(1.0);
Interpolator mip(0.0f);
Interpolator layer(0.0f);
Interpolator zoom(1.0f);
Interpolator scale(1.0f);
const char* filePath = _argc < 2 ? "" : _argv[1];
bool directory = false;
@ -750,6 +802,10 @@ int _main_(int _argc, char** _argv)
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "/"); ImGui::SameLine(64); ImGui::Text("Toggle linear/point texture sampling.");
ImGui::NextLine();
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "left"); ImGui::SameLine(64); ImGui::Text("Previous layer in texture array.");
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "right"); ImGui::SameLine(64); ImGui::Text("Next layer in texture array.");
ImGui::NextLine();
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "up"); ImGui::SameLine(64); ImGui::Text("Previous texture.");
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "down"); ImGui::SameLine(64); ImGui::Text("Next texture.");
ImGui::NextLine();
@ -849,9 +905,10 @@ int _main_(int _argc, char** _argv)
bx::mtxRotateXY(mtx, 0.0f, time);
bgfx::setUniform(u_mtx, mtx);
mip.set( float(view.m_mip), 0.5f);
mip.set(float(view.m_mip), 0.5f);
layer.set(float(view.m_layer), 0.25f);
float params[4] = { mip.getValue(), 0.0f, 0.0f, 0.0f };
float params[4] = { mip.getValue(), layer.getValue(), 0.0f, 0.0f };
bgfx::setUniform(u_params, params);
bgfx::setTexture(0
@ -869,7 +926,10 @@ int _main_(int _argc, char** _argv)
| BGFX_STATE_ALPHA_WRITE
| (view.m_alpha ? BGFX_STATE_BLEND_ALPHA : BGFX_STATE_NONE)
);
bgfx::submit(0, view.m_info.cubeMap ? textureCubeProgram : textureProgram);
bgfx::submit(0, view.m_info.cubeMap ? textureCubeProgram
: 1 < view.m_info.numLayers ? textureArrayProgram
: textureProgram
);
bgfx::frame();
}
@ -883,6 +943,7 @@ int _main_(int _argc, char** _argv)
bgfx::destroyUniform(u_mtx);
bgfx::destroyUniform(u_params);
bgfx::destroyProgram(textureProgram);
bgfx::destroyProgram(textureArrayProgram);
bgfx::destroyProgram(textureCubeProgram);
imguiDestroy();

View File

@ -136,46 +136,46 @@
///
#if BX_COMPILER_CLANG
# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG() _Pragma("clang diagnostic push")
# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG() _Pragma("clang diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG_() _Pragma("clang diagnostic push")
# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG_() _Pragma("clang diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x) _Pragma(BX_STRINGIZE(clang diagnostic ignored _x) )
#else
# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG()
# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG()
# define BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG_()
# define BX_PRAGMA_DIAGNOSTIC_POP_CLANG_()
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x)
#endif // BX_COMPILER_CLANG
#if BX_COMPILER_GCC && BX_COMPILER_GCC >= 40600
# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC() _Pragma("GCC diagnostic push")
# define BX_PRAGMA_DIAGNOSTIC_POP_GCC() _Pragma("GCC diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC_() _Pragma("GCC diagnostic push")
# define BX_PRAGMA_DIAGNOSTIC_POP_GCC_() _Pragma("GCC diagnostic pop")
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x) _Pragma(BX_STRINGIZE(GCC diagnostic ignored _x) )
#else
# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC()
# define BX_PRAGMA_DIAGNOSTIC_POP_GCC()
# define BX_PRAGMA_DIAGNOSTIC_PUSH_GCC_()
# define BX_PRAGMA_DIAGNOSTIC_POP_GCC_()
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x)
#endif // BX_COMPILER_GCC
#if BX_COMPILER_MSVC
# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC() __pragma(warning(push) )
# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC() __pragma(warning(pop) )
# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC_() __pragma(warning(push) )
# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC_() __pragma(warning(pop) )
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(_x) __pragma(warning(disable:_x) )
#else
# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC()
# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC()
# define BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC_()
# define BX_PRAGMA_DIAGNOSTIC_POP_MSVC_()
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(_x)
#endif // BX_COMPILER_CLANG
#if BX_COMPILER_CLANG
# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG
# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_CLANG
# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_CLANG_
# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_CLANG_
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG
#elif BX_COMPILER_GCC
# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_GCC
# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_GCC
# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_GCC_
# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_GCC_
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC
#elif BX_COMPILER_MSVC
# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC
# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_MSVC
# define BX_PRAGMA_DIAGNOSTIC_PUSH BX_PRAGMA_DIAGNOSTIC_PUSH_MSVC_
# define BX_PRAGMA_DIAGNOSTIC_POP BX_PRAGMA_DIAGNOSTIC_POP_MSVC_
# define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC(_x)
#endif // BX_COMPILER_

View File

@ -34,14 +34,10 @@
# include <pthread.h> // mach_port_t
# endif // BX_PLATFORM_*
# if BX_PLATFORM_NACL
# include <sys/nacl_syscalls.h> // nanosleep
# else
# include <time.h> // nanosleep
# if !BX_PLATFORM_PS4
# include <dlfcn.h> // dlopen, dlclose, dlsym
# endif // !BX_PLATFORM_PS4
# endif // BX_PLATFORM_NACL
# include <time.h> // nanosleep
# if !BX_PLATFORM_PS4 && !BX_PLATFORM_NACL
# include <dlfcn.h> // dlopen, dlclose, dlsym
# endif // !BX_PLATFORM_PS4 && !BX_PLATFORM_NACL
# if BX_PLATFORM_ANDROID
# include <malloc.h> // mallinfo

View File

@ -341,6 +341,8 @@
#if BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
# pragma warning(error:4062) // ENABLE warning C4062: enumerator'...' in switch of enum '...' is not handled
# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
# pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
# pragma warning(error:4121) // ENABLE warning C4121: 'symbol' : alignment of a member was sensitive to packing
//# pragma warning(error:4127) // ENABLE warning C4127: conditional expression is constant
# pragma warning(error:4130) // ENABLE warning C4130: 'operator' : logical operation on address of string constant
@ -350,13 +352,12 @@
# pragma warning(error:4263) // ENABLE warning C4263: 'function' : member function does not override any base class virtual member function
# pragma warning(error:4265) // ENABLE warning C4265: class has virtual functions, but destructor is not virtual
# pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
# pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
# pragma warning(error:4545) // ENABLE warning C4545: expression before comma evaluates to a function which is missing an argument list
# pragma warning(error:4549) // ENABLE warning C4549: 'operator' : operator before comma has no effect; did you intend 'operator'?
# pragma warning(error:4701) // ENABLE warning C4701: potentially uninitialized local variable 'name' used
# pragma warning(error:4706) // ENABLE warning C4706: assignment within conditional expression
# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
# pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
# pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
# pragma warning(error:4800) // ENABLE warning C4800: '': forcing value to bool 'true' or 'false' (performance warning)
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
#endif // BX_PLATFORM_H_HEADER_GUARD

View File

@ -6,4 +6,40 @@
#ifndef BX_SIMD256_AVX_H_HEADER_GUARD
#define BX_SIMD256_AVX_H_HEADER_GUARD
#include "simd_ni.inl"
namespace bx
{
template<>
BX_SIMD_FORCE_INLINE simd256_avx_t simd_ld(const void* _ptr)
{
return _mm256_load_ps(reinterpret_cast<const float*>(_ptr) );
}
template<>
BX_SIMD_FORCE_INLINE void simd_st(void* _ptr, simd256_avx_t _a)
{
_mm256_store_ps(reinterpret_cast<float*>(_ptr), _a);
}
template<>
BX_SIMD_FORCE_INLINE simd256_avx_t simd_ld(float _x, float _y, float _z, float _w, float _A, float _B, float _C, float _D)
{
return _mm256_set_ps(_D, _C, _B, _A, _w, _z, _y, _x);
}
template<>
BX_SIMD_FORCE_INLINE simd256_avx_t simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _A, uint32_t _B, uint32_t _C, uint32_t _D)
{
const __m256i set = _mm256_set_epi32(_D, _C, _B, _A, _w, _z, _y, _x);
const simd256_avx_t result = _mm256_castsi256_ps(set);
return result;
}
typedef simd256_avx_t simd256_t;
} // namespace bx
#endif // BX_SIMD256_AVX_H_HEADER_GUARD

View File

@ -6,4 +6,46 @@
#ifndef BX_SIMD256_REF_H_HEADER_GUARD
#define BX_SIMD256_REF_H_HEADER_GUARD
#include "simd_ni.inl"
namespace bx
{
template<>
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ld(const void* _ptr)
{
const simd128_t* ptr = reinterpret_cast<const simd128_t*>(_ptr);
simd256_ref_t result;
result.simd128_0 = simd_ld<simd128_t>(&ptr[0]);
result.simd128_1 = simd_ld<simd128_t>(&ptr[1]);
return result;
}
template<>
BX_SIMD_FORCE_INLINE void simd_st(void* _ptr, simd256_ref_t& _a)
{
simd128_t* result = reinterpret_cast<simd128_t*>(_ptr);
simd_st<simd128_t>(&result[0], _a.simd128_0);
simd_st<simd128_t>(&result[1], _a.simd128_1);
}
template<>
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ld(float _x, float _y, float _z, float _w, float _a, float _b, float _c, float _d)
{
simd256_ref_t result;
result.simd128_0 = simd_ld<simd128_t>(_x, _y, _z, _w);
result.simd128_1 = simd_ld<simd128_t>(_a, _b, _c, _d);
return result;
}
template<>
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _d)
{
simd256_ref_t result;
result.simd128_0 = simd_ild<simd128_t>(_x, _y, _z, _w);
result.simd128_1 = simd_ild<simd128_t>(_a, _b, _c, _d);
return result;
}
} // namespace bx
#endif // BX_SIMD256_REF_H_HEADER_GUARD

View File

@ -135,9 +135,15 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_ld(float _x, float _y, float _z, float _w);
template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_ld(float _x, float _y, float _z, float _w, float _a, float _b, float _c, float _d);
template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w);
template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _d);
template<typename Ty>
BX_SIMD_FORCE_INLINE Ty simd_splat(const void* _ptr);
@ -352,14 +358,6 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
typedef __m128 simd128_sse_t;
#endif // BX_SIMD_SSE
union simd128_ref_t
{
float fxyzw[4];
int32_t ixyzw[4];
uint32_t uxyzw[4];
};
} // namespace bx
#if BX_SIMD_AVX
@ -378,27 +376,51 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw);
# include "simd128_sse.inl"
#endif // BX_SIMD_SSE
#include "simd128_ref.inl"
#include "simd256_ref.inl"
namespace bx
{
#if !( BX_SIMD_AVX \
|| BX_SIMD_LANGEXT \
union simd128_ref_t
{
float fxyzw[4];
int32_t ixyzw[4];
uint32_t uxyzw[4];
};
#ifndef BX_SIMD_WARN_REFERENCE_IMPL
# define BX_SIMD_WARN_REFERENCE_IMPL 0
#endif // BX_SIMD_WARN_REFERENCE_IMPL
#if !( BX_SIMD_LANGEXT \
|| BX_SIMD_NEON \
|| BX_SIMD_SSE \
)
# ifndef BX_SIMD_WARN_REFERENCE_IMPL
# define BX_SIMD_WARN_REFERENCE_IMPL 0
# endif // BX_SIMD_WARN_REFERENCE_IMPL
# if BX_SIMD_WARN_REFERENCE_IMPL
# pragma message("************************************\nUsing SIMD reference implementation!\n************************************")
# pragma message("*** Using SIMD128 reference implementation! ***")
# endif // BX_SIMD_WARN_REFERENCE_IMPL
typedef simd128_ref_t simd128_t;
#endif //
struct simd256_ref_t
{
simd128_t simd128_0;
simd128_t simd128_1;
};
#if !BX_SIMD_AVX
# if BX_SIMD_WARN_REFERENCE_IMPL
# pragma message("*** Using SIMD256 reference implementation! ***")
# endif // BX_SIMD_WARN_REFERENCE_IMPL
typedef simd256_ref_t simd256_t;
#endif // !BX_SIMD_AVX
} // namespace bx
#include "simd128_ref.inl"
#include "simd256_ref.inl"
namespace bx
{
BX_SIMD_FORCE_INLINE simd128_t simd_zero()
{
return simd_zero<simd128_t>();

View File

@ -61,7 +61,6 @@ function toolchain(_buildDir, _libDir)
},
}
newoption {
trigger = "xcode",
value = "xcode_target",
@ -74,28 +73,38 @@ function toolchain(_buildDir, _libDir)
}
newoption {
trigger = "with-android",
value = "#",
trigger = "with-android",
value = "#",
description = "Set Android platform version (default: android-14).",
}
newoption {
trigger = "with-ios",
value = "#",
trigger = "with-ios",
value = "#",
description = "Set iOS target version (default: 8.0).",
}
newoption {
trigger = "with-tvos",
value = "#",
trigger = "with-tvos",
value = "#",
description = "Set tvOS target version (default: 9.0).",
}
newoption {
trigger = "with-dynamic-runtime",
trigger = "with-dynamic-runtime",
description = "Dynamically link with the runtime rather than statically",
}
newoption {
trigger = "with-32bit-compiler",
description = "Use 32-bit compiler instead 64-bit.",
}
newoption {
trigger = "with-avx",
description = "Use AVX extension.",
}
-- Avoid error when invoking genie --help.
if (_ACTION == nil) then return false end
@ -122,6 +131,11 @@ function toolchain(_buildDir, _libDir)
tvosPlatform = _OPTIONS["with-tvos"]
end
local compiler32bit = false
if _OPTIONS["with-32bit-compiler"] then
compiler32bit = true
end
if _ACTION == "gmake" or _ACTION == "ninja" then
if nil == _OPTIONS["gcc"] then
@ -249,8 +263,17 @@ function toolchain(_buildDir, _libDir)
location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink"))
elseif "mingw-gcc" == _OPTIONS["gcc"] then
premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
local mingwToolchain = "x86_64-w64-mingw32"
if compiler32bit then
if os.is("linux") then
mingwToolchain = "i686-w64-mingw32"
else
mingwToolchain = "mingw32"
end
end
premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
premake.gcc.ar = "$(MINGW)/bin/ar"
location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
@ -268,11 +291,11 @@ function toolchain(_buildDir, _libDir)
print("Set NACL_SDK_ROOT enviroment variable.")
end
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_glibc/bin/x86_64-nacl-"
if os.is("macosx") then
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_newlib/bin/x86_64-nacl-"
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_glibc/bin/x86_64-nacl-"
elseif os.is("linux") then
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/x86_64-nacl-"
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_glibc/bin/x86_64-nacl-"
end
premake.gcc.cc = naclToolchain .. "gcc"
@ -286,11 +309,11 @@ function toolchain(_buildDir, _libDir)
print("Set NACL_SDK_ROOT enviroment variable.")
end
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_glibc/bin/arm-nacl-"
if os.is("macosx") then
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_newlib/bin/arm-nacl-"
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_glibc/bin/arm-nacl-"
elseif os.is("linux") then
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_newlib/bin/arm-nacl-"
naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_glibc/bin/arm-nacl-"
end
premake.gcc.cc = naclToolchain .. "gcc"
@ -304,10 +327,14 @@ function toolchain(_buildDir, _libDir)
elseif "osx" == _OPTIONS["gcc"] then
if os.is("linux") then
if not os.getenv("OSXCROSS") then
print("Set OSXCROSS enviroment variable.")
end
local osxToolchain = "x86_64-apple-darwin15-"
premake.gcc.cc = osxToolchain .. "clang"
premake.gcc.cxx = osxToolchain .. "clang++"
premake.gcc.ar = osxToolchain .. "ar"
premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
end
location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
@ -438,6 +465,10 @@ function toolchain(_buildDir, _libDir)
flags { "StaticRuntime" }
end
if _OPTIONS["with-avx"] then
flags { "EnableAVX" }
end
flags {
"NoPCH",
"NativeWChar",
@ -907,10 +938,10 @@ function toolchain(_buildDir, _libDir)
linkoptions { "-melf32_nacl" }
configuration { "x32", "nacl", "Debug" }
libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Debug" }
configuration { "x32", "nacl", "Release" }
libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Release" }
configuration { "x64", "nacl" }
targetdir (path.join(_buildDir, "nacl-x64/bin"))
@ -919,10 +950,10 @@ function toolchain(_buildDir, _libDir)
linkoptions { "-melf64_nacl" }
configuration { "x64", "nacl", "Debug" }
libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Debug" }
configuration { "x64", "nacl", "Release" }
libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Release" }
configuration { "nacl-arm" }
buildoptions {
@ -933,10 +964,10 @@ function toolchain(_buildDir, _libDir)
libdirs { path.join(_libDir, "lib/nacl-arm") }
configuration { "nacl-arm", "Debug" }
libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Debug" }
configuration { "nacl-arm", "Release" }
libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Release" }
configuration { "pnacl" }
targetdir (path.join(_buildDir, "pnacl/bin"))

View File

@ -12,11 +12,12 @@ using namespace bx;
union simd_cast
{
bx::simd128_t f4;
float f[4];
uint32_t ui[4];
int32_t i[4];
char c[16];
bx::simd256_t simd256;
bx::simd128_t simd128;
float f[8];
uint32_t ui[8];
int32_t i[8];
char c[32];
};
void simd_check_bool(const char* _str, bool _a, bool _0)
@ -30,9 +31,16 @@ void simd_check_bool(const char* _str, bool _a, bool _0)
CHECK_EQUAL(_a, _0);
}
void simd_check_int32(const char* _str, bx::simd128_t _a, int32_t _0, int32_t _1, int32_t _2, int32_t _3)
void simd_check_int32(
const char* _str
, bx::simd128_t _a
, int32_t _0
, int32_t _1
, int32_t _2
, int32_t _3
)
{
simd_cast c; c.f4 = _a;
simd_cast c; c.simd128 = _a;
DBG("%s (%d, %d, %d, %d) == (%d, %d, %d, %d)"
, _str
, c.i[0], c.i[1], c.i[2], c.i[3]
@ -45,9 +53,48 @@ void simd_check_int32(const char* _str, bx::simd128_t _a, int32_t _0, int32_t _1
CHECK_EQUAL(c.i[3], _3);
}
void simd_check_uint32(const char* _str, bx::simd128_t _a, uint32_t _0, uint32_t _1, uint32_t _2, uint32_t _3)
#if 0
void simd_check_int32(
const char* _str
, bx::simd256_t _a
, int32_t _0
, int32_t _1
, int32_t _2
, int32_t _3
, int32_t _4
, int32_t _5
, int32_t _6
, int32_t _7
)
{
simd_cast c; c.f4 = _a;
simd_cast c; c.simd256 = _a;
DBG("%s (%d, %d, %d, %d, %d, %d, %d, %d) == (%d, %d, %d, %d, %d, %d, %d, %d)"
, _str
, c.i[0], c.i[1], c.i[2], c.i[3], c.i[4], c.i[5], c.i[6], c.i[7]
, _0, _1, _2, _3, _4, _5, _6, _7
);
CHECK_EQUAL(c.i[0], _0);
CHECK_EQUAL(c.i[1], _1);
CHECK_EQUAL(c.i[2], _2);
CHECK_EQUAL(c.i[3], _3);
CHECK_EQUAL(c.i[4], _4);
CHECK_EQUAL(c.i[5], _5);
CHECK_EQUAL(c.i[6], _6);
CHECK_EQUAL(c.i[7], _7);
}
#endif // 0
void simd_check_uint32(
const char* _str
, bx::simd128_t _a
, uint32_t _0
, uint32_t _1
, uint32_t _2
, uint32_t _3
)
{
simd_cast c; c.simd128 = _a;
DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x)"
, _str
@ -61,9 +108,49 @@ void simd_check_uint32(const char* _str, bx::simd128_t _a, uint32_t _0, uint32_t
CHECK_EQUAL(c.ui[3], _3);
}
void simd_check_float(const char* _str, bx::simd128_t _a, float _0, float _1, float _2, float _3)
#if 0
void simd_check_uint32(
const char* _str
, bx::simd256_t _a
, uint32_t _0
, uint32_t _1
, uint32_t _2
, uint32_t _3
, uint32_t _4
, uint32_t _5
, uint32_t _6
, uint32_t _7
)
{
simd_cast c; c.f4 = _a;
simd_cast c; c.simd256 = _a;
DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)"
, _str
, c.ui[0], c.ui[1], c.ui[2], c.ui[3], c.ui[4], c.ui[5], c.ui[6], c.ui[7]
, _0, _1, _2, _3, _4, _5, _6, _7
);
CHECK_EQUAL(c.ui[0], _0);
CHECK_EQUAL(c.ui[1], _1);
CHECK_EQUAL(c.ui[2], _2);
CHECK_EQUAL(c.ui[3], _3);
CHECK_EQUAL(c.ui[4], _4);
CHECK_EQUAL(c.ui[5], _5);
CHECK_EQUAL(c.ui[6], _6);
CHECK_EQUAL(c.ui[7], _7);
}
#endif // 0
void simd_check_float(
const char* _str
, bx::simd128_t _a
, float _0
, float _1
, float _2
, float _3
)
{
simd_cast c; c.simd128 = _a;
DBG("%s (%f, %f, %f, %f) == (%f, %f, %f, %f)"
, _str
@ -77,9 +164,42 @@ void simd_check_float(const char* _str, bx::simd128_t _a, float _0, float _1, fl
CHECK(bx::fequal(c.f[3], _3, 0.0001f) );
}
#if 0
void simd_check_float(
const char* _str
, bx::simd256_t _a
, float _0
, float _1
, float _2
, float _3
, float _4
, float _5
, float _6
, float _7
)
{
simd_cast c; c.simd256 = _a;
DBG("%s (%f, %f, %f, %f, %f, %f, %f, %f) == (%f, %f, %f, %f, %f, %f, %f, %f)"
, _str
, c.f[0], c.f[1], c.f[2], c.f[3], c.f[4], c.f[5], c.f[6], c.f[7]
, _0, _1, _2, _3, _4, _5, _6, _7
);
CHECK(bx::fequal(c.f[0], _0, 0.0001f) );
CHECK(bx::fequal(c.f[1], _1, 0.0001f) );
CHECK(bx::fequal(c.f[2], _2, 0.0001f) );
CHECK(bx::fequal(c.f[3], _3, 0.0001f) );
CHECK(bx::fequal(c.f[4], _4, 0.0001f) );
CHECK(bx::fequal(c.f[5], _5, 0.0001f) );
CHECK(bx::fequal(c.f[6], _6, 0.0001f) );
CHECK(bx::fequal(c.f[7], _7, 0.0001f) );
}
#endif // 0
void simd_check_string(const char* _str, bx::simd128_t _a)
{
simd_cast c; c.f4 = _a;
simd_cast c; c.simd128 = _a;
const char test[5] = { c.c[0], c.c[4], c.c[8], c.c[12], '\0' };
DBG("%s %s", _str, test);
@ -200,11 +320,21 @@ TEST(simd_load)
, 0.0f, 1.0f, 2.0f, 3.0f
);
// simd_check_float("ld"
// , simd_ld<simd256_t>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)
// , 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f
// );
simd_check_int32("ild"
, simd_ild(uint32_t(-1), 0, 1, 2)
, uint32_t(-1), 0, 1, 2
);
// simd_check_int32("ild"
// , simd_ild<simd256_t>(uint32_t(-1), 0, 1, 2, 3, 4, 5, 6)
// , uint32_t(-1), 0, 1, 2, 3, 4, 5, 6
// );
simd_check_int32("ild"
, simd_ild(uint32_t(-1), uint32_t(-2), uint32_t(-3), uint32_t(-4) )
, uint32_t(-1), uint32_t(-2), uint32_t(-3), uint32_t(-4)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -37,7 +37,7 @@ bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uin
m_targets = new bgfx::FrameBufferHandle[m_page_count];
for (int page = 0; page < m_page_count; page++)
{
m_textures[page] = bgfx::createTexture2D(m_width, m_height, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT);
m_textures[page] = bgfx::createTexture2D(m_width, m_height, false, 1, format, wrap_mode | filter_mode | BGFX_TEXTURE_RT);
assert(m_textures[page].idx != 0xffff);
m_targets[page] = bgfx::createFrameBuffer(1, &m_textures[page], false);
assert(m_targets[page].idx != 0xffff);

View File

@ -17,18 +17,18 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u
, m_height(height)
{
bgfx::TextureInfo info;
bgfx::calcTextureSize(info, width, height, 1, false, 1, format);
bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format);
if (data != nullptr)
{
m_texture = bgfx::createTexture2D(width, height, 1, format, flags, bgfx::copy(data, info.storageSize));
m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, bgfx::copy(data, info.storageSize));
}
else
{
m_texture = bgfx::createTexture2D(width, height, 1, format, flags);
m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags);
const bgfx::Memory* memory = bgfx::alloc(info.storageSize);
memset(memory->data, 0, info.storageSize);
bgfx::updateTexture2D(m_texture, 0, 0, 0, width, height, memory, info.storageSize / height);
bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, width, height, memory, info.storageSize / height);
}
}
@ -39,8 +39,8 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u
, m_height(height)
{
bgfx::TextureInfo info;
bgfx::calcTextureSize(info, width, height, 1, false, 1, format);
m_texture = bgfx::createTexture2D(width, height, 1, format, flags, data);
bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format);
m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, data);
}
bgfx_texture::~bgfx_texture()

View File

@ -146,6 +146,50 @@ static void* sdlNativeWindowHandle(SDL_Window* _window)
}
#endif
inline void winSetHwnd(::HWND _window)
{
bgfx::PlatformData pd;
pd.ndt = NULL;
pd.nwh = _window;
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
}
#ifdef OSD_SDL
inline bool sdlSetWindow(SDL_Window* _window)
{
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);
if (!SDL_GetWindowWMInfo(_window, &wmi) )
{
return false;
}
bgfx::PlatformData pd;
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
pd.ndt = wmi.info.x11.display;
pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
# elif BX_PLATFORM_OSX
pd.ndt = NULL;
pd.nwh = wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
pd.ndt = NULL;
pd.nwh = wmi.info.win.window;
# elif BX_PLATFORM_STEAMLINK
pd.ndt = wmi.info.vivante.display;
pd.nwh = wmi.info.vivante.window;
# endif // BX_PLATFORM_
pd.context = NULL;
pd.backBuffer = NULL;
pd.backBufferDS = NULL;
bgfx::setPlatformData(pd);
return true;
}
#endif
int renderer_bgfx::create()
{
// create renderer
@ -168,9 +212,9 @@ int renderer_bgfx::create()
bgfx::setPlatformData(blank_pd);
}
#ifdef OSD_WINDOWS
bgfx::winSetHwnd(win->platform_window<HWND>());
winSetHwnd(win->platform_window<HWND>());
#else
bgfx::sdlSetWindow(win->platform_window<SDL_Window*>());
sdlSetWindow(win->platform_window<SDL_Window*>());
#endif
std::string backend(m_options.bgfx_backend());
if (backend == "auto")
@ -285,7 +329,7 @@ void renderer_bgfx::record()
{
m_avi_writer->record(m_options.bgfx_avi_name());
m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0);
m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK);
m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK);
}
}
@ -477,7 +521,7 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient
const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK,
tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base);
bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem);
bgfx::TextureHandle texture = bgfx::createTexture2D(tex_width, tex_height, false, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem);
bgfx_effect** effects = PRIMFLAG_GET_SCREENTEX(prim->flags) ? m_screen_effect : m_gui_effect;
@ -1084,7 +1128,7 @@ void renderer_bgfx::process_atlas_packs(std::vector<std::vector<rectangle_packer
}
m_hash_to_entry[rect.hash()] = rect;
const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base());
bgfx::updateTexture2D(m_texture_cache->texture(), 0, rect.x(), rect.y(), rect.width(), rect.height(), mem);
bgfx::updateTexture2D(m_texture_cache->texture(), 0, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem);
}
}
}