diff --git a/3rd/bgfx/.gitignore b/3rd/bgfx/.gitignore new file mode 100644 index 000000000..2b3403028 --- /dev/null +++ b/3rd/bgfx/.gitignore @@ -0,0 +1,3 @@ +bgfx +bimg +bx diff --git a/3rd/bgfx/README.md b/3rd/bgfx/README.md new file mode 100644 index 000000000..cf93b976c --- /dev/null +++ b/3rd/bgfx/README.md @@ -0,0 +1,15 @@ +# bgfx + +使用bgfx需要手工去下列软件包: + +* bx:https://github.com/bkaradzic/bx.git +* bimg:https://github.com/bkaradzic/bimg.git +* bgfx: https://github.com/bkaradzic/bgfx.git + +``` +git clone https://github.com/bkaradzic/bx.git +git clone https://github.com/bkaradzic/bimg.git +git clone https://github.com/bkaradzic/bgfx.git + +``` + diff --git a/3rd/bgfx/SConscript b/3rd/bgfx/SConscript new file mode 100644 index 000000000..27d1074d7 --- /dev/null +++ b/3rd/bgfx/SConscript @@ -0,0 +1,70 @@ +import os +import platform +BgCppPath=[] +BgSources=[] +env=DefaultEnvironment().Clone() +OS_NAME=platform.system() +LIB_DIR=os.environ['LIB_DIR']; +CCFLAGS=os.environ['CCFLAGS']; + +BgCppPath=['bx/3rdparty', + 'bx/include', + 'bimg/include', + 'bgfx/3rdparty', + 'bgfx/3rdparty/khronos', + 'bgfx/include'] +BgSources=[ + 'bx/src/allocator.cpp', + 'bx/src/bx.cpp', + 'bx/src/commandline.cpp', + 'bx/src/crtnone.cpp', + 'bx/src/debug.cpp', + 'bx/src/dtoa.cpp', + 'bx/src/easing.cpp', + 'bx/src/file.cpp', + 'bx/src/filepath.cpp', + 'bx/src/hash.cpp', + 'bx/src/math.cpp', + 'bx/src/mutex.cpp', + 'bx/src/os.cpp', + 'bx/src/process.cpp', + 'bx/src/semaphore.cpp', + 'bx/src/settings.cpp', + 'bx/src/string.cpp', + 'bx/src/sort.cpp', + 'bx/src/thread.cpp', + 'bx/src/timer.cpp', + 'bx/src/url.cpp', + 'bimg/src/image.cpp', + 'bimg/src/image_gnf.cpp', + 'bgfx/src/bgfx.cpp', + 'bgfx/src/debug_renderdoc.cpp', + 'bgfx/src/dxgi.cpp', + 'bgfx/src/glcontext_egl.cpp', + 'bgfx/src/glcontext_glx.cpp', + 'bgfx/src/glcontext_wgl.cpp', + 'bgfx/src/nvapi.cpp', + 'bgfx/src/renderer_d3d11.cpp', + 'bgfx/src/renderer_d3d12.cpp', + 'bgfx/src/renderer_d3d9.cpp', + 'bgfx/src/renderer_gl.cpp', + 'bgfx/src/renderer_gnm.cpp', + 'bgfx/src/renderer_noop.cpp', + 'bgfx/src/renderer_vk.cpp', + 'bgfx/src/shader.cpp', + 'bgfx/src/shader_dx9bc.cpp', + 'bgfx/src/shader_dxbc.cpp', + 'bgfx/src/shader_spirv.cpp', + 'bgfx/src/topology.cpp', + 'bgfx/src/vertexdecl.cpp' + ] + +if OS_NAME == 'Windows': + BgCppPath= BgCppPath + ['bx/include/compat/msvc','bgfx/3rdparty/dxsdk/include'] +elif OS_NAME == 'Darwin': + CCFLAGS = CCFLAGS + '-std=c++11 '; + BgCppPath= BgCppPath + ['bx/include/compat/osx'] + BgSources= BgSources + ['bgfx/src/renderer_mtl.mm'] + +env.Library(os.path.join(LIB_DIR, 'bgfx'), BgSources, CPPPATH = BgCppPath,CCFLAGS = CCFLAGS) + diff --git a/3rd/nanovg/SConscript b/3rd/nanovg/SConscript index 7293bea72..1ad16405b 100644 --- a/3rd/nanovg/SConscript +++ b/3rd/nanovg/SConscript @@ -1,8 +1,14 @@ import os +import platform +def joinPath(root, subdir): + return os.path.normpath(os.path.join(root, subdir)) env=DefaultEnvironment().Clone() LIB_DIR=os.environ['LIB_DIR']; BIN_DIR=os.environ['BIN_DIR']; +CCFLAGS=os.environ['CCFLAGS']; +TK_3RD_ROOT=os.environ['TK_3RD_ROOT']; +OS_NAME=platform.system() env.Library(os.path.join(LIB_DIR, 'nanovg'), Glob('base/*.c')) @@ -23,6 +29,20 @@ elif NANOVG_BACKEND == 'AGGE': env.Program(os.path.join(BIN_DIR, 'agge_fill'), Glob('demos/agge_fill.c')); env.Program(os.path.join(BIN_DIR, 'agge_draw_image'), Glob('demos/agge_draw_image.c')); elif NANOVG_BACKEND == 'BGFX': - print("not supported yet"); + CPPPATH = [ + joinPath(TK_3RD_ROOT, 'nanovg/base'), + joinPath(TK_3RD_ROOT, 'bgfx/bx/include'), + joinPath(TK_3RD_ROOT, 'bgfx/bgfx/include'), + joinPath(TK_3RD_ROOT, 'SDL/include')] + if OS_NAME == 'Darwin': + CCFLAGS = CCFLAGS + ' -std=c++11 ' + elif OS_NAME == 'Windows': + CPPPATH = CPPPATH + [joinPath(TK_3RD_ROOT, 'bgfx/bx/include/compat/msvc')]; + env.Library(os.path.join(LIB_DIR, 'nanovg-bgfx'), Glob('bgfx/*.cpp'), CPPPATH = CPPPATH, CCFLAGS = CCFLAGS) + env['LIBS'] = ['nanovg-bgfx', 'bgfx', 'nanovg'] + env['LIBS'] + env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_fill'), Glob('demos/bgfx_sdl_fill.c')); + env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_stroke'), Glob('demos/bgfx_sdl_stroke.c')); + env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_draw_image'), Glob('demos/bgfx_sdl_draw_image.c')); + env.Program(os.path.join(BIN_DIR, 'bgfx_sdl_draw_text'), Glob('demos/bgfx_sdl_draw_text.c')); diff --git a/3rd/nanovg/base/nanovg.c b/3rd/nanovg/base/nanovg.c index 1a6827c26..703f8d3a9 100644 --- a/3rd/nanovg/base/nanovg.c +++ b/3rd/nanovg/base/nanovg.c @@ -20,7 +20,7 @@ #include #include "nanovg.h" -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU #include #include #define FONTSTASH_IMPLEMENTATION @@ -30,7 +30,7 @@ #else #include #define printf(...) -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ #ifdef _MSC_VER #pragma warning(disable: 4100) // unreferenced formal parameter @@ -290,9 +290,9 @@ static NVGstate* nvg__getState(NVGcontext* ctx) NVGcontext* nvgCreateInternal(NVGparams* params) { -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU FONSparams fontParams; -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ NVGcontext* ctx = (NVGcontext*)malloc(sizeof(NVGcontext)); int i; if (ctx == NULL) goto error; @@ -317,7 +317,7 @@ NVGcontext* nvgCreateInternal(NVGparams* params) if (ctx->params.renderCreate(ctx->params.userPtr) == 0) goto error; -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU // Init font rendering memset(&fontParams, 0, sizeof(fontParams)); fontParams.width = NVG_INIT_FONTIMAGE_SIZE; @@ -335,7 +335,7 @@ NVGcontext* nvgCreateInternal(NVGparams* params) ctx->fontImages[0] = ctx->params.renderCreateTexture(ctx->params.userPtr, NVG_TEXTURE_ALPHA, fontParams.width, fontParams.height, 0, NULL); if (ctx->fontImages[0] == 0) goto error; ctx->fontImageIdx = 0; -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ return ctx; @@ -356,7 +356,7 @@ void nvgDeleteInternal(NVGcontext* ctx) if (ctx->commands != NULL) free(ctx->commands); if (ctx->cache != NULL) nvg__deletePathCache(ctx->cache); -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU if (ctx->fs) fonsDeleteInternal(ctx->fs); @@ -368,7 +368,7 @@ void nvgDeleteInternal(NVGcontext* ctx) } #else (void)i; -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ if (ctx->params.renderDelete != NULL) ctx->params.renderDelete(ctx->params.userPtr); @@ -801,7 +801,7 @@ void nvgFillPaint(NVGcontext* ctx, NVGpaint paint) nvgTransformMultiply(state->fill.xform, state->xform); } -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags) { int w, h, n, image; @@ -840,7 +840,7 @@ int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int { return -1; } -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsigned char* data) { @@ -1448,7 +1448,7 @@ static int nvg__curveDivs(float r, float arc, float tol) return nvg__maxi(2, (int)ceilf(arc / da)); } -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU static void nvg__chooseBevel(int bevel, NVGpoint* p0, NVGpoint* p1, float w, float* x0, float* y0, float* x1, float* y1) { @@ -2177,7 +2177,7 @@ static int nvg__expandFill(NVGcontext* ctx, float w, int lineJoin, float miterLi return 1; } -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ // Draw void nvgBeginPath(NVGcontext* ctx) @@ -2411,7 +2411,7 @@ void nvgCircle(NVGcontext* ctx, float cx, float cy, float r) nvgEllipse(ctx, cx,cy, r,r); } -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU void nvgDebugDumpPathCache(NVGcontext* ctx) { const NVGpath* path; @@ -2433,7 +2433,7 @@ void nvgDebugDumpPathCache(NVGcontext* ctx) } } } -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ void nvgFill(NVGcontext* ctx) { @@ -2505,7 +2505,7 @@ void nvgStroke(NVGcontext* ctx) } } -#ifdef WITH_NANOVG_GL +#ifdef WITH_NANOVG_GPU // Add fonts int nvgCreateFont(NVGcontext* ctx, const char* name, const char* path) { @@ -3173,7 +3173,7 @@ float nvgTextBounds(NVGcontext* ctx, float x, float y, const char* string, const return 0; } -#endif/*WITH_NANOVG_GL*/ +#endif/*WITH_NANOVG_GPU*/ NVGparams* nvgGetParams(NVGcontext* ctx) { return &(ctx->params); diff --git a/3rd/nanovg/base/nanovg.h b/3rd/nanovg/base/nanovg.h index 43a21b9df..f4282128e 100644 --- a/3rd/nanovg/base/nanovg.h +++ b/3rd/nanovg/base/nanovg.h @@ -621,8 +621,7 @@ enum NVGtexture { NVG_TEXTURE_BGRA = 0x04, NVG_TEXTURE_RGB = 0x08, NVG_TEXTURE_BGR = 0x16, - NVG_TEXTURE_RGB565 = 0x32, - NVG_TEXTURE_BGR565 = 0x64 + NVG_TEXTURE_BGR565 = 0x32 }; struct NVGscissor { diff --git a/3rd/nanovg/bgfx/TODO b/3rd/nanovg/bgfx/TODO deleted file mode 100644 index 258cd5725..000000000 --- a/3rd/nanovg/bgfx/TODO +++ /dev/null @@ -1 +0,0 @@ -todo diff --git a/3rd/nanovg/bgfx/fontstash.h b/3rd/nanovg/bgfx/fontstash.h new file mode 100644 index 000000000..798b40417 --- /dev/null +++ b/3rd/nanovg/bgfx/fontstash.h @@ -0,0 +1,1760 @@ +// +// Copyright (c) 2009-2013 Mikko Mononen memon@inside.org +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// + +#ifndef FONS_H +#define FONS_H + +#define FONS_INVALID -1 + +enum FONSflags { + FONS_ZERO_TOPLEFT = 1, + FONS_ZERO_BOTTOMLEFT = 2, +}; + +enum FONSalign { + // Horizontal align + FONS_ALIGN_LEFT = 1<<0, // Default + FONS_ALIGN_CENTER = 1<<1, + FONS_ALIGN_RIGHT = 1<<2, + // Vertical align + FONS_ALIGN_TOP = 1<<3, + FONS_ALIGN_MIDDLE = 1<<4, + FONS_ALIGN_BOTTOM = 1<<5, + FONS_ALIGN_BASELINE = 1<<6, // Default +}; + +enum FONSglyphBitmap { + FONS_GLYPH_BITMAP_OPTIONAL = 1, + FONS_GLYPH_BITMAP_REQUIRED = 2, +}; + +enum FONSerrorCode { + // Font atlas is full. + FONS_ATLAS_FULL = 1, + // Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE. + FONS_SCRATCH_FULL = 2, + // Calls to fonsPushState has created too large stack, if you need deep state stack bump up FONS_MAX_STATES. + FONS_STATES_OVERFLOW = 3, + // Trying to pop too many states fonsPopState(). + FONS_STATES_UNDERFLOW = 4, +}; + +struct FONSparams { + int width, height; + unsigned char flags; + void* userPtr; + int (*renderCreate)(void* uptr, int width, int height); + int (*renderResize)(void* uptr, int width, int height); + void (*renderUpdate)(void* uptr, int* rect, const unsigned char* data); + void (*renderDraw)(void* uptr, const float* verts, const float* tcoords, const unsigned int* colors, int nverts); + void (*renderDelete)(void* uptr); +}; +typedef struct FONSparams FONSparams; + +struct FONSquad +{ + float x0,y0,s0,t0; + float x1,y1,s1,t1; +}; +typedef struct FONSquad FONSquad; + +struct FONStextIter { + float x, y, nextx, nexty, scale, spacing; + unsigned int codepoint; + short isize, iblur; + struct FONSfont* font; + int prevGlyphIndex; + const char* str; + const char* next; + const char* end; + unsigned int utf8state; + int bitmapOption; +}; +typedef struct FONStextIter FONStextIter; + +typedef struct FONScontext FONScontext; + +// Contructor and destructor. +FONScontext* fonsCreateInternal(FONSparams* params); +void fonsDeleteInternal(FONScontext* s); + +void fonsSetErrorCallback(FONScontext* s, void (*callback)(void* uptr, int error, int val), void* uptr); +// Returns current atlas size. +void fonsGetAtlasSize(FONScontext* s, int* width, int* height); +// Expands the atlas size. +int fonsExpandAtlas(FONScontext* s, int width, int height); +// Reseta the whole stash. +int fonsResetAtlas(FONScontext* stash, int width, int height); + +// Add fonts +int fonsAddFont(FONScontext* s, const char* name, const char* path); +int fonsAddFontMem(FONScontext* s, const char* name, unsigned char* data, int ndata, int freeData); +int fonsGetFontByName(FONScontext* s, const char* name); + +// State handling +void fonsPushState(FONScontext* s); +void fonsPopState(FONScontext* s); +void fonsClearState(FONScontext* s); + +// State setting +void fonsSetSize(FONScontext* s, float size); +void fonsSetColor(FONScontext* s, unsigned int color); +void fonsSetSpacing(FONScontext* s, float spacing); +void fonsSetBlur(FONScontext* s, float blur); +void fonsSetAlign(FONScontext* s, int align); +void fonsSetFont(FONScontext* s, int font); + +// Draw text +float fonsDrawText(FONScontext* s, float x, float y, const char* string, const char* end); + +// Measure text +float fonsTextBounds(FONScontext* s, float x, float y, const char* string, const char* end, float* bounds); +void fonsLineBounds(FONScontext* s, float y, float* miny, float* maxy); +void fonsVertMetrics(FONScontext* s, float* ascender, float* descender, float* lineh); + +// Text iterator +int fonsTextIterInit(FONScontext* stash, FONStextIter* iter, float x, float y, const char* str, const char* end, int bitmapOption); +int fonsTextIterNext(FONScontext* stash, FONStextIter* iter, struct FONSquad* quad); + +// Pull texture changes +const unsigned char* fonsGetTextureData(FONScontext* stash, int* width, int* height); +int fonsValidateTexture(FONScontext* s, int* dirty); + +// Draws the stash texture for debugging +void fonsDrawDebug(FONScontext* s, float x, float y); + +#endif // FONTSTASH_H + + +#ifdef FONTSTASH_IMPLEMENTATION + +#define FONS_NOTUSED(v) BX_UNUSED(v) + +#ifdef FONS_USE_FREETYPE + +#include +#include FT_FREETYPE_H +#include FT_ADVANCES_H +#include + +struct FONSttFontImpl { + FT_Face font; +}; +typedef struct FONSttFontImpl FONSttFontImpl; + +static FT_Library ftLibrary; + +int fons__tt_init(FONScontext *context) +{ + FT_Error ftError; + FONS_NOTUSED(context); + ftError = FT_Init_FreeType(&ftLibrary); + return ftError == 0; +} + +int fons__tt_loadFont(FONScontext *context, FONSttFontImpl *font, unsigned char *data, int dataSize) +{ + FT_Error ftError; + FONS_NOTUSED(context); + + //font->font.userdata = stash; + ftError = FT_New_Memory_Face(ftLibrary, (const FT_Byte*)data, dataSize, 0, &font->font); + return ftError == 0; +} + +void fons__tt_getFontVMetrics(FONSttFontImpl *font, int *ascent, int *descent, int *lineGap) +{ + *ascent = font->font->ascender; + *descent = font->font->descender; + *lineGap = font->font->height - (*ascent - *descent); +} + +float fons__tt_getPixelHeightScale(FONSttFontImpl *font, float size) +{ + return size / (font->font->ascender - font->font->descender); +} + +int fons__tt_getGlyphIndex(FONSttFontImpl *font, int codepoint) +{ + return FT_Get_Char_Index(font->font, codepoint); +} + +int fons__tt_buildGlyphBitmap(FONSttFontImpl *font, int glyph, float size, float scale, + int *advance, int *lsb, int *x0, int *y0, int *x1, int *y1) +{ + FT_Error ftError; + FT_GlyphSlot ftGlyph; + FT_Fixed advFixed; + FONS_NOTUSED(scale); + + ftError = FT_Set_Pixel_Sizes(font->font, 0, (FT_UInt)(size * (float)font->font->units_per_EM / (float)(font->font->ascender - font->font->descender))); + if (ftError) return 0; + ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER); + if (ftError) return 0; + ftError = FT_Get_Advance(font->font, glyph, FT_LOAD_NO_SCALE, &advFixed); + if (ftError) return 0; + ftGlyph = font->font->glyph; + *advance = (int)advFixed; + *lsb = (int)ftGlyph->metrics.horiBearingX; + *x0 = ftGlyph->bitmap_left; + *x1 = *x0 + ftGlyph->bitmap.width; + *y0 = -ftGlyph->bitmap_top; + *y1 = *y0 + ftGlyph->bitmap.rows; + return 1; +} + +void fons__tt_renderGlyphBitmap(FONSttFontImpl *font, unsigned char *output, int outWidth, int outHeight, int outStride, + float scaleX, float scaleY, int glyph) +{ + FT_GlyphSlot ftGlyph = font->font->glyph; + int ftGlyphOffset = 0; + int x, y; + FONS_NOTUSED(outWidth); + FONS_NOTUSED(outHeight); + FONS_NOTUSED(scaleX); + FONS_NOTUSED(scaleY); + FONS_NOTUSED(glyph); // glyph has already been loaded by fons__tt_buildGlyphBitmap + + for ( y = 0; y < ftGlyph->bitmap.rows; y++ ) { + for ( x = 0; x < ftGlyph->bitmap.width; x++ ) { + output[(y * outStride) + x] = ftGlyph->bitmap.buffer[ftGlyphOffset++]; + } + } +} + +int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font, int glyph1, int glyph2) +{ + FT_Vector ftKerning; + FT_Get_Kerning(font->font, glyph1, glyph2, FT_KERNING_DEFAULT, &ftKerning); + return (int)((ftKerning.x + 32) >> 6); // Round up and convert to integer +} + +#else + +#if 0 +#define STB_TRUETYPE_IMPLEMENTATION +# define STBTT_malloc(x,u) fons__tmpalloc(x,u) +# define STBTT_free(x,u) fons__tmpfree(x,u) +static void* fons__tmpalloc(size_t size, void* up); +static void fons__tmpfree(void* ptr, void* up); +#else +# include +# include +#endif // 0 + +#define STBTT_DEF extern +#include + +struct FONSttFontImpl { + stbtt_fontinfo font; +}; +typedef struct FONSttFontImpl FONSttFontImpl; + +int fons__tt_init(FONScontext *context) +{ + FONS_NOTUSED(context); + return 1; +} + +int fons__tt_loadFont(FONScontext *context, FONSttFontImpl *font, unsigned char *data, int dataSize) +{ + int stbError; + FONS_NOTUSED(dataSize); + + font->font.userdata = context; + stbError = stbtt_InitFont(&font->font, data, 0); + return stbError; +} + +void fons__tt_getFontVMetrics(FONSttFontImpl *font, int *ascent, int *descent, int *lineGap) +{ + stbtt_GetFontVMetrics(&font->font, ascent, descent, lineGap); +} + +float fons__tt_getPixelHeightScale(FONSttFontImpl *font, float size) +{ + return stbtt_ScaleForPixelHeight(&font->font, size); +} + +int fons__tt_getGlyphIndex(FONSttFontImpl *font, int codepoint) +{ + return stbtt_FindGlyphIndex(&font->font, codepoint); +} + +int fons__tt_buildGlyphBitmap(FONSttFontImpl *font, int glyph, float size, float scale, + int *advance, int *lsb, int *x0, int *y0, int *x1, int *y1) +{ + FONS_NOTUSED(size); + stbtt_GetGlyphHMetrics(&font->font, glyph, advance, lsb); + stbtt_GetGlyphBitmapBox(&font->font, glyph, scale, scale, x0, y0, x1, y1); + return 1; +} + +void fons__tt_renderGlyphBitmap(FONSttFontImpl *font, unsigned char *output, int outWidth, int outHeight, int outStride, + float scaleX, float scaleY, int glyph) +{ + stbtt_MakeGlyphBitmap(&font->font, output, outWidth, outHeight, outStride, scaleX, scaleY, glyph); +} + +int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font, int glyph1, int glyph2) +{ + return stbtt_GetGlyphKernAdvance(&font->font, glyph1, glyph2); +} + +#endif + +#ifndef FONS_SCRATCH_BUF_SIZE +# define FONS_SCRATCH_BUF_SIZE 64000 +#endif +#ifndef FONS_HASH_LUT_SIZE +# define FONS_HASH_LUT_SIZE 256 +#endif +#ifndef FONS_INIT_FONTS +# define FONS_INIT_FONTS 4 +#endif +#ifndef FONS_INIT_GLYPHS +# define FONS_INIT_GLYPHS 256 +#endif +#ifndef FONS_INIT_ATLAS_NODES +# define FONS_INIT_ATLAS_NODES 256 +#endif +#ifndef FONS_VERTEX_COUNT +# define FONS_VERTEX_COUNT 1024 +#endif +#ifndef FONS_MAX_STATES +# define FONS_MAX_STATES 20 +#endif +#ifndef FONS_MAX_FALLBACKS +# define FONS_MAX_FALLBACKS 20 +#endif + +static unsigned int fons__hashint(unsigned int a) +{ + a += ~(a<<15); + a ^= (a>>10); + a += (a<<3); + a ^= (a>>6); + a += ~(a<<11); + a ^= (a>>16); + return a; +} + +static int fons__mini(int a, int b) +{ + return a < b ? a : b; +} + +static int fons__maxi(int a, int b) +{ + return a > b ? a : b; +} + +struct FONSglyph +{ + unsigned int codepoint; + int index; + int next; + short size, blur; + short x0,y0,x1,y1; + short xadv,xoff,yoff; +}; +typedef struct FONSglyph FONSglyph; + +struct FONSfont +{ + FONSttFontImpl font; + char name[64]; + unsigned char* data; + int dataSize; + unsigned char freeData; + float ascender; + float descender; + float lineh; + FONSglyph* glyphs; + int cglyphs; + int nglyphs; + int lut[FONS_HASH_LUT_SIZE]; + int fallbacks[FONS_MAX_FALLBACKS]; + int nfallbacks; +}; +typedef struct FONSfont FONSfont; + +struct FONSstate +{ + int font; + int align; + float size; + unsigned int color; + float blur; + float spacing; +}; +typedef struct FONSstate FONSstate; + +struct FONSatlasNode { + short x, y, width; +}; +typedef struct FONSatlasNode FONSatlasNode; + +struct FONSatlas +{ + int width, height; + FONSatlasNode* nodes; + int nnodes; + int cnodes; +}; +typedef struct FONSatlas FONSatlas; + +struct FONScontext +{ + FONSparams params; + float itw,ith; + unsigned char* texData; + int dirtyRect[4]; + FONSfont** fonts; + FONSatlas* atlas; + int cfonts; + int nfonts; + float verts[FONS_VERTEX_COUNT*2]; + float tcoords[FONS_VERTEX_COUNT*2]; + unsigned int colors[FONS_VERTEX_COUNT]; + int nverts; + unsigned char* scratch; + int nscratch; + FONSstate states[FONS_MAX_STATES]; + int nstates; + void (*handleError)(void* uptr, int error, int val); + void* errorUptr; +}; + +#if 0 // defined(STB_TRUETYPE_IMPLEMENTATION) + +static void* fons__tmpalloc(size_t size, void* up) +{ + unsigned char* ptr; + FONScontext* stash = (FONScontext*)up; + + // 16-byte align the returned pointer + size = (size + 0xf) & ~0xf; + + if (stash->nscratch+(int)size > FONS_SCRATCH_BUF_SIZE) { + if (stash->handleError) + stash->handleError(stash->errorUptr, FONS_SCRATCH_FULL, stash->nscratch+(int)size); + return NULL; + } + ptr = stash->scratch + stash->nscratch; + stash->nscratch += (int)size; + return ptr; +} + +static void fons__tmpfree(void* ptr, void* up) +{ + (void)ptr; + (void)up; + // empty +} + +#endif // STB_TRUETYPE_IMPLEMENTATION + +// Copyright (c) 2008-2010 Bjoern Hoehrmann +// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. + +#define FONS_UTF8_ACCEPT 0 +#define FONS_UTF8_REJECT 12 + +static unsigned int fons__decutf8(unsigned int* state, unsigned int* codep, unsigned int byte) +{ + static const unsigned char utf8d[] = { + // The first part of the table maps bytes to character classes that + // to reduce the size of the transition table and create bitmasks. + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, + + // The second part is a transition table that maps a combination + // of a state of the automaton and a character class to a state. + 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, + 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, + 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12, + 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, + 12,36,12,12,12,12,12,12,12,12,12,12, + }; + + unsigned int type = utf8d[byte]; + + *codep = (*state != FONS_UTF8_ACCEPT) ? + (byte & 0x3fu) | (*codep << 6) : + (0xff >> type) & (byte); + + *state = utf8d[256 + *state + type]; + return *state; +} + +// Atlas based on Skyline Bin Packer by Jukka Jylänki + +static void fons__deleteAtlas(FONSatlas* atlas) +{ + if (atlas == NULL) return; + if (atlas->nodes != NULL) free(atlas->nodes); + free(atlas); +} + +static FONSatlas* fons__allocAtlas(int w, int h, int nnodes) +{ + FONSatlas* atlas = NULL; + + // Allocate memory for the font stash. + atlas = (FONSatlas*)malloc(sizeof(FONSatlas)); + if (atlas == NULL) goto error; + memset(atlas, 0, sizeof(FONSatlas)); + + atlas->width = w; + atlas->height = h; + + // Allocate space for skyline nodes + atlas->nodes = (FONSatlasNode*)malloc(sizeof(FONSatlasNode) * nnodes); + if (atlas->nodes == NULL) goto error; + memset(atlas->nodes, 0, sizeof(FONSatlasNode) * nnodes); + atlas->nnodes = 0; + atlas->cnodes = nnodes; + + // Init root node. + atlas->nodes[0].x = 0; + atlas->nodes[0].y = 0; + atlas->nodes[0].width = (short)w; + atlas->nnodes++; + + return atlas; + +error: + if (atlas) fons__deleteAtlas(atlas); + return NULL; +} + +static int fons__atlasInsertNode(FONSatlas* atlas, int idx, int x, int y, int w) +{ + int i; + // Insert node + if (atlas->nnodes+1 > atlas->cnodes) { + atlas->cnodes = atlas->cnodes == 0 ? 8 : atlas->cnodes * 2; + atlas->nodes = (FONSatlasNode*)realloc(atlas->nodes, sizeof(FONSatlasNode) * atlas->cnodes); + if (atlas->nodes == NULL) + return 0; + } + for (i = atlas->nnodes; i > idx; i--) + atlas->nodes[i] = atlas->nodes[i-1]; + atlas->nodes[idx].x = (short)x; + atlas->nodes[idx].y = (short)y; + atlas->nodes[idx].width = (short)w; + atlas->nnodes++; + + return 1; +} + +static void fons__atlasRemoveNode(FONSatlas* atlas, int idx) +{ + int i; + if (atlas->nnodes == 0) return; + for (i = idx; i < atlas->nnodes-1; i++) + atlas->nodes[i] = atlas->nodes[i+1]; + atlas->nnodes--; +} + +static void fons__atlasExpand(FONSatlas* atlas, int w, int h) +{ + // Insert node for empty space + if (w > atlas->width) + fons__atlasInsertNode(atlas, atlas->nnodes, atlas->width, 0, w - atlas->width); + atlas->width = w; + atlas->height = h; +} + +static void fons__atlasReset(FONSatlas* atlas, int w, int h) +{ + atlas->width = w; + atlas->height = h; + atlas->nnodes = 0; + + // Init root node. + atlas->nodes[0].x = 0; + atlas->nodes[0].y = 0; + atlas->nodes[0].width = (short)w; + atlas->nnodes++; +} + +static int fons__atlasAddSkylineLevel(FONSatlas* atlas, int idx, int x, int y, int w, int h) +{ + int i; + + // Insert new node + if (fons__atlasInsertNode(atlas, idx, x, y+h, w) == 0) + return 0; + + // Delete skyline segments that fall under the shadow of the new segment. + for (i = idx+1; i < atlas->nnodes; i++) { + if (atlas->nodes[i].x < atlas->nodes[i-1].x + atlas->nodes[i-1].width) { + int shrink = atlas->nodes[i-1].x + atlas->nodes[i-1].width - atlas->nodes[i].x; + atlas->nodes[i].x += (short)shrink; + atlas->nodes[i].width -= (short)shrink; + if (atlas->nodes[i].width <= 0) { + fons__atlasRemoveNode(atlas, i); + i--; + } else { + break; + } + } else { + break; + } + } + + // Merge same height skyline segments that are next to each other. + for (i = 0; i < atlas->nnodes-1; i++) { + if (atlas->nodes[i].y == atlas->nodes[i+1].y) { + atlas->nodes[i].width += atlas->nodes[i+1].width; + fons__atlasRemoveNode(atlas, i+1); + i--; + } + } + + return 1; +} + +static int fons__atlasRectFits(FONSatlas* atlas, int i, int w, int h) +{ + // Checks if there is enough space at the location of skyline span 'i', + // and return the max height of all skyline spans under that at that location, + // (think tetris block being dropped at that position). Or -1 if no space found. + int x = atlas->nodes[i].x; + int y = atlas->nodes[i].y; + int spaceLeft; + if (x + w > atlas->width) + return -1; + spaceLeft = w; + while (spaceLeft > 0) { + if (i == atlas->nnodes) return -1; + y = fons__maxi(y, atlas->nodes[i].y); + if (y + h > atlas->height) return -1; + spaceLeft -= atlas->nodes[i].width; + ++i; + } + return y; +} + +static int fons__atlasAddRect(FONSatlas* atlas, int rw, int rh, int* rx, int* ry) +{ + int besth = atlas->height, bestw = atlas->width, besti = -1; + int bestx = -1, besty = -1, i; + + // Bottom left fit heuristic. + for (i = 0; i < atlas->nnodes; i++) { + int y = fons__atlasRectFits(atlas, i, rw, rh); + if (y != -1) { + if (y + rh < besth || (y + rh == besth && atlas->nodes[i].width < bestw)) { + besti = i; + bestw = atlas->nodes[i].width; + besth = y + rh; + bestx = atlas->nodes[i].x; + besty = y; + } + } + } + + if (besti == -1) + return 0; + + // Perform the actual packing. + if (fons__atlasAddSkylineLevel(atlas, besti, bestx, besty, rw, rh) == 0) + return 0; + + *rx = bestx; + *ry = besty; + + return 1; +} + +static void fons__addWhiteRect(FONScontext* stash, int w, int h) +{ + int x, y, gx, gy; + unsigned char* dst; + if (fons__atlasAddRect(stash->atlas, w, h, &gx, &gy) == 0) + return; + + // Rasterize + dst = &stash->texData[gx + gy * stash->params.width]; + for (y = 0; y < h; y++) { + for (x = 0; x < w; x++) + dst[x] = 0xff; + dst += stash->params.width; + } + + stash->dirtyRect[0] = fons__mini(stash->dirtyRect[0], gx); + stash->dirtyRect[1] = fons__mini(stash->dirtyRect[1], gy); + stash->dirtyRect[2] = fons__maxi(stash->dirtyRect[2], gx+w); + stash->dirtyRect[3] = fons__maxi(stash->dirtyRect[3], gy+h); +} + +FONScontext* fonsCreateInternal(FONSparams* params) +{ + FONScontext* stash = NULL; + + // Allocate memory for the font stash. + stash = (FONScontext*)malloc(sizeof(FONScontext)); + if (stash == NULL) goto error; + memset(stash, 0, sizeof(FONScontext)); + + stash->params = *params; + + // Allocate scratch buffer. + stash->scratch = (unsigned char*)malloc(FONS_SCRATCH_BUF_SIZE); + if (stash->scratch == NULL) goto error; + + // Initialize implementation library + if (!fons__tt_init(stash)) goto error; + + if (stash->params.renderCreate != NULL) { + if (stash->params.renderCreate(stash->params.userPtr, stash->params.width, stash->params.height) == 0) + goto error; + } + + stash->atlas = fons__allocAtlas(stash->params.width, stash->params.height, FONS_INIT_ATLAS_NODES); + if (stash->atlas == NULL) goto error; + + // Allocate space for fonts. + stash->fonts = (FONSfont**)malloc(sizeof(FONSfont*) * FONS_INIT_FONTS); + if (stash->fonts == NULL) goto error; + memset(stash->fonts, 0, sizeof(FONSfont*) * FONS_INIT_FONTS); + stash->cfonts = FONS_INIT_FONTS; + stash->nfonts = 0; + + // Create texture for the cache. + stash->itw = 1.0f/stash->params.width; + stash->ith = 1.0f/stash->params.height; + stash->texData = (unsigned char*)malloc(stash->params.width * stash->params.height); + if (stash->texData == NULL) goto error; + memset(stash->texData, 0, stash->params.width * stash->params.height); + + stash->dirtyRect[0] = stash->params.width; + stash->dirtyRect[1] = stash->params.height; + stash->dirtyRect[2] = 0; + stash->dirtyRect[3] = 0; + + // Add white rect at 0,0 for debug drawing. + fons__addWhiteRect(stash, 2,2); + + fonsPushState(stash); + fonsClearState(stash); + + return stash; + +error: + fonsDeleteInternal(stash); + return NULL; +} + +static FONSstate* fons__getState(FONScontext* stash) +{ + return &stash->states[stash->nstates-1]; +} + +int fonsAddFallbackFont(FONScontext* stash, int base, int fallback) +{ + FONSfont* baseFont = stash->fonts[base]; + if (baseFont->nfallbacks < FONS_MAX_FALLBACKS) { + baseFont->fallbacks[baseFont->nfallbacks++] = fallback; + return 1; + } + return 0; +} + +void fonsSetSize(FONScontext* stash, float size) +{ + fons__getState(stash)->size = size; +} + +void fonsSetColor(FONScontext* stash, unsigned int color) +{ + fons__getState(stash)->color = color; +} + +void fonsSetSpacing(FONScontext* stash, float spacing) +{ + fons__getState(stash)->spacing = spacing; +} + +void fonsSetBlur(FONScontext* stash, float blur) +{ + fons__getState(stash)->blur = blur; +} + +void fonsSetAlign(FONScontext* stash, int align) +{ + fons__getState(stash)->align = align; +} + +void fonsSetFont(FONScontext* stash, int font) +{ + fons__getState(stash)->font = font; +} + +void fonsPushState(FONScontext* stash) +{ + if (stash->nstates >= FONS_MAX_STATES) { + if (stash->handleError) + stash->handleError(stash->errorUptr, FONS_STATES_OVERFLOW, 0); + return; + } + if (stash->nstates > 0) + memcpy(&stash->states[stash->nstates], &stash->states[stash->nstates-1], sizeof(FONSstate)); + stash->nstates++; +} + +void fonsPopState(FONScontext* stash) +{ + if (stash->nstates <= 1) { + if (stash->handleError) + stash->handleError(stash->errorUptr, FONS_STATES_UNDERFLOW, 0); + return; + } + stash->nstates--; +} + +void fonsClearState(FONScontext* stash) +{ + FONSstate* state = fons__getState(stash); + state->size = 12.0f; + state->color = 0xffffffff; + state->font = 0; + state->blur = 0; + state->spacing = 0; + state->align = FONS_ALIGN_LEFT | FONS_ALIGN_BASELINE; +} + +static void fons__freeFont(FONSfont* font) +{ + if (font == NULL) return; + if (font->glyphs) free(font->glyphs); + if (font->freeData && font->data) free(font->data); + free(font); +} + +static int fons__allocFont(FONScontext* stash) +{ + FONSfont* font = NULL; + if (stash->nfonts+1 > stash->cfonts) { + stash->cfonts = stash->cfonts == 0 ? 8 : stash->cfonts * 2; + stash->fonts = (FONSfont**)realloc(stash->fonts, sizeof(FONSfont*) * stash->cfonts); + if (stash->fonts == NULL) + return -1; + } + font = (FONSfont*)malloc(sizeof(FONSfont)); + if (font == NULL) goto error; + memset(font, 0, sizeof(FONSfont)); + + font->glyphs = (FONSglyph*)malloc(sizeof(FONSglyph) * FONS_INIT_GLYPHS); + if (font->glyphs == NULL) goto error; + font->cglyphs = FONS_INIT_GLYPHS; + font->nglyphs = 0; + + stash->fonts[stash->nfonts++] = font; + return stash->nfonts-1; + +error: + fons__freeFont(font); + + return FONS_INVALID; +} + +int fonsAddFont(FONScontext* stash, const char* name, const char* path) +{ + FILE* fp = 0; + size_t dataSize = 0; + size_t readed; + unsigned char* data = NULL; + + // Read in the font data. + fp = fopen(path, "rb"); + if (fp == NULL) goto error; + fseek(fp,0,SEEK_END); + dataSize = ftell(fp); + fseek(fp,0,SEEK_SET); + data = (unsigned char*)malloc(dataSize); + if (data == NULL) goto error; + readed = fread(data, 1, dataSize, fp); + fclose(fp); + fp = 0; + if (readed != dataSize) goto error; + + return fonsAddFontMem(stash, name, data, int(dataSize), 1); + +error: + if (data) free(data); + if (fp) fclose(fp); + return FONS_INVALID; +} + +int fonsAddFontMem(FONScontext* stash, const char* name, unsigned char* data, int dataSize, int freeData) +{ + int i, ascent, descent, fh, lineGap; + FONSfont* font; + + int idx = fons__allocFont(stash); + if (idx == FONS_INVALID) + return FONS_INVALID; + + font = stash->fonts[idx]; + + strncpy(font->name, name, sizeof(font->name)); + font->name[sizeof(font->name)-1] = '\0'; + + // Init hash lookup. + for (i = 0; i < FONS_HASH_LUT_SIZE; ++i) + font->lut[i] = -1; + + // Read in the font data. + font->dataSize = dataSize; + font->data = data; + font->freeData = (unsigned char)freeData; + + // Init font + stash->nscratch = 0; + if (!fons__tt_loadFont(stash, &font->font, data, dataSize)) goto error; + + // Store normalized line height. The real line height is got + // by multiplying the lineh by font size. + fons__tt_getFontVMetrics( &font->font, &ascent, &descent, &lineGap); + fh = ascent - descent; + font->ascender = (float)ascent / (float)fh; + font->descender = (float)descent / (float)fh; + font->lineh = (float)(fh + lineGap) / (float)fh; + + return idx; + +error: + fons__freeFont(font); + stash->nfonts--; + return FONS_INVALID; +} + +int fonsGetFontByName(FONScontext* s, const char* name) +{ + int i; + for (i = 0; i < s->nfonts; i++) { + if (strcmp(s->fonts[i]->name, name) == 0) + return i; + } + return FONS_INVALID; +} + + +static FONSglyph* fons__allocGlyph(FONSfont* font) +{ + if (font->nglyphs+1 > font->cglyphs) { + font->cglyphs = font->cglyphs == 0 ? 8 : font->cglyphs * 2; + font->glyphs = (FONSglyph*)realloc(font->glyphs, sizeof(FONSglyph) * font->cglyphs); + if (font->glyphs == NULL) return NULL; + } + font->nglyphs++; + return &font->glyphs[font->nglyphs-1]; +} + + +// Based on Exponential blur, Jani Huhtanen, 2006 + +#define APREC 16 +#define ZPREC 7 + +static void fons__blurCols(unsigned char* dst, int w, int h, int dstStride, int alpha) +{ + int x, y; + for (y = 0; y < h; y++) { + int z = 0; // force zero border + for (x = 1; x < w; x++) { + z += (alpha * (((int)(dst[x]) << ZPREC) - z)) >> APREC; + dst[x] = (unsigned char)(z >> ZPREC); + } + dst[w-1] = 0; // force zero border + z = 0; + for (x = w-2; x >= 0; x--) { + z += (alpha * (((int)(dst[x]) << ZPREC) - z)) >> APREC; + dst[x] = (unsigned char)(z >> ZPREC); + } + dst[0] = 0; // force zero border + dst += dstStride; + } +} + +static void fons__blurRows(unsigned char* dst, int w, int h, int dstStride, int alpha) +{ + int x, y; + for (x = 0; x < w; x++) { + int z = 0; // force zero border + for (y = dstStride; y < h*dstStride; y += dstStride) { + z += (alpha * (((int)(dst[y]) << ZPREC) - z)) >> APREC; + dst[y] = (unsigned char)(z >> ZPREC); + } + dst[(h-1)*dstStride] = 0; // force zero border + z = 0; + for (y = (h-2)*dstStride; y >= 0; y -= dstStride) { + z += (alpha * (((int)(dst[y]) << ZPREC) - z)) >> APREC; + dst[y] = (unsigned char)(z >> ZPREC); + } + dst[0] = 0; // force zero border + dst++; + } +} + + +static void fons__blur(FONScontext* stash, unsigned char* dst, int w, int h, int dstStride, int blur) +{ + int alpha; + float sigma; + (void)stash; + + if (blur < 1) + return; + // Calculate the alpha such that 90% of the kernel is within the radius. (Kernel extends to infinity) + sigma = (float)blur * 0.57735f; // 1 / sqrt(3) + alpha = (int)((1< 20) iblur = 20; + pad = iblur+2; + + // Reset allocator. + stash->nscratch = 0; + + // Find code point and size. + h = fons__hashint(codepoint) & (FONS_HASH_LUT_SIZE-1); + i = font->lut[h]; + while (i != -1) { + if (font->glyphs[i].codepoint == codepoint && font->glyphs[i].size == isize && font->glyphs[i].blur == iblur) { + glyph = &font->glyphs[i]; + if (bitmapOption == FONS_GLYPH_BITMAP_OPTIONAL || (glyph->x0 >= 0 && glyph->y0 >= 0)) { + return glyph; + } + // At this point, glyph exists but the bitmap data is not yet created. + break; + } + i = font->glyphs[i].next; + } + + // Create a new glyph or rasterize bitmap data for a cached glyph. + g = fons__tt_getGlyphIndex(&font->font, codepoint); + // Try to find the glyph in fallback fonts. + if (g == 0) { + for (i = 0; i < font->nfallbacks; ++i) { + FONSfont* fallbackFont = stash->fonts[font->fallbacks[i]]; + int fallbackIndex = fons__tt_getGlyphIndex(&fallbackFont->font, codepoint); + if (fallbackIndex != 0) { + g = fallbackIndex; + renderFont = fallbackFont; + break; + } + } + // It is possible that we did not find a fallback glyph. + // In that case the glyph index 'g' is 0, and we'll proceed below and cache empty glyph. + } + scale = fons__tt_getPixelHeightScale(&renderFont->font, size); + fons__tt_buildGlyphBitmap(&renderFont->font, g, size, scale, &advance, &lsb, &x0, &y0, &x1, &y1); + gw = x1-x0 + pad*2; + gh = y1-y0 + pad*2; + + // Determines the spot to draw glyph in the atlas. + if (bitmapOption == FONS_GLYPH_BITMAP_REQUIRED) { + // Find free spot for the rect in the atlas + added = fons__atlasAddRect(stash->atlas, gw, gh, &gx, &gy); + if (added == 0 && stash->handleError != NULL) { + // Atlas is full, let the user to resize the atlas (or not), and try again. + stash->handleError(stash->errorUptr, FONS_ATLAS_FULL, 0); + added = fons__atlasAddRect(stash->atlas, gw, gh, &gx, &gy); + } + if (added == 0) return NULL; + } else { + // Negative coordinate indicates there is no bitmap data created. + gx = -1; + gy = -1; + } + + // Init glyph. + if (glyph == NULL) { + glyph = fons__allocGlyph(font); + glyph->codepoint = codepoint; + glyph->size = isize; + glyph->blur = iblur; + glyph->next = 0; + + // Insert char to hash lookup. + glyph->next = font->lut[h]; + font->lut[h] = font->nglyphs-1; + } + glyph->index = g; + glyph->x0 = (short)gx; + glyph->y0 = (short)gy; + glyph->x1 = (short)(glyph->x0+gw); + glyph->y1 = (short)(glyph->y0+gh); + glyph->xadv = (short)(scale * advance * 10.0f); + glyph->xoff = (short)(x0 - pad); + glyph->yoff = (short)(y0 - pad); + + if (bitmapOption == FONS_GLYPH_BITMAP_OPTIONAL) { + return glyph; + } + + // Rasterize + dst = &stash->texData[(glyph->x0+pad) + (glyph->y0+pad) * stash->params.width]; + fons__tt_renderGlyphBitmap(&renderFont->font, dst, gw-pad*2,gh-pad*2, stash->params.width, scale, scale, g); + + // Make sure there is one pixel empty border. + dst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; + for (y = 0; y < gh; y++) { + dst[y*stash->params.width] = 0; + dst[gw-1 + y*stash->params.width] = 0; + } + for (x = 0; x < gw; x++) { + dst[x] = 0; + dst[x + (gh-1)*stash->params.width] = 0; + } + + // Debug code to color the glyph background +/* unsigned char* fdst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; + for (y = 0; y < gh; y++) { + for (x = 0; x < gw; x++) { + int a = (int)fdst[x+y*stash->params.width] + 20; + if (a > 255) a = 255; + fdst[x+y*stash->params.width] = a; + } + }*/ + + // Blur + if (iblur > 0) { + stash->nscratch = 0; + bdst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; + fons__blur(stash, bdst, gw, gh, stash->params.width, iblur); + } + + stash->dirtyRect[0] = fons__mini(stash->dirtyRect[0], glyph->x0); + stash->dirtyRect[1] = fons__mini(stash->dirtyRect[1], glyph->y0); + stash->dirtyRect[2] = fons__maxi(stash->dirtyRect[2], glyph->x1); + stash->dirtyRect[3] = fons__maxi(stash->dirtyRect[3], glyph->y1); + + return glyph; +} + +static void fons__getQuad(FONScontext* stash, FONSfont* font, + int prevGlyphIndex, FONSglyph* glyph, + float scale, float spacing, float* x, float* y, FONSquad* q) +{ + float rx,ry,xoff,yoff,x0,y0,x1,y1; + + if (prevGlyphIndex != -1) { + float adv = fons__tt_getGlyphKernAdvance(&font->font, prevGlyphIndex, glyph->index) * scale; + *x += (int)(adv + spacing + 0.5f); + } + + // Each glyph has 2px border to allow good interpolation, + // one pixel to prevent leaking, and one to allow good interpolation for rendering. + // Inset the texture region by one pixel for correct interpolation. + xoff = (short)(glyph->xoff+1); + yoff = (short)(glyph->yoff+1); + x0 = (float)(glyph->x0+1); + y0 = (float)(glyph->y0+1); + x1 = (float)(glyph->x1-1); + y1 = (float)(glyph->y1-1); + + if (stash->params.flags & FONS_ZERO_TOPLEFT) { + rx = (float)(int)(*x + xoff); + ry = (float)(int)(*y + yoff); + + q->x0 = rx; + q->y0 = ry; + q->x1 = rx + x1 - x0; + q->y1 = ry + y1 - y0; + + q->s0 = x0 * stash->itw; + q->t0 = y0 * stash->ith; + q->s1 = x1 * stash->itw; + q->t1 = y1 * stash->ith; + } else { + rx = (float)(int)(*x + xoff); + ry = (float)(int)(*y - yoff); + + q->x0 = rx; + q->y0 = ry; + q->x1 = rx + x1 - x0; + q->y1 = ry - y1 + y0; + + q->s0 = x0 * stash->itw; + q->t0 = y0 * stash->ith; + q->s1 = x1 * stash->itw; + q->t1 = y1 * stash->ith; + } + + *x += (int)(glyph->xadv / 10.0f + 0.5f); +} + +static void fons__flush(FONScontext* stash) +{ + // Flush texture + if (stash->dirtyRect[0] < stash->dirtyRect[2] && stash->dirtyRect[1] < stash->dirtyRect[3]) { + if (stash->params.renderUpdate != NULL) + stash->params.renderUpdate(stash->params.userPtr, stash->dirtyRect, stash->texData); + // Reset dirty rect + stash->dirtyRect[0] = stash->params.width; + stash->dirtyRect[1] = stash->params.height; + stash->dirtyRect[2] = 0; + stash->dirtyRect[3] = 0; + } + + // Flush triangles + if (stash->nverts > 0) { + if (stash->params.renderDraw != NULL) + stash->params.renderDraw(stash->params.userPtr, stash->verts, stash->tcoords, stash->colors, stash->nverts); + stash->nverts = 0; + } +} + +static __inline void fons__vertex(FONScontext* stash, float x, float y, float s, float t, unsigned int c) +{ + stash->verts[stash->nverts*2+0] = x; + stash->verts[stash->nverts*2+1] = y; + stash->tcoords[stash->nverts*2+0] = s; + stash->tcoords[stash->nverts*2+1] = t; + stash->colors[stash->nverts] = c; + stash->nverts++; +} + +static float fons__getVertAlign(FONScontext* stash, FONSfont* font, int align, short isize) +{ + if (stash->params.flags & FONS_ZERO_TOPLEFT) { + if (align & FONS_ALIGN_TOP) { + return font->ascender * (float)isize/10.0f; + } else if (align & FONS_ALIGN_MIDDLE) { + return (font->ascender + font->descender) / 2.0f * (float)isize/10.0f; + } else if (align & FONS_ALIGN_BASELINE) { + return 0.0f; + } else if (align & FONS_ALIGN_BOTTOM) { + return font->descender * (float)isize/10.0f; + } + } else { + if (align & FONS_ALIGN_TOP) { + return -font->ascender * (float)isize/10.0f; + } else if (align & FONS_ALIGN_MIDDLE) { + return -(font->ascender + font->descender) / 2.0f * (float)isize/10.0f; + } else if (align & FONS_ALIGN_BASELINE) { + return 0.0f; + } else if (align & FONS_ALIGN_BOTTOM) { + return -font->descender * (float)isize/10.0f; + } + } + return 0.0; +} + +float fonsDrawText(FONScontext* stash, + float x, float y, + const char* str, const char* end) +{ + FONSstate* state = fons__getState(stash); + unsigned int codepoint; + unsigned int utf8state = 0; + FONSglyph* glyph = NULL; + FONSquad q; + int prevGlyphIndex = -1; + short isize = (short)(state->size*10.0f); + short iblur = (short)state->blur; + float scale; + FONSfont* font; + float width; + + if (stash == NULL) return x; + if (state->font < 0 || state->font >= stash->nfonts) return x; + font = stash->fonts[state->font]; + if (font->data == NULL) return x; + + scale = fons__tt_getPixelHeightScale(&font->font, (float)isize/10.0f); + + if (end == NULL) + end = str + strlen(str); + + // Align horizontally + if (state->align & FONS_ALIGN_LEFT) { + // empty + } else if (state->align & FONS_ALIGN_RIGHT) { + width = fonsTextBounds(stash, x,y, str, end, NULL); + x -= width; + } else if (state->align & FONS_ALIGN_CENTER) { + width = fonsTextBounds(stash, x,y, str, end, NULL); + x -= width * 0.5f; + } + // Align vertically. + y += fons__getVertAlign(stash, font, state->align, isize); + + for (; str != end; ++str) { + if (fons__decutf8(&utf8state, &codepoint, *(const unsigned char*)str)) + continue; + glyph = fons__getGlyph(stash, font, codepoint, isize, iblur, FONS_GLYPH_BITMAP_REQUIRED); + if (glyph != NULL) { + fons__getQuad(stash, font, prevGlyphIndex, glyph, scale, state->spacing, &x, &y, &q); + + if (stash->nverts+6 > FONS_VERTEX_COUNT) + fons__flush(stash); + + fons__vertex(stash, q.x0, q.y0, q.s0, q.t0, state->color); + fons__vertex(stash, q.x1, q.y1, q.s1, q.t1, state->color); + fons__vertex(stash, q.x1, q.y0, q.s1, q.t0, state->color); + + fons__vertex(stash, q.x0, q.y0, q.s0, q.t0, state->color); + fons__vertex(stash, q.x0, q.y1, q.s0, q.t1, state->color); + fons__vertex(stash, q.x1, q.y1, q.s1, q.t1, state->color); + } + prevGlyphIndex = glyph != NULL ? glyph->index : -1; + } + fons__flush(stash); + + return x; +} + +int fonsTextIterInit(FONScontext* stash, FONStextIter* iter, + float x, float y, const char* str, const char* end, int bitmapOption) +{ + FONSstate* state = fons__getState(stash); + float width; + + memset(iter, 0, sizeof(*iter)); + + if (stash == NULL) return 0; + if (state->font < 0 || state->font >= stash->nfonts) return 0; + iter->font = stash->fonts[state->font]; + if (iter->font->data == NULL) return 0; + + iter->isize = (short)(state->size*10.0f); + iter->iblur = (short)state->blur; + iter->scale = fons__tt_getPixelHeightScale(&iter->font->font, (float)iter->isize/10.0f); + + // Align horizontally + if (state->align & FONS_ALIGN_LEFT) { + // empty + } else if (state->align & FONS_ALIGN_RIGHT) { + width = fonsTextBounds(stash, x,y, str, end, NULL); + x -= width; + } else if (state->align & FONS_ALIGN_CENTER) { + width = fonsTextBounds(stash, x,y, str, end, NULL); + x -= width * 0.5f; + } + // Align vertically. + y += fons__getVertAlign(stash, iter->font, state->align, iter->isize); + + if (end == NULL) + end = str + strlen(str); + + iter->x = iter->nextx = x; + iter->y = iter->nexty = y; + iter->spacing = state->spacing; + iter->str = str; + iter->next = str; + iter->end = end; + iter->codepoint = 0; + iter->prevGlyphIndex = -1; + iter->bitmapOption = bitmapOption; + + return 1; +} + +int fonsTextIterNext(FONScontext* stash, FONStextIter* iter, FONSquad* quad) +{ + FONSglyph* glyph = NULL; + const char* str = iter->next; + iter->str = iter->next; + + if (str == iter->end) + return 0; + + for (; str != iter->end; str++) { + if (fons__decutf8(&iter->utf8state, &iter->codepoint, *(const unsigned char*)str)) + continue; + str++; + // Get glyph and quad + iter->x = iter->nextx; + iter->y = iter->nexty; + glyph = fons__getGlyph(stash, iter->font, iter->codepoint, iter->isize, iter->iblur, iter->bitmapOption); + // If the iterator was initialized with FONS_GLYPH_BITMAP_OPTIONAL, then the UV coordinates of the quad will be invalid. + if (glyph != NULL) + fons__getQuad(stash, iter->font, iter->prevGlyphIndex, glyph, iter->scale, iter->spacing, &iter->nextx, &iter->nexty, quad); + iter->prevGlyphIndex = glyph != NULL ? glyph->index : -1; + break; + } + iter->next = str; + + return 1; +} + +void fonsDrawDebug(FONScontext* stash, float x, float y) +{ + int i; + int w = stash->params.width; + int h = stash->params.height; + float u = w == 0 ? 0 : (1.0f / w); + float v = h == 0 ? 0 : (1.0f / h); + + if (stash->nverts+6+6 > FONS_VERTEX_COUNT) + fons__flush(stash); + + // Draw background + fons__vertex(stash, x+0, y+0, u, v, 0x0fffffff); + fons__vertex(stash, x+w, y+h, u, v, 0x0fffffff); + fons__vertex(stash, x+w, y+0, u, v, 0x0fffffff); + + fons__vertex(stash, x+0, y+0, u, v, 0x0fffffff); + fons__vertex(stash, x+0, y+h, u, v, 0x0fffffff); + fons__vertex(stash, x+w, y+h, u, v, 0x0fffffff); + + // Draw texture + fons__vertex(stash, x+0, y+0, 0, 0, 0xffffffff); + fons__vertex(stash, x+w, y+h, 1, 1, 0xffffffff); + fons__vertex(stash, x+w, y+0, 1, 0, 0xffffffff); + + fons__vertex(stash, x+0, y+0, 0, 0, 0xffffffff); + fons__vertex(stash, x+0, y+h, 0, 1, 0xffffffff); + fons__vertex(stash, x+w, y+h, 1, 1, 0xffffffff); + + // Drawbug draw atlas + for (i = 0; i < stash->atlas->nnodes; i++) { + FONSatlasNode* n = &stash->atlas->nodes[i]; + + if (stash->nverts+6 > FONS_VERTEX_COUNT) + fons__flush(stash); + + fons__vertex(stash, x+n->x+0, y+n->y+0, u, v, 0xc00000ff); + fons__vertex(stash, x+n->x+n->width, y+n->y+1, u, v, 0xc00000ff); + fons__vertex(stash, x+n->x+n->width, y+n->y+0, u, v, 0xc00000ff); + + fons__vertex(stash, x+n->x+0, y+n->y+0, u, v, 0xc00000ff); + fons__vertex(stash, x+n->x+0, y+n->y+1, u, v, 0xc00000ff); + fons__vertex(stash, x+n->x+n->width, y+n->y+1, u, v, 0xc00000ff); + } + + fons__flush(stash); +} + +float fonsTextBounds(FONScontext* stash, + float x, float y, + const char* str, const char* end, + float* bounds) +{ + FONSstate* state = fons__getState(stash); + unsigned int codepoint; + unsigned int utf8state = 0; + FONSquad q; + FONSglyph* glyph = NULL; + int prevGlyphIndex = -1; + short isize = (short)(state->size*10.0f); + short iblur = (short)state->blur; + float scale; + FONSfont* font; + float startx, advance; + float minx, miny, maxx, maxy; + + if (stash == NULL) return 0; + if (state->font < 0 || state->font >= stash->nfonts) return 0; + font = stash->fonts[state->font]; + if (font->data == NULL) return 0; + + scale = fons__tt_getPixelHeightScale(&font->font, (float)isize/10.0f); + + // Align vertically. + y += fons__getVertAlign(stash, font, state->align, isize); + + minx = maxx = x; + miny = maxy = y; + startx = x; + + if (end == NULL) + end = str + strlen(str); + + for (; str != end; ++str) { + if (fons__decutf8(&utf8state, &codepoint, *(const unsigned char*)str)) + continue; + glyph = fons__getGlyph(stash, font, codepoint, isize, iblur, FONS_GLYPH_BITMAP_OPTIONAL); + if (glyph != NULL) { + fons__getQuad(stash, font, prevGlyphIndex, glyph, scale, state->spacing, &x, &y, &q); + if (q.x0 < minx) minx = q.x0; + if (q.x1 > maxx) maxx = q.x1; + if (stash->params.flags & FONS_ZERO_TOPLEFT) { + if (q.y0 < miny) miny = q.y0; + if (q.y1 > maxy) maxy = q.y1; + } else { + if (q.y1 < miny) miny = q.y1; + if (q.y0 > maxy) maxy = q.y0; + } + } + prevGlyphIndex = glyph != NULL ? glyph->index : -1; + } + + advance = x - startx; + + // Align horizontally + if (state->align & FONS_ALIGN_LEFT) { + // empty + } else if (state->align & FONS_ALIGN_RIGHT) { + minx -= advance; + maxx -= advance; + } else if (state->align & FONS_ALIGN_CENTER) { + minx -= advance * 0.5f; + maxx -= advance * 0.5f; + } + + if (bounds) { + bounds[0] = minx; + bounds[1] = miny; + bounds[2] = maxx; + bounds[3] = maxy; + } + + return advance; +} + +void fonsVertMetrics(FONScontext* stash, + float* ascender, float* descender, float* lineh) +{ + FONSfont* font; + FONSstate* state = fons__getState(stash); + short isize; + + if (stash == NULL) return; + if (state->font < 0 || state->font >= stash->nfonts) return; + font = stash->fonts[state->font]; + isize = (short)(state->size*10.0f); + if (font->data == NULL) return; + + if (ascender) + *ascender = font->ascender*isize/10.0f; + if (descender) + *descender = font->descender*isize/10.0f; + if (lineh) + *lineh = font->lineh*isize/10.0f; +} + +void fonsLineBounds(FONScontext* stash, float y, float* miny, float* maxy) +{ + FONSfont* font; + FONSstate* state = fons__getState(stash); + short isize; + + if (stash == NULL) return; + if (state->font < 0 || state->font >= stash->nfonts) return; + font = stash->fonts[state->font]; + isize = (short)(state->size*10.0f); + if (font->data == NULL) return; + + y += fons__getVertAlign(stash, font, state->align, isize); + + if (stash->params.flags & FONS_ZERO_TOPLEFT) { + *miny = y - font->ascender * (float)isize/10.0f; + *maxy = *miny + font->lineh*isize/10.0f; + } else { + *maxy = y + font->descender * (float)isize/10.0f; + *miny = *maxy - font->lineh*isize/10.0f; + } +} + +const unsigned char* fonsGetTextureData(FONScontext* stash, int* width, int* height) +{ + if (width != NULL) + *width = stash->params.width; + if (height != NULL) + *height = stash->params.height; + return stash->texData; +} + +int fonsValidateTexture(FONScontext* stash, int* dirty) +{ + if (stash->dirtyRect[0] < stash->dirtyRect[2] && stash->dirtyRect[1] < stash->dirtyRect[3]) { + dirty[0] = stash->dirtyRect[0]; + dirty[1] = stash->dirtyRect[1]; + dirty[2] = stash->dirtyRect[2]; + dirty[3] = stash->dirtyRect[3]; + // Reset dirty rect + stash->dirtyRect[0] = stash->params.width; + stash->dirtyRect[1] = stash->params.height; + stash->dirtyRect[2] = 0; + stash->dirtyRect[3] = 0; + return 1; + } + return 0; +} + +void fonsDeleteInternal(FONScontext* stash) +{ + int i; + if (stash == NULL) return; + + if (stash->params.renderDelete) + stash->params.renderDelete(stash->params.userPtr); + + for (i = 0; i < stash->nfonts; ++i) + fons__freeFont(stash->fonts[i]); + + if (stash->atlas) fons__deleteAtlas(stash->atlas); + if (stash->fonts) free(stash->fonts); + if (stash->texData) free(stash->texData); + if (stash->scratch) free(stash->scratch); + free(stash); +} + +void fonsSetErrorCallback(FONScontext* stash, void (*callback)(void* uptr, int error, int val), void* uptr) +{ + if (stash == NULL) return; + stash->handleError = callback; + stash->errorUptr = uptr; +} + +void fonsGetAtlasSize(FONScontext* stash, int* width, int* height) +{ + if (stash == NULL) return; + *width = stash->params.width; + *height = stash->params.height; +} + +int fonsExpandAtlas(FONScontext* stash, int width, int height) +{ + int i, maxy = 0; + unsigned char* data = NULL; + if (stash == NULL) return 0; + + width = fons__maxi(width, stash->params.width); + height = fons__maxi(height, stash->params.height); + + if (width == stash->params.width && height == stash->params.height) + return 1; + + // Flush pending glyphs. + fons__flush(stash); + + // Create new texture + if (stash->params.renderResize != NULL) { + if (stash->params.renderResize(stash->params.userPtr, width, height) == 0) + return 0; + } + // Copy old texture data over. + data = (unsigned char*)malloc(width * height); + if (data == NULL) + return 0; + for (i = 0; i < stash->params.height; i++) { + unsigned char* dst = &data[i*width]; + unsigned char* src = &stash->texData[i*stash->params.width]; + memcpy(dst, src, stash->params.width); + if (width > stash->params.width) + memset(dst+stash->params.width, 0, width - stash->params.width); + } + if (height > stash->params.height) + memset(&data[stash->params.height * width], 0, (height - stash->params.height) * width); + + free(stash->texData); + stash->texData = data; + + // Increase atlas size + fons__atlasExpand(stash->atlas, width, height); + + // Add existing data as dirty. + for (i = 0; i < stash->atlas->nnodes; i++) + maxy = fons__maxi(maxy, stash->atlas->nodes[i].y); + stash->dirtyRect[0] = 0; + stash->dirtyRect[1] = 0; + stash->dirtyRect[2] = stash->params.width; + stash->dirtyRect[3] = maxy; + + stash->params.width = width; + stash->params.height = height; + stash->itw = 1.0f/stash->params.width; + stash->ith = 1.0f/stash->params.height; + + return 1; +} + +int fonsResetAtlas(FONScontext* stash, int width, int height) +{ + int i, j; + if (stash == NULL) return 0; + + // Flush pending glyphs. + fons__flush(stash); + + // Create new texture + if (stash->params.renderResize != NULL) { + if (stash->params.renderResize(stash->params.userPtr, width, height) == 0) + return 0; + } + + // Reset atlas + fons__atlasReset(stash->atlas, width, height); + + // Clear texture data. + stash->texData = (unsigned char*)realloc(stash->texData, width * height); + if (stash->texData == NULL) return 0; + memset(stash->texData, 0, width * height); + + // Reset dirty rect + stash->dirtyRect[0] = width; + stash->dirtyRect[1] = height; + stash->dirtyRect[2] = 0; + stash->dirtyRect[3] = 0; + + // Reset cached glyphs + for (i = 0; i < stash->nfonts; i++) { + FONSfont* font = stash->fonts[i]; + font->nglyphs = 0; + for (j = 0; j < FONS_HASH_LUT_SIZE; j++) + font->lut[j] = -1; + } + + stash->params.width = width; + stash->params.height = height; + stash->itw = 1.0f/stash->params.width; + stash->ith = 1.0f/stash->params.height; + + // Add white rect at 0,0 for debug drawing. + fons__addWhiteRect(stash, 2,2); + + return 1; +} + + +#endif diff --git a/3rd/nanovg/bgfx/fs_nanovg_fill.bin.h b/3rd/nanovg/bgfx/fs_nanovg_fill.bin.h new file mode 100644 index 000000000..5900a7054 --- /dev/null +++ b/3rd/nanovg/bgfx/fs_nanovg_fill.bin.h @@ -0,0 +1,1028 @@ +static const uint8_t fs_nanovg_fill_glsl[2928] = +{ + 0x46, 0x53, 0x48, 0x05, 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_ + 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, // paintMat.......u + 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, // _innerCol....... + 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // u_outerCol...... + 0x11, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, // .u_scissorExtSca + 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, 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_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // texcoord0;.unifo + 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x33, 0x20, 0x75, 0x5f, // rm highp mat3 u_ + 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // scissorMat;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x33, 0x20, 0x75, // orm highp mat3 u + 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // _paintMat;.unifo + 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, // rm highp vec4 u_ + 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, // innerCol;.unifor + 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x6f, // m highp vec4 u_o + 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // uterCol;.uniform + 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x73, 0x63, // highp vec4 u_sc + 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x3b, 0x0a, 0x75, // issorExtScale;.u + 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // niform highp vec + 0x34, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, // 4 u_extentRadius + 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ;.uniform highp + 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, // vec4 u_params;.u + 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // niform sampler2D + 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, // s_tex;.void mai + 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, // n ().{. lowp ve + 0x63, 0x34, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x68, // c4 result_1;. h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ighp float tmpva + 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // r_2;. highp vec + 0x32, 0x20, 0x73, 0x63, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // 2 sc_3;. highp + 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec3 tmpvar_4;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, // tmpvar_4.z = 1. + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, // 0;. tmpvar_4.xy + 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, // = v_position;. + 0x20, 0x73, 0x63, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, // sc_3 = (vec2(0. + 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, // 5, 0.5) - ((. + 0x20, 0x61, 0x62, 0x73, 0x28, 0x28, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, // abs((u_scissorM + 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x2e, 0x78, // at * tmpvar_4).x + 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, // y). - u_scisso + 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2a, 0x20, // rExtScale.xy) * + 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, // u_scissorExtScal + 0x65, 0x2e, 0x7a, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // e.zw));. tmpvar + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x73, 0x63, 0x5f, // _2 = (clamp (sc_ + 0x33, 0x2e, 0x78, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, // 3.x, 0.0, 1.0) * + 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x73, 0x63, 0x5f, 0x33, 0x2e, 0x79, 0x2c, 0x20, // clamp (sc_3.y, + 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, // 0.0, 1.0));. hi + 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ghp float tmpvar + 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, // _5;. tmpvar_5 = + 0x20, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x28, 0x0a, 0x20, 0x20, // (min (1.0, (. + 0x20, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x61, 0x62, 0x73, 0x28, 0x28, 0x28, 0x76, // (1.0 - abs(((v + 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x32, // _texcoord0.x * 2 + 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, // .0) - 1.0))). + 0x2a, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x29, 0x29, 0x20, 0x2a, // * u_params.y)) * + 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, // min (1.0, v_tex + 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, 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, 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, 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_spv[5804] = +{ + 0x46, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x07, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par + 0x61, 0x6d, 0x73, 0x12, 0x01, 0xa0, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, // ams.......u_pain + 0x74, 0x4d, 0x61, 0x74, 0x13, 0x01, 0x30, 0x00, 0x03, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, // tMat..0....u_ext + 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x12, 0x01, 0x90, 0x00, 0x01, 0x00, 0x0a, // entRadius....... + 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x60, 0x00, 0x01, 0x00, // u_innerCol..`... + 0x0a, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x70, 0x00, 0x01, // .u_outerCol..p.. + 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x13, 0x01, // ..u_scissorMat.. + 0x00, 0x00, 0x03, 0x00, 0x11, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, // .....u_scissorEx + 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x01, 0x80, 0x00, 0x01, 0x00, 0x18, 0x16, 0x00, 0x00, // tScale.......... + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xa8, 0x02, 0x00, 0x00, // ..#............. + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, // ....GLSL.std.450 + 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, 0x66, 0x01, 0x00, 0x00, 0x71, 0x01, 0x00, 0x00, // ....c...f...q... + 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, // ................ + 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, // main............ + 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, // BgfxSampler2D... + 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, // ............m_sa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, // mpler........... + 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, // ....m_texture... + 0x05, 0x00, 0x04, 0x00, 0x33, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x00, 0x00, // ....3...s_tex... + 0x05, 0x00, 0x06, 0x00, 0x35, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, // ....5...s_texSam + 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x38, 0x00, 0x00, 0x00, // pler........8... + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, // s_texTexture.... + 0x05, 0x00, 0x04, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ....}...$Global. + 0x06, 0x00, 0x07, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x63, // ....}.......u_sc + 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // issorMat........ + 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // }.......u_paintM + 0x61, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // at......}....... + 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // u_innerCol...... + 0x7d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, // }.......u_outerC + 0x6f, 0x6c, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ol......}....... + 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, // u_scissorExtScal + 0x65, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // e.......}....... + 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x00, // u_extentRadius.. + 0x06, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, // ....}.......u_pa + 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x00, 0x00, // rams............ + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x63, 0x01, 0x00, 0x00, 0x76, 0x5f, 0x70, 0x6f, // ........c...v_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x66, 0x01, 0x00, 0x00, // sition......f... + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, // v_texcoord0..... + 0x71, 0x01, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // q...bgfx_FragDat + 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // a0..G...8..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...8...!... + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...}....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...}....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, // #.......H...}... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... + 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // }...........H... + 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // }.......#...0... + 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...}........... + 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....H...}....... + 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, // #...`...H...}... + 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...p...H... + 0x7d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // }.......#....... + 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...}.......#... + 0x90, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ....H...}....... + 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x7d, 0x00, 0x00, 0x00, // #.......G...}... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G......."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x63, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...c....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x66, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...f....... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...q....... + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, // ........ ....... + 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ + 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...2........... + 0x3b, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ;...2...3....... + 0x20, 0x00, 0x04, 0x00, 0x34, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...4........... + 0x3b, 0x00, 0x04, 0x00, 0x34, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ;...4...5....... + 0x20, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ...7........... + 0x3b, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ;...7...8....... + 0x15, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....;... ....... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // +...;...<....... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +...;...@....... + 0x1b, 0x00, 0x03, 0x00, 0x44, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ....D........... + 0x62, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // b... .......+... + 0x62, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // b...c.......+... + 0x62, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // b...f.......+... + 0x07, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, // ....j.......,... + 0x0b, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, // ....m...j...j... + 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, // +.......w......? + 0x17, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....x........... + 0x18, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....|...x....... + 0x1e, 0x00, 0x09, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, // ....}...|...|... + 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...~....... + 0x7d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // }...;...~....... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... + 0x7c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, // |...+...;....... + 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x87, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... + 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, // ....+........... + 0x00, 0x00, 0x00, 0x3f, 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, // ...?,........... + 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........+....... + 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // .......@+...;... + 0xa4, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........ ....... + 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00, // ........+...b... + 0xbb, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, 0x00, 0xbe, 0x00, 0x00, 0x00, // ................ + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // +...;........... + 0x2b, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +...b........... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +...;........... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // +...;........... + 0x2c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ,.......4...w... + 0x77, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // w...w...w...+... + 0x07, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x00, 0x04, 0x00, // ....8.....@@ ... + 0x62, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // b...........;... + 0x62, 0x01, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // b...c.......;... + 0x62, 0x01, 0x00, 0x00, 0x66, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // b...f....... ... + 0x70, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // p...........;... + 0x70, 0x01, 0x00, 0x00, 0x71, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, // p...q........... + 0x0d, 0x00, 0x00, 0x00, 0xa7, 0x02, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, // ........6....... + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // ................ + 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, // ....=.......6... + 0x35, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, // 5...=.......9... + 0x38, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, // 8...P.......:... + 0x36, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x00, // 6...9...>...3... + 0x3a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, // :...=.......d... + 0x63, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, // c...=.......g... + 0x66, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, // f...Q.......7... + 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // d.......Q....... + 0x38, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, // 8...d.......P... + 0x78, 0x00, 0x00, 0x00, 0x39, 0x02, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, // x...9...7...8... + 0x77, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x3a, 0x02, 0x00, 0x00, // w...A.......:... + 0x7f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, // ....@...=...|... + 0x3b, 0x02, 0x00, 0x00, 0x3a, 0x02, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, // ;...:.......x... + 0x3c, 0x02, 0x00, 0x00, 0x39, 0x02, 0x00, 0x00, 0x3b, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, // <...9...;...O... + 0x0b, 0x00, 0x00, 0x00, 0x3d, 0x02, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, // ....=...<...<... + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x3e, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3d, 0x02, 0x00, 0x00, // >...........=... + 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0x3f, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A.......?....... + 0x86, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, // ....=.......@... + 0x3f, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x41, 0x02, 0x00, 0x00, // ?...O.......A... + 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // @...@........... + 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x42, 0x02, 0x00, 0x00, 0x3e, 0x02, 0x00, 0x00, // ........B...>... + 0x41, 0x02, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, // A...A.......D... + 0x7f, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... + 0x45, 0x02, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, // E...D...O....... + 0x46, 0x02, 0x00, 0x00, 0x45, 0x02, 0x00, 0x00, 0x45, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // F...E...E....... + 0x03, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x47, 0x02, 0x00, 0x00, // ............G... + 0x42, 0x02, 0x00, 0x00, 0x46, 0x02, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // B...F........... + 0x48, 0x02, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x47, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // H.......G...Q... + 0x07, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....J...H....... + 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........K....... + 0x2b, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // +...J...j...w... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4d, 0x02, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, // Q.......M...H... + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4e, 0x02, 0x00, 0x00, // ............N... + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x4d, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, // ....+...M...j... + 0x77, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4f, 0x02, 0x00, 0x00, // w...........O... + 0x4b, 0x02, 0x00, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // K...N...Q....... + 0x52, 0x02, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // R...g........... + 0x07, 0x00, 0x00, 0x00, 0x53, 0x02, 0x00, 0x00, 0x52, 0x02, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // ....S...R....... + 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x53, 0x02, 0x00, 0x00, // ........T...S... + 0x77, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x55, 0x02, 0x00, 0x00, // w...........U... + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // ........T....... + 0x07, 0x00, 0x00, 0x00, 0x56, 0x02, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x55, 0x02, 0x00, 0x00, // ....V...w...U... + 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x57, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A.......W....... + 0xa4, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ....f...=....... + 0x58, 0x02, 0x00, 0x00, 0x57, 0x02, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // X...W........... + 0x59, 0x02, 0x00, 0x00, 0x56, 0x02, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // Y...V...X....... + 0x07, 0x00, 0x00, 0x00, 0x5a, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // ....Z.......%... + 0x77, 0x00, 0x00, 0x00, 0x59, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // w...Y...Q....... + 0x5c, 0x02, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // ....g........... + 0x07, 0x00, 0x00, 0x00, 0x5d, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // ....].......%... + 0x77, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // w............... + 0x5e, 0x02, 0x00, 0x00, 0x5a, 0x02, 0x00, 0x00, 0x5d, 0x02, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, // ^...Z...]...A... + 0xa5, 0x00, 0x00, 0x00, 0xa1, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, // ................ + 0xbb, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa2, 0x01, 0x00, 0x00, // ....=........... + 0xa1, 0x01, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xa3, 0x01, 0x00, 0x00, // ................ + 0xa2, 0x01, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xa4, 0x01, 0x00, 0x00, // ....j........... + 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xa3, 0x01, 0x00, 0x00, 0xa5, 0x01, 0x00, 0x00, // ................ + 0xa6, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa5, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x07, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........d....... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa9, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, // Q...........d... + 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00, 0x00, 0xaa, 0x01, 0x00, 0x00, // ....P...x....... + 0xa8, 0x01, 0x00, 0x00, 0xa9, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ........w...A... + 0x80, 0x00, 0x00, 0x00, 0xab, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ............<... + 0x3d, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xac, 0x01, 0x00, 0x00, 0xab, 0x01, 0x00, 0x00, // =...|........... + 0x90, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0xad, 0x01, 0x00, 0x00, 0xaa, 0x01, 0x00, 0x00, // ....x........... + 0xac, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xae, 0x01, 0x00, 0x00, // ....O........... + 0xad, 0x01, 0x00, 0x00, 0xad, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xcc, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb1, 0x01, 0x00, 0x00, // ....=........... + 0xb0, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb2, 0x01, 0x00, 0x00, // ....O........... + 0xb1, 0x01, 0x00, 0x00, 0xb1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, 0xb3, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xcc, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........=....... + 0xb4, 0x01, 0x00, 0x00, 0xb3, 0x01, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // ........P....... + 0x65, 0x02, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // e............... + 0x0b, 0x00, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x65, 0x02, 0x00, 0x00, // ....f.......e... + 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x68, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........h....... + 0x04, 0x00, 0x00, 0x00, 0xae, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x6a, 0x02, 0x00, 0x00, 0x68, 0x02, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // j...h...f...Q... + 0x07, 0x00, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x6a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....l...j....... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6e, 0x02, 0x00, 0x00, 0x6a, 0x02, 0x00, 0x00, // Q.......n...j... + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6f, 0x02, 0x00, 0x00, // ............o... + 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x6e, 0x02, 0x00, 0x00, // ....(...l...n... + 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........p....... + 0x25, 0x00, 0x00, 0x00, 0x6f, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // %...o...j....... + 0x0b, 0x00, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, // ....r.......(... + 0x6a, 0x02, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, // j...m........... + 0x73, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, // s.......B...r... + 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, // ........t...p... + 0x73, 0x02, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x76, 0x02, 0x00, 0x00, // s...........v... + 0x74, 0x02, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // t.......A....... + 0xb6, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, // ............c... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb7, 0x01, 0x00, 0x00, 0xb6, 0x01, 0x00, 0x00, // =............... + 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0xb7, 0x01, 0x00, 0x00, // ................ + 0x8c, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, // ................ + 0x76, 0x02, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // v.......A....... + 0xba, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, // ............c... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbb, 0x01, 0x00, 0x00, 0xba, 0x01, 0x00, 0x00, // =............... + 0x88, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, // ................ + 0xbb, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, // ....+.......j... + 0x77, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbf, 0x01, 0x00, 0x00, // w...P........... + 0xbd, 0x01, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, // ................ + 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xe1, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc1, 0x01, 0x00, 0x00, // ....=........... + 0xc0, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xc2, 0x01, 0x00, 0x00, // ....A........... + 0x7f, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... + 0xc3, 0x01, 0x00, 0x00, 0xc2, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x7b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0xc1, 0x01, 0x00, 0x00, // {............... + 0xc3, 0x01, 0x00, 0x00, 0xbf, 0x01, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0xc7, 0x01, 0x00, 0x00, 0x5e, 0x02, 0x00, 0x00, 0x4f, 0x02, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ....^...O....... + 0x0d, 0x00, 0x00, 0x00, 0xc9, 0x01, 0x00, 0x00, 0x7b, 0x02, 0x00, 0x00, 0xc7, 0x01, 0x00, 0x00, // ........{....... + 0xf9, 0x00, 0x02, 0x00, 0xa4, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa6, 0x01, 0x00, 0x00, // ................ + 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, 0xcb, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........=....... + 0xcc, 0x01, 0x00, 0x00, 0xcb, 0x01, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, // ................ + 0xcd, 0x01, 0x00, 0x00, 0xcc, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, // ........w....... + 0xce, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xcd, 0x01, 0x00, 0x00, // ................ + 0xcf, 0x01, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xcf, 0x01, 0x00, 0x00, // ................ + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, // Q...........d... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd3, 0x01, 0x00, 0x00, // ....Q........... + 0x64, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00, 0x00, // d.......P...x... + 0xd4, 0x01, 0x00, 0x00, 0xd2, 0x01, 0x00, 0x00, 0xd3, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ............w... + 0x41, 0x00, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0xd5, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xd6, 0x01, 0x00, 0x00, // <...=...|....... + 0xd5, 0x01, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, // ........x....... + 0xd4, 0x01, 0x00, 0x00, 0xd6, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, // ........O....... + 0xd8, 0x01, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xd9, 0x01, 0x00, 0x00, // ....A........... + 0x7f, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... + 0xda, 0x01, 0x00, 0x00, 0xd9, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, // ........O....... + 0xdb, 0x01, 0x00, 0x00, 0xda, 0x01, 0x00, 0x00, 0xda, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, // ................ + 0xd8, 0x01, 0x00, 0x00, 0xdb, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ........=....... + 0xdd, 0x01, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // ....3...Q....... + 0x8e, 0x02, 0x00, 0x00, 0xdd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x08, 0x00, 0x00, 0x00, 0x8f, 0x02, 0x00, 0x00, 0xdd, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x56, 0x00, 0x05, 0x00, 0x44, 0x00, 0x00, 0x00, 0x81, 0x02, 0x00, 0x00, 0x8f, 0x02, 0x00, 0x00, // V...D........... + 0x8e, 0x02, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, // ....W........... + 0x81, 0x02, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0xe0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe1, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xe2, 0x01, 0x00, 0x00, 0xe1, 0x01, 0x00, 0x00, // ................ + 0x77, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // w............... + 0xfa, 0x00, 0x04, 0x00, 0xe2, 0x01, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00, 0xe3, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xe4, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x78, 0x00, 0x00, 0x00, // ........O...x... + 0xe6, 0x01, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0xe8, 0x01, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ................ + 0x78, 0x00, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00, // x............... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, // Q............... + 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, // ....Q........... + 0xe9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0xed, 0x01, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x07, 0x00, 0x00, 0x00, 0xee, 0x01, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, // P............... + 0xed, 0x01, 0x00, 0x00, 0xee, 0x01, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0xe3, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xe3, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0xcf, 0x01, 0x00, 0x00, // ................ + 0xef, 0x01, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0xf0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, // ................ + 0x9f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xfa, 0x00, 0x04, 0x00, 0xf2, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........O....... + 0xf6, 0x01, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0xf3, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf3, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xa2, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0xe3, 0x01, 0x00, 0x00, // ................ + 0xf6, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, // ........A....... + 0xf7, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x0d, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf7, 0x01, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xfa, 0x01, 0x00, 0x00, 0xa2, 0x02, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, // ................ + 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0x5e, 0x02, 0x00, 0x00, // ............^... + 0x4f, 0x02, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, // O............... + 0xfa, 0x01, 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xce, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xd0, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0x01, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, // ................ + 0x9f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xfa, 0x00, 0x04, 0x00, 0x03, 0x02, 0x00, 0x00, 0x05, 0x02, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x05, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x04, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x06, 0x02, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0x07, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x09, 0x02, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, // ................ + 0x38, 0x01, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 8............... + 0xfa, 0x00, 0x04, 0x00, 0x09, 0x02, 0x00, 0x00, 0x0b, 0x02, 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x0b, 0x02, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ........=....... + 0x0c, 0x02, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // ....3...Q....... + 0x92, 0x02, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x08, 0x00, 0x00, 0x00, 0x93, 0x02, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x56, 0x00, 0x05, 0x00, 0x44, 0x00, 0x00, 0x00, 0x89, 0x02, 0x00, 0x00, 0x93, 0x02, 0x00, 0x00, // V...D........... + 0x92, 0x02, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, // ....W........... + 0x89, 0x02, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ....g...A....... + 0x0f, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x0f, 0x02, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, // ................ + 0x77, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // w............... + 0xfa, 0x00, 0x04, 0x00, 0x11, 0x02, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x13, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x78, 0x00, 0x00, 0x00, // ........O...x... + 0x15, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0x17, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ................ + 0x78, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x15, 0x02, 0x00, 0x00, 0x17, 0x02, 0x00, 0x00, // x............... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, // Q............... + 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00, // ....Q........... + 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0x1c, 0x02, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x07, 0x00, 0x00, 0x00, 0x1d, 0x02, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1e, 0x02, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00, // P............... + 0x1c, 0x02, 0x00, 0x00, 0x1d, 0x02, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0x12, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x12, 0x02, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x0b, 0x02, 0x00, 0x00, // ................ + 0x1e, 0x02, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0x1f, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x1f, 0x02, 0x00, 0x00, // =....... ....... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, // ........!... ... + 0x9f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x22, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........"....... + 0xfa, 0x00, 0x04, 0x00, 0x21, 0x02, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, // ....!...#..."... + 0xf8, 0x00, 0x02, 0x00, 0x23, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, // ....#...O....... + 0x25, 0x02, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // %............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0x22, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x22, 0x02, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // "......."....... + 0x0d, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, // ................ + 0x25, 0x02, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // %...#........... + 0x28, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x4f, 0x02, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // (.......O...A... + 0x87, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // ....*........... + 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x02, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, // =.......+...*... + 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, // ........,...(... + 0x2b, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x0a, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // +............... + 0x0a, 0x02, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa6, 0x02, 0x00, 0x00, // ................ + 0xa7, 0x02, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, // ........,..."... + 0xf9, 0x00, 0x02, 0x00, 0x04, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x04, 0x02, 0x00, 0x00, // ................ + 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa5, 0x02, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, // ............4... + 0x05, 0x02, 0x00, 0x00, 0xa6, 0x02, 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0xce, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xce, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, // ................ + 0xa5, 0x02, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xa4, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xa4, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0xa3, 0x02, 0x00, 0x00, 0xc9, 0x01, 0x00, 0x00, 0xa5, 0x01, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00, // ................ + 0xce, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x71, 0x01, 0x00, 0x00, 0xa3, 0x02, 0x00, 0x00, // ....>...q....... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb0, 0x00, // ....8....... +}; +static const uint8_t fs_nanovg_fill_dx9[1585] = +{ + 0x46, 0x53, 0x48, 0x05, 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 + 0x61, 0x64, 0x69, 0x75, 0x73, 0x12, 0x01, 0x09, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x69, 0x6e, // adius.......u_in + 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x06, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x6f, // nerCol.......u_o + 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x07, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, // uterCol.......u_ + 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x13, 0x01, 0x03, 0x00, 0x03, 0x00, 0x08, 0x75, // paintMat.......u + 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, 0x94, 0x05, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, // at.............. + 0xfe, 0xff, 0x61, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, // ..a.CTAB....W... + 0x00, 0x03, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ + 0x50, 0x01, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, // P............... + 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, // ................ + 0x02, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ + 0x18, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, // ........(....... + 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x01, 0x00, 0x00, // ............1... + 0x02, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x43, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, // C............... + 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0xab, 0xab, 0x04, 0x00, 0x0c, 0x00, // ....s_tex....... + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x65, 0x78, // ............u_ex + 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, // tentRadius...... + 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in + 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x00, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, // nerCol.u_outerCo + 0x6c, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x00, 0xab, 0xab, 0xab, // l.u_paintMat.... + 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, // u_params.u_sciss + 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x00, 0x75, 0x5f, 0x73, 0x63, 0x69, // orExtScale.u_sci + 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, // ssorMat.ps_3_0.M + 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, // icrosoft (R) HLS + 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, // L Shader Compile + 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x0f, 0xa0, // r 10.1..Q....... + 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, // ...?...@.......? + 0x51, 0x00, 0x00, 0x05, 0x0c, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, // Q.............@@ + 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, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x03, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, // ..........U..... + 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 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, // ..........U..... + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x01, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x55, 0xa0, // ..............U. + 0x0b, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x8c, // ..............U. + 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, // ..............U. + 0x0a, 0x00, 0x55, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0x55, 0x80, // ..U...........U. + 0x0b, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x90, // ..............U. + 0x0b, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, // ..............U. + 0x01, 0x00, 0xaa, 0x80, 0x23, 0x00, 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, // ..............U. + 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 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, 0x00, 0x03, 0x02, 0x00, 0x0c, 0x80, 0x02, 0x00, 0xe4, 0x81, // ..D............. + 0x02, 0x00, 0x44, 0x8b, 0x0b, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x80, 0x02, 0x00, 0xee, 0x80, // ..D............. + 0x0c, 0x00, 0x00, 0xa0, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80, 0x03, 0x00, 0xe4, 0x80, // ....Z........... + 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, // ..............U. + 0x06, 0x00, 0x00, 0x02, 0x03, 0x00, 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, // ......U......... + 0x02, 0x00, 0xd4, 0x80, 0x03, 0x00, 0xd4, 0x80, 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, // ........B....... + 0x01, 0x00, 0xe8, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0d, 0x80, // ................ + 0x01, 0x00, 0x77, 0x81, 0x0a, 0x00, 0xa7, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x07, 0x80, // ..w............. + 0x02, 0x00, 0xff, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80, // ........X....... + 0x01, 0x00, 0xaa, 0x8c, 0x03, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, // ............X... + 0x02, 0x00, 0x0e, 0x80, 0x01, 0x00, 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, // ..........U..... + 0x29, 0x00, 0x02, 0x02, 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, // ).........U..... + 0x03, 0x00, 0x0f, 0x80, 0x0b, 0x00, 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, // ......U.)....... + 0x01, 0x00, 0x55, 0x80, 0x42, 0x00, 0x00, 0x03, 0x04, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, // ..U.B........... + 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x05, 0x00, 0x07, 0x80, 0x04, 0x00, 0xff, 0x80, // ................ + 0x04, 0x00, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, 0x01, 0x00, 0xaa, 0x8c, // ....X........... + 0x05, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0e, 0x80, // ........X....... + 0x01, 0x00, 0xff, 0x8c, 0x04, 0x00, 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, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x8c, // +...X........... + 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, 0xe4, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x08, 0x0f, 0x80, // ..U.....X....... + 0x00, 0x00, 0xaa, 0x81, 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, // ................ + 0x00, // . +}; +static const uint8_t fs_nanovg_fill_dx11[2364] = +{ + 0x46, 0x53, 0x48, 0x05, 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_ + 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x13, 0x00, 0x30, 0x00, 0x03, 0x00, 0x0a, 0x75, // paintMat..0....u + 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x00, 0x60, 0x00, 0x01, 0x00, 0x0a, // _innerCol..`.... + 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x00, 0x70, 0x00, 0x01, 0x00, // u_outerCol..p... + 0x11, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, // .u_scissorExtSca + 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, 0x9c, 0x08, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, // ex0.........DXBC + 0x21, 0x36, 0x2a, 0x19, 0x73, 0x28, 0xce, 0xe0, 0xff, 0xcd, 0x27, 0x27, 0x8e, 0x5c, 0x18, 0x73, // !6*.s(....''...s + 0x01, 0x00, 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, // ........ISGNh... + 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, 0x03, 0x03, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, // ................ + 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, // SV_POSITION.TEXC + 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, // OORD....OSGN,... + 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, 0x53, 0x48, 0x44, 0x52, // SV_TARGET...SHDR + 0xc4, 0x07, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, // ....@.......Y... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X....p.. + 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ....UU..b...2... + 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xc2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....b........... + 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, // e.... ......h... + 0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....8...2....... + 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // V.......F. ..... + 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2...2....... + 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, // F. ............. + 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // ....F........... + 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // 2.......F....... + 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, // F. ............. + 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, // 2.......F....... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. .A....... + 0x08, 0x00, 0x00, 0x00, 0x32, 0x20, 0x00, 0x0e, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2 ..2....... + 0x46, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x8a, 0x20, 0x00, // F...A......... . + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, // .........@.....? + 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ...?........8... + 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x09, 0x22, 0x00, 0x10, 0x00, // ........2..."... + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, // ....*........@.. + 0x00, 0x00, 0x00, 0x40, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x08, // ...@.@.......... + 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x80, 0xc1, 0x00, 0x00, 0x00, // "............... + 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x38, 0x00, 0x00, 0x08, // .....@.....?8... + 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // "............... + 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x07, // .. .........3... + 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // "............... + 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x33, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, // .@.....?3...B... + 0x00, 0x00, 0x00, 0x00, 0x3a, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, // ....:........@.. + 0x00, 0x00, 0x80, 0x3f, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ...?8..."....... + 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // *............... + 0x18, 0x00, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, // ....B.......:. . + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........@...... + 0x1f, 0x00, 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, // ....*.......8... + 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........V....... + 0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, // .. .........2... + 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, 0x00, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........2....... + 0xa6, 0x8a, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // .. .A........... + 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, // F. ............. + 0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........A....... + 0x34, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, // 4...........:... + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x07, // ....*.......3... + 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x0a, 0xc2, 0x00, 0x10, 0x00, // .@......4....... + 0x00, 0x00, 0x00, 0x00, 0xa6, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // .............@.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x0f, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, // ....B........... + 0x00, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x05, // ............K... + 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // B.......*....... + 0x00, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, // ....B.......*... + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, // ................ + 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // B.......*....... + 0x2a, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // *. .A........... + 0x32, 0x00, 0x00, 0x0a, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, // 2...B......... . + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, // .........@.....? + 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x20, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, // *........ ..B... + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, // ....*......... . + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. .A....... + 0x06, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....F. ......... + 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa6, 0x0a, 0x10, 0x00, // 2............... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // ....F.......F. . + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, // ........8...B... + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....8.... ...... + 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... + 0x12, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........B....... + 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, 0x10, 0x00, // 8...........V... + 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, 0x20, 0x00, // 2............. . + 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, // ........E....... + 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ............F~.. + 0x00, 0x00, 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, // ...?...@8...r... + 0x02, 0x00, 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, // ............F... + 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....7...r....... + 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ........F....... + 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xe2, 0x00, 0x10, 0x00, // F.......7....... + 0x01, 0x00, 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, // ....V.......8... + 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // F. .........8... + 0x22, 0x00, 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, 0xf2, 0x20, 0x10, 0x00, // ........8.... .. + 0x00, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ....V.......F... + 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, 0x00, 0x00, // ....6.... ...... + 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, 0x00, 0x00, // ....E........... + 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~...... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x0b, 0x62, 0x00, 0x10, 0x00, // .`..........b... + 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, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, // .@.........?...@ + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....8...r....... + 0xf6, 0x0f, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... + 0x37, 0x00, 0x00, 0x09, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, // 7...r.......V... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, // ....F.......F... + 0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0xe2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....7........... + 0xa6, 0x0a, 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, 0x07, 0xf2, 0x00, 0x10, 0x00, // V.......8....... + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ............F... + 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....8.... ...... + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F. ..... + 0x06, 0x00, 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[3462] = +{ + 0x46, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x07, 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_ + 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, // paintMat.......u + 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, // _innerCol....... + 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // u_outerCol...... + 0x11, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, // .u_scissorExtSca + 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, 0xf5, 0x0c, 0x00, 0x00, // params.......... + 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, // using namespace + 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, // metal;.struct xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, // atMtlShaderInput + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x70, 0x6f, // {. float2 v_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // sition;. float2 + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, // v_texcoord0;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, // haderOutput {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // float4 gl_FragCo + 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // lor;.};.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x78, 0x33, // orm {. float3x3 + 0x20, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x3b, 0x0a, 0x20, // u_scissorMat;. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x78, 0x33, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, // float3x3 u_pain + 0x74, 0x4d, 0x61, 0x74, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // tMat;. float4 u + 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // _innerCol;. flo + 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x3b, 0x0a, // at4 u_outerCol;. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, // float4 u_sciss + 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // orExtScale;. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, // oat4 u_extentRad + 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, // ius;. float4 u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, // params;.};.fragm + 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // ent xlatMtlShade + 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // rOutput xlatMtlM + 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ain (xlatMtlShad + 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, // erInput _mtl_i [ + 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, // [stage_in]], con + 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // stant xlatMtlSha + 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // derUniform& _mtl + 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // _u [[buffer(0)]] + 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, // . , texture2d + 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, // s_tex [[ + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, // texture(0)]], sa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // mpler _mtlsmp_s_ + 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, // tex [[sampler(0) + 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // ]]).{. xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // haderOutput _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x72, 0x65, 0x73, // _o;. float4 res + 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // ult_1 = 0;. flo + 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, // at tmpvar_2 = 0; + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x73, 0x63, 0x5f, 0x33, 0x20, 0x3d, // . float2 sc_3 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, // 0;. float3 tmp + 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // var_4 = 0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, // var_4.z = 1.0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, // tmpvar_4.xy = _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // mtl_i.v_position + 0x3b, 0x0a, 0x20, 0x20, 0x73, 0x63, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // ;. sc_3 = (floa + 0x74, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2d, 0x20, 0x28, // t2(0.5, 0.5) - ( + 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x73, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // (. abs((_mtl_ + 0x75, 0x2e, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x20, 0x2a, // u.u_scissorMat * + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, // tmpvar_4).xy). + 0x20, 0x20, 0x2d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x73, 0x63, 0x69, // - _mtl_u.u_sci + 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x78, 0x79, 0x29, // ssorExtScale.xy) + 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, // * _mtl_u.u_scis + 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x2e, 0x7a, 0x77, 0x29, 0x29, // sorExtScale.zw)) + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // ;. tmpvar_2 = ( + 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x73, 0x63, 0x5f, 0x33, 0x2e, 0x78, 0x2c, 0x20, 0x30, // clamp (sc_3.x, 0 + 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, // .0, 1.0) * clamp + 0x20, 0x28, 0x73, 0x63, 0x5f, 0x33, 0x2e, 0x79, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, // (sc_3.y, 0.0, 1 + 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, // .0));. float tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_5 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, // pvar_5 = (min (1 + 0x2e, 0x30, 0x2c, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, // .0, (. (1.0 - + 0x20, 0x61, 0x62, 0x73, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // abs(((_mtl_i.v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x32, 0x2e, // texcoord0.x * 2. + 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, // 0) - 1.0))). * + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // _mtl_u.u_params + 0x2e, 0x79, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, // .y)) * min (1.0, + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // _mtl_i.v_texcoo + 0x72, 0x64, 0x30, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, // rd0.y));. if (( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params. + 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // w == 0.0)) {. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, // float3 tmpvar_6 + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // = 0;. tmpvar + 0x5f, 0x36, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // _6.z = 1.0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // tmpvar_6.xy = _m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, // tl_i.v_position; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, // . float2 tmpv + 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // ar_7 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x5f, // pvar_7 = (abs((_ + 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, 0x61, 0x74, // mtl_u.u_paintMat + 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x2e, 0x78, 0x79, 0x29, // * tmpvar_6).xy) + 0x20, 0x2d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, // - (_mtl_u.u_ext + 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x20, 0x2d, 0x20, 0x5f, // entRadius.xy - _ + 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, // mtl_u.u_extentRa + 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x7a, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, // dius.zz));. f + 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x3d, // loat2 tmpvar_8 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // 0;. 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, 0x5f, 0x6d, 0x74, // lt_1 = (mix (_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, // l_u.u_innerCol, + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, // _mtl_u.u_outerCo + 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // l, clamp (. + 0x20, 0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, // ((((. mi + 0x6e, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, // n (max (tmpvar_7 + 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x79, 0x29, 0x2c, // .x, tmpvar_7.y), + 0x20, 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2b, 0x20, 0x0a, // 0.0). + . + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x64, 0x6f, 0x74, // sqrt(dot + 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, // (tmpvar_8, tmpv + 0x61, 0x72, 0x5f, 0x38, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x2d, // ar_8)). ) - + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, // _mtl_u.u_extent + 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x5f, 0x6d, 0x74, // Radius.z) + (_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, // l_u.u_params.x * + 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // 0.5)) / _mtl_u. + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, // u_params.x). + 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x28, // , 0.0, 1.0)) * ( + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // tmpvar_5 * tmpva + 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, // r_2));. } else + 0x7b, 0x0a, 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 == + 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, // 1.0)) {. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x30, // oat4 color_9 = 0 + 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, 0x30, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // mpvar_10 = 0;. + 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x7a, 0x20, // tmpvar_10.z + 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // = 1.0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // var_10.xy = _mtl + 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, // _i.v_position;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // float4 tmpv + 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_11 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, // tmpvar_11 = s_t + 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, // ex.sample(_mtlsm + 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // p_s_tex, (float2 + 0x29, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x69, // )(((_mtl_u.u_pai + 0x6e, 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ntMat * tmpvar_1 + 0x30, 0x29, 0x2e, 0x78, 0x79, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // 0).xy / _mtl_u.u + 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, // _extentRadius.xy + 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // )));. color + 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, // _9 = tmpvar_11;. + 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, 0x7a, 0x20, 0x3d, 0x3d, 0x20, // u.u_params.z == + 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 1.0)) {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, // float4 tmpvar_12 + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, // pvar_12.xyz = (t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, // mpvar_11.xyz * t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // mpvar_11.w);. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x2e, 0x77, // tmpvar_12.w + 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x77, 0x3b, 0x0a, // = tmpvar_11.w;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, // color_9 + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, // = tmpvar_12;. + 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, // };. if ( + 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // (_mtl_u.u_params + 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, // .z == 2.0)) {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, // color_9 = + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, // color_9.xxxx;. + 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, // };. col + 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, // or_9 = (color_9 + 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, // * _mtl_u.u_inner + 0x43, 0x6f, 0x6c, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // Col);. colo + 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x39, 0x20, 0x2a, // r_9 = (color_9 * + 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, // (tmpvar_5 * tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, // var_2));. r + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // esult_1 = color_ + 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // 9;. } else {. + 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 == + 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, 0x66, 0x6c, 0x6f, 0x61, 0x74, // result_1 = float + 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, // 4(1.0, 1.0, 1.0, + 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, // 1.0);. } e + 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, // lse {. if + 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ((_mtl_u.u_para + 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, // ms.w == 3.0)) {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // float4 + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // color_13 = 0;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // float4 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_14 = 0;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // tmpvar_ + 0x31, 0x34, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // 14 = 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, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // (float2)(_mtl_i + 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x3b, 0x0a, // .v_texcoord0));. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // color_ + 0x31, 0x33, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, // 13 = tmpvar_14;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, // if ((_ + 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, // mtl_u.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, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, // float4 t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // mpvar_15 = 0;. + 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, 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, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 2.0)) {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, // color_13 + 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, // = color_13.xxxx; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 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, // color_13 + 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x2a, 0x20, 0x74, // = (color_13 * 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, 0x33, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // color_13 * _mtl_ + 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x3b, 0x0a, 0x20, // u.u_innerCol);. + 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, 0x72, 0x61, 0x67, 0x43, // _mtl_o.gl_FragC + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, // olor = result_1; + 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // . return _mtl_o + 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... +}; +extern const uint8_t* fs_nanovg_fill_pssl; +extern const uint32_t fs_nanovg_fill_pssl_size; diff --git a/3rd/nanovg/bgfx/fs_nanovg_fill.sc b/3rd/nanovg/bgfx/fs_nanovg_fill.sc new file mode 100644 index 000000000..fb8a17b0d --- /dev/null +++ b/3rd/nanovg/bgfx/fs_nanovg_fill.sc @@ -0,0 +1,94 @@ +$input v_position, v_texcoord0 + +#include "../common.sh" + +#define EDGE_AA 1 + +uniform mat3 u_scissorMat; +uniform mat3 u_paintMat; +uniform vec4 u_innerCol; +uniform vec4 u_outerCol; +uniform vec4 u_scissorExtScale; +uniform vec4 u_extentRadius; +uniform vec4 u_params; + +SAMPLER2D(s_tex, 0); + +#define u_scissorExt (u_scissorExtScale.xy) +#define u_scissorScale (u_scissorExtScale.zw) +#define u_extent (u_extentRadius.xy) +#define u_radius (u_extentRadius.z) +#define u_feather (u_params.x) +#define u_strokeMult (u_params.y) +#define u_texType (u_params.z) +#define u_type (u_params.w) + +float sdroundrect(vec2 pt, vec2 ext, float rad) +{ + vec2 ext2 = ext - vec2(rad,rad); + vec2 d = abs(pt) - ext2; + return min(max(d.x, d.y), 0.0) + length(max(d, 0.0) ) - rad; +} + +// Scissoring +float scissorMask(vec2 p) +{ + vec2 sc = abs(mul(u_scissorMat, vec3(p, 1.0) ).xy) - u_scissorExt; + sc = vec2(0.5, 0.5) - sc * u_scissorScale; + return clamp(sc.x, 0.0, 1.0) * clamp(sc.y, 0.0, 1.0); +} + +// Stroke - from [0..1] to clipped pyramid, where the slope is 1px. +float strokeMask(vec2 _texcoord) +{ +#if EDGE_AA + return min(1.0, (1.0 - abs(_texcoord.x*2.0 - 1.0) )*u_strokeMult) * min(1.0, _texcoord.y); +#else + return 1.0; +#endif // EDGE_AA +} + +void main() +{ + vec4 result; + float scissor = scissorMask(v_position); + float strokeAlpha = strokeMask(v_texcoord0); + + if (u_type == 0.0) // Gradient + { + // Calculate gradient color using box gradient + vec2 pt = mul(u_paintMat, vec3(v_position, 1.0) ).xy; + 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 *= strokeAlpha * scissor; + result = color; + } + else if (u_type == 1.0) // Image + { + // Calculate color from texture + vec2 pt = mul(u_paintMat, vec3(v_position, 1.0) ).xy / u_extent; + vec4 color = texture2D(s_tex, pt); + 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 *= strokeAlpha * scissor; + result = color; + } + else if (u_type == 2.0) // Stencil fill + { + result = vec4(1.0, 1.0, 1.0, 1.0); + } + else if (u_type == 3.0) // Textured tris + { + vec4 color = texture2D(s_tex, v_texcoord0.xy); + 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; + } + + gl_FragColor = result; +} diff --git a/3rd/nanovg/bgfx/nanovg_bgfx.cpp b/3rd/nanovg/bgfx/nanovg_bgfx.cpp new file mode 100644 index 000000000..31ce898fa --- /dev/null +++ b/3rd/nanovg/bgfx/nanovg_bgfx.cpp @@ -0,0 +1,1351 @@ +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +// +// Copyright (c) 2009-2013 Mikko Mononen memon@inside.org +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// +#define NVG_ANTIALIAS 1 + +#include +#include +#include "nanovg.h" + +//#include +#include "nanovg_bgfx.h" +#include "nanovg_bgfxEx.h" +#include +#include +#include +#include + +#include + +#include "SDL_syswm.h" + +BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244); // warning C4244: '=' : conversion from '' to '', possible loss of data + +#include "vs_nanovg_fill.bin.h" +#include "fs_nanovg_fill.bin.h" + +static const bgfx::EmbeddedShader s_embeddedShaders[] = +{ + BGFX_EMBEDDED_SHADER(vs_nanovg_fill), + BGFX_EMBEDDED_SHADER(fs_nanovg_fill), + + BGFX_EMBEDDED_SHADER_END() +}; + +namespace +{ + static bgfx::VertexDecl s_nvgDecl; + + enum GLNVGshaderType + { + NSVG_SHADER_FILLGRAD, + NSVG_SHADER_FILLIMG, + NSVG_SHADER_SIMPLE, + NSVG_SHADER_IMG + }; + + // These are additional flags on top of NVGimageFlags. + enum NVGimageFlagsGL { + NVG_IMAGE_NODELETE = 1<<16, // Do not delete GL texture handle. + }; + + struct GLNVGtexture + { + bgfx::TextureHandle id; + int width, height; + int type; + int flags; + }; + + struct GLNVGblend + { + uint64_t srcRGB; + uint64_t dstRGB; + uint64_t srcAlpha; + uint64_t dstAlpha; + }; + + enum GLNVGcallType + { + GLNVG_FILL, + GLNVG_CONVEXFILL, + GLNVG_STROKE, + GLNVG_TRIANGLES, + }; + + struct GLNVGcall + { + int type; + int image; + int pathOffset; + int pathCount; + int vertexOffset; + int vertexCount; + int uniformOffset; + GLNVGblend blendFunc; + }; + + struct GLNVGpath + { + int fillOffset; + int fillCount; + int strokeOffset; + int strokeCount; + }; + + struct GLNVGfragUniforms + { + float scissorMat[12]; // matrices are actually 3 vec4s + float paintMat[12]; + NVGcolor innerCol; + NVGcolor outerCol; + + // u_scissorExtScale + float scissorExt[2]; + float scissorScale[2]; + + // u_extentRadius + float extent[2]; + float radius; + + // u_params + float feather; + float strokeMult; + float texType; + float type; + }; + + struct GLNVGcontext + { + bx::AllocatorI* allocator; + + bgfx::ProgramHandle prog; + bgfx::UniformHandle u_scissorMat; + bgfx::UniformHandle u_paintMat; + bgfx::UniformHandle u_innerCol; + bgfx::UniformHandle u_outerCol; + bgfx::UniformHandle u_viewSize; + bgfx::UniformHandle u_scissorExtScale; + bgfx::UniformHandle u_extentRadius; + bgfx::UniformHandle u_params; + bgfx::UniformHandle u_halfTexel; + + bgfx::UniformHandle s_tex; + + uint64_t state; + bgfx::TextureHandle th; + bgfx::TextureHandle texMissing; + + bgfx::TransientVertexBuffer tvb; + bgfx::ViewId viewId; + + struct GLNVGtexture* textures; + float view[2]; + int ntextures; + int ctextures; + int textureId; + int vertBuf; + int fragSize; + int edgeAntiAlias; + + // Per frame buffers + struct GLNVGcall* calls; + int ccalls; + int ncalls; + struct GLNVGpath* paths; + int cpaths; + int npaths; + struct NVGvertex* verts; + int cverts; + int nverts; + unsigned char* uniforms; + int cuniforms; + int nuniforms; + }; + + static struct GLNVGtexture* glnvg__allocTexture(struct GLNVGcontext* gl) + { + struct GLNVGtexture* tex = NULL; + int i; + + for (i = 0; i < gl->ntextures; i++) + { + if (gl->textures[i].id.idx == bgfx::kInvalidHandle) + { + tex = &gl->textures[i]; + break; + } + } + + if (tex == NULL) + { + if (gl->ntextures+1 > gl->ctextures) + { + int old = gl->ctextures; + gl->ctextures = (gl->ctextures == 0) ? 2 : gl->ctextures*2; + gl->textures = (struct GLNVGtexture*)BX_REALLOC(gl->allocator, gl->textures, sizeof(struct GLNVGtexture)*gl->ctextures); + bx::memSet(&gl->textures[old], 0xff, (gl->ctextures-old)*sizeof(struct GLNVGtexture) ); + + if (gl->textures == NULL) + { + return NULL; + } + } + tex = &gl->textures[gl->ntextures++]; + } + + bx::memSet(tex, 0, sizeof(*tex) ); + + return tex; + } + + static struct GLNVGtexture* glnvg__findTexture(struct GLNVGcontext* gl, int id) + { + int i; + for (i = 0; i < gl->ntextures; i++) + { + if (gl->textures[i].id.idx == id) + { + return &gl->textures[i]; + } + } + + return NULL; + } + + static int glnvg__deleteTexture(struct GLNVGcontext* gl, int id) + { + for (int ii = 0; ii < gl->ntextures; ii++) + { + if (gl->textures[ii].id.idx == id) + { + if (bgfx::isValid(gl->textures[ii].id) + && (gl->textures[ii].flags & NVG_IMAGE_NODELETE) == 0) + { + bgfx::destroy(gl->textures[ii].id); + } + bx::memSet(&gl->textures[ii], 0, sizeof(gl->textures[ii]) ); + gl->textures[ii].id.idx = bgfx::kInvalidHandle; + return 1; + } + } + + return 0; + } + + static int nvgRenderCreate(void* _userPtr) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + + bgfx::RendererType::Enum type = bgfx::getRendererType(); + gl->prog = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_nanovg_fill") + , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_nanovg_fill") + , true + ); + + const bgfx::Memory* mem = bgfx::alloc(4*4*4); + uint32_t* bgra8 = (uint32_t*)mem->data; + bx::memSet(bgra8, 0, 4*4*4); + 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); + gl->u_innerCol = bgfx::createUniform("u_innerCol", bgfx::UniformType::Vec4); + gl->u_outerCol = bgfx::createUniform("u_outerCol", bgfx::UniformType::Vec4); + gl->u_viewSize = bgfx::createUniform("u_viewSize", bgfx::UniformType::Vec4); + gl->u_scissorExtScale = bgfx::createUniform("u_scissorExtScale", bgfx::UniformType::Vec4); + gl->u_extentRadius = bgfx::createUniform("u_extentRadius", bgfx::UniformType::Vec4); + gl->u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4); + gl->s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Int1); + + if (bgfx::getRendererType() == bgfx::RendererType::Direct3D9) + { + gl->u_halfTexel = bgfx::createUniform("u_halfTexel", bgfx::UniformType::Vec4); + } + else + { + gl->u_halfTexel.idx = bgfx::kInvalidHandle; + } + + s_nvgDecl + .begin() + .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) + .end(); + + int align = 16; + gl->fragSize = sizeof(struct GLNVGfragUniforms) + align - sizeof(struct GLNVGfragUniforms) % align; + + return 1; + } + + static int nvgRenderCreateTexture( + void* _userPtr + , int _type + , int _width + , int _height + , int _flags + , const unsigned char* _rgba + ) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + struct GLNVGtexture* tex = glnvg__allocTexture(gl); + + if (tex == NULL) + { + return 0; + } + + tex->width = _width; + tex->height = _height; + tex->type = _type; + tex->flags = _flags; + + uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1; + uint32_t pitch = tex->width * bytesPerPixel; + + const bgfx::Memory* mem = NULL; + if (NULL != _rgba) + { + mem = bgfx::copy(_rgba, tex->height * pitch); + } + + tex->id = bgfx::createTexture2D( + tex->width + , tex->height + , false + , 1 + , NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8 + , BGFX_SAMPLER_NONE + ); + + if (NULL != mem) + { + bgfx::updateTexture2D( + tex->id + , 0 + , 0 + , 0 + , 0 + , tex->width + , tex->height + , mem + ); + } + + return bgfx::isValid(tex->id) ? tex->id.idx : 0; + } + + static int nvgRenderDeleteTexture(void* _userPtr, int image) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + return glnvg__deleteTexture(gl, image); + } + + static int nvgRenderUpdateTexture(void* _userPtr, int image, int x, int y, int w, int h, const unsigned char* data) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + struct GLNVGtexture* tex = glnvg__findTexture(gl, image); + if (tex == NULL) + { + return 0; + } + + uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1; + uint32_t pitch = tex->width * bytesPerPixel; + + const bgfx::Memory* mem = bgfx::alloc(w * h * bytesPerPixel); + bx::gather(mem->data, data + y * pitch + x * bytesPerPixel, w * bytesPerPixel, h, pitch); + + bgfx::updateTexture2D( + tex->id + , 0 + , 0 + , x + , y + , w + , h + , mem + , UINT16_MAX + ); + + return 1; + } + + static int nvgRenderGetTextureSize(void* _userPtr, int image, int* w, int* h) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + struct GLNVGtexture* tex = glnvg__findTexture(gl, image); + + if (NULL == tex + || !bgfx::isValid(tex->id) ) + { + return 0; + } + + *w = tex->width; + *h = tex->height; + + return 1; + } + + static void glnvg__xformToMat3x4(float* m3, float* t) + { + m3[ 0] = t[0]; + m3[ 1] = t[1]; + m3[ 2] = 0.0f; + m3[ 3] = 0.0f; + m3[ 4] = t[2]; + m3[ 5] = t[3]; + m3[ 6] = 0.0f; + m3[ 7] = 0.0f; + m3[ 8] = t[4]; + m3[ 9] = t[5]; + m3[10] = 1.0f; + 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 + ) + { + struct GLNVGtexture* tex = NULL; + float invxform[6] = {}; + + bx::memSet(frag, 0, sizeof(*frag) ); + + frag->innerCol = glnvg__premulColor(paint->innerColor); + frag->outerCol = glnvg__premulColor(paint->outerColor); + + if (scissor->extent[0] < -0.5f || scissor->extent[1] < -0.5f) + { + bx::memSet(frag->scissorMat, 0, sizeof(frag->scissorMat) ); + frag->scissorExt[0] = 1.0f; + frag->scissorExt[1] = 1.0f; + frag->scissorScale[0] = 1.0f; + frag->scissorScale[1] = 1.0f; + } + else + { + nvgTransformInverse(invxform, scissor->xform); + glnvg__xformToMat3x4(frag->scissorMat, invxform); + frag->scissorExt[0] = scissor->extent[0]; + frag->scissorExt[1] = scissor->extent[1]; + frag->scissorScale[0] = sqrtf(scissor->xform[0]*scissor->xform[0] + scissor->xform[2]*scissor->xform[2]) / fringe; + frag->scissorScale[1] = sqrtf(scissor->xform[1]*scissor->xform[1] + scissor->xform[3]*scissor->xform[3]) / fringe; + } + bx::memCopy(frag->extent, paint->extent, sizeof(frag->extent) ); + frag->strokeMult = (width*0.5f + fringe*0.5f) / fringe; + + gl->th = gl->texMissing; + if (paint->image != 0) + { + tex = glnvg__findTexture(gl, paint->image); + if (tex == NULL) + { + return 0; + } + nvgTransformInverse(invxform, paint->xform); + frag->type = NSVG_SHADER_FILLIMG; + + 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 + { + frag->type = NSVG_SHADER_FILLGRAD; + frag->radius = paint->radius; + frag->feather = paint->feather; + nvgTransformInverse(invxform, paint->xform); + } + + glnvg__xformToMat3x4(frag->paintMat, invxform); + + return 1; + } + + static void glnvg__mat3(float* dst, float* src) + { + dst[0] = src[ 0]; + dst[1] = src[ 1]; + dst[2] = src[ 2]; + + dst[3] = src[ 4]; + dst[4] = src[ 5]; + dst[5] = src[ 6]; + + dst[6] = src[ 8]; + dst[7] = src[ 9]; + dst[8] = src[10]; + } + + static struct GLNVGfragUniforms* nvg__fragUniformPtr(struct GLNVGcontext* gl, int i) + { + return (struct GLNVGfragUniforms*)&gl->uniforms[i]; + } + + static void nvgRenderSetUniforms(struct GLNVGcontext* gl, int uniformOffset, int image) + { + struct GLNVGfragUniforms* frag = nvg__fragUniformPtr(gl, uniformOffset); + float tmp[9]; // Maybe there's a way to get rid of this... + glnvg__mat3(tmp, frag->scissorMat); + bgfx::setUniform(gl->u_scissorMat, tmp); + glnvg__mat3(tmp, frag->paintMat); + bgfx::setUniform(gl->u_paintMat, tmp); + + bgfx::setUniform(gl->u_innerCol, frag->innerCol.rgba); + bgfx::setUniform(gl->u_outerCol, frag->outerCol.rgba); + bgfx::setUniform(gl->u_scissorExtScale, &frag->scissorExt[0]); + bgfx::setUniform(gl->u_extentRadius, &frag->extent[0]); + bgfx::setUniform(gl->u_params, &frag->feather); + + bgfx::TextureHandle handle = gl->texMissing; + + if (image != 0) + { + struct GLNVGtexture* tex = glnvg__findTexture(gl, image); + if (tex != NULL) + { + handle = tex->id; + + if (bgfx::isValid(gl->u_halfTexel) ) + { + float halfTexel[4] = { 0.5f / tex->width, 0.5f / tex->height }; + bgfx::setUniform(gl->u_halfTexel, halfTexel); + } + } + } + + gl->th = handle; + } + + static void nvgRenderViewport(void* _userPtr, float width, float height, float devicePixelRatio) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + gl->view[0] = (float)width; + gl->view[1] = (float)height; + bgfx::setViewRect(gl->viewId, 0, 0, width * devicePixelRatio, height * devicePixelRatio); + } + + static void fan(uint32_t _start, uint32_t _count) + { + uint32_t numTris = _count-2; + bgfx::TransientIndexBuffer tib; + bgfx::allocTransientIndexBuffer(&tib, numTris*3); + uint16_t* data = (uint16_t*)tib.data; + for (uint32_t ii = 0; ii < numTris; ++ii) + { + data[ii*3+0] = _start; + data[ii*3+1] = _start + ii + 1; + data[ii*3+2] = _start + ii + 2; + } + + bgfx::setIndexBuffer(&tib); + } + + static void glnvg__fill(struct GLNVGcontext* gl, struct GLNVGcall* call) + { + struct GLNVGpath* paths = &gl->paths[call->pathOffset]; + int i, npaths = call->pathCount; + + // set bindpoint for solid loc + nvgRenderSetUniforms(gl, call->uniformOffset, 0); + + for (i = 0; i < npaths; i++) + { + if (2 < paths[i].fillCount) + { + bgfx::setState(0); + bgfx::setStencil(0 + | BGFX_STENCIL_TEST_ALWAYS + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_KEEP + | BGFX_STENCIL_OP_FAIL_Z_KEEP + | BGFX_STENCIL_OP_PASS_Z_INCR + , 0 + | BGFX_STENCIL_TEST_ALWAYS + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_KEEP + | BGFX_STENCIL_OP_FAIL_Z_KEEP + | BGFX_STENCIL_OP_PASS_Z_DECR + ); + bgfx::setVertexBuffer(0, &gl->tvb); + bgfx::setTexture(0, gl->s_tex, gl->th); + fan(paths[i].fillOffset, paths[i].fillCount); + bgfx::submit(gl->viewId, gl->prog); + } + } + + // Draw aliased off-pixels + nvgRenderSetUniforms(gl, call->uniformOffset + gl->fragSize, call->image); + + if (gl->edgeAntiAlias) + { + // Draw fringes + for (i = 0; i < npaths; i++) + { + bgfx::setState(gl->state + | BGFX_STATE_PT_TRISTRIP + ); + bgfx::setStencil(0 + | BGFX_STENCIL_TEST_EQUAL + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_KEEP + | BGFX_STENCIL_OP_FAIL_Z_KEEP + | BGFX_STENCIL_OP_PASS_Z_KEEP + ); + bgfx::setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + bgfx::setTexture(0, gl->s_tex, gl->th); + bgfx::submit(gl->viewId, gl->prog); + } + } + + // Draw fill + bgfx::setState(gl->state); + bgfx::setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + bgfx::setTexture(0, gl->s_tex, gl->th); + bgfx::setStencil(0 + | BGFX_STENCIL_TEST_NOTEQUAL + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_ZERO + | BGFX_STENCIL_OP_FAIL_Z_ZERO + | BGFX_STENCIL_OP_PASS_Z_ZERO + ); + bgfx::submit(gl->viewId, gl->prog); + } + + static void glnvg__convexFill(struct GLNVGcontext* gl, struct GLNVGcall* call) + { + struct GLNVGpath* paths = &gl->paths[call->pathOffset]; + int i, npaths = call->pathCount; + + nvgRenderSetUniforms(gl, call->uniformOffset, call->image); + + for (i = 0; i < npaths; i++) + { + if (paths[i].fillCount == 0) continue; + bgfx::setState(gl->state); + bgfx::setVertexBuffer(0, &gl->tvb); + bgfx::setTexture(0, gl->s_tex, gl->th); + fan(paths[i].fillOffset, paths[i].fillCount); + bgfx::submit(gl->viewId, gl->prog); + } + + if (gl->edgeAntiAlias) + { + // Draw fringes + for (i = 0; i < npaths; i++) + { + bgfx::setState(gl->state + | BGFX_STATE_PT_TRISTRIP + ); + bgfx::setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + bgfx::setTexture(0, gl->s_tex, gl->th); + bgfx::submit(gl->viewId, gl->prog); + } + } + } + + static void glnvg__stroke(struct GLNVGcontext* gl, struct GLNVGcall* call) + { + struct GLNVGpath* paths = &gl->paths[call->pathOffset]; + int npaths = call->pathCount, i; + + nvgRenderSetUniforms(gl, call->uniformOffset, call->image); + + // Draw Strokes + for (i = 0; i < npaths; i++) + { + bgfx::setState(gl->state + | BGFX_STATE_PT_TRISTRIP + ); + bgfx::setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + bgfx::setTexture(0, gl->s_tex, gl->th); + bgfx::submit(gl->viewId, gl->prog); + } + } + + static void glnvg__triangles(struct GLNVGcontext* gl, struct GLNVGcall* call) + { + if (3 <= call->vertexCount) + { + nvgRenderSetUniforms(gl, call->uniformOffset, call->image); + + bgfx::setState(gl->state); + bgfx::setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + bgfx::setTexture(0, gl->s_tex, gl->th); + bgfx::submit(gl->viewId, gl->prog); + } + } + + 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 GLNVGblend glnvg__blendCompositeOperation(NVGcompositeOperationState op) + { + GLNVGblend blend; + blend.srcRGB = glnvg_convertBlendFuncFactor(op.srcRGB); + blend.dstRGB = glnvg_convertBlendFuncFactor(op.dstRGB); + blend.srcAlpha = glnvg_convertBlendFuncFactor(op.srcAlpha); + blend.dstAlpha = glnvg_convertBlendFuncFactor(op.dstAlpha); + if (blend.srcRGB == BGFX_STATE_NONE || blend.dstRGB == BGFX_STATE_NONE || blend.srcAlpha == BGFX_STATE_NONE || blend.dstAlpha == BGFX_STATE_NONE) + { + blend.srcRGB = BGFX_STATE_BLEND_ONE; + blend.dstRGB = BGFX_STATE_BLEND_INV_SRC_ALPHA; + blend.srcAlpha = BGFX_STATE_BLEND_ONE; + blend.dstAlpha = BGFX_STATE_BLEND_INV_SRC_ALPHA; + } + return blend; + } + + static void nvgRenderFlush(void* _userPtr) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + + if (gl->ncalls > 0) + { + bgfx::allocTransientVertexBuffer(&gl->tvb, gl->nverts, s_nvgDecl); + + int allocated = gl->tvb.size/gl->tvb.stride; + + if (allocated < gl->nverts) + { + gl->nverts = allocated; + BX_WARN(true, "Vertex number truncated due to transient vertex buffer overflow"); + } + + bx::memCopy(gl->tvb.data, gl->verts, gl->nverts * sizeof(struct NVGvertex) ); + + bgfx::setUniform(gl->u_viewSize, gl->view); + + for (uint32_t ii = 0, num = gl->ncalls; ii < num; ++ii) + { + struct GLNVGcall* call = &gl->calls[ii]; + const GLNVGblend* blend = &call->blendFunc; + gl->state = BGFX_STATE_BLEND_FUNC_SEPARATE(blend->srcRGB, blend->dstRGB, blend->srcAlpha, blend->dstAlpha) + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + ; + switch (call->type) + { + case GLNVG_FILL: + glnvg__fill(gl, call); + break; + + case GLNVG_CONVEXFILL: + glnvg__convexFill(gl, call); + break; + + case GLNVG_STROKE: + glnvg__stroke(gl, call); + break; + + case GLNVG_TRIANGLES: + glnvg__triangles(gl, call); + break; + } + } + } + + // Reset calls + gl->nverts = 0; + gl->npaths = 0; + gl->ncalls = 0; + gl->nuniforms = 0; + } + + static int glnvg__maxVertCount(const struct NVGpath* paths, int npaths) + { + int i, count = 0; + for (i = 0; i < npaths; i++) + { + count += paths[i].nfill; + count += paths[i].nstroke; + } + return count; + } + + static int glnvg__maxi(int a, int b) { return a > b ? a : b; } + + static struct GLNVGcall* glnvg__allocCall(struct GLNVGcontext* gl) + { + struct GLNVGcall* ret = NULL; + if (gl->ncalls+1 > gl->ccalls) + { + gl->ccalls = gl->ccalls == 0 ? 32 : gl->ccalls * 2; + gl->calls = (struct GLNVGcall*)BX_REALLOC(gl->allocator, gl->calls, sizeof(struct GLNVGcall) * gl->ccalls); + } + ret = &gl->calls[gl->ncalls++]; + bx::memSet(ret, 0, sizeof(struct GLNVGcall) ); + return ret; + } + + static int glnvg__allocPaths(struct GLNVGcontext* gl, int n) + { + int ret = 0; + if (gl->npaths + n > gl->cpaths) { + GLNVGpath* paths; + int cpaths = glnvg__maxi(gl->npaths + n, 128) + gl->cpaths / 2; // 1.5x Overallocate + paths = (GLNVGpath*)BX_REALLOC(gl->allocator, gl->paths, sizeof(GLNVGpath) * cpaths); + if (paths == NULL) return -1; + gl->paths = paths; + gl->cpaths = cpaths; + } + ret = gl->npaths; + gl->npaths += n; + return ret; + } + + static int glnvg__allocVerts(GLNVGcontext* gl, int n) + { + int ret = 0; + if (gl->nverts+n > gl->cverts) + { + NVGvertex* verts; + int cverts = glnvg__maxi(gl->nverts + n, 4096) + gl->cverts/2; // 1.5x Overallocate + verts = (NVGvertex*)BX_REALLOC(gl->allocator, gl->verts, sizeof(NVGvertex) * cverts); + if (verts == NULL) return -1; + gl->verts = verts; + gl->cverts = cverts; + } + ret = gl->nverts; + gl->nverts += n; + return ret; + } + + static int glnvg__allocFragUniforms(struct GLNVGcontext* gl, int n) + { + int ret = 0, structSize = gl->fragSize; + if (gl->nuniforms+n > gl->cuniforms) + { + gl->cuniforms = gl->cuniforms == 0 ? glnvg__maxi(n, 32) : gl->cuniforms * 2; + gl->uniforms = (unsigned char*)BX_REALLOC(gl->allocator, gl->uniforms, gl->cuniforms * structSize); + } + ret = gl->nuniforms * structSize; + gl->nuniforms += n; + return ret; + } + + static void glnvg__vset(struct NVGvertex* vtx, float x, float y, float u, float v) + { + vtx->x = x; + vtx->y = y; + vtx->u = u; + vtx->v = v; + } + + static void nvgRenderFill( + void* _userPtr + , NVGpaint* paint + , NVGcompositeOperationState compositeOperation + , NVGscissor* scissor + , float fringe + , const float* bounds + , const NVGpath* paths + , int npaths + ) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + + struct GLNVGcall* call = glnvg__allocCall(gl); + struct NVGvertex* quad; + struct GLNVGfragUniforms* frag; + int i, maxverts, offset; + + call->type = GLNVG_FILL; + call->pathOffset = glnvg__allocPaths(gl, npaths); + call->pathCount = npaths; + call->image = paint->image; + call->blendFunc = glnvg__blendCompositeOperation(compositeOperation); + + if (npaths == 1 && paths[0].convex) + { + call->type = GLNVG_CONVEXFILL; + } + + // Allocate vertices for all the paths. + maxverts = glnvg__maxVertCount(paths, npaths) + 6; + offset = glnvg__allocVerts(gl, maxverts); + + for (i = 0; i < npaths; i++) + { + struct GLNVGpath* copy = &gl->paths[call->pathOffset + i]; + const struct NVGpath* path = &paths[i]; + bx::memSet(copy, 0, sizeof(struct GLNVGpath) ); + if (path->nfill > 0) + { + copy->fillOffset = offset; + copy->fillCount = path->nfill; + bx::memCopy(&gl->verts[offset], path->fill, sizeof(struct NVGvertex) * path->nfill); + offset += path->nfill; + } + + if (path->nstroke > 0) + { + copy->strokeOffset = offset; + copy->strokeCount = path->nstroke; + bx::memCopy(&gl->verts[offset], path->stroke, sizeof(struct NVGvertex) * path->nstroke); + offset += path->nstroke; + } + } + + // Quad + call->vertexOffset = offset; + call->vertexCount = 6; + quad = &gl->verts[call->vertexOffset]; + glnvg__vset(&quad[0], bounds[0], bounds[3], 0.5f, 1.0f); + glnvg__vset(&quad[1], bounds[2], bounds[3], 0.5f, 1.0f); + glnvg__vset(&quad[2], bounds[2], bounds[1], 0.5f, 1.0f); + + glnvg__vset(&quad[3], bounds[0], bounds[3], 0.5f, 1.0f); + glnvg__vset(&quad[4], bounds[2], bounds[1], 0.5f, 1.0f); + glnvg__vset(&quad[5], bounds[0], bounds[1], 0.5f, 1.0f); + + // Setup uniforms for draw calls + if (call->type == GLNVG_FILL) + { + call->uniformOffset = glnvg__allocFragUniforms(gl, 2); + // Simple shader for stencil + frag = nvg__fragUniformPtr(gl, call->uniformOffset); + bx::memSet(frag, 0, sizeof(*frag) ); + frag->type = NSVG_SHADER_SIMPLE; + // Fill shader + glnvg__convertPaint(gl, nvg__fragUniformPtr(gl, call->uniformOffset + gl->fragSize), paint, scissor, fringe, fringe); + } + else + { + call->uniformOffset = glnvg__allocFragUniforms(gl, 1); + // Fill shader + glnvg__convertPaint(gl, nvg__fragUniformPtr(gl, call->uniformOffset), paint, scissor, fringe, fringe); + } + } + + static void nvgRenderStroke( + void* _userPtr + , struct NVGpaint* paint + , NVGcompositeOperationState compositeOperation + , struct NVGscissor* scissor + , float fringe + , float strokeWidth + , const struct NVGpath* paths + , int npaths + ) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + + struct GLNVGcall* call = glnvg__allocCall(gl); + int i, maxverts, offset; + + call->type = GLNVG_STROKE; + call->pathOffset = glnvg__allocPaths(gl, npaths); + call->pathCount = npaths; + call->image = paint->image; + call->blendFunc = glnvg__blendCompositeOperation(compositeOperation); + + // Allocate vertices for all the paths. + maxverts = glnvg__maxVertCount(paths, npaths); + offset = glnvg__allocVerts(gl, maxverts); + + for (i = 0; i < npaths; i++) + { + struct GLNVGpath* copy = &gl->paths[call->pathOffset + i]; + const struct NVGpath* path = &paths[i]; + bx::memSet(copy, 0, sizeof(struct GLNVGpath) ); + if (path->nstroke) + { + copy->strokeOffset = offset; + copy->strokeCount = path->nstroke; + bx::memCopy(&gl->verts[offset], path->stroke, sizeof(struct NVGvertex) * path->nstroke); + offset += path->nstroke; + } + } + + // Fill shader + call->uniformOffset = glnvg__allocFragUniforms(gl, 1); + glnvg__convertPaint(gl, nvg__fragUniformPtr(gl, call->uniformOffset), paint, scissor, strokeWidth, fringe); + } + + static void nvgRenderTriangles(void* _userPtr, struct NVGpaint* paint, NVGcompositeOperationState compositeOperation, struct NVGscissor* scissor, + const struct NVGvertex* verts, int nverts) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + struct GLNVGcall* call = glnvg__allocCall(gl); + struct GLNVGfragUniforms* frag; + + call->type = GLNVG_TRIANGLES; + call->image = paint->image; + call->blendFunc = glnvg__blendCompositeOperation(compositeOperation); + + // Allocate vertices for all the paths. + call->vertexOffset = glnvg__allocVerts(gl, nverts); + call->vertexCount = nverts; + bx::memCopy(&gl->verts[call->vertexOffset], verts, sizeof(struct NVGvertex) * nverts); + + // Fill shader + call->uniformOffset = glnvg__allocFragUniforms(gl, 1); + frag = nvg__fragUniformPtr(gl, call->uniformOffset); + glnvg__convertPaint(gl, frag, paint, scissor, 1.0f, 1.0f); + frag->type = NSVG_SHADER_IMG; + } + + static void nvgRenderDelete(void* _userPtr) + { + struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; + + if (gl == NULL) + { + return; + } + + bgfx::destroy(gl->prog); + bgfx::destroy(gl->texMissing); + + bgfx::destroy(gl->u_scissorMat); + bgfx::destroy(gl->u_paintMat); + bgfx::destroy(gl->u_innerCol); + bgfx::destroy(gl->u_outerCol); + bgfx::destroy(gl->u_viewSize); + bgfx::destroy(gl->u_scissorExtScale); + bgfx::destroy(gl->u_extentRadius); + bgfx::destroy(gl->u_params); + bgfx::destroy(gl->s_tex); + + if (bgfx::isValid(gl->u_halfTexel) ) + { + bgfx::destroy(gl->u_halfTexel); + } + + for (uint32_t ii = 0, num = gl->ntextures; ii < num; ++ii) + { + if (bgfx::isValid(gl->textures[ii].id) + && (gl->textures[ii].flags & NVG_IMAGE_NODELETE) == 0) + { + bgfx::destroy(gl->textures[ii].id); + } + } + + BX_FREE(gl->allocator, gl->uniforms); + BX_FREE(gl->allocator, gl->verts); + BX_FREE(gl->allocator, gl->paths); + BX_FREE(gl->allocator, gl->calls); + BX_FREE(gl->allocator, gl->textures); + BX_FREE(gl->allocator, gl); + } + +} // namespace + +NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _allocator) +{ + if (NULL == _allocator) + { + static bx::DefaultAllocator allocator; + _allocator = &allocator; + } + + struct NVGparams params; + struct NVGcontext* ctx = NULL; + struct GLNVGcontext* gl = (struct GLNVGcontext*)BX_ALLOC(_allocator, sizeof(struct GLNVGcontext) ); + if (gl == NULL) + { + goto error; + } + + bx::memSet(gl, 0, sizeof(struct GLNVGcontext) ); + + bx::memSet(¶ms, 0, sizeof(params) ); + params.renderCreate = nvgRenderCreate; + params.renderCreateTexture = nvgRenderCreateTexture; + params.renderDeleteTexture = nvgRenderDeleteTexture; + params.renderUpdateTexture = nvgRenderUpdateTexture; + params.renderGetTextureSize = nvgRenderGetTextureSize; + params.renderViewport = nvgRenderViewport; + params.renderFlush = nvgRenderFlush; + params.renderFill = nvgRenderFill; + params.renderStroke = nvgRenderStroke; + params.renderTriangles = nvgRenderTriangles; + params.renderDelete = nvgRenderDelete; + params.userPtr = gl; + params.edgeAntiAlias = _edgeaa; + + gl->allocator = _allocator; + gl->edgeAntiAlias = _edgeaa; + gl->viewId = _viewId; + + ctx = nvgCreateInternal(¶ms); + if (ctx == NULL) goto error; + + return ctx; + +error: + // 'gl' is freed by nvgDeleteInternal. + if (ctx != NULL) + { + nvgDeleteInternal(ctx); + } + + return NULL; +} + +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; + } + +NVGcontext* nvgCreateBGFX(int32_t _edgeaa, uint16_t _viewId ,uint32_t _width, uint32_t _height, SDL_Window* _window) { + + if (!sdlSetWindow(_window)) + { + return NULL; + } + //bgfx::renderFrame(); + bgfx::Init init; + init.type = bgfx::RendererType::Count; + init.vendorId = BGFX_PCI_ID_NONE; + init.resolution.width = _width; + init.resolution.height = _height; + init.resolution.reset = BGFX_RESET_VSYNC; + bgfx::init(init); + + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); + + NVGcontext* vg = nvgCreate(_edgeaa, _viewId, NULL); + bgfx::setViewMode(0, bgfx::ViewMode::Sequential); + return vg; +} + +uint32_t renderBGFXFrame(int32_t _msecs) +{ + return (uint32_t)bgfx::renderFrame(_msecs); +} + +void setBGFXViewRect(uint16_t _viewId, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +{ + bgfx::setViewRect(_viewId, _x, _y, _width, _height); +} + +void touchBGFX(uint16_t _viewId) +{ + bgfx::touch(_viewId); +} + +uint32_t frameBGFX(bool _capture) +{ + return bgfx::frame(_capture); +} + +void resetBGFX(uint32_t _width, uint32_t _height, uint32_t _flags) +{ + bgfx::reset(_width, _height, _flags); +} + +void nvgDeleteBGFX(NVGcontext* _ctx) +{ + nvgDeleteInternal(_ctx); +} + +void nvgSetViewId(NVGcontext* _ctx, bgfx::ViewId _viewId) +{ + struct NVGparams* params = nvgInternalParams(_ctx); + struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; + gl->viewId = _viewId; +} + +uint16_t nvgGetViewId(struct NVGcontext* _ctx) +{ + struct NVGparams* params = nvgInternalParams(_ctx); + struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; + return gl->viewId; +} + +bgfx::TextureHandle nvglImageHandle(NVGcontext* _ctx, int32_t _image) +{ + GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; + GLNVGtexture* tex = glnvg__findTexture(gl, _image); + return tex->id; +} + +NVGLUframebuffer_bgfx* nvgluCreateFramebuffer(NVGcontext* ctx, int32_t width, int32_t height, int32_t imageFlags, bgfx::ViewId viewId) +{ + NVGLUframebuffer_bgfx* framebuffer = nvgluCreateFramebuffer(ctx, width, height, imageFlags); + + if (framebuffer != NULL) + { + nvgluSetViewFramebuffer(viewId, framebuffer); + } + + return framebuffer; +} + +NVGLUframebuffer_bgfx* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32_t _height, int32_t _imageFlags) +{ + BX_UNUSED(_imageFlags); + bgfx::TextureHandle textures[] = + { + bgfx::createTexture2D(_width, _height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(_width, _height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT | BGFX_TEXTURE_RT_WRITE_ONLY) + }; + bgfx::FrameBufferHandle fbh = bgfx::createFrameBuffer( + BX_COUNTOF(textures) + , textures + , true + ); + + if (!bgfx::isValid(fbh) ) + { + return NULL; + } + + struct NVGparams* params = nvgInternalParams(_ctx); + struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; + struct GLNVGtexture* tex = glnvg__allocTexture(gl); + + if (NULL == tex) + { + bgfx::destroy(fbh); + return NULL; + } + + tex->width = _width; + tex->height = _height; + tex->type = NVG_TEXTURE_RGBA; + tex->flags = _imageFlags | NVG_IMAGE_PREMULTIPLIED; + tex->id = bgfx::getTexture(fbh); + + NVGLUframebuffer_bgfx* framebuffer = BX_NEW(gl->allocator, NVGLUframebuffer_bgfx); + framebuffer->ctx = _ctx; + framebuffer->image = tex->id.idx; + framebuffer->handle = fbh; + + return framebuffer; +} + +void nvgluBindFramebuffer(NVGLUframebuffer_bgfx* _framebuffer) +{ + static NVGcontext* s_prevCtx = NULL; + static bgfx::ViewId s_prevViewId; + if (_framebuffer != NULL) + { + s_prevCtx = _framebuffer->ctx; + s_prevViewId = nvgGetViewId(_framebuffer->ctx); + nvgSetViewId(_framebuffer->ctx, _framebuffer->viewId); + } + else if (s_prevCtx != NULL) + { + nvgSetViewId(s_prevCtx, s_prevViewId); + } +} + +void nvgluDeleteFramebuffer(NVGLUframebuffer_bgfx* _framebuffer) +{ + if (_framebuffer == NULL) + { + return; + } + + if (bgfx::isValid(_framebuffer->handle)) + { + bgfx::destroy(_framebuffer->handle); + } + + struct NVGparams* params = nvgInternalParams(_framebuffer->ctx); + struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; + glnvg__deleteTexture(gl, _framebuffer->image); + BX_DELETE(gl->allocator, _framebuffer); +} + +void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer_bgfx* _framebuffer) +{ + _framebuffer->viewId = _viewId; + bgfx::setViewFrameBuffer(_viewId, _framebuffer->handle); + bgfx::setViewMode(_viewId, bgfx::ViewMode::Sequential); +} diff --git a/3rd/nanovg/bgfx/nanovg_bgfx.h b/3rd/nanovg/bgfx/nanovg_bgfx.h new file mode 100644 index 000000000..d01898942 --- /dev/null +++ b/3rd/nanovg/bgfx/nanovg_bgfx.h @@ -0,0 +1,44 @@ +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#ifndef NANOVG_BGFX_H_HEADER_GUARD +#define NANOVG_BGFX_H_HEADER_GUARD +#include +#include +#include +#include +#include +#include "nanovg.h" +#include + +#ifndef M_PI +#define M_PI 3.1415926f +#endif /*M_PI*/ + +#ifdef __cplusplus +extern "C" { +#endif + +///sdl entry +NVGcontext* nvgCreateBGFX(int32_t _edgeaa, uint16_t _viewId,uint32_t _width, uint32_t _height, SDL_Window* _window); + +/// +void nvgDeleteBGFX(NVGcontext* _ctx); + +uint32_t renderBGFXFrame(int32_t _msecs); + +void setBGFXViewRect(uint16_t _viewId, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + +void touchBGFX(uint16_t _viewId); + +uint32_t frameBGFX(bool _capture); + +void resetBGFX(uint32_t _width, uint32_t _height, uint32_t _flags); + +#ifdef __cplusplus +} +#endif + +#endif // NANOVG_BGFX_H_HEADER_GUARD diff --git a/3rd/nanovg/bgfx/nanovg_bgfxEx.h b/3rd/nanovg/bgfx/nanovg_bgfxEx.h new file mode 100644 index 000000000..2f897e518 --- /dev/null +++ b/3rd/nanovg/bgfx/nanovg_bgfxEx.h @@ -0,0 +1,61 @@ +#ifndef NANOVG_BGFXEX_H_HEADER_GUARD +#define NANOVG_BGFXEX_H_HEADER_GUARD + +#include + +namespace bx { struct AllocatorI; } + +typedef struct NVGcontext NVGcontext; + +struct NVGLUframebuffer_bgfx +{ + NVGcontext* ctx; + bgfx::FrameBufferHandle handle; + int image; + bgfx::ViewId viewId; +}; + +/// +NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _allocator); +/// +void nvgSetViewId(NVGcontext* _ctx, bgfx::ViewId _viewId); + +/// +uint16_t nvgGetViewId(struct NVGcontext* _ctx); + +// Helper functions to create bgfx framebuffer to render to. +// Example: +// float scale = 2; +// NVGLUframebuffer* fb = nvgluCreateFramebuffer(ctx, 100 * scale, 100 * scale, 0); +// nvgluSetViewFramebuffer(VIEW_ID, fb); +// nvgluBindFramebuffer(fb); +// nvgBeginFrame(ctx, 100, 100, scale); +// // renders anything offscreen +// nvgEndFrame(ctx); +// nvgluBindFramebuffer(NULL); +// +// // Pastes the framebuffer rendering. +// nvgBeginFrame(ctx, 1024, 768, scale); +// NVGpaint paint = nvgImagePattern(ctx, 0, 0, 100, 100, 0, fb->image, 1); +// nvgBeginPath(ctx); +// nvgRect(ctx, 0, 0, 100, 100); +// nvgFillPaint(ctx, paint); +// nvgFill(ctx); +// nvgEndFrame(ctx); + +/// +NVGLUframebuffer_bgfx* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32_t _height, int32_t _imageFlags, bgfx::ViewId _viewId); + +/// +NVGLUframebuffer_bgfx* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32_t _height, int32_t _imageFlags); + +/// +void nvgluBindFramebuffer(NVGLUframebuffer_bgfx* _framebuffer); + +/// +void nvgluDeleteFramebuffer(NVGLUframebuffer_bgfx* _framebuffer); + +/// +void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer_bgfx* _framebuffer); + +#endif \ No newline at end of file diff --git a/3rd/nanovg/bgfx/varying.def.sc b/3rd/nanovg/bgfx/varying.def.sc new file mode 100644 index 000000000..f836bcf24 --- /dev/null +++ b/3rd/nanovg/bgfx/varying.def.sc @@ -0,0 +1,5 @@ +vec2 v_position : TEXCOORD0 = vec2(0.0, 0.0); +vec2 v_texcoord0 : TEXCOORD1 = vec2(0.0, 0.0); + +vec2 a_position : POSITION; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/3rd/nanovg/bgfx/vs_nanovg_fill.bin.h b/3rd/nanovg/bgfx/vs_nanovg_fill.bin.h new file mode 100644 index 000000000..5b2853828 --- /dev/null +++ b/3rd/nanovg/bgfx/vs_nanovg_fill.bin.h @@ -0,0 +1,265 @@ +static const uint8_t vs_nanovg_fill_glsl[541] = +{ + 0x56, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, // wSize.......u_ha + 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0xeb, 0x01, 0x00, // lfTexel......... + 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // .attribute highp + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // vec2 a_position + 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, // ;.attribute high + 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // p vec2 a_texcoor + 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, // d0;.varying high + 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // p vec2 v_positio + 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // n;.varying highp + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec2 v_texcoord + 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 0;.uniform highp + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, // vec4 u_viewSize + 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ;.uniform highp + 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x68, 0x61, 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, // vec4 u_halfTexel + 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, // ;.void main ().{ + 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, // . v_position = + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, // a_position;. v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x5f, 0x74, // texcoord0 = (a_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x75, 0x5f, 0x68, 0x61, 0x6c, // excoord0 + u_hal + 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, // fTexel.xy);. hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ghp vec4 tmpvar_ + 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, // 1;. tmpvar_1.zw + 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // = vec2(0.0, 1.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x20, // );. tmpvar_1.x + 0x3d, 0x20, 0x28, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, // = (((2.0 * a_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x29, 0x20, 0x2f, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, // ition.x) / u_vie + 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, // wSize.x) - 1.0); + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, // . tmpvar_1.y = + 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x61, // (1.0 - ((2.0 * a + 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x79, 0x29, 0x20, 0x2f, 0x20, 0x75, // _position.y) / u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, // _viewSize.y));. + 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, // gl_Position = t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mpvar_1;.}... +}; +static const uint8_t vs_nanovg_fill_spv[1481] = +{ + 0x56, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, 0x6c, // VSH........u_hal + 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x10, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, // fTexel.......u_v + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x90, 0x05, 0x00, // iewSize......... + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xb1, 0x00, 0x00, // ...#............ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // n....G...J...S.. + 0x00, 0x57, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // .W...Z.......... + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, // n............$Gl + 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // obal............ + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewSize..... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x68, 0x61, 0x6c, 0x66, 0x54, // .........u_halfT + 0x65, 0x78, 0x65, 0x6c, 0x00, 0x05, 0x00, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exel............ + 0x00, 0x05, 0x00, 0x05, 0x00, 0x47, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // .....G...a_posit + 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, // ion......J...a_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x53, 0x00, 0x00, // excoord0.....S.. + 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, // .@entryPointOutp + 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ut.gl_Position.. + 0x00, 0x05, 0x00, 0x0a, 0x00, 0x57, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, // .....W...@entryP + 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, // ointOutput.v_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x5a, 0x00, 0x00, // ition........Z.. + 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, // .@entryPointOutp + 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, // ut.v_texcoord0.. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x00, // .#.......G...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G.......".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...G...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...J...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x53, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....G...S...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...W...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...Z...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // . .............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, // .....+.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....;.......... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, // .....+.......%.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .....+.......&.. + 0x00, 0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ....@....'... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .....+...'...(.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...-...... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, // .....+.......1.. + 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, // ....?+...'...3.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... ...F...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, // .....;...F...G.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, // .....;...F...J.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...R...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // .....;...R...S.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...V...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, // .....;...V...W.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, // .....;...V...Z.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....H...G...=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // .....K...J...A.. + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, // .....v.......... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, // .=.......w...v.. + 0x00, 0x4f, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, // .O.......x...w.. + 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, // .w.............. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // .....y...K...x.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, // .Q.......|...H.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. + 0x00, 0x26, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2d, 0x00, 0x00, // .&...|...A...-.. + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .~.......%...(.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, // .=...........~.. + 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. + 0x00, 0x7f, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....1...Q...... + 0x00, 0x83, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, // .....H.......... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, // .........&...... + 0x00, 0x41, 0x00, 0x06, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .A...-.......... + 0x00, 0x25, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, // .%...3...=...... + 0x00, 0x86, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x87, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, // .............P.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x14, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....1.......... + 0x00, 0x8d, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, // .........1...R.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x53, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, // .....>...S...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x57, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...W...H...>.. + 0x00, 0x5a, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .Z...y.......8.. + 0x00, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, 0x20, 0x00, // ....... . +}; +static const uint8_t vs_nanovg_fill_dx9[426] = +{ + 0x56, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, 0x6c, // VSH........u_hal + 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x01, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, // fTexel.......u_v + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x78, 0x01, 0x00, // iewSize......x.. + 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x28, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, // .......(.CTAB... + 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, // .r.............. + 0x00, 0x00, 0x91, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, // .....k...D...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .....P.......`.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P...... + 0x00, 0x75, 0x5f, 0x68, 0x61, 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x01, 0x00, 0x03, // .u_halfTexel.... + 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, // iewSize.vs_3_0.M + 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, // icrosoft (R) HLS + 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, // L Shader Compile + 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, // r 10.1...Q...... + 0xa0, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........?....... + 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, // ................ + 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x03, 0xe0, 0x02, 0x00, 0x00, // ................ + 0x03, 0x02, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xe4, 0x90, 0x06, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, // ................ + 0x80, 0x00, 0x00, 0xd0, 0x90, 0x00, 0x00, 0xd0, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, // ................ + 0xe0, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, // ...U............ + 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, // .......U........ + 0xe0, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0x00, 0x81, 0x02, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, // ...........U.... + 0x02, 0x00, 0x00, 0x0c, 0xe0, 0x02, 0x00, 0x64, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, // .......d........ + 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... +}; +static const uint8_t vs_nanovg_fill_dx11[579] = +{ + 0x56, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x02, 0x00, 0x00, 0x44, // wSize..........D + 0x58, 0x42, 0x43, 0x99, 0x64, 0x1c, 0x9f, 0xec, 0x38, 0xd9, 0xd2, 0x91, 0x86, 0xde, 0x66, 0x7d, // XBC.d...8.....f} + 0x52, 0x06, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, // R.............., + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x4c, // ...........ISGNL + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, // ...........8.... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ + 0x03, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ...A............ + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, // ...........POSIT + 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0x4f, // ION.TEXCOORD...O + 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, // SGNh...........P + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x03, 0x0c, 0x00, 0x00, 0x5c, // ................ + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, // ................ + 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, // .......SV_POSITI + 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x53, // ON.TEXCOORD....S + 0x48, 0x44, 0x52, 0x24, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x49, 0x00, 0x00, 0x00, 0x59, // HDR$...@...I...Y + 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, // ...F. ........._ + 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, // ...2......._...2 + 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, // .......g.... ... + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x01, // .......e...2 ... + 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xc2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, // ...e.... ......h + 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x32, 0x00, 0x10, 0x00, 0x00, // ...........2.... + 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x00, // ...F.......F.... + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // .......2.......F + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .......F. ...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, // ........ ....... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x00, // ........@....... + 0x00, 0x00, 0x08, 0x22, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x80, 0x41, // ..." ..........A + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x36, // ........@.....?6 + 0x00, 0x00, 0x08, 0xc2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, // .... .......@... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x36, // ..............?6 + 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x00, // ...2 ......F.... + 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xc2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, // ...6.... ....... + 0x14, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x00, 0x10, // .......>........ + 0x00, 0x10, 0x00, // ... +}; +static const uint8_t vs_nanovg_fill_mtl[904] = +{ + 0x56, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, // wSize.......u_ha + 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x56, 0x03, 0x00, // lfTexel......V.. + 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, // .using namespace + 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // metal;.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, // latMtlShaderInpu + 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x61, 0x5f, 0x70, // t {. float2 a_p + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, // osition [[attrib + 0x75, 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // ute(0)]];. floa + 0x74, 0x32, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, // t2 a_texcoord0 [ + 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, // [attribute(1)]]; + 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // . float4 gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ition [[position + 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x70, // ]];. float2 v_p + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // osition;. float + 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, // 2 v_texcoord0;.} + 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // ;.struct xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, // ShaderUniform {. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, // float4 u_viewS + 0x69, 0x7a, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, // ize;. float4 u_ + 0x68, 0x61, 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, // halfTexel;.};.ve + 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // rtex xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // erOutput xlatMtl + 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // Main (xlatMtlSha + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, // derInput _mtl_i + 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // nstant xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, // aderUniform& _mt + 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // l_u [[buffer(0)] + 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ + 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x70, 0x6f, // o;. _mtl_o.v_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // sition = _mtl_i. + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // a_position;. _m + 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_o.v_texcoord0 + 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, // = (_mtl_i.a_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // coord0 + _mtl_u. + 0x75, 0x5f, 0x68, 0x61, 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x2e, 0x78, 0x79, 0x29, 0x3b, // u_halfTexel.xy); + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // . float4 tmpvar + 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _1 = 0;. tmpvar + 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, // _1.zw = float2(0 + 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // .0, 1.0);. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, // ar_1.x = (((2.0 + 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // * _mtl_i.a_posit + 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // ion.x) / _mtl_u. + 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x29, 0x20, 0x2d, 0x20, // u_viewSize.x) - + 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 1.0);. tmpvar_1 + 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x32, 0x2e, // .y = (1.0 - ((2. + 0x30, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, // 0 * _mtl_i.a_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x79, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ition.y) / _mtl_ + 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x79, 0x29, 0x29, // u.u_viewSize.y)) + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, // ;. _mtl_o.gl_Po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // sition = tmpvar_ + 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // 1;. return _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... +}; +extern const uint8_t* vs_nanovg_fill_pssl; +extern const uint32_t vs_nanovg_fill_pssl_size; diff --git a/3rd/nanovg/bgfx/vs_nanovg_fill.sc b/3rd/nanovg/bgfx/vs_nanovg_fill.sc new file mode 100644 index 000000000..b1cb88e4d --- /dev/null +++ b/3rd/nanovg/bgfx/vs_nanovg_fill.sc @@ -0,0 +1,23 @@ +$input a_position, a_texcoord0 +$output v_position, v_texcoord0 + +#include "../common.sh" + +#define NEED_HALF_TEXEL (BGFX_SHADER_LANGUAGE_HLSL < 4) + +uniform vec4 u_viewSize; + +#if NEED_HALF_TEXEL +uniform vec4 u_halfTexel; +#endif // NEED_HALF_TEXEL + +void main() +{ +#if !NEED_HALF_TEXEL + const vec4 u_halfTexel = vec4_splat(0.0); +#endif // !NEED_HALF_TEXEL + + v_position = a_position; + v_texcoord0 = a_texcoord0+u_halfTexel.xy; + gl_Position = vec4(2.0*v_position.x/u_viewSize.x - 1.0, 1.0 - 2.0*v_position.y/u_viewSize.y, 0.0, 1.0); +} diff --git a/3rd/nanovg/demos/bgfx_sdl_draw_image.c b/3rd/nanovg/demos/bgfx_sdl_draw_image.c new file mode 100644 index 000000000..a2248d70e --- /dev/null +++ b/3rd/nanovg/demos/bgfx_sdl_draw_image.c @@ -0,0 +1,60 @@ +#include "bgfx/nanovg_bgfx.h" +#define STB_IMAGE_IMPLEMENTATION +#include "../stb/stb_image.h" +#include "draw_image.inc" +#include "get_sdl_window.inc" + + +static void run_test(int w, int h) +{ + bool exit = false; + SDL_Event event; + SDL_WindowEvent wev; + NVGcontext* vg = nvgCreateBGFX(1, 0, w, h, CreateSDLWindow(w, h)); + while (!exit) + { + setBGFXViewRect(0, 0, 0, w, h); + touchBGFX(0); + do_draw(vg, w, h); + frameBGFX(false); + while (SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_QUIT: + exit = true; + break; + case SDL_WINDOWEVENT: + { + wev = event.window; + switch (wev.event) + { + case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: + { + w = wev.data1; + h = wev.data2; + resetBGFX(w, h, 0); + } + break; + default: + break; + } + } + default: + break; + } + } + } + nvgDeleteBGFX(vg); +} + +#if defined(WIN32) +#include +int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { +#else +int main(void) { +#endif + run_test(400, 400); + return 0; +} \ No newline at end of file diff --git a/3rd/nanovg/demos/bgfx_sdl_draw_text.c b/3rd/nanovg/demos/bgfx_sdl_draw_text.c new file mode 100644 index 000000000..bef5c20ce --- /dev/null +++ b/3rd/nanovg/demos/bgfx_sdl_draw_text.c @@ -0,0 +1,58 @@ +#include "bgfx/nanovg_bgfx.h" +#include "draw_text.inc" +#include "get_sdl_window.inc" + +static void run_test(int w, int h) +{ + bool exit = false; + SDL_Event event; + SDL_WindowEvent wev; + NVGcontext* vg = nvgCreateBGFX(1, 0, w, h, CreateSDLWindow(w, h)); + nvgCreateFont(vg, "default", "default.ttf"); + nvgFontFace(vg, "default"); + while (!exit) + { + setBGFXViewRect(0, 0, 0, w, h); + touchBGFX(0); + do_draw_text(vg, w, h); + frameBGFX(false); + while (SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_QUIT: + exit = true; + break; + case SDL_WINDOWEVENT: + { + wev = event.window; + switch (wev.event) + { + case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: + { + w = wev.data1; + h = wev.data2; + resetBGFX(w, h, 0); + } + break; + default: + break; + } + } + default: + break; + } + } + } + nvgDeleteBGFX(vg); +} +#if defined(WIN32) +#include +int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { +#else +int main(void) { +#endif + run_test(400, 400); + return 0; +} \ No newline at end of file diff --git a/3rd/nanovg/demos/bgfx_sdl_fill.c b/3rd/nanovg/demos/bgfx_sdl_fill.c new file mode 100644 index 000000000..a5059cd5d --- /dev/null +++ b/3rd/nanovg/demos/bgfx_sdl_fill.c @@ -0,0 +1,57 @@ +#include "bgfx/nanovg_bgfx.h" +#include "fill.inc" +#include "get_sdl_window.inc" + +static void run_test(int w, int h) +{ + bool exit = false; + SDL_Event event; + SDL_WindowEvent wev; + NVGcontext* vg = nvgCreateBGFX(1, 0, w, h, CreateSDLWindow(w, h)); + while (!exit) + { + setBGFXViewRect(0, 0, 0, w, h); + touchBGFX(0); + do_fill(vg, w, h); + frameBGFX(false); + while (SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_QUIT: + exit = true; + break; + case SDL_WINDOWEVENT: + { + wev = event.window; + switch (wev.event) + { + case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: + { + w = wev.data1; + h = wev.data2; + resetBGFX(w, h, 0); + } + break; + default: + break; + } + } + default: + break; + } + } + } + nvgDeleteBGFX(vg); +} + +#if defined(WIN32) +#include +int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { +#else +int main(void) { +#endif + run_test(400, 400); + return 0; +} \ No newline at end of file diff --git a/3rd/nanovg/demos/bgfx_sdl_stroke.c b/3rd/nanovg/demos/bgfx_sdl_stroke.c new file mode 100644 index 000000000..0a8edc892 --- /dev/null +++ b/3rd/nanovg/demos/bgfx_sdl_stroke.c @@ -0,0 +1,56 @@ +#include "bgfx/nanovg_bgfx.h" +#include "stroke.inc" +#include "get_sdl_window.inc" + +static void run_test(int w, int h) +{ + bool exit = false; + SDL_Event event; + SDL_WindowEvent wev; + NVGcontext* vg = nvgCreateBGFX(1, 0, w, h, CreateSDLWindow(w, h)); + while (!exit) + { + setBGFXViewRect(0, 0, 0, (uint16_t)w, (uint16_t)h); + touchBGFX(0); + do_stroke(vg, w, h); + frameBGFX(false); + while (SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_QUIT: + exit = true; + break; + case SDL_WINDOWEVENT: + { + wev = event.window; + switch (wev.event) + { + case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: + { + w = wev.data1; + h = wev.data2; + resetBGFX(w, h, 0); + } + break; + default: + break; + } + } + default: + break; + } + } + } + nvgDeleteBGFX(vg); +} +#if defined(WIN32) +#include +int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { +#else +int main(void) { +#endif + run_test(400, 400); + return 0; +} \ No newline at end of file diff --git a/3rd/nanovg/demos/draw_image.inc b/3rd/nanovg/demos/draw_image.inc index 6e3c88e67..0b9a6c86f 100644 --- a/3rd/nanovg/demos/draw_image.inc +++ b/3rd/nanovg/demos/draw_image.inc @@ -27,7 +27,7 @@ static void do_draw(NVGcontext* vg, int32_t w, int32_t h) { int32_t iw = 0; int32_t ih = 0; int32_t comp = 4; - int img = load_image(vg, "demos/assets/raw/images/x2/rgb.png", &comp, &iw, &ih); + int img = load_image(vg, "../demos/assets/raw/images/x2/rgb.png", &comp, &iw, &ih); nvgBeginFrame(vg, w, h, 1); @@ -37,7 +37,7 @@ static void do_draw(NVGcontext* vg, int32_t w, int32_t h) { draw_image(vg, imgPaint, 0, 0, iw, ih, 10, 100, iw*2, ih*2); - int img2 = load_image(vg, "demos/assets/raw/images/x2/rgba.png", &comp, &iw, &ih); + int img2 = load_image(vg, "../demos/assets/raw/images/x2/rgba.png", &comp, &iw, &ih); NVGpaint imgPaint2 = nvgImagePattern(vg, 0, 0, iw, ih, 0, img2, 1); nvgTranslate(vg, 100, 100); diff --git a/3rd/nanovg/demos/draw_text.inc b/3rd/nanovg/demos/draw_text.inc new file mode 100644 index 000000000..21a6efbbd --- /dev/null +++ b/3rd/nanovg/demos/draw_text.inc @@ -0,0 +1,17 @@ + +static void do_draw_text(NVGcontext* vg, int32_t w, int32_t h) { + + const char* text = "Hello AWTK"; + nvgBeginFrame(vg, w, h, 1); + nvgFillColor(vg, nvgRGBA(255, 0, 0, 255)); + nvgSave(vg); + nvgFontSize(vg, 20); + nvgTextAlign(vg, NVG_ALIGN_LEFT|NVG_ALIGN_TOP); + //nvgFontBlur(vg,2); + nvgFillColor(vg, nvgRGBA(0, 255, 0, 255)); + nvgText(vg, 20, 20, text, NULL); + nvgRestore(vg); + + nvgEndFrame(vg); +} + diff --git a/3rd/nanovg/demos/get_sdl_window.inc b/3rd/nanovg/demos/get_sdl_window.inc new file mode 100644 index 000000000..a4d4fc953 --- /dev/null +++ b/3rd/nanovg/demos/get_sdl_window.inc @@ -0,0 +1,13 @@ +static SDL_Window* CreateSDLWindow(int w, int h){ + SDL_Init(0 | SDL_INIT_GAMECONTROLLER); + static SDL_Window* sdl_window = NULL; + sdl_window = SDL_CreateWindow("bgfx" + , SDL_WINDOWPOS_UNDEFINED + , SDL_WINDOWPOS_UNDEFINED + , w + , h + , SDL_WINDOW_SHOWN + | SDL_WINDOW_RESIZABLE + ); + return sdl_window; +} diff --git a/3rd/nanovg/sync.py b/3rd/nanovg/sync.py index e7ac43731..28baf35ad 100755 --- a/3rd/nanovg/sync.py +++ b/3rd/nanovg/sync.py @@ -36,3 +36,14 @@ for f in GL_FILES: src=os.path.join('src', f); dst=os.path.join('gl', f); copyFile(src, dst) + + +SRC_ROOT_DIR=joinPath(os.getcwd(), '../../../3rd/bgfx-awtk/nanovg/'); +BGFX_FILES=['fs_nanovg_fill.sc', 'nanovg_bgfxEx.h', 'vs_nanovg_fill.sc', + 'fontstash.h','nanovg_bgfx.cpp','varying.def.sc', + 'fs_nanovg_fill.bin.h','nanovg_bgfx.h','vs_nanovg_fill.bin.h']; + +for f in BGFX_FILES: + src=os.path.join('bgfx', f); + dst=os.path.join('bgfx', f); + copyFile(src, dst) diff --git a/SConstruct b/SConstruct index a152c9c8f..99ee8dd1c 100644 --- a/SConstruct +++ b/SConstruct @@ -6,12 +6,12 @@ def joinPath(root, subdir): OS_NAME=platform.system() TK_ROOT = os.path.normpath(os.getcwd()) +BIN_DIR=joinPath(TK_ROOT, 'bin') +LIB_DIR=joinPath(TK_ROOT, 'lib') TK_SRC = joinPath(TK_ROOT, 'src') TK_3RD_ROOT = joinPath(TK_ROOT, '3rd') TK_TOOLS_ROOT = joinPath(TK_ROOT, 'tools') GTEST_ROOT = joinPath(TK_ROOT, '3rd/gtest/googletest') -BIN_DIR=joinPath(TK_ROOT, 'bin') -LIB_DIR=joinPath(TK_ROOT, 'lib') if OS_NAME == 'Windows': TK_ROOT=TK_ROOT.replace('\\', '\\\\'); @@ -19,38 +19,35 @@ if OS_NAME == 'Windows': #INPUT_ENGINE='null' INPUT_ENGINE='pinyin' -LCD='SDL' -LCD='GL' - VGCANVAS='NANOVG' +NANOVG_BACKEND='GL3' +#NANOVG_BACKEND='GLES2' +#NANOVG_BACKEND='GLES3' +#NANOVG_BACKEND='AGG' #NANOVG_BACKEND='AGGE' #NANOVG_BACKEND='BGFX' -#NANOVG_BACKEND='GL3' -#NANOVG_BACKEND='GLES' -#NANOVG_BACKEND='AGG' -NANOVG_BACKEND='AGGE' -#FRAME_BUFFER_FORMAT='bgr888' -FRAME_BUFFER_FORMAT='bgr565' -FRAME_BUFFER_FORMAT='bgra8888' - -COMMON_CCFLAGS=' -DTK_ROOT=\\\"'+TK_ROOT+'\\\" -DHAS_STD_MALLOC -DWITH_SDL -DWITH_FS_RES -DHAS_STDIO -DWITH_DESKTOP_STYLE ' -COMMON_CCFLAGS=COMMON_CCFLAGS+' -DSTBTT_STATIC -DSTB_IMAGE_STATIC -DWITH_STB_IMAGE -DWITH_STB_FONT -DWITH_VGCANVAS -DWITH_UNICODE_BREAK ' +FRAME_BUFFER_FORMAT='' +if NANOVG_BACKEND == 'AGGE' or NANOVG_BACKEND == 'AGG': + LCD='SDL_FB' + FRAME_BUFFER_FORMAT='bgr565' + #FRAME_BUFFER_FORMAT='bgra8888' +else: + LCD='SDL_GPU' NANOVG_BACKEND_LIBS=[]; NANOVG_BACKEND_PROJS=[]; +COMMON_CCFLAGS=' -DTK_ROOT=\\\"'+TK_ROOT+'\\\" -DHAS_STD_MALLOC -DWITH_SDL -DWITH_FS_RES -DHAS_STDIO -DWITH_DESKTOP_STYLE ' +COMMON_CCFLAGS=COMMON_CCFLAGS+' -DSTBTT_STATIC -DSTB_IMAGE_STATIC -DWITH_STB_IMAGE -DWITH_STB_FONT -DWITH_VGCANVAS -DWITH_UNICODE_BREAK ' -if LCD == 'GL': - NANOVG_BACKEND='GL' - COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GL -DWITH_VGCANVAS_LCD' +if LCD == 'SDL_GPU': + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GPU -DWITH_VGCANVAS_LCD' else: COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_BITMAP_BGRA -DWITH_NANOVG_SOFT ' if FRAME_BUFFER_FORMAT=='bgra8888': COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGRA8888=1 '; - elif FRAME_BUFFER_FORMAT=='bgr888': - COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGR888=1 '; else: - COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGR565=1 '; + COMMON_CCFLAGS=COMMON_CCFLAGS+' -DWITH_FB_BGR565=1 -DWITH_BITMAP_BGR565'; if NANOVG_BACKEND == 'AGG': NANOVG_BACKEND_LIBS=['nanovg-agg', 'agg']; @@ -59,23 +56,17 @@ if NANOVG_BACKEND == 'AGG': elif NANOVG_BACKEND == 'AGGE': NANOVG_BACKEND_LIBS=['nanovg-agge', 'agge']; NANOVG_BACKEND_PROJS=['3rd/agge/SConscript']; - COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_AGGE -DWITH_BITMAP_BGR565 ' + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_AGGE ' elif NANOVG_BACKEND == 'BGFX': + NANOVG_BACKEND_LIBS=['nanovg-bgfx','bgfx']; + NANOVG_BACKEND_PROJS=['3rd/bgfx/SConscript']; COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_BGFX ' -elif NANOVG_BACKEND == 'GLES': - COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES ' +elif NANOVG_BACKEND == 'GLES2': + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES2 -DWITH_NANOVG_GL ' +elif NANOVG_BACKEND == 'GLES3': + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GLES3 -DWITH_NANOVG_GL ' else: - COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GL3 ' - -os.environ['LCD'] = LCD -os.environ['VGCANVAS'] = VGCANVAS -os.environ['BIN_DIR'] = BIN_DIR; -os.environ['LIB_DIR'] = LIB_DIR; -os.environ['TK_ROOT'] = TK_ROOT; -os.environ['GTEST_ROOT'] = GTEST_ROOT; -os.environ['INPUT_ENGINE'] = INPUT_ENGINE; -os.environ['NANOVG_BACKEND'] = NANOVG_BACKEND; -os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT; + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DWITH_NANOVG_GL3 -DWITH_NANOVG_GL ' OS_LIBS=[] OS_LIBPATH=[] @@ -88,9 +79,9 @@ OS_PROJECTS=[] if OS_NAME == 'Darwin': OS_LIBS = ['stdc++', 'pthread', 'm', 'dl'] - OS_LINKFLAGS='-framework OpenGL' - COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__APPLE__ -DHAS_PTHREAD -DMACOS -DENABLE_MEM_LEAK_CHECK1 ' - COMMON_CCFLAGS=COMMON_CCFLAGS+' -DENABLE_CURSOR ' + OS_LINKFLAGS='-framework Cocoa -framework QuartzCore -framework OpenGL -weak_framework Metal -weak_framework MetalKit' + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__APPLE__ -DHAS_PTHREAD -DMACOS -DENABLE_MEM_LEAK_CHECK ' + COMMON_CCFLAGS = COMMON_CCFLAGS + ' -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -DBGFX_CONFIG_RENDERER_METAL=1 ' elif OS_NAME == 'Linux': OS_LIBS = ['GL', 'gtk-3','gdk-3','Xext', 'X11', 'sndio','stdc++', 'pthread', 'm', 'dl'] @@ -102,9 +93,11 @@ elif OS_NAME == 'Linux': OS_PROJECTS=['3rd/SDL/SConscript'] elif OS_NAME == 'Windows': - OS_LIBS=['gdi32', 'user32','winmm.lib','imm32.lib','version.lib','shell32.lib','ole32.lib','Oleaut32.lib','Advapi32.lib'] + OS_LIBS=['gdi32', 'user32','winmm.lib','imm32.lib','version.lib','shell32.lib','ole32.lib','Oleaut32.lib','Advapi32.lib','DelayImp.lib','psapi.lib'] OS_FLAGS='-DWIN32 -D_WIN32 -DWINDOWS /EHsc -D_CONSOLE /DEBUG /Od /FS /Z7 ' COMMON_CCFLAGS = COMMON_CCFLAGS + ' -DSDL_REAL_API -DSDL_HAPTIC_DISABLED -DSDL_SENSOR_DISABLED -DSDL_JOYSTICK_DISABLED ' + COMMON_CCFLAGS = COMMON_CCFLAGS + '-D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_HAS_EXCEPTIONS=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_ITERATOR_DEBUG_LEVEL=0 -D_SCL_SECURE=0' + COMMON_CCFLAGS = COMMON_CCFLAGS + '-D_SECURE_SCL=0 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_WIN64' OS_LINKFLAGS='/MACHINE:X64 /DEBUG' OS_SUBSYSTEM_CONSOLE='/SUBSYSTEM:CONSOLE ' OS_SUBSYSTEM_WINDOWS='/SUBSYSTEM:WINDOWS ' @@ -119,12 +112,16 @@ CPPPATH=[TK_ROOT, TK_SRC, TK_3RD_ROOT, joinPath(TK_SRC, 'ext_widgets'), + joinPath(TK_3RD_ROOT, 'bgfx/bgfx/include'), + joinPath(TK_3RD_ROOT, 'bgfx/bx/include'), + joinPath(TK_3RD_ROOT, 'bgfx/bimg/include'), joinPath(TK_3RD_ROOT, 'agge'), joinPath(TK_3RD_ROOT, 'agg/include'), joinPath(TK_3RD_ROOT, 'nanovg'), - joinPath(TK_3RD_ROOT, 'nanovg/base'), joinPath(TK_3RD_ROOT, 'nanovg/gl'), + joinPath(TK_3RD_ROOT, 'nanovg/base'), joinPath(TK_3RD_ROOT, 'nanovg/agge'), + joinPath(TK_3RD_ROOT, 'nanovg/bgfx'), joinPath(TK_3RD_ROOT, 'SDL/src'), joinPath(TK_3RD_ROOT, 'SDL/include'), joinPath(TK_3RD_ROOT, 'agge/src'), @@ -142,6 +139,18 @@ DefaultEnvironment(CCFLAGS = CCFLAGS, OS_SUBSYSTEM_WINDOWS=OS_SUBSYSTEM_WINDOWS ) +os.environ['LCD'] = LCD +os.environ['BIN_DIR'] = BIN_DIR; +os.environ['LIB_DIR'] = LIB_DIR; +os.environ['TK_ROOT'] = TK_ROOT; +os.environ['CCFLAGS'] = CCFLAGS; +os.environ['VGCANVAS'] = VGCANVAS +os.environ['GTEST_ROOT'] = GTEST_ROOT; +os.environ['TK_3RD_ROOT'] = TK_3RD_ROOT; +os.environ['INPUT_ENGINE'] = INPUT_ENGINE; +os.environ['NANOVG_BACKEND'] = NANOVG_BACKEND; +os.environ['FRAME_BUFFER_FORMAT'] = FRAME_BUFFER_FORMAT; + SConscriptFiles=NANOVG_BACKEND_PROJS + [ '3rd/nanovg/SConscript', '3rd/glad/SConscript', diff --git a/src/SConscript b/src/SConscript index 514cbd703..6df3451f3 100644 --- a/src/SConscript +++ b/src/SConscript @@ -3,6 +3,7 @@ import copy BIN_DIR=os.environ['BIN_DIR']; LIB_DIR=os.environ['LIB_DIR']; +NANOVG_BACKEND=os.environ['NANOVG_BACKEND']; sources=Glob('base/*.c') +\ Glob('ui_loader/*.c') + \ @@ -19,20 +20,28 @@ sources=Glob('base/*.c') +\ ['awtk.c']; sources += ['main_loop/main_loop_simple.c']; -if os.environ['LCD'] == 'GL': - sources += ['window_animators/window_animator_opengl.c']; - sources += ['lcd/lcd_nanovg.c', 'main_loop/main_loop_nanovg.c']; -elif os.environ['LCD'] == 'SDL': +if os.environ['LCD'] == 'SDL_GPU': + sources += ['window_animators/window_animator_gpu.c']; + sources += ['lcd/lcd_nanovg.c', 'main_loop/main_loop_sdl_gpu.c']; +elif os.environ['LCD'] == 'SDL_FB': sources += ['window_animators/window_animator_fb.c']; - sources += ['lcd/lcd_sdl2.c', 'main_loop/main_loop_sdl2.c'] + sources += ['lcd/lcd_sdl2.c', 'main_loop/main_loop_sdl_fb.c'] else: sources += ['window_animators/window_animator_fb.c']; sources += [ - 'vgcanvas/vgcanvas_nanovg.c', 'input_methods/input_method_creator.c' ] + Glob('lcd/lcd_mem_*.c') ; +if NANOVG_BACKEND == 'BGFX': + sources +=['vgcanvas/vgcanvas_nanovg_bgfx.c']; +elif NANOVG_BACKEND == 'AGG': + sources +=['vgcanvas/vgcanvas_nanovg_soft.c']; +elif NANOVG_BACKEND == 'AGGE': + sources +=['vgcanvas/vgcanvas_nanovg_soft.c']; +else: + sources +=['vgcanvas/vgcanvas_nanovg_gl.c']; + if os.environ['INPUT_ENGINE'] == 'null': sources += Glob('input_engines/input_engine_null.c') else: diff --git a/src/main_loop/main_loop_sdl2.c b/src/main_loop/main_loop_sdl_fb.c similarity index 84% rename from src/main_loop/main_loop_sdl2.c rename to src/main_loop/main_loop_sdl_fb.c index 659c418a7..853e8b767 100644 --- a/src/main_loop/main_loop_sdl2.c +++ b/src/main_loop/main_loop_sdl_fb.c @@ -1,5 +1,5 @@ /** - * File: main_loop_sdl2.c + * File: main_loop_sdl_fb.c * Author: AWTK Develop Team * Brief: sdl2 implemented main_loop interface * @@ -20,7 +20,7 @@ */ #include "main_loop/main_loop_simple.h" -#include "main_loop/main_loop_sdl2.h" +#include "main_loop/main_loop_sdl_fb.h" #include "base/window_manager.h" #include "base/font_manager.h" #include "lcd/lcd_sdl2.h" @@ -35,7 +35,7 @@ #include "sdl2_common.inc" -static ret_t main_loop_sdl2_destroy(main_loop_t* l) { +static ret_t main_loop_sdl_fb_destroy(main_loop_t* l) { const char* errMsg = SDL_GetError(); main_loop_simple_t* loop = (main_loop_simple_t*)l; @@ -57,7 +57,7 @@ static ret_t main_loop_sdl2_destroy(main_loop_t* l) { return RET_OK; } -static ret_t main_loop_sdl2_create_window(main_loop_simple_t* l) { +static ret_t main_loop_sdl_fb_create_window(main_loop_simple_t* l) { int x = SDL_WINDOWPOS_UNDEFINED; int y = SDL_WINDOWPOS_UNDEFINED; int flags = SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED; @@ -77,10 +77,10 @@ static ret_t main_loop_sdl2_create_window(main_loop_simple_t* l) { main_loop_t* main_loop_init(int w, int h) { main_loop_simple_t* loop = main_loop_simple_init(w, h); - loop->base.destroy = main_loop_sdl2_destroy; - loop->dispatch_input = main_loop_sdl2_dispatch; + loop->base.destroy = main_loop_sdl_fb_destroy; + loop->dispatch_input = main_loop_sdl_fb_dispatch; - main_loop_sdl2_create_window(loop); + main_loop_sdl_fb_create_window(loop); SDL_StopTextInput(); return (main_loop_t*)loop; diff --git a/src/main_loop/main_loop_sdl2.h b/src/main_loop/main_loop_sdl_fb.h similarity index 80% rename from src/main_loop/main_loop_sdl2.h rename to src/main_loop/main_loop_sdl_fb.h index 1803a08cf..951b76955 100644 --- a/src/main_loop/main_loop_sdl2.h +++ b/src/main_loop/main_loop_sdl_fb.h @@ -1,5 +1,5 @@ /** - * File: main_loop_sdl2.h + * File: main_loop_sdl_fb.h * Author: AWTK Develop Team * Brief: sdl2 implemented main_loop interface * @@ -19,8 +19,8 @@ * */ -#ifndef TK_MAIN_LOOP_SDL2_H -#define TK_MAIN_LOOP_SDL2_H +#ifndef TK_MAIN_LOOP_SDL_FB_H +#define TK_MAIN_LOOP_SDL_FB_H #include "base/main_loop.h" @@ -30,4 +30,4 @@ main_loop_t* main_loop_init(int w, int h); END_C_DECLS -#endif /*TK_MAIN_LOOP_SDL2_H*/ +#endif /*TK_MAIN_LOOP_SDL_FB_H*/ diff --git a/src/main_loop/main_loop_nanovg.c b/src/main_loop/main_loop_sdl_gpu.c similarity index 57% rename from src/main_loop/main_loop_nanovg.c rename to src/main_loop/main_loop_sdl_gpu.c index 76df3a88c..885e2246a 100644 --- a/src/main_loop/main_loop_nanovg.c +++ b/src/main_loop/main_loop_sdl_gpu.c @@ -1,5 +1,5 @@ /** - * File: main_loop_nanovg.c + * File: main_loop_sdl_gpu.c * Author: AWTK Develop Team * Brief: nanovg implemented main_loop interface * @@ -19,23 +19,17 @@ * */ -#include "glad/glad.h" +#include #include "lcd/lcd_nanovg.h" -#include "main_loop/main_loop_nanovg.h" +#include "main_loop/main_loop_sdl_gpu.h" #include "main_loop/main_loop_simple.h" -#include -#include -#include - #define LOOP_SDL_WINDOW(loop) ((SDL_Window*)(((main_loop_simple_t*)loop)->user1)) -#define LOOP_SDL_GLCONTEXT(loop) ((SDL_Window*)(((main_loop_simple_t*)loop)->user2)) #define LOOP_SDL_WINDOW_SET(loop, v) (((main_loop_simple_t*)loop)->user1 = v) -#define LOOP_SDL_GLCONTEXT_SET(loop, v) (((main_loop_simple_t*)loop)->user2 = v) #include "sdl2_common.inc" -static ret_t main_loop_nanovg_destroy(main_loop_t* l) { +static ret_t main_loop_sdl_gpu_destroy(main_loop_t* l) { const char* errMsg = SDL_GetError(); main_loop_simple_t* loop = (main_loop_simple_t*)l; @@ -45,7 +39,6 @@ static ret_t main_loop_nanovg_destroy(main_loop_t* l) { if (LOOP_SDL_WINDOW(loop)) { SDL_DestroyWindow(LOOP_SDL_WINDOW(loop)); - SDL_GL_DeleteContext(LOOP_SDL_GLCONTEXT(loop)); } SDL_Quit(); @@ -54,11 +47,11 @@ static ret_t main_loop_nanovg_destroy(main_loop_t* l) { return RET_OK; } -static ret_t main_loop_nanovg_create_window(main_loop_simple_t* l) { +static ret_t main_loop_sdl_gpu_create_window(main_loop_simple_t* l) { int32_t x = SDL_WINDOWPOS_UNDEFINED; int32_t y = SDL_WINDOWPOS_UNDEFINED; - uint32_t flags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI; const char* title = system_info()->app_name; + uint32_t flags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI; if (title == NULL) { title = "AWTK Simulator"; @@ -73,33 +66,10 @@ static ret_t main_loop_nanovg_create_window(main_loop_simple_t* l) { exit(0); return RET_FAIL; } - - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); - -#ifdef WITH_NANOVG_GL2 - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); -#elif defined(WITH_NANOVG_GL3) - SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); -#endif - + LOOP_SDL_WINDOW_SET(l, SDL_CreateWindow(title, x, y, l->w, l->h, flags)); return_value_if_fail(LOOP_SDL_WINDOW(l) != NULL, RET_FAIL); - LOOP_SDL_GLCONTEXT_SET(l, SDL_GL_CreateContext(LOOP_SDL_WINDOW(l))); - SDL_GL_MakeCurrent(LOOP_SDL_WINDOW(l), LOOP_SDL_GLCONTEXT(l)); - SDL_GL_SetSwapInterval(1); - - gladLoadGL(); - glEnable(GL_ALPHA_TEST); - glEnable(GL_STENCIL_TEST); - glEnable(GL_DEPTH_TEST); - canvas_init(&(l->base.canvas), lcd_nanovg_init(LOOP_SDL_WINDOW(l)), font_manager()); return RET_OK; @@ -108,10 +78,10 @@ static ret_t main_loop_nanovg_create_window(main_loop_simple_t* l) { main_loop_t* main_loop_init(int w, int h) { main_loop_simple_t* loop = main_loop_simple_init(w, h); - loop->base.destroy = main_loop_nanovg_destroy; + loop->base.destroy = main_loop_sdl_gpu_destroy; loop->dispatch_input = main_loop_sdl2_dispatch; - main_loop_nanovg_create_window(loop); + main_loop_sdl_gpu_create_window(loop); SDL_StopTextInput(); return (main_loop_t*)loop; diff --git a/src/main_loop/main_loop_nanovg.h b/src/main_loop/main_loop_sdl_gpu.h similarity index 80% rename from src/main_loop/main_loop_nanovg.h rename to src/main_loop/main_loop_sdl_gpu.h index 285275dff..b36385e5b 100644 --- a/src/main_loop/main_loop_nanovg.h +++ b/src/main_loop/main_loop_sdl_gpu.h @@ -1,5 +1,5 @@ /** - * File: main_loop_nanovg.h + * File: main_loop_sdl_gpu.h * Author: AWTK Develop Team * Brief: nanovg implemented main_loop interface * @@ -19,8 +19,8 @@ * */ -#ifndef TK_MAIN_LOOP_NANOVG_H -#define TK_MAIN_LOOP_NANOVG_H +#ifndef TK_MAIN_LOOP_SDL_GPU_H +#define TK_MAIN_LOOP_SDL_GPU_H #include "base/main_loop.h" @@ -30,4 +30,4 @@ main_loop_t* main_loop_init(int w, int h); END_C_DECLS -#endif /*TK_MAIN_LOOP_NANOVG_H*/ +#endif /*TK_MAIN_LOOP_SDL_GPU_H*/ diff --git a/src/vgcanvas/README.md b/src/vgcanvas/README.md new file mode 100644 index 000000000..e68c2705b --- /dev/null +++ b/src/vgcanvas/README.md @@ -0,0 +1,11 @@ +# 矢量图绘图接口的实现 + +目前有4类实现: + +* vgcanvas\_nanovg\_soft 软件实现(**适合普通嵌入式平台**)。软件实现又有agg和agge两种实现。 + +* vgcanvas\_nanovg\_gl OpenGL实现。OpenGL实现又有OpenGL3、OpenGLES2和OpenGLES3三种实现。 + +* vgcanvas\_nanovg\_bfgx 基于bgfx的实现。bgfx可以使用平台特有的加速接口。如DirectX和Metal等。 + +* vgcanvas\_null 空实现。极低端平台不支持矢量图绘图函数,使用本实现。 diff --git a/src/vgcanvas/texture.inc b/src/vgcanvas/texture.inc new file mode 100644 index 000000000..eca500eae --- /dev/null +++ b/src/vgcanvas/texture.inc @@ -0,0 +1,42 @@ + +static ret_t nanovg_on_bitmap_destroy(bitmap_t* img) { + int32_t id = (char*)(img->specific) - (char*)NULL; + NVGcontext* vg = (NVGcontext*)(img->specific_ctx); + + if (vg != NULL && id >= 0) { + nvgDeleteImage(vg, id); + } + img->specific = NULL; + img->specific_ctx = NULL; + img->specific_destroy = NULL; + + return RET_OK; +} + +static int vgcanvas_nanovg_ensure_image(vgcanvas_nanovg_t* canvas, bitmap_t* img) { + int32_t i = 0; + if (img->flags & BITMAP_FLAG_TEXTURE) { + i = (char*)(img->specific) - (char*)NULL; + + if (img->flags & BITMAP_FLAG_CHANGED) { + img->flags &= (~(BITMAP_FLAG_CHANGED)); + nvgUpdateImage(canvas->vg, i, img->data); + log_debug("nvgUpdateImage %d\n", i); + } + + return i; + } + + i = nvgCreateImageRGBA(canvas->vg, img->w, img->h, NVG_IMAGE_NEAREST, img->data); + + if (i >= 0) { + img->flags |= BITMAP_FLAG_TEXTURE; + img->specific = (char*)NULL + i; + img->specific_ctx = canvas->vg; + img->specific_destroy = nanovg_on_bitmap_destroy; + image_manager_update_specific(image_manager(), img); + } + + return i; +} + diff --git a/src/vgcanvas/vgcanvas_nanovg.c b/src/vgcanvas/vgcanvas_nanovg.inc similarity index 58% rename from src/vgcanvas/vgcanvas_nanovg.c rename to src/vgcanvas/vgcanvas_nanovg.inc index 8bba9f22e..63b2155a7 100644 --- a/src/vgcanvas/vgcanvas_nanovg.c +++ b/src/vgcanvas/vgcanvas_nanovg.inc @@ -1,72 +1,10 @@ -/** - * File: vgcanvas.c - * Author: AWTK Develop Team - * Brief: vector graphics canvas base on nanovg - * - * Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * License file for more details. - * - */ - -/** - * History: - * ================================================================ - * 2018-04-14 Li XianJing created - * - */ - -#if defined(WITH_NANOVG_GL3) -#define NANOVG_GL3_IMPLEMENTATION -#endif - -#if defined(WITH_NANOVG_GLES2) -#define NANOVG_GLES2_IMPLEMENTATION -#endif - -#if defined(WITH_NANOVG_GLES3) -#define NANOVG_GLES3_IMPLEMENTATION -#endif - -#include "base/utf8.h" +#include "nanovg.h" #include "base/mem.h" +#include "base/utf8.h" #include "base/vgcanvas.h" #include "base/image_manager.h" #include "base/assets_manager.h" -#include "nanovg.h" - -#ifdef WITH_NANOVG_AGGE -#include "agge/nanovg_agge.h" -#elif defined(WITH_NANOVG_AGG) -#include "agg/nanovg_agg.h" -#else /*OpenGL*/ -#include "glad/glad.h" -#include "nanovg_gl.h" -#include "nanovg_gl_utils.h" - -#include -#include -#include -#endif /*WITH_NANOVG_AGGE*/ - -typedef struct _vgcanvas_nanovg_t { - vgcanvas_t base; - - int font_id; - NVGcontext* vg; - uint32_t text_align_v; - uint32_t text_align_h; -#if defined(WITH_NANOVG_GL) - SDL_Window* sdl_window; -#endif /*WITH_NANOVG_GL*/ -} vgcanvas_nanovg_t; - -static int vgcanvas_nanovg_ensure_image(vgcanvas_nanovg_t* canvas, bitmap_t* img); - static ret_t vgcanvas_nanovg_reset(vgcanvas_t* vgcanvas) { (void)vgcanvas; @@ -374,22 +312,6 @@ static float_t vgcanvas_nanovg_measure_text(vgcanvas_t* vgcanvas, const char* te return nvgTextBounds(vg, 0, 0, text, text + strlen(text), bounds); } -#if defined(WITH_NANOVG_GL) -static ret_t nanovg_on_bitmap_destroy(bitmap_t* img) { - int32_t id = (char*)(img->specific) - (char*)NULL; - NVGcontext* vg = (NVGcontext*)(img->specific_ctx); - - if (vg != NULL && id >= 0) { - nvgDeleteImage(vg, id); - } - img->specific = NULL; - img->specific_ctx = NULL; - img->specific_destroy = NULL; - - return RET_OK; -} -#endif /*WITH_NANOVG_GL*/ - static ret_t vgcanvas_nanovg_draw_image(vgcanvas_t* vgcanvas, bitmap_t* img, float_t sx, float_t sy, float_t sw, float_t sh, float_t dx, float_t dy, float_t dw, float_t dh) { @@ -514,268 +436,6 @@ static ret_t vgcanvas_nanovg_restore(vgcanvas_t* vgcanvas) { return RET_OK; } -#if defined(WITH_NANOVG_SOFT) -static enum NVGtexture bitmap_format_to_nanovg(bitmap_format_t format) { - enum NVGtexture f = NVG_TEXTURE_BGRA; - - switch (format) { - case BITMAP_FMT_RGBA8888: { - f = NVG_TEXTURE_RGBA; - break; - } - case BITMAP_FMT_BGRA8888: { - f = NVG_TEXTURE_BGRA; - break; - } - case BITMAP_FMT_BGR888: { - f = NVG_TEXTURE_BGR; - break; - } - case BITMAP_FMT_RGB888: { - f = NVG_TEXTURE_RGB; - break; - } - case BITMAP_FMT_BGR565: { - f = NVG_TEXTURE_BGR565; - break; - } - case BITMAP_FMT_RGB565: { - f = NVG_TEXTURE_RGB565; - break; - } - default: { - assert(!"not supported format"); - break; - } - } - - return f; -} - -static ret_t vgcanvas_nanovg_create_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - return RET_NOT_IMPL; -} - -static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - return RET_NOT_IMPL; -} - -static ret_t vgcanvas_nanovg_bind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - return RET_NOT_IMPL; -} - -static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - return RET_NOT_IMPL; -} - -static ret_t vgcanvas_nanovg_reinit(vgcanvas_t* vgcanvas, uint32_t w, uint32_t h, uint32_t stride, - bitmap_format_t format, void* data) { - vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; - NVGcontext* vg = canvas->vg; - - vgcanvas->w = w; - vgcanvas->h = h; - vgcanvas->buff = (uint32_t*)data; - nvgReinitAgge(vg, w, h, stride, bitmap_format_to_nanovg(format), data); - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_begin_frame(vgcanvas_t* vgcanvas, rect_t* dirty_rect) { - vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; - NVGcontext* vg = canvas->vg; - - nvgBeginFrame(vg, vgcanvas->w, vgcanvas->h, vgcanvas->ratio); - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_end_frame(vgcanvas_t* vgcanvas) { - vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; - NVGcontext* vg = canvas->vg; - - nvgEndFrame(vg); - - return RET_OK; -} - -static int vgcanvas_nanovg_ensure_image(vgcanvas_nanovg_t* canvas, bitmap_t* img) { - int32_t i = 0; - int32_t f = 0; - if (img->flags & BITMAP_FLAG_TEXTURE) { - i = (char*)(img->specific) - (char*)NULL; - - return i; - } - - switch (img->format) { - case BITMAP_FMT_RGBA8888: { - f = NVG_TEXTURE_RGBA; - break; - } - case BITMAP_FMT_BGRA8888: { - f = NVG_TEXTURE_BGRA; - break; - } - case BITMAP_FMT_BGR565: { - f = NVG_TEXTURE_BGR565; - break; - } - case BITMAP_FMT_RGB888: { - f = NVG_TEXTURE_RGB; - break; - } - default: { assert(!"not supported format"); } - } - - i = nvgCreateImageRaw(canvas->vg, img->w, img->h, f, NVG_IMAGE_NEAREST, img->data); - - if (i >= 0) { - img->flags |= BITMAP_FLAG_TEXTURE; - img->specific = (char*)NULL + i; - image_manager_update_specific(image_manager(), img); - } - - return i; -} -#else -static ret_t vgcanvas_nanovg_reinit(vgcanvas_t* vg, uint32_t w, uint32_t h, uint32_t stride, - bitmap_format_t format, void* data) { - (void)vg; - (void)w; - (void)h; - (void)format; - (void)data; - return RET_OK; -} - -static ret_t vgcanvas_nanovg_begin_frame(vgcanvas_t* vgcanvas, rect_t* dirty_rect) { - int ww = 0; - int wh = 0; - int fw = 0; - int fh = 0; - - vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; - SDL_Window* sdl_window = canvas->sdl_window; - NVGcontext* vg = canvas->vg; - - SDL_GetWindowSize(sdl_window, &ww, &wh); - SDL_GL_GetDrawableSize(sdl_window, &fw, &fh); - - glViewport(0, 0, fw, fh); - glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - - nvgBeginFrame(vg, ww, wh, vgcanvas->ratio); - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_end_frame(vgcanvas_t* vgcanvas) { - vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; - SDL_Window* sdl_window = canvas->sdl_window; - NVGcontext* vg = canvas->vg; - - nvgEndFrame(vg); - SDL_GL_SwapWindow(sdl_window); - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_create_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - NVGLUframebuffer* handle = NULL; - NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; - - handle = nvgluCreateFramebuffer(vg, (int)(vgcanvas->w * vgcanvas->ratio), - (int)(vgcanvas->h * vgcanvas->ratio), 0); - return_value_if_fail(handle != NULL, RET_FAIL); - - fbo->w = vgcanvas->w; - fbo->h = vgcanvas->h; - fbo->handle = handle; - fbo->id = handle->image; - fbo->ratio = vgcanvas->ratio; - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - NVGLUframebuffer* handle = (NVGLUframebuffer*)fbo->handle; - nvgluDeleteFramebuffer(handle); - (void)vgcanvas; - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_bind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; - NVGLUframebuffer* handle = (NVGLUframebuffer*)fbo->handle; - - nvgluBindFramebuffer(handle); - glClearColor(0, 0, 0, 0); - glViewport(0, 0, fbo->w * fbo->ratio, fbo->h * fbo->ratio); - glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - nvgBeginFrame(vg, fbo->w, fbo->h, fbo->ratio); - - return RET_OK; -} - -static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { - NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; - - nvgEndFrame(vg); - nvgluBindFramebuffer(NULL); - - return RET_OK; -} - -static int vgcanvas_nanovg_ensure_image(vgcanvas_nanovg_t* canvas, bitmap_t* img) { - int32_t i = 0; - if (img->flags & BITMAP_FLAG_TEXTURE) { - i = (char*)(img->specific) - (char*)NULL; - - if (img->flags & BITMAP_FLAG_CHANGED) { - img->flags &= (~(BITMAP_FLAG_CHANGED)); - nvgUpdateImage(canvas->vg, i, img->data); - log_debug("nvgUpdateImage %d\n", i); - } - - return i; - } - - i = nvgCreateImageRGBA(canvas->vg, img->w, img->h, NVG_IMAGE_NEAREST, img->data); - - if (i >= 0) { - img->flags |= BITMAP_FLAG_TEXTURE; - img->specific = (char*)NULL + i; - img->specific_ctx = canvas->vg; - img->specific_destroy = nanovg_on_bitmap_destroy; - image_manager_update_specific(image_manager(), img); - } - - return i; -} - -#endif /*WITH_NANOVG_AGGE*/ - -static ret_t vgcanvas_nanovg_destroy(vgcanvas_t* vgcanvas) { - NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; -#if defined(WITH_NANOVG_GL3) - nvgDeleteGL3(vg); -#elif defined(WITH_NANOVG_GLES2) - nvgDeleteGLES2(vg); -#elif defined(WITH_NANOVG_GLES3) - nvgDeleteGLES3(vg); -#elif defined(WITH_NANOVG_AGGE) - nvgDeleteAGGE(vg); -#elif defined(WITH_NANOVG_AGG) - nvgDeleteAGG(vg); -#endif - TKMEM_FREE(vgcanvas); - - return RET_OK; -} - static const vgcanvas_vtable_t vt = {vgcanvas_nanovg_reinit, vgcanvas_nanovg_begin_frame, vgcanvas_nanovg_reset, @@ -825,60 +485,3 @@ static const vgcanvas_vtable_t vt = {vgcanvas_nanovg_reinit, vgcanvas_nanovg_unbind_fbo, vgcanvas_nanovg_destroy}; -#if defined(WITH_NANOVG_SOFT) -vgcanvas_t* vgcanvas_create(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format, - void* data) { - enum NVGtexture f = bitmap_format_to_nanovg(format); - vgcanvas_nanovg_t* nanovg = (vgcanvas_nanovg_t*)TKMEM_ZALLOC(vgcanvas_nanovg_t); - return_value_if_fail(nanovg != NULL, NULL); - - nanovg->base.w = w; - nanovg->base.h = h; - nanovg->base.vt = &vt; - nanovg->base.ratio = 1; - nanovg->base.buff = (uint32_t*)data; -#if defined(WITH_NANOVG_AGG) - nanovg->vg = nvgCreateAGG(w, h, stride, f, (uint8_t*)data); -#elif defined(WITH_NANOVG_AGGE) - nanovg->vg = nvgCreateAGGE(w, h, stride, f, (uint8_t*)data); -#else -#error "not supported" -#endif - - return &(nanovg->base); -} -#else /*OpenGL*/ -vgcanvas_t* vgcanvas_create(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format, - void* sdl_window) { - int ww = 0; - int wh = 0; - int fw = 0; - int fh = 0; - vgcanvas_nanovg_t* nanovg = (vgcanvas_nanovg_t*)TKMEM_ZALLOC(vgcanvas_nanovg_t); - return_value_if_fail(nanovg != NULL, NULL); - - (void)format; - - SDL_GetWindowSize((SDL_Window*)sdl_window, &ww, &wh); - SDL_GL_GetDrawableSize((SDL_Window*)sdl_window, &fw, &fh); - - nanovg->base.w = w; - nanovg->base.h = h; - nanovg->base.vt = &vt; - nanovg->base.ratio = (float)fw / (float)ww; - nanovg->sdl_window = (SDL_Window*)sdl_window; -#if defined(WITH_NANOVG_GL3) - nanovg->vg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); -#elif defined(WITH_NANOVG_GLES2) - nanovg->vg = nvgCreateGLES2(NVG_ANTIALIAS | NVG_STENCIL_STROKES); -#elif defined(WITH_NANOVG_GLES3) - nanovg->vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); -#endif - - if (nanovg->vg == NULL) { - assert(!"OpenGL is not supported!"); - } - - return &(nanovg->base); -} -#endif diff --git a/src/vgcanvas/vgcanvas_nanovg_bgfx.c b/src/vgcanvas/vgcanvas_nanovg_bgfx.c new file mode 100644 index 000000000..303ee28d9 --- /dev/null +++ b/src/vgcanvas/vgcanvas_nanovg_bgfx.c @@ -0,0 +1,62 @@ +/** + * File: vgcanvas_nanovg_bgfx.c + * Author: AWTK Develop Team + * Brief: vector graphics canvas base on nanovg-bgfx + * + * Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * License file for more details. + * + */ + +/** + * History: + * ================================================================ + * 2018-04-14 Li XianJing created + * + */ + +#include "nanovg.h" +#include "base/mem.h" +#include "base/vgcanvas.h" +#include "bgfx/nanovg_bgfx.h" +#include "base/image_manager.h" + +typedef struct _vgcanvas_nanovg_t { + vgcanvas_t base; + + int font_id; + NVGcontext* vg; + uint32_t text_align_v; + uint32_t text_align_h; + SDL_Window* sdl_window; +} vgcanvas_nanovg_t; + +#include "texture.inc" +#include "vgcanvas_nanovg_bgfx.inc" +#include "vgcanvas_nanovg.inc" + +vgcanvas_t* vgcanvas_create(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format, + void* sdl_window) { + vgcanvas_nanovg_t* nanovg = (vgcanvas_nanovg_t*)TKMEM_ZALLOC(vgcanvas_nanovg_t); + return_value_if_fail(nanovg != NULL, NULL); + + (void)format; + (void)stride; + + nanovg->base.w = w; + nanovg->base.h = h; + nanovg->base.vt = &vt; + nanovg->base.ratio = 1; + nanovg->sdl_window = (SDL_Window*)sdl_window; + nanovg->vg = nvgCreateBGFX(1, 0, w, h, nanovg->sdl_window); + + if (nanovg->vg == NULL) { + assert(!"BGFX is not supported!"); + } + + return &(nanovg->base); +} diff --git a/src/vgcanvas/vgcanvas_nanovg_bgfx.inc b/src/vgcanvas/vgcanvas_nanovg_bgfx.inc new file mode 100644 index 000000000..7dbc555bc --- /dev/null +++ b/src/vgcanvas/vgcanvas_nanovg_bgfx.inc @@ -0,0 +1,52 @@ +static ret_t vgcanvas_nanovg_reinit(vgcanvas_t* vg, uint32_t w, uint32_t h, uint32_t stride, + bitmap_format_t format, void* data) { + (void)vg; + (void)w; + (void)h; + (void)format; + (void)data; + return RET_OK; +} + +static ret_t vgcanvas_nanovg_begin_frame(vgcanvas_t* vgcanvas, rect_t* dirty_rect) { + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + + nvgBeginFrame(canvas->vg, vgcanvas->w, vgcanvas->h, vgcanvas->ratio); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_end_frame(vgcanvas_t* vgcanvas) { + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + NVGcontext* vg = canvas->vg; + + nvgEndFrame(vg); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_create_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_OK; +} + +static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_OK; +} + +static ret_t vgcanvas_nanovg_bind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_OK; +} + +static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_OK; +} + +static ret_t vgcanvas_nanovg_destroy(vgcanvas_t* vgcanvas) { + NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; + + nvgDeleteBGFX(vg); + TKMEM_FREE(vgcanvas); + + return RET_OK; +} + diff --git a/src/vgcanvas/vgcanvas_nanovg_gl.c b/src/vgcanvas/vgcanvas_nanovg_gl.c new file mode 100644 index 000000000..9baff4f94 --- /dev/null +++ b/src/vgcanvas/vgcanvas_nanovg_gl.c @@ -0,0 +1,126 @@ +/** + * File: vgcanvas_nanovg_gl.c + * Author: AWTK Develop Team + * Brief: vector graphics canvas base on nanovg-gl + * + * Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * License file for more details. + * + */ + +/** + * History: + * ================================================================ + * 2018-04-14 Li XianJing created + * + */ + +#if defined(WITH_NANOVG_GL3) +#define NANOVG_GL3_IMPLEMENTATION +#endif + +#if defined(WITH_NANOVG_GLES2) +#define NANOVG_GLES2_IMPLEMENTATION +#endif + +#if defined(WITH_NANOVG_GLES3) +#define NANOVG_GLES3_IMPLEMENTATION +#endif + +#include "glad/glad.h" + +#include "nanovg.h" +#include "base/utf8.h" +#include "base/mem.h" +#include "base/vgcanvas.h" +#include "base/image_manager.h" +#include "base/assets_manager.h" + +#include +#include "nanovg_gl.h" +#include +#include +#include "nanovg_gl_utils.h" + +typedef struct _vgcanvas_nanovg_t { + vgcanvas_t base; + + int font_id; + NVGcontext* vg; + uint32_t text_align_v; + uint32_t text_align_h; + + SDL_Window* sdl_window; + SDL_GLContext context; +} vgcanvas_nanovg_t; + +#include "texture.inc" +#include "vgcanvas_nanovg_gl.inc" +#include "vgcanvas_nanovg.inc" + +static ret_t vgcanvas_init_gl(vgcanvas_nanovg_t* nanovg, SDL_Window* win) { + + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); + +#ifdef WITH_NANOVG_GL2 + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); +#elif defined(WITH_NANOVG_GL3) + SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); +#endif + + nanovg->context = SDL_GL_CreateContext(win); + SDL_GL_MakeCurrent(win, nanovg->context); + SDL_GL_SetSwapInterval(1); + + gladLoadGL(); + glEnable(GL_ALPHA_TEST); + glEnable(GL_STENCIL_TEST); + glEnable(GL_DEPTH_TEST); + + return RET_OK; +} + +vgcanvas_t* vgcanvas_create(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format, + void* sdl_window) { + int ww = 0; + int wh = 0; + int fw = 0; + int fh = 0; + vgcanvas_nanovg_t* nanovg = (vgcanvas_nanovg_t*)TKMEM_ZALLOC(vgcanvas_nanovg_t); + return_value_if_fail(nanovg != NULL, NULL); + + (void)format; + + SDL_GetWindowSize((SDL_Window*)sdl_window, &ww, &wh); + SDL_GL_GetDrawableSize((SDL_Window*)sdl_window, &fw, &fh); + + nanovg->base.w = w; + nanovg->base.h = h; + nanovg->base.vt = &vt; + nanovg->base.ratio = (float)fw / (float)ww; + nanovg->sdl_window = (SDL_Window*)sdl_window; + vgcanvas_init_gl(nanovg, nanovg->sdl_window); +#if defined(WITH_NANOVG_GL3) + nanovg->vg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); +#elif defined(WITH_NANOVG_GLES2) + nanovg->vg = nvgCreateGLES2(NVG_ANTIALIAS | NVG_STENCIL_STROKES); +#elif defined(WITH_NANOVG_GLES3) + nanovg->vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); +#endif + + if (nanovg->vg == NULL) { + assert(!"OpenGL is not supported!"); + } + + return &(nanovg->base); +} diff --git a/src/vgcanvas/vgcanvas_nanovg_gl.inc b/src/vgcanvas/vgcanvas_nanovg_gl.inc new file mode 100644 index 000000000..b28058fa1 --- /dev/null +++ b/src/vgcanvas/vgcanvas_nanovg_gl.inc @@ -0,0 +1,110 @@ +#include "glad/glad.h" +#include +#include + +static ret_t vgcanvas_nanovg_reinit(vgcanvas_t* vg, uint32_t w, uint32_t h, uint32_t stride, + bitmap_format_t format, void* data) { + (void)vg; + (void)w; + (void)h; + (void)format; + (void)data; + return RET_OK; +} + +static ret_t vgcanvas_nanovg_begin_frame(vgcanvas_t* vgcanvas, rect_t* dirty_rect) { + int ww = 0; + int wh = 0; + int fw = 0; + int fh = 0; + + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + SDL_Window* sdl_window = canvas->sdl_window; + NVGcontext* vg = canvas->vg; + + SDL_GetWindowSize(sdl_window, &ww, &wh); + SDL_GL_GetDrawableSize(sdl_window, &fw, &fh); + + glViewport(0, 0, fw, fh); + glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + + nvgBeginFrame(vg, ww, wh, vgcanvas->ratio); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_end_frame(vgcanvas_t* vgcanvas) { + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + SDL_Window* sdl_window = canvas->sdl_window; + NVGcontext* vg = canvas->vg; + + nvgEndFrame(vg); + SDL_GL_SwapWindow(sdl_window); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_create_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + NVGLUframebuffer* handle = NULL; + NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; + + handle = nvgluCreateFramebuffer(vg, (int)(vgcanvas->w * vgcanvas->ratio), + (int)(vgcanvas->h * vgcanvas->ratio), 0); + return_value_if_fail(handle != NULL, RET_FAIL); + + fbo->w = vgcanvas->w; + fbo->h = vgcanvas->h; + fbo->handle = handle; + fbo->id = handle->image; + fbo->ratio = vgcanvas->ratio; + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + NVGLUframebuffer* handle = (NVGLUframebuffer*)fbo->handle; + nvgluDeleteFramebuffer(handle); + (void)vgcanvas; + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_bind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; + NVGLUframebuffer* handle = (NVGLUframebuffer*)fbo->handle; + + nvgluBindFramebuffer(handle); + glClearColor(0, 0, 0, 0); + glViewport(0, 0, fbo->w * fbo->ratio, fbo->h * fbo->ratio); + glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + nvgBeginFrame(vg, fbo->w, fbo->h, fbo->ratio); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; + + nvgEndFrame(vg); + nvgluBindFramebuffer(NULL); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_destroy(vgcanvas_t* vgcanvas) { + NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; +#if defined(WITH_NANOVG_GL3) + nvgDeleteGL3(vg); +#elif defined(WITH_NANOVG_GLES2) + nvgDeleteGLES2(vg); +#elif defined(WITH_NANOVG_GLES3) + nvgDeleteGLES3(vg); +#endif + SDL_GL_DeleteContext(((vgcanvas_nanovg_t*)vgcanvas)->context); + + TKMEM_FREE(vgcanvas); + + return RET_OK; +} + diff --git a/src/vgcanvas/vgcanvas_nanovg_soft.c b/src/vgcanvas/vgcanvas_nanovg_soft.c new file mode 100644 index 000000000..4eb6fc4ae --- /dev/null +++ b/src/vgcanvas/vgcanvas_nanovg_soft.c @@ -0,0 +1,68 @@ +/** + * File: vgcanvas_nanovg_soft.c + * Author: AWTK Develop Team + * Brief: vector graphics canvas base on nanovg-soft + * + * Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * License file for more details. + * + */ + +/** + * History: + * ================================================================ + * 2018-04-14 Li XianJing created + * + */ + + +#include "nanovg.h" +#include "base/utf8.h" +#include "base/mem.h" +#include "base/vgcanvas.h" +#include "base/image_manager.h" +#include "base/assets_manager.h" + +#ifdef WITH_NANOVG_AGGE +#include "agge/nanovg_agge.h" +#elif defined(WITH_NANOVG_AGG) +#include "agg/nanovg_agg.h" +#endif/*WITH_NANOVG_AGGE|WITH_NANOVG_AGG*/ + +typedef struct _vgcanvas_nanovg_t { + vgcanvas_t base; + + int font_id; + NVGcontext* vg; + uint32_t text_align_v; + uint32_t text_align_h; +} vgcanvas_nanovg_t; + +#include "vgcanvas_nanovg_soft.inc" +#include "vgcanvas_nanovg.inc" + +vgcanvas_t* vgcanvas_create(uint32_t w, uint32_t h, uint32_t stride, bitmap_format_t format, + void* data) { + enum NVGtexture f = bitmap_format_to_nanovg(format); + vgcanvas_nanovg_t* nanovg = (vgcanvas_nanovg_t*)TKMEM_ZALLOC(vgcanvas_nanovg_t); + return_value_if_fail(nanovg != NULL, NULL); + + nanovg->base.w = w; + nanovg->base.h = h; + nanovg->base.vt = &vt; + nanovg->base.ratio = 1; + nanovg->base.buff = (uint32_t*)data; +#if defined(WITH_NANOVG_AGG) + nanovg->vg = nvgCreateAGG(w, h, stride, f, (uint8_t*)data); +#elif defined(WITH_NANOVG_AGGE) + nanovg->vg = nvgCreateAGGE(w, h, stride, f, (uint8_t*)data); +#else + assert(!"not support backend"); +#endif + + return &(nanovg->base); +} diff --git a/src/vgcanvas/vgcanvas_nanovg_soft.inc b/src/vgcanvas/vgcanvas_nanovg_soft.inc new file mode 100644 index 000000000..a1b8fd555 --- /dev/null +++ b/src/vgcanvas/vgcanvas_nanovg_soft.inc @@ -0,0 +1,142 @@ + +static enum NVGtexture bitmap_format_to_nanovg(bitmap_format_t format) { + enum NVGtexture f = NVG_TEXTURE_BGRA; + + switch (format) { + case BITMAP_FMT_RGBA8888: { + f = NVG_TEXTURE_RGBA; + break; + } + case BITMAP_FMT_BGRA8888: { + f = NVG_TEXTURE_BGRA; + break; + } + case BITMAP_FMT_BGR888: { + f = NVG_TEXTURE_BGR; + break; + } + case BITMAP_FMT_RGB888: { + f = NVG_TEXTURE_RGB; + break; + } + case BITMAP_FMT_BGR565: { + f = NVG_TEXTURE_BGR565; + break; + } + case BITMAP_FMT_RGB565: { + f = NVG_TEXTURE_RGB565; + break; + } + default: { + assert(!"not supported format"); + break; + } + } + + return f; +} + +static ret_t vgcanvas_nanovg_create_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_NOT_IMPL; +} + +static ret_t vgcanvas_nanovg_destroy_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_NOT_IMPL; +} + +static ret_t vgcanvas_nanovg_bind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_NOT_IMPL; +} + +static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo) { + return RET_NOT_IMPL; +} + +static ret_t vgcanvas_nanovg_reinit(vgcanvas_t* vgcanvas, uint32_t w, uint32_t h, uint32_t stride, + bitmap_format_t format, void* data) { + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + NVGcontext* vg = canvas->vg; + + vgcanvas->w = w; + vgcanvas->h = h; + vgcanvas->buff = (uint32_t*)data; + nvgReinitAgge(vg, w, h, stride, bitmap_format_to_nanovg(format), data); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_begin_frame(vgcanvas_t* vgcanvas, rect_t* dirty_rect) { + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + NVGcontext* vg = canvas->vg; + + nvgBeginFrame(vg, vgcanvas->w, vgcanvas->h, vgcanvas->ratio); + + return RET_OK; +} + +static ret_t vgcanvas_nanovg_end_frame(vgcanvas_t* vgcanvas) { + vgcanvas_nanovg_t* canvas = (vgcanvas_nanovg_t*)vgcanvas; + NVGcontext* vg = canvas->vg; + + nvgEndFrame(vg); + + return RET_OK; +} + +static int vgcanvas_nanovg_ensure_image(vgcanvas_nanovg_t* canvas, bitmap_t* img) { + int32_t i = 0; + int32_t f = 0; + if (img->flags & BITMAP_FLAG_TEXTURE) { + i = (char*)(img->specific) - (char*)NULL; + + return i; + } + + switch (img->format) { + case BITMAP_FMT_RGBA8888: { + f = NVG_TEXTURE_RGBA; + break; + } + case BITMAP_FMT_BGRA8888: { + f = NVG_TEXTURE_BGRA; + break; + } + case BITMAP_FMT_BGR565: { + f = NVG_TEXTURE_BGR565; + break; + } + case BITMAP_FMT_RGB888: { + f = NVG_TEXTURE_RGB; + break; + } + default: { assert(!"not supported format"); } + } + + i = nvgCreateImageRaw(canvas->vg, img->w, img->h, f, NVG_IMAGE_NEAREST, img->data); + + if (i >= 0) { + img->flags |= BITMAP_FLAG_TEXTURE; + img->specific = (char*)NULL + i; + image_manager_update_specific(image_manager(), img); + } + + return i; +} + +static ret_t vgcanvas_nanovg_destroy(vgcanvas_t* vgcanvas) { + NVGcontext* vg = ((vgcanvas_nanovg_t*)vgcanvas)->vg; +#if defined(WITH_NANOVG_GL3) + nvgDeleteGL3(vg); +#elif defined(WITH_NANOVG_GLES2) + nvgDeleteGLES2(vg); +#elif defined(WITH_NANOVG_GLES3) + nvgDeleteGLES3(vg); +#elif defined(WITH_NANOVG_AGGE) + nvgDeleteAGGE(vg); +#elif defined(WITH_NANOVG_AGG) + nvgDeleteAGG(vg); +#endif + TKMEM_FREE(vgcanvas); + + return RET_OK; +} diff --git a/src/window_animators/window_animator_opengl.c b/src/window_animators/window_animator_gpu.c similarity index 100% rename from src/window_animators/window_animator_opengl.c rename to src/window_animators/window_animator_gpu.c