diff --git a/include/bgfx.h b/include/bgfx.h index 097770c4..63f70f96 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -165,6 +165,7 @@ namespace bgfx D3D9_UnableToCreateDevice, D3D9_UnableToCreateRenderTarget, D3D9_UnableToCreateTexture, + D3D11_UnableToInitialize, OPENGL_UnableToCreateContext, }; }; @@ -175,7 +176,8 @@ namespace bgfx { Null = 0, Direct3D9, - OpenGLES, + Direct3D11, + OpenGLES2, OpenGL, }; }; @@ -283,10 +285,10 @@ namespace bgfx }; }; - typedef void (*fatalFn)(Fatal::Enum _code, const char* _str); - typedef void* (*reallocFn)(void* _ptr, size_t _size); - typedef void (*freeFn)(void* _ptr); - typedef void (*cacheFn)(uint64_t _id, bool _store, void* _data, uint32_t& _length); + typedef void (*FatalFn)(Fatal::Enum _code, const char* _str); + typedef void* (*ReallocFn)(void* _ptr, size_t _size); + typedef void (*FreeFn)(void* _ptr); + typedef void (*CacheFn)(uint64_t _id, bool _store, void* _data, uint32_t& _length); struct VertexDecl { @@ -305,7 +307,7 @@ namespace bgfx RendererType::Enum getRendererType(); /// - void init(bool _createRenderThread = true, fatalFn _fatal = NULL, reallocFn _realloc = NULL, freeFn _free = NULL, cacheFn _cache = NULL); + void init(bool _createRenderThread = true, FatalFn _fatal = NULL, ReallocFn _realloc = NULL, FreeFn _free = NULL, CacheFn _cache = NULL); /// void shutdown(); diff --git a/premake/bgfx.lua b/premake/bgfx.lua index e607b683..dc1a98e2 100644 --- a/premake/bgfx.lua +++ b/premake/bgfx.lua @@ -25,6 +25,7 @@ project "bgfx" includedirs { BGFX_DIR .. "include", + "$(DXSDK_DIR)/include", } files { diff --git a/premake/shaderc.lua b/premake/shaderc.lua index 999c575e..9eb26e04 100644 --- a/premake/shaderc.lua +++ b/premake/shaderc.lua @@ -52,4 +52,6 @@ project "shaderc" links { "d3dx9", + "d3dcompiler", + "dxguid", } diff --git a/src/bgfx.cpp b/src/bgfx.cpp index d77788cb..af6479e4 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -63,10 +63,10 @@ namespace bgfx _length = 0; } - fatalFn g_fatal = fatalStub; - reallocFn g_realloc = reallocStub; - freeFn g_free = freeStub; - cacheFn g_cache = cacheStub; + FatalFn g_fatal = fatalStub; + ReallocFn g_realloc = reallocStub; + FreeFn g_free = freeStub; + CacheFn g_cache = cacheStub; static BX_THREAD uint32_t s_threadIndex = 0; static Context s_ctx; @@ -199,8 +199,8 @@ namespace bgfx { m_decl.begin(); m_decl.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float); - m_decl.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8); - m_decl.add(bgfx::Attrib::Color1, 4, bgfx::AttribType::Uint8); + m_decl.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true); + m_decl.add(bgfx::Attrib::Color1, 4, bgfx::AttribType::Uint8, true); m_decl.add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float); m_decl.end(); @@ -228,8 +228,11 @@ namespace bgfx m_texture = s_ctx.createTexture(mem, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT, NULL, NULL); #if BGFX_CONFIG_RENDERER_DIRECT3D9 - mem = bgfx::alloc(sizeof(vs_debugfont_hlsl)+1); - memcpy(mem->data, vs_debugfont_hlsl, mem->size-1); + mem = bgfx::alloc(sizeof(vs_debugfont_dx9)+1); + memcpy(mem->data, vs_debugfont_dx9, mem->size-1); +#elif BGFX_CONFIG_RENDERER_DIRECT3D11 + mem = bgfx::alloc(sizeof(vs_debugfont_dx11)+1); + memcpy(mem->data, vs_debugfont_dx11, mem->size-1); #else mem = bgfx::alloc(sizeof(vs_debugfont_glsl)+1); memcpy(mem->data, vs_debugfont_glsl, mem->size-1); @@ -238,8 +241,11 @@ namespace bgfx bgfx::VertexShaderHandle vsh = bgfx::createVertexShader(mem); #if BGFX_CONFIG_RENDERER_DIRECT3D9 - mem = bgfx::alloc(sizeof(fs_debugfont_hlsl)+1); - memcpy(mem->data, fs_debugfont_hlsl, mem->size-1); + mem = bgfx::alloc(sizeof(fs_debugfont_dx9)+1); + memcpy(mem->data, fs_debugfont_dx9, mem->size-1); +#elif BGFX_CONFIG_RENDERER_DIRECT3D11 + mem = bgfx::alloc(sizeof(fs_debugfont_dx11)+1); + memcpy(mem->data, fs_debugfont_dx11, mem->size-1); #else mem = bgfx::alloc(sizeof(fs_debugfont_glsl)+1); memcpy(mem->data, fs_debugfont_glsl, mem->size-1); @@ -372,6 +378,11 @@ namespace bgfx "u_alphaRef", }; + const char* getPredefinedUniformName(PredefinedUniform::Enum _enum) + { + return s_predefinedName[_enum]; + } + PredefinedUniform::Enum nameToPredefinedUniformEnum(const char* _name) { for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) @@ -460,16 +471,18 @@ namespace bgfx { #if BGFX_CONFIG_RENDERER_DIRECT3D9 return RendererType::Direct3D9; +#elif BGFX_CONFIG_RENDERER_DIRECT3D11 + return RendererType::Direct3D11; #elif BGFX_CONFIG_RENDERER_OPENGL return RendererType::OpenGL; #elif BGFX_CONFIG_RENDERER_OPENGLES2 - return RendererType::OpenGLES; + return RendererType::OpenGLES2; #else return RendererType::Null; #endif // BGFX_CONFIG_RENDERER_ } - void init(bool _createRenderThread, fatalFn _fatal, reallocFn _realloc, freeFn _free, cacheFn _cache) + void init(bool _createRenderThread, FatalFn _fatal, ReallocFn _realloc, FreeFn _free, CacheFn _cache) { if (NULL != _fatal) { @@ -742,9 +755,9 @@ namespace bgfx return mem; } - void release(Memory* _mem) + void release(const Memory* _mem) { - g_free(_mem); + g_free(const_cast<Memory*>(_mem) ); } void setDebug(uint32_t _debug) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index a30393c6..6efd9cfe 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -134,6 +134,8 @@ namespace stl = std; #if BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_RENDERER_NAME "Direct3D 9" +#elif BGFX_CONFIG_RENDERER_DIRECT3D11 +# define BGFX_RENDERER_NAME "Direct3D 11" #elif BGFX_CONFIG_RENDERER_OPENGL # define BGFX_RENDERER_NAME "OpenGL" #elif BGFX_CONFIG_RENDERER_OPENGLES2 @@ -143,13 +145,13 @@ namespace stl = std; namespace bgfx { extern const uint32_t g_constantTypeSize[ConstantType::Count]; - extern fatalFn g_fatal; - extern reallocFn g_realloc; - extern freeFn g_free; - extern cacheFn g_cache; + extern FatalFn g_fatal; + extern ReallocFn g_realloc; + extern FreeFn g_free; + extern CacheFn g_cache; void fatal(bgfx::Fatal::Enum _code, const char* _format, ...); - void release(Memory* _mem); + void release(const Memory* _mem); void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale = false, bool _yflip = false); const char* getAttribName(Attrib::Enum _attr); bool renderFrame(); @@ -339,6 +341,7 @@ namespace bgfx uint16_t m_count; }; + const char* getPredefinedUniformName(PredefinedUniform::Enum _enum); PredefinedUniform::Enum nameToPredefinedUniformEnum(const char* _name); class StreamRead diff --git a/src/charset.h b/src/charset.h index 3b37ba90..b876669a 100644 --- a/src/charset.h +++ b/src/charset.h @@ -1,734 +1,740 @@ -/* - * Copyright 2011-2012 Branimir Karadzic. All rights reserved. - * License: http://www.opensource.org/licenses/BSD-2-Clause - */ - -static const uint8_t vga8x8[256*8] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, - 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e, - 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, - 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, - 0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x92, 0x10, 0x7c, - 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c, - 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, - 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, - 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, - 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, - 0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78, - 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, - 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0, - 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0, - 0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99, - 0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00, - 0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00, - 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18, - 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, - 0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00, - 0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0x86, 0xfc, - 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, - 0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff, - 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, - 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, - 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, - 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, - 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x00, - 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, - 0x18, 0x7e, 0xc0, 0x7c, 0x06, 0xfc, 0x18, 0x00, - 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00, - 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00, - 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00, - 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00, - 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, - 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, - 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, - 0x7c, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0x7c, 0x00, - 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, - 0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00, - 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00, - 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00, - 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00, - 0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00, - 0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00, - 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00, - 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00, - 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, - 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00, - 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, - 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, - 0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00, - 0x7c, 0xc6, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, - 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00, - 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, - 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00, - 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, - 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, - 0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00, - 0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3a, 0x00, - 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00, - 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00, - 0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00, - 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, - 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00, - 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00, - 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, - 0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, - 0x7c, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x0e, 0x00, - 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00, - 0x7c, 0xc6, 0xe0, 0x78, 0x0e, 0xc6, 0x7c, 0x00, - 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, - 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00, - 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, - 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00, - 0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x00, - 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00, - 0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00, - 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, - 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00, - 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, - 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, - 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00, - 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00, - 0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, - 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, - 0x38, 0x6c, 0x64, 0xf0, 0x60, 0x60, 0xf0, 0x00, - 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, - 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00, - 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, - 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00, - 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xd6, 0x00, - 0x00, 0x00, 0xb8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, - 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, - 0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0, - 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e, - 0x00, 0x00, 0xdc, 0x76, 0x62, 0x60, 0xf0, 0x00, - 0x00, 0x00, 0x7c, 0xc0, 0x70, 0x1c, 0xf8, 0x00, - 0x10, 0x30, 0xfc, 0x30, 0x30, 0x34, 0x18, 0x00, - 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, - 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00, - 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00, - 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, - 0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00, - 0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00, - 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, - 0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00, - 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00, - 0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x0c, 0x06, 0x7c, - 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, - 0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, - 0x7e, 0x81, 0x3c, 0x06, 0x3e, 0x66, 0x3b, 0x00, - 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, - 0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, - 0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0x0c, 0x38, - 0x7e, 0x81, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, - 0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, - 0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, - 0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x7c, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00, - 0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0xc6, 0x10, 0x7c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, - 0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00, - 0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00, - 0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00, - 0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00, - 0x78, 0x84, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, - 0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, - 0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, - 0x78, 0x84, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, - 0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, - 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, - 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00, - 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, - 0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18, - 0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00, - 0xcc, 0xcc, 0x78, 0x30, 0xfc, 0x30, 0xfc, 0x30, - 0xf8, 0xcc, 0xcc, 0xfa, 0xc6, 0xcf, 0xc6, 0xc3, - 0x0e, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0xd8, 0x70, - 0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, - 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, - 0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, - 0x00, 0xf8, 0x00, 0xb8, 0xcc, 0xcc, 0xcc, 0x00, - 0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00, - 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, - 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, - 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3c, 0x00, - 0x00, 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00, - 0xc6, 0xcc, 0xd8, 0x36, 0x6b, 0xc2, 0x84, 0x0f, - 0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6d, 0xcf, 0x03, - 0x18, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x00, - 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00, - 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, - 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, - 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, - 0xdb, 0xf6, 0xdb, 0x6f, 0xdb, 0x7e, 0xd7, 0xed, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, - 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, - 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, - 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, - 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, - 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, - 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, - 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, - 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xdc, 0xc8, 0xdc, 0x76, 0x00, - 0x00, 0x78, 0xcc, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0, - 0x00, 0xfc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, - 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, - 0xfc, 0xcc, 0x60, 0x30, 0x60, 0xcc, 0xfc, 0x00, - 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0x70, 0x00, - 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0, - 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x00, - 0xfc, 0x30, 0x78, 0xcc, 0xcc, 0x78, 0x30, 0xfc, - 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x6c, 0x38, 0x00, - 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x6c, 0xee, 0x00, - 0x1c, 0x30, 0x18, 0x7c, 0xcc, 0xcc, 0x78, 0x00, - 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00, - 0x06, 0x0c, 0x7e, 0xdb, 0xdb, 0x7e, 0x60, 0xc0, - 0x38, 0x60, 0xc0, 0xf8, 0xc0, 0x60, 0x38, 0x00, - 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, - 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, - 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00, - 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xfc, 0x00, - 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xfc, 0x00, - 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70, - 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, - 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c, - 0x58, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, - 0x70, 0x98, 0x30, 0x60, 0xf8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const uint8_t vga8x16[256*16] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x99, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xd6, 0xd6, 0xe6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x0e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0xdc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, - 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, - 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, - 0x00, 0x00, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xcc, 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0xc6, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, - 0x00, 0xc6, 0xc6, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x93, 0x06, 0x0c, 0x1f, 0x00, 0x00, - 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9a, 0x3f, 0x06, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, - 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, - 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xcf, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x70, 0x98, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const uint8_t vs_debugfont_hlsl[418] = -{ - 0x01,0x00,0x0f,'u', '_', 'm', 'o', 'd', - 'e', 'l', 'V', 'i', 'e', 'w', 'P', 'r', - 'o', 'j', 0x09,0x01,0x00,0x00,0x04,0x00, - 0x88,0x01,0x00,0x03,0xfe,0xff,0xfe,0xff, - '#', 0x00,'C', 'T', 'A', 'B', 0x1c,0x00, - 0x00,0x00,'W', 0x00,0x00,0x00,0x00,0x03, - 0xfe,0xff,0x01,0x00,0x00,0x00,0x1c,0x00, - 0x00,0x00,0x00,0x81,0x00,0x00,'P', 0x00, - 0x00,0x00,'0', 0x00,0x00,0x00,0x02,0x00, - 0x00,0x00,0x04,0x00,0x00,0x00,'@', 0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,'u', '_', - 'm', 'o', 'd', 'e', 'l', 'V', 'i', 'e', - 'w', 'P', 'r', 'o', 'j', 0x00,0x03,0x00, - 0x03,0x00,0x04,0x00,0x04,0x00,0x01,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,'v', 's', - '_', '3', '_', '0', 0x00,'M', 'i', 'c', - 'r', 'o', 's', 'o', 'f', 't', ' ', '(', - 'R', ')', ' ', 'H', 'L', 'S', 'L', ' ', - 'S', 'h', 'a', 'd', 'e', 'r', ' ', 'C', - 'o', 'm', 'p', 'i', 'l', 'e', 'r', ' ', - '9', '.', '2', '9', '.', '9', '5', '2', - '.', '3', '1', '1', '1', 0x00,'Q', 0x00, - 0x00,0x05,0x04,0x00,0x0f,0xa0,0x81,0x80, - 0x80,';', 0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, - 0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00, - 0x0f,0x90,0x1f,0x00,0x00,0x02,0x0a,0x00, - 0x00,0x80,0x01,0x00,0x0f,0x90,0x1f,0x00, - 0x00,0x02,0x0a,0x00,0x01,0x80,0x02,0x00, - 0x0f,0x90,0x1f,0x00,0x00,0x02,0x05,0x00, - 0x00,0x80,0x03,0x00,0x0f,0x90,0x1f,0x00, - 0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00, - 0x0f,0xe0,0x1f,0x00,0x00,0x02,0x0a,0x00, - 0x00,0x80,0x01,0x00,0x0f,0xe0,0x1f,0x00, - 0x00,0x02,0x0a,0x00,0x01,0x80,0x02,0x00, - 0x0f,0xe0,0x1f,0x00,0x00,0x02,0x05,0x00, - 0x00,0x80,0x03,0x00,0x03,0xe0,0x05,0x00, - 0x00,0x03,0x00,0x00,0x0f,0x80,0x01,0x00, - 0xe4,0xa0,0x00,0x00,'U', 0x90,0x04,0x00, - 0x00,0x04,0x00,0x00,0x0f,0x80,0x00,0x00, - 0xe4,0xa0,0x00,0x00,0x00,0x90,0x00,0x00, - 0xe4,0x80,0x04,0x00,0x00,0x04,0x00,0x00, - 0x0f,0x80,0x02,0x00,0xe4,0xa0,0x00,0x00, - 0xaa,0x90,0x00,0x00,0xe4,0x80,0x04,0x00, - 0x00,0x04,0x00,0x00,0x0f,0xe0,0x03,0x00, - 0xe4,0xa0,0x00,0x00,0xff,0x90,0x00,0x00, - 0xe4,0x80,0x05,0x00,0x00,0x03,0x01,0x00, - 0x0f,0xe0,0x04,0x00,0x00,0xa0,0x01,0x00, - 0xe4,0x90,0x05,0x00,0x00,0x03,0x02,0x00, - 0x0f,0xe0,0x04,0x00,0x00,0xa0,0x02,0x00, - 0xe4,0x90,0x01,0x00,0x00,0x02,0x03,0x00, - 0x03,0xe0,0x03,0x00,0xe4,0x90,0xff,0xff, - 0x00,0x00 -}; - -static const uint8_t fs_debugfont_hlsl[344] = -{ - 0x00,0x00,'T', 0x01,0x00,0x03,0xff,0xff, - 0xfe,0xff,'"', 0x00,'C', 'T', 'A', 'B', - 0x1c,0x00,0x00,0x00,'S', 0x00,0x00,0x00, - 0x00,0x03,0xff,0xff,0x01,0x00,0x00,0x00, - 0x1c,0x00,0x00,0x00,0x00,0x81,0x00,0x00, - 'L', 0x00,0x00,0x00,'0', 0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x01,0x00,0x02,0x00, - '<', 0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 'u', '_', 't', 'e', 'x', 'C', 'o', 'l', - 'o', 'r', 0x00,0xab,0x04,0x00,0x0c,0x00, - 0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,'p', 's', '_', '3', - '_', '0', 0x00,'M', 'i', 'c', 'r', 'o', - 's', 'o', 'f', 't', ' ', '(', 'R', ')', - ' ', 'H', 'L', 'S', 'L', ' ', 'S', 'h', - 'a', 'd', 'e', 'r', ' ', 'C', 'o', 'm', - 'p', 'i', 'l', 'e', 'r', ' ', '9', '.', - '2', '9', '.', '9', '5', '2', '.', '3', - '1', '1', '1', 0x00,'Q', 0x00,0x00,0x05, - 0x00,0x00,0x0f,0xa0,0x81,0x80,0x80,0xbb, - 0x00,0x00,0x00,0x80,0x00,0x00,0x80,0xbf, - 0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0x02, - 0x0a,0x00,0x00,0x80,0x00,0x00,0x0f,0x90, - 0x1f,0x00,0x00,0x02,0x0a,0x00,0x01,0x80, - 0x01,0x00,0x0f,0x90,0x1f,0x00,0x00,0x02, - 0x05,0x00,0x00,0x80,0x02,0x00,0x03,0x90, - 0x1f,0x00,0x00,0x02,0x00,0x00,0x00,0x90, - 0x00,0x08,0x0f,0xa0,'B', 0x00,0x00,0x03, - 0x00,0x00,0x0f,0x80,0x02,0x00,0xe4,0x90, - 0x00,0x08,0xe4,0xa0,0x01,0x00,0x00,0x02, - 0x01,0x00,0x0f,0x80,0x01,0x00,0xe4,0x90, - 0x02,0x00,0x00,0x03,0x01,0x00,0x0f,0x80, - 0x01,0x00,0xe4,0x81,0x00,0x00,0xe4,0x90, - 0x04,0x00,0x00,0x04,0x00,0x00,0x0f,0x80, - 0x00,0x00,0x00,0x80,0x01,0x00,0xe4,0x80, - 0x01,0x00,0xe4,0x90,0x02,0x00,0x00,0x03, - 0x01,0x00,0x01,0x80,0x00,0x00,0xff,0x80, - 0x00,0x00,0x00,0xa0,'X', 0x00,0x00,0x04, - 0x01,0x00,0x0f,0x80,0x01,0x00,0x00,0x80, - 0x00,0x00,'U', 0xa0,0x00,0x00,0xaa,0xa0, - 'A', 0x00,0x00,0x01,0x01,0x00,0x0f,0x80, - 0x01,0x00,0x00,0x02,0x00,0x08,0x0f,0x80, - 0x00,0x00,0xe4,0x80,0xff,0xff,0x00,0x00 -}; - -static const uint8_t vs_debugfont_glsl[462] = -{ - 'p', 'r', 'e', 'c', 'i', 's', 'i', 'o', - 'n', ' ', 'h', 'i', 'g', 'h', 'p', ' ', - 'f', 'l', 'o', 'a', 't', ';', 0x0a,0x0a, - 'u', 'n', 'i', 'f', 'o', 'r', 'm', ' ', - 'm', 'a', 't', '4', ' ', 'u', '_', 'm', - 'o', 'd', 'e', 'l', 'V', 'i', 'e', 'w', - 'P', 'r', 'o', 'j', ';', 0x0a,'v', 'a', - 'r', 'y', 'i', 'n', 'g', ' ', 'v', 'e', - 'c', '4', ' ', 'v', '_', 'c', 'o', 'l', - 'o', 'r', '1', ';', 0x0a,'v', 'a', 'r', - 'y', 'i', 'n', 'g', ' ', 'v', 'e', 'c', - '4', ' ', 'v', '_', 'c', 'o', 'l', 'o', - 'r', ';', 0x0a,'v', 'a', 'r', 'y', 'i', - 'n', 'g', ' ', 'v', 'e', 'c', '2', ' ', - 'v', '_', 't', 'e', 'x', 'c', 'o', 'o', - 'r', 'd', '0', ';', 0x0a,'a', 't', 't', - 'r', 'i', 'b', 'u', 't', 'e', ' ', 'v', - 'e', 'c', '2', ' ', 'a', '_', 't', 'e', - 'x', 'c', 'o', 'o', 'r', 'd', '0', ';', - 0x0a,'a', 't', 't', 'r', 'i', 'b', 'u', - 't', 'e', ' ', 'v', 'e', 'c', '4', ' ', - 'a', '_', 'c', 'o', 'l', 'o', 'r', '1', - ';', 0x0a,'a', 't', 't', 'r', 'i', 'b', - 'u', 't', 'e', ' ', 'v', 'e', 'c', '4', - ' ', 'a', '_', 'c', 'o', 'l', 'o', 'r', - ';', 0x0a,'a', 't', 't', 'r', 'i', 'b', - 'u', 't', 'e', ' ', 'v', 'e', 'c', '3', - ' ', 'a', '_', 'p', 'o', 's', 'i', 't', - 'i', 'o', 'n', ';', 0x0a,'v', 'o', 'i', - 'd', ' ', 'm', 'a', 'i', 'n', ' ', '(', - ')', 0x0a,'{', 0x0a,' ', ' ', 'v', 'e', - 'c', '4', ' ', 't', 'm', 'p', 'v', 'a', - 'r', '_', '1', ';', 0x0a,' ', ' ', 't', - 'm', 'p', 'v', 'a', 'r', '_', '1', '.', - 'w', ' ', '=', ' ', '1', '.', '0', ';', - 0x0a,' ', ' ', 't', 'm', 'p', 'v', 'a', - 'r', '_', '1', '.', 'x', 'y', 'z', ' ', - '=', ' ', 'a', '_', 'p', 'o', 's', 'i', - 't', 'i', 'o', 'n', ';', 0x0a,' ', ' ', - 'g', 'l', '_', 'P', 'o', 's', 'i', 't', - 'i', 'o', 'n', ' ', '=', ' ', '(', 'u', - '_', 'm', 'o', 'd', 'e', 'l', 'V', 'i', - 'e', 'w', 'P', 'r', 'o', 'j', ' ', '*', - ' ', 't', 'm', 'p', 'v', 'a', 'r', '_', - '1', ')', ';', 0x0a,' ', ' ', 'v', '_', - 't', 'e', 'x', 'c', 'o', 'o', 'r', 'd', - '0', ' ', '=', ' ', 'a', '_', 't', 'e', - 'x', 'c', 'o', 'o', 'r', 'd', '0', ';', - 0x0a,' ', ' ', 'v', '_', 'c', 'o', 'l', - 'o', 'r', ' ', '=', ' ', '(', 'a', '_', - 'c', 'o', 'l', 'o', 'r', ' ', '*', ' ', - '0', '.', '0', '0', '3', '9', '2', '1', - '5', '7', ')', ';', 0x0a,' ', ' ', 'v', - '_', 'c', 'o', 'l', 'o', 'r', '1', ' ', - '=', ' ', '(', 'a', '_', 'c', 'o', 'l', - 'o', 'r', '1', ' ', '*', ' ', '0', '.', - '0', '0', '3', '9', '2', '1', '5', '7', - ')', ';', 0x0a,'}', 0x0a,0x0a -}; - -static const uint8_t fs_debugfont_glsl[320] = -{ - 'p', 'r', 'e', 'c', 'i', 's', 'i', 'o', - 'n', ' ', 'h', 'i', 'g', 'h', 'p', ' ', - 'f', 'l', 'o', 'a', 't', ';', 0x0a,0x0a, - 'u', 'n', 'i', 'f', 'o', 'r', 'm', ' ', - 's', 'a', 'm', 'p', 'l', 'e', 'r', '2', - 'D', ' ', 'u', '_', 't', 'e', 'x', 'C', - 'o', 'l', 'o', 'r', ';', 0x0a,'v', 'a', - 'r', 'y', 'i', 'n', 'g', ' ', 'v', 'e', - 'c', '4', ' ', 'v', '_', 'c', 'o', 'l', - 'o', 'r', '1', ';', 0x0a,'v', 'a', 'r', - 'y', 'i', 'n', 'g', ' ', 'v', 'e', 'c', - '4', ' ', 'v', '_', 'c', 'o', 'l', 'o', - 'r', ';', 0x0a,'v', 'a', 'r', 'y', 'i', - 'n', 'g', ' ', 'v', 'e', 'c', '2', ' ', - 'v', '_', 't', 'e', 'x', 'c', 'o', 'o', - 'r', 'd', '0', ';', 0x0a,'v', 'o', 'i', - 'd', ' ', 'm', 'a', 'i', 'n', ' ', '(', - ')', 0x0a,'{', 0x0a,' ', ' ', 'v', 'e', - 'c', '4', ' ', 't', 'm', 'p', 'v', 'a', - 'r', '_', '1', ';', 0x0a,' ', ' ', 't', - 'm', 'p', 'v', 'a', 'r', '_', '1', ' ', - '=', ' ', 'm', 'i', 'x', ' ', '(', 'v', - '_', 'c', 'o', 'l', 'o', 'r', '1', ',', - ' ', 'v', '_', 'c', 'o', 'l', 'o', 'r', - ',', ' ', 't', 'e', 'x', 't', 'u', 'r', - 'e', '2', 'D', ' ', '(', 'u', '_', 't', - 'e', 'x', 'C', 'o', 'l', 'o', 'r', ',', - ' ', 'v', '_', 't', 'e', 'x', 'c', 'o', - 'o', 'r', 'd', '0', ')', '.', 'x', 'x', - 'x', 'x', ')', ';', 0x0a,' ', ' ', 'i', - 'f', ' ', '(', '(', 't', 'm', 'p', 'v', - 'a', 'r', '_', '1', '.', 'w', ' ', '<', - ' ', '0', '.', '0', '0', '3', '9', '2', - '1', '5', '7', ')', ')', ' ', '{', 0x0a, - ' ', ' ', ' ', ' ', 'd', 'i', 's', 'c', - 'a', 'r', 'd', ';', 0x0a,' ', ' ', '}', - ';', 0x0a,' ', ' ', 'g', 'l', '_', 'F', - 'r', 'a', 'g', 'C', 'o', 'l', 'o', 'r', - ' ', '=', ' ', 't', 'm', 'p', 'v', 'a', - 'r', '_', '1', ';', 0x0a,'}', 0x0a,0x0a -}; +/* + * Copyright 2011-2012 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +static const uint8_t vga8x8[256*8] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, + 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e, + 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, + 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, + 0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x92, 0x10, 0x7c, + 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c, + 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, + 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, + 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, + 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, + 0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78, + 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, + 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0, + 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0, + 0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99, + 0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00, + 0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00, + 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, + 0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00, + 0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0x86, 0xfc, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, + 0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff, + 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, + 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, + 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, + 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, + 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x00, + 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, + 0x18, 0x7e, 0xc0, 0x7c, 0x06, 0xfc, 0x18, 0x00, + 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00, + 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00, + 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00, + 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00, + 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, + 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, + 0x7c, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0x7c, 0x00, + 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00, + 0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00, + 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00, + 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00, + 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00, + 0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00, + 0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00, + 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, + 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00, + 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, + 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, + 0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00, + 0x7c, 0xc6, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, + 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00, + 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, + 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00, + 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, + 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, + 0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00, + 0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3a, 0x00, + 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00, + 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00, + 0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00, + 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, + 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00, + 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00, + 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, + 0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, + 0x7c, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x0e, 0x00, + 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00, + 0x7c, 0xc6, 0xe0, 0x78, 0x0e, 0xc6, 0x7c, 0x00, + 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, + 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00, + 0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x00, + 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00, + 0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00, + 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, + 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00, + 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, + 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, + 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00, + 0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, + 0x38, 0x6c, 0x64, 0xf0, 0x60, 0x60, 0xf0, 0x00, + 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, + 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00, + 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, + 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00, + 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xd6, 0x00, + 0x00, 0x00, 0xb8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0, + 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e, + 0x00, 0x00, 0xdc, 0x76, 0x62, 0x60, 0xf0, 0x00, + 0x00, 0x00, 0x7c, 0xc0, 0x70, 0x1c, 0xf8, 0x00, + 0x10, 0x30, 0xfc, 0x30, 0x30, 0x34, 0x18, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00, + 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, + 0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00, + 0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00, + 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, + 0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00, + 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00, + 0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x0c, 0x06, 0x7c, + 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, + 0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, + 0x7e, 0x81, 0x3c, 0x06, 0x3e, 0x66, 0x3b, 0x00, + 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, + 0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, + 0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0x0c, 0x38, + 0x7e, 0x81, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, + 0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, + 0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, + 0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x7c, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00, + 0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0xc6, 0x10, 0x7c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, + 0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00, + 0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00, + 0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00, + 0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00, + 0x78, 0x84, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x78, 0x84, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, + 0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, + 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, + 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00, + 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18, + 0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00, + 0xcc, 0xcc, 0x78, 0x30, 0xfc, 0x30, 0xfc, 0x30, + 0xf8, 0xcc, 0xcc, 0xfa, 0xc6, 0xcf, 0xc6, 0xc3, + 0x0e, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0xd8, 0x70, + 0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00, + 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00, + 0x00, 0xf8, 0x00, 0xb8, 0xcc, 0xcc, 0xcc, 0x00, + 0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00, + 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, + 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, + 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00, + 0xc6, 0xcc, 0xd8, 0x36, 0x6b, 0xc2, 0x84, 0x0f, + 0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6d, 0xcf, 0x03, + 0x18, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x00, + 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00, + 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, + 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, + 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, + 0xdb, 0xf6, 0xdb, 0x6f, 0xdb, 0x7e, 0xd7, 0xed, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, + 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, + 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, + 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, + 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, + 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, + 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, + 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, + 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x76, 0xdc, 0xc8, 0xdc, 0x76, 0x00, + 0x00, 0x78, 0xcc, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0, + 0x00, 0xfc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, + 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, + 0xfc, 0xcc, 0x60, 0x30, 0x60, 0xcc, 0xfc, 0x00, + 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0x70, 0x00, + 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0, + 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x00, + 0xfc, 0x30, 0x78, 0xcc, 0xcc, 0x78, 0x30, 0xfc, + 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x6c, 0x38, 0x00, + 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x6c, 0xee, 0x00, + 0x1c, 0x30, 0x18, 0x7c, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00, + 0x06, 0x0c, 0x7e, 0xdb, 0xdb, 0x7e, 0x60, 0xc0, + 0x38, 0x60, 0xc0, 0xf8, 0xc0, 0x60, 0x38, 0x00, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, + 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, + 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00, + 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xfc, 0x00, + 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xfc, 0x00, + 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70, + 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, + 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c, + 0x58, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, + 0x70, 0x98, 0x30, 0x60, 0xf8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static const uint8_t vga8x16[256*16] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x99, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xd6, 0xd6, 0xe6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x0e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, + 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0xdc, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, + 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc6, 0xc6, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, + 0x00, 0xc6, 0xc6, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, + 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, + 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x93, 0x06, 0x0c, 0x1f, 0x00, 0x00, + 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9a, 0x3f, 0x06, 0x0f, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, + 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, + 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xcf, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0x98, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +// static const uint8_t vs_debugfont_hlsl[418] = +// { +// 0x01,0x00,0x0f,'u', '_', 'm', 'o', 'd', +// 'e', 'l', 'V', 'i', 'e', 'w', 'P', 'r', +// 'o', 'j', 0x09,0x01,0x00,0x00,0x04,0x00, +// 0x88,0x01,0x00,0x03,0xfe,0xff,0xfe,0xff, +// '#', 0x00,'C', 'T', 'A', 'B', 0x1c,0x00, +// 0x00,0x00,'W', 0x00,0x00,0x00,0x00,0x03, +// 0xfe,0xff,0x01,0x00,0x00,0x00,0x1c,0x00, +// 0x00,0x00,0x00,0x81,0x00,0x00,'P', 0x00, +// 0x00,0x00,'0', 0x00,0x00,0x00,0x02,0x00, +// 0x00,0x00,0x04,0x00,0x00,0x00,'@', 0x00, +// 0x00,0x00,0x00,0x00,0x00,0x00,'u', '_', +// 'm', 'o', 'd', 'e', 'l', 'V', 'i', 'e', +// 'w', 'P', 'r', 'o', 'j', 0x00,0x03,0x00, +// 0x03,0x00,0x04,0x00,0x04,0x00,0x01,0x00, +// 0x00,0x00,0x00,0x00,0x00,0x00,'v', 's', +// '_', '3', '_', '0', 0x00,'M', 'i', 'c', +// 'r', 'o', 's', 'o', 'f', 't', ' ', '(', +// 'R', ')', ' ', 'H', 'L', 'S', 'L', ' ', +// 'S', 'h', 'a', 'd', 'e', 'r', ' ', 'C', +// 'o', 'm', 'p', 'i', 'l', 'e', 'r', ' ', +// '9', '.', '2', '9', '.', '9', '5', '2', +// '.', '3', '1', '1', '1', 0x00,'Q', 0x00, +// 0x00,0x05,0x04,0x00,0x0f,0xa0,0x81,0x80, +// 0x80,';', 0x00,0x00,0x00,0x00,0x00,0x00, +// 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, +// 0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00, +// 0x0f,0x90,0x1f,0x00,0x00,0x02,0x0a,0x00, +// 0x00,0x80,0x01,0x00,0x0f,0x90,0x1f,0x00, +// 0x00,0x02,0x0a,0x00,0x01,0x80,0x02,0x00, +// 0x0f,0x90,0x1f,0x00,0x00,0x02,0x05,0x00, +// 0x00,0x80,0x03,0x00,0x0f,0x90,0x1f,0x00, +// 0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00, +// 0x0f,0xe0,0x1f,0x00,0x00,0x02,0x0a,0x00, +// 0x00,0x80,0x01,0x00,0x0f,0xe0,0x1f,0x00, +// 0x00,0x02,0x0a,0x00,0x01,0x80,0x02,0x00, +// 0x0f,0xe0,0x1f,0x00,0x00,0x02,0x05,0x00, +// 0x00,0x80,0x03,0x00,0x03,0xe0,0x05,0x00, +// 0x00,0x03,0x00,0x00,0x0f,0x80,0x01,0x00, +// 0xe4,0xa0,0x00,0x00,'U', 0x90,0x04,0x00, +// 0x00,0x04,0x00,0x00,0x0f,0x80,0x00,0x00, +// 0xe4,0xa0,0x00,0x00,0x00,0x90,0x00,0x00, +// 0xe4,0x80,0x04,0x00,0x00,0x04,0x00,0x00, +// 0x0f,0x80,0x02,0x00,0xe4,0xa0,0x00,0x00, +// 0xaa,0x90,0x00,0x00,0xe4,0x80,0x04,0x00, +// 0x00,0x04,0x00,0x00,0x0f,0xe0,0x03,0x00, +// 0xe4,0xa0,0x00,0x00,0xff,0x90,0x00,0x00, +// 0xe4,0x80,0x05,0x00,0x00,0x03,0x01,0x00, +// 0x0f,0xe0,0x04,0x00,0x00,0xa0,0x01,0x00, +// 0xe4,0x90,0x05,0x00,0x00,0x03,0x02,0x00, +// 0x0f,0xe0,0x04,0x00,0x00,0xa0,0x02,0x00, +// 0xe4,0x90,0x01,0x00,0x00,0x02,0x03,0x00, +// 0x03,0xe0,0x03,0x00,0xe4,0x90,0xff,0xff, +// 0x00,0x00 +// }; +// +// static const uint8_t fs_debugfont_hlsl[344] = +// { +// 0x00,0x00,'T', 0x01,0x00,0x03,0xff,0xff, +// 0xfe,0xff,'"', 0x00,'C', 'T', 'A', 'B', +// 0x1c,0x00,0x00,0x00,'S', 0x00,0x00,0x00, +// 0x00,0x03,0xff,0xff,0x01,0x00,0x00,0x00, +// 0x1c,0x00,0x00,0x00,0x00,0x81,0x00,0x00, +// 'L', 0x00,0x00,0x00,'0', 0x00,0x00,0x00, +// 0x03,0x00,0x00,0x00,0x01,0x00,0x02,0x00, +// '<', 0x00,0x00,0x00,0x00,0x00,0x00,0x00, +// 'u', '_', 't', 'e', 'x', 'C', 'o', 'l', +// 'o', 'r', 0x00,0xab,0x04,0x00,0x0c,0x00, +// 0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00, +// 0x00,0x00,0x00,0x00,'p', 's', '_', '3', +// '_', '0', 0x00,'M', 'i', 'c', 'r', 'o', +// 's', 'o', 'f', 't', ' ', '(', 'R', ')', +// ' ', 'H', 'L', 'S', 'L', ' ', 'S', 'h', +// 'a', 'd', 'e', 'r', ' ', 'C', 'o', 'm', +// 'p', 'i', 'l', 'e', 'r', ' ', '9', '.', +// '2', '9', '.', '9', '5', '2', '.', '3', +// '1', '1', '1', 0x00,'Q', 0x00,0x00,0x05, +// 0x00,0x00,0x0f,0xa0,0x81,0x80,0x80,0xbb, +// 0x00,0x00,0x00,0x80,0x00,0x00,0x80,0xbf, +// 0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0x02, +// 0x0a,0x00,0x00,0x80,0x00,0x00,0x0f,0x90, +// 0x1f,0x00,0x00,0x02,0x0a,0x00,0x01,0x80, +// 0x01,0x00,0x0f,0x90,0x1f,0x00,0x00,0x02, +// 0x05,0x00,0x00,0x80,0x02,0x00,0x03,0x90, +// 0x1f,0x00,0x00,0x02,0x00,0x00,0x00,0x90, +// 0x00,0x08,0x0f,0xa0,'B', 0x00,0x00,0x03, +// 0x00,0x00,0x0f,0x80,0x02,0x00,0xe4,0x90, +// 0x00,0x08,0xe4,0xa0,0x01,0x00,0x00,0x02, +// 0x01,0x00,0x0f,0x80,0x01,0x00,0xe4,0x90, +// 0x02,0x00,0x00,0x03,0x01,0x00,0x0f,0x80, +// 0x01,0x00,0xe4,0x81,0x00,0x00,0xe4,0x90, +// 0x04,0x00,0x00,0x04,0x00,0x00,0x0f,0x80, +// 0x00,0x00,0x00,0x80,0x01,0x00,0xe4,0x80, +// 0x01,0x00,0xe4,0x90,0x02,0x00,0x00,0x03, +// 0x01,0x00,0x01,0x80,0x00,0x00,0xff,0x80, +// 0x00,0x00,0x00,0xa0,'X', 0x00,0x00,0x04, +// 0x01,0x00,0x0f,0x80,0x01,0x00,0x00,0x80, +// 0x00,0x00,'U', 0xa0,0x00,0x00,0xaa,0xa0, +// 'A', 0x00,0x00,0x01,0x01,0x00,0x0f,0x80, +// 0x01,0x00,0x00,0x02,0x00,0x08,0x0f,0x80, +// 0x00,0x00,0xe4,0x80,0xff,0xff,0x00,0x00 +// }; + +static const uint8_t vs_debugfont_glsl[462] = +{ + 'p', 'r', 'e', 'c', 'i', 's', 'i', 'o', + 'n', ' ', 'h', 'i', 'g', 'h', 'p', ' ', + 'f', 'l', 'o', 'a', 't', ';', 0x0a,0x0a, + 'u', 'n', 'i', 'f', 'o', 'r', 'm', ' ', + 'm', 'a', 't', '4', ' ', 'u', '_', 'm', + 'o', 'd', 'e', 'l', 'V', 'i', 'e', 'w', + 'P', 'r', 'o', 'j', ';', 0x0a,'v', 'a', + 'r', 'y', 'i', 'n', 'g', ' ', 'v', 'e', + 'c', '4', ' ', 'v', '_', 'c', 'o', 'l', + 'o', 'r', '1', ';', 0x0a,'v', 'a', 'r', + 'y', 'i', 'n', 'g', ' ', 'v', 'e', 'c', + '4', ' ', 'v', '_', 'c', 'o', 'l', 'o', + 'r', ';', 0x0a,'v', 'a', 'r', 'y', 'i', + 'n', 'g', ' ', 'v', 'e', 'c', '2', ' ', + 'v', '_', 't', 'e', 'x', 'c', 'o', 'o', + 'r', 'd', '0', ';', 0x0a,'a', 't', 't', + 'r', 'i', 'b', 'u', 't', 'e', ' ', 'v', + 'e', 'c', '2', ' ', 'a', '_', 't', 'e', + 'x', 'c', 'o', 'o', 'r', 'd', '0', ';', + 0x0a,'a', 't', 't', 'r', 'i', 'b', 'u', + 't', 'e', ' ', 'v', 'e', 'c', '4', ' ', + 'a', '_', 'c', 'o', 'l', 'o', 'r', '1', + ';', 0x0a,'a', 't', 't', 'r', 'i', 'b', + 'u', 't', 'e', ' ', 'v', 'e', 'c', '4', + ' ', 'a', '_', 'c', 'o', 'l', 'o', 'r', + ';', 0x0a,'a', 't', 't', 'r', 'i', 'b', + 'u', 't', 'e', ' ', 'v', 'e', 'c', '3', + ' ', 'a', '_', 'p', 'o', 's', 'i', 't', + 'i', 'o', 'n', ';', 0x0a,'v', 'o', 'i', + 'd', ' ', 'm', 'a', 'i', 'n', ' ', '(', + ')', 0x0a,'{', 0x0a,' ', ' ', 'v', 'e', + 'c', '4', ' ', 't', 'm', 'p', 'v', 'a', + 'r', '_', '1', ';', 0x0a,' ', ' ', 't', + 'm', 'p', 'v', 'a', 'r', '_', '1', '.', + 'w', ' ', '=', ' ', '1', '.', '0', ';', + 0x0a,' ', ' ', 't', 'm', 'p', 'v', 'a', + 'r', '_', '1', '.', 'x', 'y', 'z', ' ', + '=', ' ', 'a', '_', 'p', 'o', 's', 'i', + 't', 'i', 'o', 'n', ';', 0x0a,' ', ' ', + 'g', 'l', '_', 'P', 'o', 's', 'i', 't', + 'i', 'o', 'n', ' ', '=', ' ', '(', 'u', + '_', 'm', 'o', 'd', 'e', 'l', 'V', 'i', + 'e', 'w', 'P', 'r', 'o', 'j', ' ', '*', + ' ', 't', 'm', 'p', 'v', 'a', 'r', '_', + '1', ')', ';', 0x0a,' ', ' ', 'v', '_', + 't', 'e', 'x', 'c', 'o', 'o', 'r', 'd', + '0', ' ', '=', ' ', 'a', '_', 't', 'e', + 'x', 'c', 'o', 'o', 'r', 'd', '0', ';', + 0x0a,' ', ' ', 'v', '_', 'c', 'o', 'l', + 'o', 'r', ' ', '=', ' ', '(', 'a', '_', + 'c', 'o', 'l', 'o', 'r', ' ', '*', ' ', + '0', '.', '0', '0', '3', '9', '2', '1', + '5', '7', ')', ';', 0x0a,' ', ' ', 'v', + '_', 'c', 'o', 'l', 'o', 'r', '1', ' ', + '=', ' ', '(', 'a', '_', 'c', 'o', 'l', + 'o', 'r', '1', ' ', '*', ' ', '0', '.', + '0', '0', '3', '9', '2', '1', '5', '7', + ')', ';', 0x0a,'}', 0x0a,0x0a +}; + +static const uint8_t fs_debugfont_glsl[320] = +{ + 'p', 'r', 'e', 'c', 'i', 's', 'i', 'o', + 'n', ' ', 'h', 'i', 'g', 'h', 'p', ' ', + 'f', 'l', 'o', 'a', 't', ';', 0x0a,0x0a, + 'u', 'n', 'i', 'f', 'o', 'r', 'm', ' ', + 's', 'a', 'm', 'p', 'l', 'e', 'r', '2', + 'D', ' ', 'u', '_', 't', 'e', 'x', 'C', + 'o', 'l', 'o', 'r', ';', 0x0a,'v', 'a', + 'r', 'y', 'i', 'n', 'g', ' ', 'v', 'e', + 'c', '4', ' ', 'v', '_', 'c', 'o', 'l', + 'o', 'r', '1', ';', 0x0a,'v', 'a', 'r', + 'y', 'i', 'n', 'g', ' ', 'v', 'e', 'c', + '4', ' ', 'v', '_', 'c', 'o', 'l', 'o', + 'r', ';', 0x0a,'v', 'a', 'r', 'y', 'i', + 'n', 'g', ' ', 'v', 'e', 'c', '2', ' ', + 'v', '_', 't', 'e', 'x', 'c', 'o', 'o', + 'r', 'd', '0', ';', 0x0a,'v', 'o', 'i', + 'd', ' ', 'm', 'a', 'i', 'n', ' ', '(', + ')', 0x0a,'{', 0x0a,' ', ' ', 'v', 'e', + 'c', '4', ' ', 't', 'm', 'p', 'v', 'a', + 'r', '_', '1', ';', 0x0a,' ', ' ', 't', + 'm', 'p', 'v', 'a', 'r', '_', '1', ' ', + '=', ' ', 'm', 'i', 'x', ' ', '(', 'v', + '_', 'c', 'o', 'l', 'o', 'r', '1', ',', + ' ', 'v', '_', 'c', 'o', 'l', 'o', 'r', + ',', ' ', 't', 'e', 'x', 't', 'u', 'r', + 'e', '2', 'D', ' ', '(', 'u', '_', 't', + 'e', 'x', 'C', 'o', 'l', 'o', 'r', ',', + ' ', 'v', '_', 't', 'e', 'x', 'c', 'o', + 'o', 'r', 'd', '0', ')', '.', 'x', 'x', + 'x', 'x', ')', ';', 0x0a,' ', ' ', 'i', + 'f', ' ', '(', '(', 't', 'm', 'p', 'v', + 'a', 'r', '_', '1', '.', 'w', ' ', '<', + ' ', '0', '.', '0', '0', '3', '9', '2', + '1', '5', '7', ')', ')', ' ', '{', 0x0a, + ' ', ' ', ' ', ' ', 'd', 'i', 's', 'c', + 'a', 'r', 'd', ';', 0x0a,' ', ' ', '}', + ';', 0x0a,' ', ' ', 'g', 'l', '_', 'F', + 'r', 'a', 'g', 'C', 'o', 'l', 'o', 'r', + ' ', '=', ' ', 't', 'm', 'p', 'v', 'a', + 'r', '_', '1', ';', 0x0a,'}', 0x0a,0x0a +}; + +#include "vs_debugfont_dx9.bin.h" +#include "fs_debugfont_dx9.bin.h" + +#include "vs_debugfont_dx11.bin.h" +#include "fs_debugfont_dx11.bin.h" \ No newline at end of file diff --git a/src/config.h b/src/config.h index 0aa814c3..341a7740 100644 --- a/src/config.h +++ b/src/config.h @@ -24,7 +24,7 @@ # endif // BGFX_CONFIG_RENDERER_OPENGLES # ifndef BGFX_CONFIG_RENDERER_NULL -# define BGFX_CONFIG_RENDERER_NULL (!(BGFX_CONFIG_RENDERER_DIRECT3D9|BGFX_CONFIG_RENDERER_OPENGL|BGFX_CONFIG_RENDERER_OPENGLES2) ) +# define BGFX_CONFIG_RENDERER_NULL (!(BGFX_CONFIG_RENDERER_DIRECT3D9|BGFX_CONFIG_RENDERER_DIRECT3D11|BGFX_CONFIG_RENDERER_OPENGL|BGFX_CONFIG_RENDERER_OPENGLES2) ) # endif // BGFX_CONFIG_RENDERER_NULL #endif // !defined... diff --git a/src/fs_debugfont_dx11.bin.h b/src/fs_debugfont_dx11.bin.h new file mode 100644 index 00000000..b4ba412a --- /dev/null +++ b/src/fs_debugfont_dx11.bin.h @@ -0,0 +1,58 @@ +static const uint8_t fs_debugfont_dx11[879] = +{ + 0x00, 0x00, 0x00, 0x00, 0x68, 0x03, 0x44, 0x58, 0x42, 0x43, 0x86, 0xad, 0xb6, 0x81, 0xa7, 0x03, // ....h.DXBC...... + 0x01, 0x3e, 0x2a, 0x57, 0xe1, 0x88, 0xd8, 0x74, 0xb7, 0x81, 0x01, 0x00, 0x00, 0x00, 0x68, 0x03, // .>*W...t......h. + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x80, 0x01, // ......4......... + 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xcc, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xb8, 0x00, // ..........RDEF.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3c, 0x00, // ..............<. + 0x00, 0x00, 0x00, 0x05, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x52, 0x44, // ..............RD + 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, // 11<....... ...(. + 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..$...........|. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..............|. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, // ................ + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, // texColor.Microso + 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, // ft (R) HLSL Shad + 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, // er Compiler 9.29 + 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x84, 0x00, // .952.3111.ISGN.. + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........h..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ + 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..t............. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........t..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, // ................ + 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..z............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, // ..........SV_POS + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, // ITION.COLOR.TEXC + 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, // OORD..OSGN,..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, // ..............SV + 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0x10, 0x01, // _TARGET...SHEX.. + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x5a, 0x00, // ..P...D...j...Z. + 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, // ...`......X....p + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, // ......UU..b..... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x02, 0x00, // ......b......... + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, // ..b...2.......e. + 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, // ... ......h..... + 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0x12, 0x00, // ..E.......CU.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x7e, // ......F.......F~ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .......`........ + 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, // ..........F..... + 0x00, 0x00, 0x46, 0x1e, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F...A.......2. + 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x02, 0x00, // ..F.......F..... + 0x00, 0x00, 0x31, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3a, 0x00, // ..1...........:. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x81, 0x80, 0x80, 0x3b, 0x0d, 0x00, // .......@.....;.. + 0x04, 0x03, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, // ..........6.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......F.......>. + 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, // ..STAT.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ............... +}; diff --git a/src/fs_debugfont_dx9.bin.h b/src/fs_debugfont_dx9.bin.h new file mode 100644 index 00000000..d8e642e1 --- /dev/null +++ b/src/fs_debugfont_dx9.bin.h @@ -0,0 +1,25 @@ +static const uint8_t fs_debugfont_dx9[345] = +{ + 0x00, 0x00, 0x54, 0x01, 0x01, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, // ..T.......".CTAB + 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x01, 0x02, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, // ....S........... + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ........L...0... + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........<....... + 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, // u_texColor...... + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, // ............ps_2 + 0x5f, 0x61, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, // _a.Microsoft (R) + 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, // HLSL Shader Com + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, // piler 9.29.952.3 + 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, // 111.Q........... + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, // ................ + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ + 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, // ............B... + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, // ................ + 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, // ................ + 0x01, 0x00, 0xe4, 0x81, 0x00, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ................ + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x02, 0x00, 0x00, 0x03, // ................ + 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x58, 0x00, 0x00, 0x04, // ............X... + 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, // ..........U..... + 0x41, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // A............... + 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... +}; diff --git a/src/renderer_d3d.h b/src/renderer_d3d.h new file mode 100644 index 00000000..8f38f9c1 --- /dev/null +++ b/src/renderer_d3d.h @@ -0,0 +1,58 @@ +/* + * Copyright 2011-2012 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#ifndef __RENDERER_D3D_H__ +#define __RENDERER_D3D_H__ + +#if BGFX_CONFIG_DEBUG && BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC +# include <dxerr.h> +# pragma comment(lib, "dxerr.lib") +# define DX_CHECK_EXTRA_F " (%s): %s" +# define DX_CHECK_EXTRA_ARGS , DXGetErrorString(__hr__), DXGetErrorDescription(__hr__) +#else +# define DX_CHECK_EXTRA_F "" +# define DX_CHECK_EXTRA_ARGS +#endif // BGFX_CONFIG_DEBUG && BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC + +namespace bgfx +{ +#define _DX_CHECK(_call) \ + do { \ + HRESULT __hr__ = _call; \ + BX_CHECK(SUCCEEDED(__hr__), #_call " FAILED 0x%08x" DX_CHECK_EXTRA_F "\n" \ + , (uint32_t)__hr__ \ + DX_CHECK_EXTRA_ARGS \ + ); \ + } while (0) + +#if BGFX_CONFIG_DEBUG +# define DX_CHECK(_call) _DX_CHECK(_call) +#else +# define DX_CHECK(_call) _call +#endif // BGFX_CONFIG_DEBUG + +#if BGFX_CONFIG_DEBUG +# define DX_RELEASE(_ptr, _expected) \ + do { \ + if (NULL != _ptr) \ + { \ + ULONG count = _ptr->Release(); \ + BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \ + _ptr = NULL; \ + } \ + } while (0) +#else +# define DX_RELEASE(_ptr, _expected) \ + do { \ + if (NULL != _ptr) \ + { \ + _ptr->Release(); \ + _ptr = NULL; \ + } \ + } while (0) +#endif // BGFX_CONFIG_DEBUG +} // namespace bgfx + +#endif // __RENDERER_D3D_H__ diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index dd3e7bab..1dd8b642 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -1,141 +1,1850 @@ -/* - * Copyright 2011-2012 Branimir Karadzic. All rights reserved. - * License: http://www.opensource.org/licenses/BSD-2-Clause - */ - -#include "bgfx_p.h" - -#if BGFX_CONFIG_RENDERER_DIRECT3D11 - -namespace bgfx -{ - void ConstantBuffer::commit() - { - } - - void TextVideoMemBlitter::setup() - { - } - - void TextVideoMemBlitter::render(uint32_t /*_numIndices*/) - { - } - - void Context::flip() - { - } - - void Context::rendererInit() - { - } - - void Context::rendererShutdown() - { - } - - void Context::rendererCreateIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyIndexBuffer(IndexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) - { - } - - void Context::rendererDestroyVertexDecl(VertexDeclHandle /*_handle*/) - { - } - - void Context::rendererCreateVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/) - { - } - - void Context::rendererDestroyVertexBuffer(VertexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/) - { - } - - void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/) - { - } - - void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateVertexShader(VertexShaderHandle /*_handle*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyVertexShader(VertexShaderHandle /*_handle*/) - { - } - - void Context::rendererCreateFragmentShader(FragmentShaderHandle /*_handle*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyFragmentShader(FragmentShaderHandle /*_handle*/) - { - } - - void Context::rendererCreateMaterial(MaterialHandle /*_handle*/, VertexShaderHandle /*_vsh*/, FragmentShaderHandle /*_fsh*/) - { - } - - void Context::rendererDestroyMaterial(FragmentShaderHandle /*_handle*/) - { - } - - void Context::rendererCreateTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/) - { - } - - void Context::rendererDestroyTexture(TextureHandle /*_handle*/) - { - } - - void Context::rendererCreateRenderTarget(RenderTargetHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint32_t /*_flags*/, uint32_t /*_textureFlags*/) - { - } - - void Context::rendererDestroyRenderTarget(RenderTargetHandle /*_handle*/) - { - } - - void Context::rendererCreateUniform(UniformHandle /*_handle*/, ConstantType::Enum /*_type*/, uint16_t /*_num*/, const char* /*_name*/) - { - } - - void Context::rendererDestroyUniform(UniformHandle /*_handle*/) - { - } - - void Context::rendererSaveScreenShot(Memory* /*_mem*/) - { - } - - void Context::rendererSubmit() - { - } -} - -#endif // BGFX_CONFIG_RENDERER_DIRECT3D11 +/* + * Copyright 2011-2012 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "bgfx_p.h" + +#if BGFX_CONFIG_RENDERER_DIRECT3D11 +# include "renderer_d3d11.h" + +namespace bgfx +{ + static const D3D11_PRIMITIVE_TOPOLOGY s_primType[] = + { + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D11_PRIMITIVE_TOPOLOGY_LINELIST, + D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, + }; + + static const uint32_t s_primNumVerts[] = + { + 3, + 2, + 1, + }; + + static const D3D11_BLEND s_blendFactor[] = + { + (D3D11_BLEND)0, // ignored + D3D11_BLEND_ZERO, + D3D11_BLEND_ONE, + D3D11_BLEND_SRC_COLOR, + D3D11_BLEND_INV_SRC_COLOR, + D3D11_BLEND_SRC_ALPHA, + D3D11_BLEND_INV_SRC_ALPHA, + D3D11_BLEND_DEST_ALPHA, + D3D11_BLEND_INV_DEST_ALPHA, + D3D11_BLEND_DEST_COLOR, + D3D11_BLEND_INV_DEST_COLOR, + D3D11_BLEND_SRC_ALPHA_SAT, + }; + + static const D3D11_COMPARISON_FUNC s_depthFunc[] = + { + (D3D11_COMPARISON_FUNC)0, // ignored + D3D11_COMPARISON_LESS, + D3D11_COMPARISON_LESS_EQUAL, + D3D11_COMPARISON_EQUAL, + D3D11_COMPARISON_GREATER_EQUAL, + D3D11_COMPARISON_GREATER, + D3D11_COMPARISON_NOT_EQUAL, + D3D11_COMPARISON_NEVER, + D3D11_COMPARISON_ALWAYS, + }; + + static const D3D11_CULL_MODE s_cullMode[] = + { + D3D11_CULL_NONE, + D3D11_CULL_FRONT, + D3D11_CULL_BACK, + }; + + static const D3D11_TEXTURE_ADDRESS_MODE s_textureAddress[] = + { + D3D11_TEXTURE_ADDRESS_WRAP, + D3D11_TEXTURE_ADDRESS_MIRROR, + D3D11_TEXTURE_ADDRESS_CLAMP, + }; + + static const D3D11_INPUT_ELEMENT_DESC s_attrib[Attrib::Count] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 1, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BLENDINDICES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BLENDWEIGHT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 2, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 3, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 4, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 5, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 6, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 7, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(D3D11_INPUT_ELEMENT_DESC* _out, uint32_t _count, const VertexDecl& _decl) + { + D3D11_INPUT_ELEMENT_DESC* elem = _out; + + for (uint32_t attr = 0; attr < Attrib::Count; ++attr) + { + if (0xff != _decl.m_attributes[attr]) + { + uint8_t num; + AttribType::Enum type; + bool normalized; + _decl.decode(Attrib::Enum(attr), num, type, normalized); + + memcpy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) ); + + DXGI_FORMAT format = elem->Format; + + switch (type) + { + case AttribType::Uint8: + if (normalized) + { + switch (num) + { + case 1: + format = DXGI_FORMAT_R8_UNORM; + break; + + case 2: + format = DXGI_FORMAT_R8G8_UNORM; + break; + + default: + case 4: + format = DXGI_FORMAT_R8G8B8A8_UNORM; + break; + } + } + else + { + switch (num) + { + case 1: + format = DXGI_FORMAT_R8_UINT; + break; + + case 2: + format = DXGI_FORMAT_R8G8_UINT; + break; + + default: + case 4: + format = DXGI_FORMAT_R8G8B8A8_UNORM; //DXGI_FORMAT_R8G8B8A8_UINT; + break; + } + } + break; + + case AttribType::Uint16: + if (normalized) + { + switch (num) + { + default: + case 2: + format = DXGI_FORMAT_R16G16_UNORM; + break; + + case 4: + format = DXGI_FORMAT_R16G16B16A16_UNORM; + break; + } + } + else + { + switch (num) + { + default: + case 2: + format = DXGI_FORMAT_R16G16_UINT; + break; + + case 4: + format = DXGI_FORMAT_R16G16B16A16_UINT; + break; + } + } + break; + + case AttribType::Float: + switch (num) + { + case 1: + format = DXGI_FORMAT_R32_FLOAT; + break; + + case 2: + format = DXGI_FORMAT_R32G32_FLOAT; + break; + + default: + case 3: + format = DXGI_FORMAT_R32G32B32_FLOAT; + break; + + case 4: + format = DXGI_FORMAT_R32G32B32A32_FLOAT; + break; + } + + break; + + default: + BX_CHECK(false, "Invalid attrib type."); + break; + } + + elem->Format = format; + elem->AlignedByteOffset = _decl.m_offset[attr]; + ++elem; + } + } + + return elem; + } + + struct RendererContext + { + RendererContext() + : m_vsChanges(0) + , m_fsChanges(0) + { + } + + void init() + { + m_d3d11dll = LoadLibrary("d3d11.dll"); + BGFX_FATAL(NULL != m_d3d11dll, bgfx::Fatal::D3D11_UnableToInitialize, "Failed to load d3d11.dll."); + + m_dxgidll = LoadLibrary("dxgi.dll"); + BGFX_FATAL(NULL != m_dxgidll, bgfx::Fatal::D3D11_UnableToInitialize, "Failed to load dxgi.dll."); + + PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN d3D11CreateDeviceAndSwapChain = (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)GetProcAddress(m_d3d11dll, "D3D11CreateDeviceAndSwapChain"); + BGFX_FATAL(NULL != d3D11CreateDeviceAndSwapChain, bgfx::Fatal::D3D11_UnableToInitialize, "Function D3D11CreateDeviceAndSwapChain not found."); + + CreateDXGIFactoryFn createDXGIFactory = (CreateDXGIFactoryFn)GetProcAddress(m_dxgidll, "CreateDXGIFactory"); + BGFX_FATAL(NULL != createDXGIFactory, bgfx::Fatal::D3D11_UnableToInitialize, "Function CreateDXGIFactory not found."); + + HRESULT hr; +// IDXGIFactory* factory; +// hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&factory) ); + + D3D_FEATURE_LEVEL features[] = + { + D3D_FEATURE_LEVEL_11_0, + }; + + memset(&m_scd, 0, sizeof(m_scd) ); + m_scd.BufferDesc.Width = BGFX_DEFAULT_WIDTH; + m_scd.BufferDesc.Height = BGFX_DEFAULT_HEIGHT; + m_scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + m_scd.BufferDesc.RefreshRate.Numerator = 60; + m_scd.BufferDesc.RefreshRate.Denominator = 1; + m_scd.SampleDesc.Count = 1; + m_scd.SampleDesc.Quality = 0; + m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + m_scd.BufferCount = 1; + m_scd.OutputWindow = g_bgfxHwnd; + m_scd.Windowed = true; + + uint32_t flags = D3D11_CREATE_DEVICE_SINGLETHREADED +#if BGFX_CONFIG_DEBUG + | D3D11_CREATE_DEVICE_DEBUG +#endif // BGFX_CONFIG_DEBUG + ; + + D3D_FEATURE_LEVEL featureLevel; + + hr = d3D11CreateDeviceAndSwapChain(NULL + , D3D_DRIVER_TYPE_HARDWARE + , NULL + , flags + , features + , 1 + , D3D11_SDK_VERSION + , &m_scd + , &m_swapChain + , &m_device + , &featureLevel + , &m_deviceCtx + ); + BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::D3D11_UnableToInitialize, "Unable to create Direct3D11 device."); + + ID3D11Texture2D* color; + DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&color) ); + DX_CHECK(m_device->CreateRenderTargetView(color, NULL, &m_backBufferColor) ); + DX_RELEASE(color, 0); + + D3D11_TEXTURE2D_DESC dsd; + dsd.Width = m_scd.BufferDesc.Width; + dsd.Height = m_scd.BufferDesc.Height; + dsd.MipLevels = 1; + dsd.ArraySize = 1; + dsd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + dsd.SampleDesc = m_scd.SampleDesc; + dsd.Usage = D3D11_USAGE_DEFAULT; + dsd.BindFlags = D3D11_BIND_DEPTH_STENCIL; + dsd.CPUAccessFlags = 0; + dsd.MiscFlags = 0; + + ID3D11Texture2D* depthStencil; + DX_CHECK(m_device->CreateTexture2D(&dsd, NULL, &depthStencil) ); + DX_CHECK(m_device->CreateDepthStencilView(depthStencil, NULL, &m_backBufferDepthStencil) ); + DX_RELEASE(depthStencil, 0); + + m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil); + + for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) + { + m_predefinedUniforms[ii].create(ConstantType::Uniform4x4fv, 1, false); + m_uniformReg.reg(getPredefinedUniformName(PredefinedUniform::Enum(ii) ), &m_predefinedUniforms[ii]); + } + } + + void shutdown() + { + invalidateCache(); + + for (uint32_t ii = 0; ii < countof(m_indexBuffers); ++ii) + { + m_indexBuffers[ii].destroy(); + } + + for (uint32_t ii = 0; ii < countof(m_vertexBuffers); ++ii) + { + m_vertexBuffers[ii].destroy(); + } + + for (uint32_t ii = 0; ii < countof(m_vertexShaders); ++ii) + { + m_vertexShaders[ii].destroy(); + } + + for (uint32_t ii = 0; ii < countof(m_fragmentShaders); ++ii) + { + m_fragmentShaders[ii].destroy(); + } + + for (uint32_t ii = 0; ii < countof(m_textures); ++ii) + { + m_textures[ii].destroy(); + } + + for (uint32_t ii = 0; ii < countof(m_renderTargets); ++ii) + { + m_renderTargets[ii].destroy(); + } + + for (uint32_t ii = 0; ii < countof(m_uniforms); ++ii) + { + m_uniforms[ii].destroy(); + } + + for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) + { + m_predefinedUniforms[ii].destroy(); + } + + DX_RELEASE(m_backBufferDepthStencil, 0); + DX_RELEASE(m_backBufferColor, 0); + DX_RELEASE(m_swapChain, 0); + DX_RELEASE(m_deviceCtx, 0); + DX_RELEASE(m_device, 0); + + FreeLibrary(m_dxgidll); + FreeLibrary(m_d3d11dll); + } + + void flip() + { + if (NULL != m_swapChain) + { + DX_CHECK(m_swapChain->Present(0, 0) ); + } + } + + void invalidateCache() + { + m_deviceCtx->IASetInputLayout(NULL); + m_deviceCtx->OMSetBlendState(NULL, NULL, 0); + m_deviceCtx->OMSetDepthStencilState(NULL, 0); + m_deviceCtx->RSSetState(NULL); + m_deviceCtx->VSSetShader(NULL, 0, 0); + m_deviceCtx->PSSetSamplers(0, 0, NULL); + m_deviceCtx->PSSetShaderResources(0, 0, NULL); + m_deviceCtx->PSSetShader(NULL, 0, 0); + + m_inputLayoutCache.invalidate(); + m_blendStateCache.invalidate(); + m_depthStencilStateCache.invalidate(); + m_rasterizerStateCache.invalidate(); + m_samplerStateCache.invalidate(); + } + + void updateResolution(const Resolution& _resolution) + { + if ( (uint32_t)m_scd.BufferDesc.Width != _resolution.m_width + || (uint32_t)m_scd.BufferDesc.Height != _resolution.m_height + || m_flags != _resolution.m_flags) + { + m_flags = _resolution.m_flags; + + m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.clear(); + +#if 0 + D3DDEVICE_CREATION_PARAMETERS dcp; + DX_CHECK(m_device->GetCreationParameters(&dcp) ); + + D3DDISPLAYMODE dm; + DX_CHECK(m_d3d9->GetAdapterDisplayMode(dcp.AdapterOrdinal, &dm) ); + + m_params.BackBufferFormat = dm.Format; + + m_params.BackBufferWidth = _resolution.m_width; + m_params.BackBufferHeight = _resolution.m_height; + m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_flags&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0; + m_params.PresentationInterval = !!(m_flags&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; + + updateMsaa(); + + Msaa& msaa = s_msaa[(m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; + m_params.MultiSampleType = msaa.m_type; + m_params.MultiSampleQuality = msaa.m_quality; + + preReset(); + DX_CHECK(m_device->Reset(&m_params) ); + postReset(); +#endif // 0 + } + } + + void setShaderConstant(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs) + { + if (_flags&BGFX_UNIFORM_FRAGMENTBIT) + { + memcpy(&m_fsScratch[_regIndex], _val, _numRegs*16); + ++m_fsChanges; + } + else + { + memcpy(&m_vsScratch[_regIndex], _val, _numRegs*16); + ++m_vsChanges; + } + } + + void commitShaderConstants() + { + if (0 < m_vsChanges) + { + if (NULL != m_currentMaterial->m_vsh->m_buffer) + { + m_deviceCtx->UpdateSubresource(m_currentMaterial->m_vsh->m_buffer, 0, 0, m_vsScratch, 0, 0); + } + + m_vsChanges = 0; + } + + if (0 < m_fsChanges) + { + if (NULL != m_currentMaterial->m_fsh->m_buffer) + { + m_deviceCtx->UpdateSubresource(m_currentMaterial->m_fsh->m_buffer, 0, 0, m_fsScratch, 0, 0); + } + + m_fsChanges = 0; + } + } + + void setRenderTarget(RenderTargetHandle _rt, bool _msaa = true) + { + if (_rt.idx == invalidHandle) + { + m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil); + } + else + { + } + } + + void clear(const Rect& _rect, const Clear& _clear) + { +// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE) ); +// DX_CHECK(s_renderCtx.m_device->SetScissorRect(&rc) ); + + if (BGFX_CLEAR_COLOR_BIT & _clear.m_flags) + { + uint32_t rgba = _clear.m_rgba; + float frgba[4] = { (rgba>>24)/255.0f, ( (rgba>>16)&0xff)/255.0f, ( (rgba>>8)&0xff)/255.0f, (rgba&0xff)/255.0f }; +// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_ALPHA) ); + m_deviceCtx->ClearRenderTargetView(m_backBufferColor, frgba); + } + + if ( (BGFX_CLEAR_DEPTH_BIT|BGFX_CLEAR_STENCIL_BIT) & _clear.m_flags) + { + DWORD flags = 0; + flags |= (_clear.m_flags & BGFX_CLEAR_DEPTH_BIT) ? D3D11_CLEAR_DEPTH : 0; + flags |= (_clear.m_flags & BGFX_CLEAR_STENCIL_BIT) ? D3D11_CLEAR_STENCIL : 0; +// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) ); + m_deviceCtx->ClearDepthStencilView(m_backBufferDepthStencil, flags, _clear.m_depth, _clear.m_stencil); + } + +// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) ); + } + + void setInputLayout(const VertexDecl& _vertexDecl, const Material& _material) + { + uint64_t layoutHash = (uint64_t(_vertexDecl.m_hash)<<32) | _material.m_vsh->m_hash; + ID3D11InputLayout* layout = m_inputLayoutCache.find(layoutHash); + if (NULL == layout) + { + D3D11_INPUT_ELEMENT_DESC vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; + D3D11_INPUT_ELEMENT_DESC* elem = fillVertexDecl(vertexElements, Attrib::Count, _vertexDecl); + DX_CHECK(m_device->CreateInputLayout(vertexElements + , uint32_t(elem-vertexElements) + , _material.m_vsh->m_code->data + , _material.m_vsh->m_code->size + , &layout + ) ); + m_inputLayoutCache.add(layoutHash, layout); + } + + m_deviceCtx->IASetInputLayout(layout); + } + + void setBlendState(uint64_t _state) + { + _state &= BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE; + + ID3D11BlendState* bs = m_blendStateCache.find(_state); + if (NULL == bs) + { + D3D11_BLEND_DESC desc; + memset(&desc, 0, sizeof(desc) ); + D3D11_RENDER_TARGET_BLEND_DESC& drt = desc.RenderTarget[0]; + drt.BlendEnable = !!(BGFX_STATE_BLEND_MASK & _state); + + uint32_t blend = (_state&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT; + uint32_t src = blend&0xf; + uint32_t dst = (blend>>4)&0xf; + uint32_t writeMask = (_state&BGFX_STATE_ALPHA_WRITE) ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0; + writeMask |= (_state&BGFX_STATE_RGB_WRITE) ? D3D11_COLOR_WRITE_ENABLE_RED|D3D11_COLOR_WRITE_ENABLE_GREEN|D3D11_COLOR_WRITE_ENABLE_BLUE : 0; + + drt.SrcBlend = + drt.SrcBlendAlpha = s_blendFactor[src]; + drt.DestBlend = + drt.DestBlendAlpha = s_blendFactor[dst]; + drt.BlendOp = + drt.BlendOpAlpha = D3D11_BLEND_OP_ADD; + + drt.SrcBlend = s_blendFactor[src]; + drt.DestBlend = s_blendFactor[dst]; + drt.BlendOp = D3D11_BLEND_OP_ADD; + drt.RenderTargetWriteMask = writeMask; + + DX_CHECK(m_device->CreateBlendState(&desc, &bs) ); + + m_blendStateCache.add(_state, bs); + } + + m_deviceCtx->OMSetBlendState(bs, NULL, 0xffffffff); + } + + void setDepthStencilState(uint64_t _state) + { + _state &= BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK; + + ID3D11DepthStencilState* dss = m_depthStencilStateCache.find(_state); + if (NULL == dss) + { + D3D11_DEPTH_STENCIL_DESC desc; + memset(&desc, 0, sizeof(desc) ); + uint32_t func = (_state&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT; + desc.DepthEnable = 0 != func; + desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO; + desc.DepthFunc = s_depthFunc[func]; + + DX_CHECK(m_device->CreateDepthStencilState(&desc, &dss) ); + + m_depthStencilStateCache.add(_state, dss); + } + + m_deviceCtx->OMSetDepthStencilState(dss, 0); + } + + void setRasterizerState(uint64_t _state, bool _wireframe = false) + { + _state &= BGFX_STATE_CULL_MASK; + + ID3D11RasterizerState* rs = m_rasterizerStateCache.find(_state); + if (NULL == rs) + { + D3D11_RASTERIZER_DESC desc; + memset(&desc, 0, sizeof(desc) ); + desc.FillMode = _wireframe ? D3D11_FILL_WIREFRAME : D3D11_FILL_SOLID; + + uint32_t cull = (_state&BGFX_STATE_CULL_MASK)>>BGFX_STATE_CULL_SHIFT; + desc.CullMode = s_cullMode[cull]; + + DX_CHECK(m_device->CreateRasterizerState(&desc, &rs) ); + + m_rasterizerStateCache.add(_state, rs); + } + + m_deviceCtx->RSSetState(rs); + } + + void saveScreenShot(Memory* _mem) + { + ID3D11Texture2D* backBuffer; + DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) ); + + D3D11_TEXTURE2D_DESC backBufferDesc; + backBuffer->GetDesc(&backBufferDesc); + + ID3D11Texture2D *texture = backBuffer; + if (backBufferDesc.SampleDesc.Count > 1) + { + D3D11_TEXTURE2D_DESC desc; + memcpy(&desc, &backBufferDesc, sizeof(desc) ); + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = 0; + desc.CPUAccessFlags = 0; + + ID3D11Texture2D* resolveTexture; + HRESULT hr = m_device->CreateTexture2D(&desc, NULL, &resolveTexture); + if (SUCCEEDED(hr) ) + { + m_deviceCtx->ResolveSubresource(resolveTexture, 0, backBuffer, 0, backBufferDesc.Format); + texture = resolveTexture; + } + + texture->GetDesc(&backBufferDesc); + + // save texture +// saveTga( (const char*)_mem->data, m_params.BackBufferWidth, m_params.BackBufferHeight, rect.Pitch, &data[point.y*rect.Pitch+point.x*bpp]); + + DX_RELEASE(resolveTexture, 0); + } + + DX_RELEASE(backBuffer, 0); + } + + HMODULE m_d3d11dll; + HMODULE m_dxgidll; + IDXGISwapChain* m_swapChain; + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceCtx; + ID3D11RenderTargetView* m_backBufferColor; + ID3D11DepthStencilView* m_backBufferDepthStencil; + + DXGI_SWAP_CHAIN_DESC m_scd; + uint32_t m_flags; + + IndexBuffer m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS]; + VertexBuffer m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; + Shader m_vertexShaders[BGFX_CONFIG_MAX_VERTEX_SHADERS]; + Shader m_fragmentShaders[BGFX_CONFIG_MAX_FRAGMENT_SHADERS]; + Material m_materials[BGFX_CONFIG_MAX_MATERIALS]; + Texture m_textures[BGFX_CONFIG_MAX_TEXTURES]; + VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + RenderTarget m_renderTargets[BGFX_CONFIG_MAX_RENDER_TARGETS]; + Uniform m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; + Uniform m_predefinedUniforms[PredefinedUniform::Count]; + UniformRegistry m_uniformReg; + + StateCacheT<ID3D11BlendState> m_blendStateCache; + StateCacheT<ID3D11DepthStencilState> m_depthStencilStateCache; + StateCacheT<ID3D11InputLayout> m_inputLayoutCache; + StateCacheT<ID3D11RasterizerState> m_rasterizerStateCache; + StateCacheT<ID3D11SamplerState> m_samplerStateCache; + + TextVideoMem m_textVideoMem; + RenderTargetHandle m_rt; + + Material* m_currentMaterial; + + uint8_t m_vsScratch[64<<10]; + uint8_t m_fsScratch[64<<10]; + + uint32_t m_vsChanges; + uint32_t m_fsChanges; + }; + + static RendererContext s_renderCtx; + + void IndexBuffer::create(uint32_t _size, void* _data) + { + m_size = _size; + m_dynamic = NULL == _data; + + D3D11_BUFFER_DESC desc; + desc.ByteWidth = _size; + desc.BindFlags = D3D11_BIND_INDEX_BUFFER; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; + + if (m_dynamic) + { + desc.Usage = D3D11_USAGE_DYNAMIC; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + + DX_CHECK(s_renderCtx.m_device->CreateBuffer(&desc + , NULL + , &m_ptr + ) ); + } + else + { + desc.Usage = D3D11_USAGE_DEFAULT; + desc.CPUAccessFlags = 0; + + D3D11_SUBRESOURCE_DATA srd; + srd.pSysMem = _data; + srd.SysMemPitch = 0; + srd.SysMemSlicePitch = 0; + + DX_CHECK(s_renderCtx.m_device->CreateBuffer(&desc + , &srd + , &m_ptr + ) ); + } + } + + void IndexBuffer::update(uint32_t _offset, uint32_t _size, void* _data) + { + ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx; + BX_CHECK(m_dynamic, "Must be dynamic!"); + + D3D11_MAPPED_SUBRESOURCE mapped; + D3D11_MAP type = m_dynamic && 0 == _offset && m_size == _size ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE; + DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) ); + memcpy( (uint8_t*)mapped.pData + _offset, _data, _size); + deviceCtx->Unmap(m_ptr, 0); + } + + void VertexBuffer::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle) + { + m_size = _size; + m_decl = _declHandle; + m_dynamic = NULL == _data; + + D3D11_BUFFER_DESC desc; + desc.ByteWidth = _size; + desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + desc.MiscFlags = 0; + + if (m_dynamic) + { + desc.Usage = D3D11_USAGE_DYNAMIC; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + desc.StructureByteStride = 0; + + DX_CHECK(s_renderCtx.m_device->CreateBuffer(&desc + , NULL + , &m_ptr + ) ); + } + else + { + desc.Usage = D3D11_USAGE_DEFAULT; + desc.CPUAccessFlags = 0; + desc.StructureByteStride = 0; + + D3D11_SUBRESOURCE_DATA srd; + srd.pSysMem = _data; + srd.SysMemPitch = 0; + srd.SysMemSlicePitch = 0; + + DX_CHECK(s_renderCtx.m_device->CreateBuffer(&desc + , &srd + , &m_ptr + ) ); + } + } + + void VertexBuffer::update(uint32_t _offset, uint32_t _size, void* _data) + { + ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx; + BX_CHECK(m_dynamic, "Must be dynamic!"); + + D3D11_MAPPED_SUBRESOURCE mapped; + D3D11_MAP type = m_dynamic && 0 == _offset && m_size == _size ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE; + DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) ); + memcpy( (uint8_t*)mapped.pData + _offset, _data, _size); + deviceCtx->Unmap(m_ptr, 0); + } + + void ConstantBuffer::commit() + { + ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx; + + reset(); + + do + { + uint32_t opcode = read(); + + if (ConstantType::End == opcode) + { + break; + } + + ConstantType::Enum type; + uint16_t loc; + uint16_t num; + uint16_t copy; + decodeOpcode(opcode, type, loc, num, copy); + + const char* data; + if (copy) + { + data = read(g_constantTypeSize[type]*num); + } + else + { + memcpy(&data, read(sizeof(void*) ), sizeof(void*) ); + } + +#define CASE_IMPLEMENT_UNIFORM(_uniform, _glsuffix, _dxsuffix, _type) \ + case ConstantType::_uniform: \ + case ConstantType::_uniform|BGFX_UNIFORM_FRAGMENTBIT: \ + { \ + s_renderCtx.setShaderConstant(type, loc, data, num); \ + } \ + break; + + switch ((int32_t)type) + { + CASE_IMPLEMENT_UNIFORM(Uniform1i, 1iv, I, int); + CASE_IMPLEMENT_UNIFORM(Uniform1f, 1fv, F, float); + CASE_IMPLEMENT_UNIFORM(Uniform1iv, 1iv, I, int); + CASE_IMPLEMENT_UNIFORM(Uniform1fv, 1fv, F, float); + CASE_IMPLEMENT_UNIFORM(Uniform2fv, 2fv, F, float); + CASE_IMPLEMENT_UNIFORM(Uniform3fv, 3fv, F, float); + CASE_IMPLEMENT_UNIFORM(Uniform4fv, 4fv, F, float); + CASE_IMPLEMENT_UNIFORM(Uniform3x3fv, Matrix3fv, F, float); + CASE_IMPLEMENT_UNIFORM(Uniform4x4fv, Matrix4fv, F, float); + + case ConstantType::End: + break; + + default: + BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", m_pos, opcode, type, loc, num, copy); + break; + } + +#undef CASE_IMPLEMENT_UNIFORM + + } while (true); + } + + void TextVideoMemBlitter::setup() + { + ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx; + + uint32_t width = s_renderCtx.m_scd.BufferDesc.Width; + uint32_t height = s_renderCtx.m_scd.BufferDesc.Width; + + RenderTargetHandle rt = BGFX_INVALID_HANDLE; + s_renderCtx.setRenderTarget(rt, false); + + D3D11_VIEWPORT vp; + vp.TopLeftX = 0; + vp.TopLeftY = 0; + vp.Width = (float)width; + vp.Height = (float)height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + deviceCtx->RSSetViewports(1, &vp); + + uint64_t state = BGFX_STATE_RGB_WRITE + | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_DEPTH_TEST_ALWAYS + ; + + s_renderCtx.setBlendState(state); + s_renderCtx.setDepthStencilState(state); + s_renderCtx.setRasterizerState(state); + +#if 0 + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZENABLE, FALSE) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID) ); +#endif // 0 + + Material& material = s_renderCtx.m_materials[m_material.idx]; + s_renderCtx.m_currentMaterial = &material; + deviceCtx->VSSetShader( (ID3D11VertexShader*)material.m_vsh->m_ptr, NULL, 0); + deviceCtx->VSSetConstantBuffers(0, 1, &material.m_vsh->m_buffer); + deviceCtx->PSSetShader( (ID3D11PixelShader*)material.m_fsh->m_ptr, NULL, 0); + deviceCtx->PSSetConstantBuffers(0, 1, &material.m_fsh->m_buffer); + + VertexBuffer& vb = s_renderCtx.m_vertexBuffers[m_vb->handle.idx]; + VertexDecl& vertexDecl = s_renderCtx.m_vertexDecls[m_vb->decl.idx]; + uint32_t stride = vertexDecl.m_stride; + uint32_t offset = 0; + deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset); + s_renderCtx.setInputLayout(vertexDecl, material); + + IndexBuffer& ib = s_renderCtx.m_indexBuffers[m_ib->handle.idx]; + deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0); + + float proj[16]; + matrix_ortho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); + + PredefinedUniform& predefined = material.m_predefined[0]; + uint8_t flags = predefined.m_type; + s_renderCtx.setShaderConstant(flags, predefined.m_loc, proj, 4); + + s_renderCtx.commitShaderConstants(); + s_renderCtx.m_textures[m_texture.idx].commit(0); + } + + void TextVideoMemBlitter::render(uint32_t _numIndices) + { + ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx; + + IndexBuffer& ib = s_renderCtx.m_indexBuffers[m_ib->handle.idx]; + ib.update(0, _numIndices*2, m_ib->data); + + uint32_t numVertices = _numIndices*4/6; + s_renderCtx.m_vertexBuffers[m_vb->handle.idx].update(0, numVertices*m_decl.m_stride, m_vb->data); + + deviceCtx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + deviceCtx->DrawIndexed(_numIndices, 0, 0); + } + + void Shader::create(bool _fragment, const Memory* _mem) + { + m_constantBuffer = ConstantBuffer::create(1024); + + StreamRead stream(_mem->data, _mem->size); + uint16_t count; + stream.read(count); + + uint16_t size; + stream.read(size); + + if (0 < size) + { + D3D11_BUFFER_DESC desc; + desc.ByteWidth = size; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; + DX_CHECK(s_renderCtx.m_device->CreateBuffer(&desc, NULL, &m_buffer) ); + } + + m_numPredefined = 0; + m_numUniforms = count; + + BX_TRACE("Shader consts %d", count); + + uint8_t fragmentBit = _fragment ? BGFX_UNIFORM_FRAGMENTBIT : 0; + + for (uint32_t ii = 0; ii < count; ++ii) + { + uint8_t nameSize; + stream.read(nameSize); + + char name[256]; + stream.read(&name, nameSize); + name[nameSize] = '\0'; + + uint8_t type; + stream.read(type); + + uint8_t num; + stream.read(num); + + uint16_t regIndex; + stream.read(regIndex); + + uint16_t regCount; + stream.read(regCount); + + const char* kind = "invalid"; + + const void* data = NULL; + PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name); + if (PredefinedUniform::Count != predefined) + { + kind = "predefined"; + m_predefined[m_numPredefined].m_loc = regIndex; + m_predefined[m_numPredefined].m_count = regCount; + m_predefined[m_numPredefined].m_type = predefined|fragmentBit; + m_numPredefined++; + } + else + { + const UniformInfo* info = s_renderCtx.m_uniformReg.find(name); + Uniform* uniform = info != NULL ? (Uniform*)info->m_data : NULL; + + if (NULL != uniform) + { + kind = "user"; + data = uniform->m_data; + m_constantBuffer->writeUniformRef( (ConstantType::Enum)(type|fragmentBit), regIndex, data, regCount); + } + } + + BX_TRACE("\t%s: %s, type %2d, num %2d, r.index %3d, r.count %2d" + , kind + , name + , type + , num + , regIndex + , regCount + ); + BX_UNUSED(kind); + } + + uint16_t shaderSize; + stream.read(shaderSize); + + m_constantBuffer->finish(); + + const DWORD* code = (const DWORD*)stream.getDataPtr(); + + if (_fragment) + { + DX_CHECK(s_renderCtx.m_device->CreatePixelShader(code, shaderSize, NULL, (ID3D11PixelShader**)&m_ptr) ); + } + else + { + m_hash = hash(code, shaderSize); + m_code = alloc(shaderSize); + memcpy(m_code->data, code, shaderSize); + + DX_CHECK(s_renderCtx.m_device->CreateVertexShader(code, shaderSize, NULL, (ID3D11VertexShader**)&m_ptr) ); + } + } + + void Texture::create(const Memory* _mem, uint32_t _flags) + { + m_sampler = s_renderCtx.m_samplerStateCache.find(_flags); + if (NULL == m_sampler) + { + D3D11_SAMPLER_DESC desc; + desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + desc.AddressU = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; + desc.AddressV = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; + desc.AddressW = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; + desc.MipLODBias = 0.0f; + desc.MaxAnisotropy = 1; + desc.ComparisonFunc = D3D11_COMPARISON_ALWAYS; + desc.BorderColor[0] = 0.0f; + desc.BorderColor[1] = 0.0f; + desc.BorderColor[2] = 0.0f; + desc.BorderColor[3] = 0.0f; + desc.MinLOD = 0; + desc.MaxLOD = D3D11_FLOAT32_MAX; + s_renderCtx.m_device->CreateSamplerState(&desc, &m_sampler); + +// D3D11_TEXTURE_ADDRESS_WRAP +// D3D11_FILTER_MIN_MAG_MIP_POINT + +// desc. = s_textureFilter[(_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT]; +// m_magFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT]; +// m_mipFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT]; +// m_srgb = (_flags&BGFX_TEXTURE_SRGB) == BGFX_TEXTURE_SRGB; + + s_renderCtx.m_samplerStateCache.add(_flags, m_sampler); + } + + Dds dds; + + if (parseDds(dds, _mem) ) + { + uint8_t bpp = dds.m_bpp; + + bool decompress = false; + + if (dds.m_cubeMap) + { +// createCubeTexture(dds.m_width, dds.m_numMips, s_textureFormat[dds.m_type].m_fmt); + } + else if (dds.m_depth > 1) + { +// createVolumeTexture(dds.m_width, dds.m_height, dds.m_depth, dds.m_numMips, s_textureFormat[dds.m_type].m_fmt); + } + else + { +// createTexture(dds.m_width, dds.m_height, dds.m_numMips, s_textureFormat[dds.m_type].m_fmt); + } + } + else + { + StreamRead stream(_mem->data, _mem->size); + + uint32_t magic; + stream.read(magic); + + if (BGFX_MAGIC == magic) + { + uint16_t width; + stream.read(width); + + uint16_t height; + stream.read(height); + + uint8_t bpp; + stream.read(bpp); + + uint8_t numMips; + stream.read(numMips); + + stream.align(16); + + DXGI_FORMAT fmt = 1 == bpp ? DXGI_FORMAT_R8_UNORM : DXGI_FORMAT_R8G8B8A8_UNORM; + + D3D11_TEXTURE2D_DESC desc; + desc.Width = width; + desc.Height = height; + desc.MipLevels = numMips; + desc.ArraySize = 1; + desc.Format = fmt; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; + + D3D11_SUBRESOURCE_DATA* srd = (D3D11_SUBRESOURCE_DATA*)alloca(numMips*sizeof(D3D11_SUBRESOURCE_DATA) ); + + for (uint8_t mip = 0; mip < numMips; ++mip) + { + width = uint32_max(width, 1); + height = uint32_max(height, 1); + + srd[mip].pSysMem = stream.getDataPtr(); + srd[mip].SysMemPitch = width*bpp; + srd[mip].SysMemSlicePitch = 0; + + stream.skip(width*height*bpp); + + width >>= 1; + height >>= 1; + } + + ID3D11Texture2D* texture; + DX_CHECK(s_renderCtx.m_device->CreateTexture2D(&desc, srd, &texture) ); + + D3D11_SHADER_RESOURCE_VIEW_DESC srv; + memset(&srv, 0, sizeof(srv) ); + srv.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srv.Texture2D.MipLevels = numMips; + DX_CHECK(s_renderCtx.m_device->CreateShaderResourceView(texture, &srv, &m_ptr) ); + + DX_RELEASE(texture, 0); + } + else + { + // + } + } + } + + void Texture::commit(uint8_t _stage) + { + s_renderCtx.m_deviceCtx->PSSetShaderResources(0, 1, &m_ptr); + s_renderCtx.m_deviceCtx->PSSetSamplers(0, 1, &m_sampler); + } + + void RenderTarget::create(uint16_t _width, uint16_t _height, uint32_t _flags, uint32_t _textureFlags) + { + + } + + void RenderTarget::commit(uint8_t _stage) + { + + } + + void Uniform::create(ConstantType::Enum _type, uint16_t _num, bool _alloc) + { + uint32_t size = BX_ALIGN_16(g_constantTypeSize[_type]*_num); + if (_alloc) + { + m_data = g_realloc(NULL, size); + } + + D3D11_BUFFER_DESC desc; + desc.ByteWidth = size; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; + DX_CHECK(s_renderCtx.m_device->CreateBuffer(&desc, NULL, &m_ptr) ); + } + + void Uniform::destroy() + { + if (NULL != m_data) + { + g_free(m_data); + m_data = NULL; + + DX_RELEASE(m_ptr, 0); + } + } + + void Context::flip() + { + s_renderCtx.flip(); + } + + void Context::rendererInit() + { + s_renderCtx.init(); + } + + void Context::rendererShutdown() + { + s_renderCtx.shutdown(); + } + + void Context::rendererCreateIndexBuffer(IndexBufferHandle _handle, Memory* _mem) + { + s_renderCtx.m_indexBuffers[_handle.idx].create(_mem->size, _mem->data); + } + + void Context::rendererDestroyIndexBuffer(IndexBufferHandle _handle) + { + s_renderCtx.m_indexBuffers[_handle.idx].destroy(); + } + + void Context::rendererCreateVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) + { + VertexDecl& decl = s_renderCtx.m_vertexDecls[_handle.idx]; + memcpy(&decl, &_decl, sizeof(VertexDecl) ); + dump(decl); + } + + void Context::rendererDestroyVertexDecl(VertexDeclHandle /*_handle*/) + { + } + + void Context::rendererCreateVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle) + { + s_renderCtx.m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle); + } + + void Context::rendererDestroyVertexBuffer(VertexBufferHandle _handle) + { + s_renderCtx.m_vertexBuffers[_handle.idx].destroy(); + } + + void Context::rendererCreateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size) + { + s_renderCtx.m_indexBuffers[_handle.idx].create(_size, NULL); + } + + void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) + { + s_renderCtx.m_indexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data); + } + + void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle _handle) + { + s_renderCtx.m_indexBuffers[_handle.idx].destroy(); + } + + void Context::rendererCreateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size) + { + VertexDeclHandle decl = BGFX_INVALID_HANDLE; + s_renderCtx.m_vertexBuffers[_handle.idx].create(_size, NULL, decl); + } + + void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) + { + s_renderCtx.m_vertexBuffers[_handle.idx].update(_offset, uint32_min(_size, _mem->size), _mem->data); + } + + void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle _handle) + { + s_renderCtx.m_vertexBuffers[_handle.idx].destroy(); + } + + void Context::rendererCreateVertexShader(VertexShaderHandle _handle, Memory* _mem) + { + s_renderCtx.m_vertexShaders[_handle.idx].create(false, _mem); + } + + void Context::rendererDestroyVertexShader(VertexShaderHandle _handle) + { + s_renderCtx.m_vertexShaders[_handle.idx].destroy(); + } + + void Context::rendererCreateFragmentShader(FragmentShaderHandle _handle, Memory* _mem) + { + s_renderCtx.m_fragmentShaders[_handle.idx].create(true, _mem); + } + + void Context::rendererDestroyFragmentShader(FragmentShaderHandle _handle) + { + s_renderCtx.m_fragmentShaders[_handle.idx].destroy(); + } + + void Context::rendererCreateMaterial(MaterialHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh) + { + s_renderCtx.m_materials[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]); + } + + void Context::rendererDestroyMaterial(FragmentShaderHandle _handle) + { + s_renderCtx.m_materials[_handle.idx].destroy(); + } + + void Context::rendererCreateTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags) + { + s_renderCtx.m_textures[_handle.idx].create(_mem, _flags); + } + + void Context::rendererDestroyTexture(TextureHandle _handle) + { + s_renderCtx.m_textures[_handle.idx].destroy(); + } + + void Context::rendererCreateRenderTarget(RenderTargetHandle _handle, uint16_t _width, uint16_t _height, uint32_t _flags, uint32_t _textureFlags) + { + s_renderCtx.m_renderTargets[_handle.idx].create(_width, _height, _flags, _textureFlags); + } + + void Context::rendererDestroyRenderTarget(RenderTargetHandle _handle) + { + s_renderCtx.m_renderTargets[_handle.idx].destroy(); + } + + void Context::rendererCreateUniform(UniformHandle _handle, ConstantType::Enum _type, uint16_t _num, const char* _name) + { + s_renderCtx.m_uniforms[_handle.idx].create(_type, _num); + s_renderCtx.m_uniformReg.reg(_name, &s_renderCtx.m_uniforms[_handle.idx]); + } + + void Context::rendererDestroyUniform(UniformHandle _handle) + { + s_renderCtx.m_uniforms[_handle.idx].destroy(); + } + + void Context::rendererSaveScreenShot(Memory* _mem) + { + s_renderCtx.saveScreenShot(_mem); + } + + void Context::rendererUpdateUniform(uint16_t _loc, const void* _data, uint32_t _size) + { + memcpy(s_renderCtx.m_uniforms[_loc].m_data, _data, _size); + } + + void Context::rendererSubmit() + { + ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx; + + s_renderCtx.updateResolution(m_render->m_resolution); + + if (0 < m_render->m_iboffset) + { + TransientIndexBuffer* ib = m_render->m_transientIb; + s_renderCtx.m_indexBuffers[ib->handle.idx].update(0, m_render->m_iboffset, ib->data); + } + + if (0 < m_render->m_vboffset) + { + TransientVertexBuffer* vb = m_render->m_transientVb; + s_renderCtx.m_vertexBuffers[vb->handle.idx].update(0, m_render->m_vboffset, vb->data); + } + + m_render->sort(); + + RenderState currentState; + currentState.reset(); + currentState.m_flags = BGFX_STATE_NONE; + + Matrix4 viewProj[BGFX_CONFIG_MAX_VIEWS]; + for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) + { + matrix_mul(viewProj[ii].val, m_render->m_view[ii].val, m_render->m_proj[ii].val); + } + +// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_FILLMODE, m_render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) ); + uint16_t materialIdx = bgfx::invalidHandle; + SortKey key; + uint8_t view = 0xff; + RenderTargetHandle rt = BGFX_INVALID_HANDLE; + float alphaRef = 0.0f; + D3D11_PRIMITIVE_TOPOLOGY primType = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + deviceCtx->IASetPrimitiveTopology(primType); + uint32_t primNumVerts = 3; + + uint32_t statsNumPrimsSubmitted = 0; + uint32_t statsNumIndices = 0; + uint32_t statsNumInstances = 0; + uint32_t statsNumPrimsRendered = 0; + + int64_t elapsed = -bx::getHPCounter(); + + if (0 == (m_render->m_debug&BGFX_DEBUG_IFH) ) + { + for (uint32_t item = 0, numItems = m_render->m_num; item < numItems; ++item) + { + key.decode(m_render->m_sortKeys[item]); + const RenderState& state = m_render->m_renderState[m_render->m_sortValues[item] ]; + + const uint64_t newFlags = state.m_flags; + uint64_t changedFlags = currentState.m_flags ^ state.m_flags; + currentState.m_flags = newFlags; + + if (key.m_view != view) + { + currentState.clear(); + changedFlags = BGFX_STATE_MASK; + currentState.m_flags = newFlags; + + view = key.m_view; + materialIdx = bgfx::invalidHandle; + + if (m_render->m_rt[view].idx != rt.idx) + { + rt = m_render->m_rt[view]; + s_renderCtx.setRenderTarget(rt); + } + + Rect& rect = m_render->m_rect[view]; + + D3D11_VIEWPORT vp; + vp.TopLeftX = rect.m_x; + vp.TopLeftY = rect.m_y; + vp.Width = rect.m_width; + vp.Height = rect.m_height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + deviceCtx->RSSetViewports(1, &vp); + Clear& clear = m_render->m_clear[view]; + + if (BGFX_CLEAR_NONE != clear.m_flags) + { + s_renderCtx.clear(rect, clear); + } + + s_renderCtx.setBlendState(BGFX_STATE_DEFAULT); + s_renderCtx.setDepthStencilState(BGFX_STATE_DEFAULT); + s_renderCtx.setRasterizerState(BGFX_STATE_DEFAULT); + + uint8_t primIndex = uint8_t( (newFlags&BGFX_STATE_PT_MASK)>>BGFX_STATE_PT_SHIFT); + if (primType != s_primType[primIndex]) + { + primType = s_primType[primIndex]; + primNumVerts = s_primNumVerts[primIndex]; + deviceCtx->IASetPrimitiveTopology(primType); + } + } + + if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK + |BGFX_STATE_ALPHA_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE + |BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_REF_MASK|BGFX_STATE_PT_MASK + |BGFX_STATE_POINT_SIZE_MASK|BGFX_STATE_SRGBWRITE|BGFX_STATE_MSAA) & changedFlags) + { + if ( (BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK) & changedFlags) + { + s_renderCtx.setDepthStencilState(newFlags); + } + + if ( (BGFX_STATE_BLEND_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags) + { + s_renderCtx.setBlendState(newFlags); + } + + if ( (BGFX_STATE_CULL_MASK) & changedFlags) + { + s_renderCtx.setRasterizerState(newFlags); + } + } + + bool materialChanged = false; + bool constantsChanged = state.m_constBegin < state.m_constEnd; + rendererUpdateUniforms(m_render->m_constantBuffer, state.m_constBegin, state.m_constEnd); + + if (key.m_material != materialIdx) + { + materialIdx = key.m_material; + + if (bgfx::invalidHandle == materialIdx) + { + s_renderCtx.m_currentMaterial = NULL; + + deviceCtx->VSSetShader(NULL, 0, 0); + deviceCtx->PSSetShader(NULL, 0, 0); + } + else + { + Material& material = s_renderCtx.m_materials[materialIdx]; + s_renderCtx.m_currentMaterial = &material; + + deviceCtx->VSSetShader( (ID3D11VertexShader*)material.m_vsh->m_ptr, NULL, 0); + deviceCtx->VSSetConstantBuffers(0, 1, &material.m_vsh->m_buffer); + + deviceCtx->PSSetShader( (ID3D11PixelShader*)material.m_fsh->m_ptr, NULL, 0); + deviceCtx->PSSetConstantBuffers(0, 1, &material.m_fsh->m_buffer); + } + + materialChanged = + constantsChanged = true; + } + + if (bgfx::invalidHandle != materialIdx) + { + Material& material = s_renderCtx.m_materials[materialIdx]; + + if (constantsChanged) + { + Material& material = s_renderCtx.m_materials[materialIdx]; + material.m_vsh->m_constantBuffer->commit(); + material.m_fsh->m_constantBuffer->commit(); + } + + for (uint32_t ii = 0, num = material.m_numPredefined; ii < num; ++ii) + { + PredefinedUniform& predefined = material.m_predefined[ii]; + uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT; + switch (predefined.m_type&(~BGFX_UNIFORM_FRAGMENTBIT) ) + { + case PredefinedUniform::ViewRect: + { + float rect[4]; + rect[0] = m_render->m_rect[view].m_x; + rect[1] = m_render->m_rect[view].m_y; + rect[2] = m_render->m_rect[view].m_width; + rect[3] = m_render->m_rect[view].m_height; + + s_renderCtx.setShaderConstant(flags, predefined.m_loc, &rect[0], 1); + } + break; + + case PredefinedUniform::ViewTexel: + { + float rect[4]; + rect[0] = 1.0f/float(m_render->m_rect[view].m_width); + rect[1] = 1.0f/float(m_render->m_rect[view].m_height); + + s_renderCtx.setShaderConstant(flags, predefined.m_loc, &rect[0], 1); + } + break; + + case PredefinedUniform::View: + { + s_renderCtx.setShaderConstant(flags, predefined.m_loc, m_render->m_view[view].val, uint32_min(4, predefined.m_count) ); + } + break; + + case PredefinedUniform::ViewProj: + { + s_renderCtx.setShaderConstant(flags, predefined.m_loc, viewProj[view].val, uint32_min(4, predefined.m_count) ); + } + break; + + case PredefinedUniform::Model: + { + const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix]; + s_renderCtx.setShaderConstant(flags, predefined.m_loc, model.val, uint32_min(state.m_num*4, predefined.m_count) ); + } + break; + + case PredefinedUniform::ModelViewProj: + { + Matrix4 modelViewProj; + const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix]; + matrix_mul(modelViewProj.val, model.val, viewProj[view].val); + s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelViewProj.val, uint32_min(4, predefined.m_count) ); + } + break; + + case PredefinedUniform::ModelViewProjX: + { + const Matrix4& model = m_render->m_matrixCache.m_cache[state.m_matrix]; + + static const BX_ALIGN_STRUCT_16(float) s_bias[16] = + { + 0.5f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.5f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.5f, 0.5f, 0.5f, 1.0f, + }; + + uint8_t other = m_render->m_other[view]; + Matrix4 viewProjBias; + matrix_mul(viewProjBias.val, viewProj[other].val, s_bias); + + Matrix4 modelViewProj; + matrix_mul(modelViewProj.val, model.val, viewProjBias.val); + + s_renderCtx.setShaderConstant(flags, predefined.m_loc, modelViewProj.val, uint32_min(4, predefined.m_count) ); + } + break; + + case PredefinedUniform::ViewProjX: + { + static const BX_ALIGN_STRUCT_16(float) s_bias[16] = + { + 0.5f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.5f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.5f, 0.5f, 0.5f, 1.0f, + }; + + uint8_t other = m_render->m_other[view]; + Matrix4 viewProjBias; + matrix_mul(viewProjBias.val, viewProj[other].val, s_bias); + + s_renderCtx.setShaderConstant(flags, predefined.m_loc, viewProjBias.val, uint32_min(4, predefined.m_count) ); + } + break; + + case PredefinedUniform::AlphaRef: + { + s_renderCtx.setShaderConstant(flags, predefined.m_loc, &alphaRef, 1); + } + break; + + default: + BX_CHECK(false, "predefined %d not handled", predefined.m_type); + break; + } + } + + if (constantsChanged) + { + s_renderCtx.commitShaderConstants(); + } + } + +// if (BGFX_STATE_TEX_MASK & changedFlags) + { + uint64_t flag = BGFX_STATE_TEX0; + for (uint32_t stage = 0; stage < BGFX_STATE_TEX_COUNT; ++stage) + { + const Sampler& sampler = state.m_sampler[stage]; + Sampler& current = currentState.m_sampler[stage]; + if (current.m_idx != sampler.m_idx + || current.m_flags != sampler.m_flags + || materialChanged) + { + if (bgfx::invalidHandle != sampler.m_idx) + { + switch (sampler.m_flags&BGFX_SAMPLER_TYPE_MASK) + { + case BGFX_SAMPLER_TEXTURE: +// s_renderCtx.m_textures[sampler.m_idx].commit(stage); + break; + + case BGFX_SAMPLER_RENDERTARGET_COLOR: +// s_renderCtx.m_renderTargets[sampler.m_idx].commit(stage); + break; + + case BGFX_SAMPLER_RENDERTARGET_DEPTH: +// id = s_renderCtx.m_renderTargets[sampler.m_idx].m_depth.m_id; + break; + } + } + else + { +// DX_CHECK(device->SetTexture(stage, NULL) ); + } + } + + current = sampler; + flag <<= 1; + } + } + + if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || materialChanged) + { + currentState.m_vertexBuffer = state.m_vertexBuffer; + + uint16_t handle = state.m_vertexBuffer.idx; + if (bgfx::invalidHandle != handle) + { + const VertexBuffer& vb = s_renderCtx.m_vertexBuffers[handle]; + + uint16_t decl = vb.m_decl.idx == bgfx::invalidHandle ? state.m_vertexDecl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = s_renderCtx.m_vertexDecls[decl]; + uint32_t stride = vertexDecl.m_stride; + uint32_t offset = 0; + deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset); + s_renderCtx.setInputLayout(vertexDecl, s_renderCtx.m_materials[materialIdx]); + + if (invalidHandle != state.m_instanceDataBuffer.idx) + { +// const VertexBuffer& inst = s_renderCtx.m_vertexBuffers[state.m_instanceDataBuffer.idx]; +// DX_CHECK(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA|state.m_numInstances) ); +// DX_CHECK(device->SetStreamSourceFreq(1, D3DSTREAMSOURCE_INSTANCEDATA|1) ); +// DX_CHECK(device->SetStreamSource(1, inst.m_ptr, state.m_instanceDataOffset, state.m_instanceDataStride) ); +// +// IDirect3DVertexDeclaration9* ptr = createVertexDecl(vertexDecl.m_decl, state.m_instanceDataStride/16); +// DX_CHECK(device->SetVertexDeclaration(ptr) ); +// DX_RELEASE(ptr, 0); + } + else + { +// DX_CHECK(device->SetStreamSourceFreq(0, 1) ); +// DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); +// DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) ); + } + } + else + { + deviceCtx->IASetVertexBuffers(0, 0, NULL, NULL, NULL); + } + } + + if (currentState.m_indexBuffer.idx != state.m_indexBuffer.idx) + { + currentState.m_indexBuffer = state.m_indexBuffer; + + uint16_t handle = state.m_indexBuffer.idx; + if (bgfx::invalidHandle != handle) + { + const IndexBuffer& ib = s_renderCtx.m_indexBuffers[handle]; + deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0); + } + else + { + deviceCtx->IASetIndexBuffer(NULL, DXGI_FORMAT_R16_UINT, 0); + } + } + + if (bgfx::invalidHandle != currentState.m_vertexBuffer.idx) + { + uint32_t numVertices = state.m_numVertices; + if (UINT32_C(0xffffffff) == numVertices) + { + const VertexBuffer& vb = s_renderCtx.m_vertexBuffers[currentState.m_vertexBuffer.idx]; + uint16_t decl = vb.m_decl.idx == bgfx::invalidHandle ? state.m_vertexDecl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = s_renderCtx.m_vertexDecls[decl]; + numVertices = vb.m_size/vertexDecl.m_stride; + } + + uint32_t numIndices = 0; + uint32_t numPrimsSubmitted = 0; + uint32_t numInstances = 0; + uint32_t numPrimsRendered = 0; + + if (bgfx::invalidHandle != state.m_indexBuffer.idx) + { + if (BGFX_DRAW_WHOLE_INDEX_BUFFER == state.m_startIndex) + { + numIndices = s_renderCtx.m_indexBuffers[state.m_indexBuffer.idx].m_size/2; + numPrimsSubmitted = numIndices/primNumVerts; + numInstances = state.m_numInstances; + numPrimsRendered = numPrimsSubmitted*state.m_numInstances; + + deviceCtx->DrawIndexed(numIndices, 0, 0); + } + else if (primNumVerts <= state.m_numIndices) + { + numIndices = state.m_numIndices; + numPrimsSubmitted = numIndices/primNumVerts; + numInstances = state.m_numInstances; + numPrimsRendered = numPrimsSubmitted*state.m_numInstances; + + deviceCtx->DrawIndexed(numIndices, state.m_startIndex, 0); + } + } + else + { + numPrimsSubmitted = numVertices/primNumVerts; + numInstances = state.m_numInstances; + numPrimsRendered = numPrimsSubmitted*state.m_numInstances; + + deviceCtx->Draw(numVertices, state.m_startVertex); + } + + statsNumPrimsSubmitted += numPrimsSubmitted; + statsNumIndices += numIndices; + statsNumInstances += numInstances; + statsNumPrimsRendered += numPrimsRendered; + } + } + } + + int64_t now = bx::getHPCounter(); + elapsed += now; + + static int64_t last = now; + int64_t frameTime = now - last; + last = now; + + if (m_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) + { +// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugstats"); + + TextVideoMem& tvm = s_renderCtx.m_textVideoMem; + + static int64_t next = now; + + if (now >= next) + { + next = now + bx::getHPFrequency(); + double freq = double(bx::getHPFrequency() ); + double toMs = 1000.0/freq; + double elapsedCpuMs = double(elapsed)*toMs; + + tvm.clear(); + uint16_t pos = 10; + tvm.printf(0, 0, 0x8f, " " BGFX_RENDERER_NAME " "); + tvm.printf(10, pos++, 0x8e, " Frame: %3.4f [ms] / %3.2f", frameTime*toMs, freq/frameTime); + tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms]" + , m_render->m_num + , elapsedCpuMs + ); + tvm.printf(10, pos++, 0x8e, " Prims: %7d (#inst: %5d), submitted: %7d" + , statsNumPrimsRendered + , statsNumInstances + , statsNumPrimsSubmitted + ); + tvm.printf(10, pos++, 0x8e, " Indices: %7d", statsNumIndices); + tvm.printf(10, pos++, 0x8e, " DVB size: %7d", m_render->m_vboffset); + tvm.printf(10, pos++, 0x8e, " DIB size: %7d", m_render->m_iboffset); + + uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attrIndex = m_render->m_waitSubmit < m_render->m_waitRender; + + tvm.printf(10, pos++, attr[attrIndex&1], "Submit wait: %3.4f [ms]", m_render->m_waitSubmit*toMs); + tvm.printf(10, pos++, attr[(attrIndex+1)&1], "Render wait: %3.4f [ms]", m_render->m_waitRender*toMs); + } + + m_textVideoMemBlitter.blit(tvm); + +// PIX_ENDEVENT(); + } + else if (m_render->m_debug & BGFX_DEBUG_TEXT) + { +// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugtext"); + + m_textVideoMemBlitter.blit(m_render->m_textVideoMem); + +// PIX_ENDEVENT(); + } + } +} + +#endif // BGFX_CONFIG_RENDERER_DIRECT3D11 diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h new file mode 100644 index 00000000..5df36123 --- /dev/null +++ b/src/renderer_d3d11.h @@ -0,0 +1,289 @@ +/* + * Copyright 2011-2012 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#ifndef __RENDERER_D3D11_H__ +#define __RENDERER_D3D11_H__ + +#include <d3d11.h> +#include "renderer_d3d.h" + +typedef HRESULT (WINAPI *CreateDXGIFactoryFn)(REFIID, void**); + +namespace bgfx +{ + template <typename Ty> + class StateCacheT + { + public: + void add(uint64_t _id, Ty* _item) + { + invalidate(_id); + m_hashMap.insert(stl::make_pair(_id, _item) ); + } + + Ty* find(uint64_t _id) + { + HashMap::iterator it = m_hashMap.find(_id); + if (it != m_hashMap.end() ) + { + return it->second; + } + + return NULL; + } + + void invalidate(uint64_t _id) + { + HashMap::iterator it = m_hashMap.find(_id); + if (it != m_hashMap.end() ) + { + DX_RELEASE(it->second, 0); + m_hashMap.erase(it); + } + } + + void invalidate() + { + for (HashMap::iterator it = m_hashMap.begin(), itEnd = m_hashMap.end(); it != itEnd; ++it) + { + DX_RELEASE(it->second, 0); + } + m_hashMap.clear(); + } + + private: + typedef stl::unordered_map<uint64_t, Ty*> HashMap; + HashMap m_hashMap; + }; + + struct IndexBuffer + { + IndexBuffer() + : m_ptr(NULL) + , m_dynamic(false) + { + } + + void create(uint32_t _size, void* _data); + void update(uint32_t _offset, uint32_t _size, void* _data); + + void destroy() + { + if (NULL != m_ptr) + { + DX_RELEASE(m_ptr, 0); + m_dynamic = false; + } + } + + ID3D11Buffer* m_ptr; + uint32_t m_size; + bool m_dynamic; + }; + + struct VertexBuffer + { + VertexBuffer() + : m_ptr(NULL) + , m_dynamic(false) + { + } + + void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle); + void update(uint32_t _offset, uint32_t _size, void* _data); + + void destroy() + { + if (NULL != m_ptr) + { + DX_RELEASE(m_ptr, 0); + m_dynamic = false; + } + } + + ID3D11Buffer* m_ptr; + uint32_t m_size; + VertexDeclHandle m_decl; + bool m_dynamic; + }; + + struct Uniform + { + Uniform() + : m_ptr(NULL) + , m_data(NULL) + { + } + + void create(ConstantType::Enum _type, uint16_t _num, bool _alloc = true); + void destroy(); + + ID3D11Buffer* m_ptr; + void* m_data; + }; + + struct Shader + { + Shader() + : m_ptr(NULL) + , m_code(NULL) + , m_buffer(NULL) + , m_hash(0) + { + } + + void create(bool _fragment, const Memory* _mem); + DWORD* getShaderCode(uint8_t _fragmentBit, const Memory* _mem); + + void destroy() + { + ConstantBuffer::destroy(m_constantBuffer); + m_constantBuffer = NULL; + m_numPredefined = 0; + + if (NULL != m_buffer) + { + DX_RELEASE(m_buffer, 0); + } + + DX_RELEASE(m_ptr, 0); + + if (NULL != m_code) + { + release(m_code); + m_code = NULL; + m_hash = 0; + } + } + + IUnknown* m_ptr; + const Memory* m_code; + ID3D11Buffer* m_buffer; + ConstantBuffer* m_constantBuffer; + + PredefinedUniform m_predefined[PredefinedUniform::Count]; + + uint32_t m_hash; + + uint16_t m_numUniforms; + uint8_t m_numPredefined; + }; + + struct Material + { + Material() + : m_vsh(NULL) + , m_fsh(NULL) + { + } + + void create(const Shader& _vsh, const Shader& _fsh) + { + BX_CHECK(NULL != _vsh.m_ptr, "Vertex shader doesn't exist."); + m_vsh = &_vsh; + + BX_CHECK(NULL != _fsh.m_ptr, "Fragment shader doesn't exist."); + m_fsh = &_fsh; + + memcpy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) ); + memcpy(&m_predefined[_vsh.m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) ); + m_numPredefined = _vsh.m_numPredefined + _fsh.m_numPredefined; + } + + void destroy() + { + m_numPredefined = 0; + m_vsh = NULL; + m_fsh = NULL; + } + + const Shader* m_vsh; + const Shader* m_fsh; + + PredefinedUniform m_predefined[PredefinedUniform::Count*2]; + uint8_t m_numPredefined; + }; + + struct Texture + { + enum Enum + { + Texture2D, + Texture3D, + TextureCube, + }; + + Texture() + : m_ptr(NULL) + { + } + +// void createTexture(uint32_t _width, uint32_t _height, uint8_t _numMips, D3DFORMAT _fmt); +// void createVolumeTexture(uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _numMips, D3DFORMAT _fmt); +// void createCubeTexture(uint32_t _edge, uint32_t _numMips, D3DFORMAT _fmt); + + void create(const Memory* _mem, uint32_t _flags); + + void destroy() + { + DX_RELEASE(m_ptr, 0); + } + + void commit(uint8_t _stage); + + ID3D11ShaderResourceView* m_ptr; + ID3D11SamplerState* m_sampler; + Enum m_type; + bool m_srgb; + }; + + struct RenderTarget + { + RenderTarget() + : +// m_rt(NULL) +// , m_colorTexture(NULL) +// , m_color(NULL) +// , m_depthTexture(NULL) +// , m_depth(NULL) +// , m_minFilter(D3DTEXF_LINEAR) +// , m_magFilter(D3DTEXF_LINEAR) + m_width(0) + , m_height(0) + , m_flags(0) + , m_depthOnly(false) + { + } + + void create(uint16_t _width, uint16_t _height, uint32_t _flags, uint32_t _textureFlags); +// void createTextures(); +// void destroyTextures(); + + void destroy() + { +// destroyTextures(); + m_flags = 0; + } + + void commit(uint8_t _stage); +// void resolve(); + +// Msaa m_msaa; +// IDirect3DSurface9* m_rt; +// IDirect3DTexture9* m_colorTexture; +// IDirect3DSurface9* m_color; +// IDirect3DTexture9* m_depthTexture; +// IDirect3DSurface9* m_depth; +// D3DTEXTUREFILTERTYPE m_minFilter; +// D3DTEXTUREFILTERTYPE m_magFilter; + uint16_t m_width; + uint16_t m_height; + uint32_t m_flags; + bool m_depthOnly; + }; + +} // namespace bgfx + +#endif // __RENDERER_D3D11_H__ diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 464d29ea..894d8897 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -193,11 +193,11 @@ namespace bgfx m_D3DPERF_EndEvent = (D3DPERF_EndEventFunc)GetProcAddress(m_d3d9dll, "D3DPERF_EndEvent"); #if BGFX_CONFIG_RENDERER_DIRECT3D9EX - Direct3DCreate9ExFunc direct3DCreate9Ex = (Direct3DCreate9ExFunc)GetProcAddress(m_d3d9dll, "Direct3DCreate9Ex"); + Direct3DCreate9ExFn direct3DCreate9Ex = (Direct3DCreate9ExFn)GetProcAddress(m_d3d9dll, "Direct3DCreate9Ex"); BGFX_FATAL(NULL != direct3DCreate9Ex, bgfx::Fatal::D3D9_UnableToCreateInterface, "Function Direct3DCreate9Ex not found."); direct3DCreate9Ex(D3D_SDK_VERSION, &m_d3d9); #else - Direct3DCreate9Func direct3DCreate9 = (Direct3DCreate9Func)GetProcAddress(m_d3d9dll, "Direct3DCreate9"); + Direct3DCreate9Fn direct3DCreate9 = (Direct3DCreate9Fn)GetProcAddress(m_d3d9dll, "Direct3DCreate9"); BGFX_FATAL(NULL != direct3DCreate9, bgfx::Fatal::D3D9_UnableToCreateInterface, "Function Direct3DCreate9 not found."); m_d3d9 = direct3DCreate9(D3D_SDK_VERSION); #endif // defined(D3D_DISABLE_9EX) @@ -308,8 +308,10 @@ namespace bgfx || (m_caps.VertexShaderVersion >= D3DVS_VERSION(3, 0) ) ; - if (m_instancing) + if (m_amd + && s_extendedFormats[ExtendedFormat::Inst].m_supported) { + // ATi only m_device->SetRenderState(D3DRS_POINTSIZE, D3DFMT_INST); } @@ -949,14 +951,6 @@ namespace bgfx elem->Type = declType; elem->Offset = _decl.m_offset[attr]; ++elem; - -// BX_TRACE("\tattr %d, num %d, type %d, norm %d, offset %d" -// , attr -// , num -// , type -// , normalized -// , _decl.m_offset[attr] -// ); } } @@ -1657,7 +1651,7 @@ namespace bgfx matrix_ortho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); PredefinedUniform& predefined = material.m_predefined[0]; - uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT; + uint8_t flags = predefined.m_type; s_renderCtx.setShaderConstantF(flags, predefined.m_loc, proj, 4); s_renderCtx.m_textures[m_texture.idx].commit(0); @@ -1829,11 +1823,13 @@ namespace bgfx void Context::rendererSubmit() { + IDirect3DDevice9* device = s_renderCtx.m_device; + PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), "rendererSubmit"); s_renderCtx.updateResolution(m_render->m_resolution); - s_renderCtx.m_device->BeginScene(); + device->BeginScene(); if (0 < m_render->m_iboffset) { @@ -1859,7 +1855,7 @@ namespace bgfx matrix_mul(viewProj[ii].val, m_render->m_view[ii].val, m_render->m_proj[ii].val); } - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_FILLMODE, m_render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) ); + DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, m_render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) ); uint16_t materialIdx = bgfx::invalidHandle; SortKey key; uint8_t view = 0xff; @@ -1913,7 +1909,7 @@ namespace bgfx vp.Height = rect.m_height; vp.MinZ = 0.0f; vp.MaxZ = 1.0f; - DX_CHECK(s_renderCtx.m_device->SetViewport(&vp) ); + DX_CHECK(device->SetViewport(&vp) ); Clear& clear = m_render->m_clear[view]; @@ -1927,13 +1923,13 @@ namespace bgfx flags |= D3DCLEAR_TARGET; uint32_t rgba = clear.m_rgba; color = D3DCOLOR_RGBA(rgba>>24, (rgba>>16)&0xff, (rgba>>8)&0xff, rgba&0xff); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_ALPHA) ); + DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_ALPHA) ); } if (BGFX_CLEAR_DEPTH_BIT & clear.m_flags) { flags |= D3DCLEAR_ZBUFFER; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) ); + DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) ); } if (BGFX_CLEAR_STENCIL_BIT & clear.m_flags) @@ -1948,18 +1944,18 @@ namespace bgfx rc.top = rect.m_y; rc.right = rect.m_x + rect.m_width; rc.bottom = rect.m_y + rect.m_height; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE) ); - DX_CHECK(s_renderCtx.m_device->SetScissorRect(&rc) ); - DX_CHECK(s_renderCtx.m_device->Clear(0, NULL, flags, color, clear.m_depth, clear.m_stencil) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) ); + DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE) ); + DX_CHECK(device->SetScissorRect(&rc) ); + DX_CHECK(device->Clear(0, NULL, flags, color, clear.m_depth, clear.m_stencil) ); + DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) ); } } - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZENABLE, TRUE) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) ); + DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, TRUE) ); + DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS) ); + DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) ); + DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); + DX_CHECK(device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) ); } if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK @@ -1970,22 +1966,22 @@ namespace bgfx if (BGFX_STATE_CULL_MASK & changedFlags) { uint32_t cull = (newFlags&BGFX_STATE_CULL_MASK)>>BGFX_STATE_CULL_SHIFT; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_CULLMODE, s_cullMode[cull]) ); + DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, s_cullMode[cull]) ); } if (BGFX_STATE_DEPTH_WRITE & changedFlags) { - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZWRITEENABLE, !!(BGFX_STATE_DEPTH_WRITE & newFlags) ) ); + DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, !!(BGFX_STATE_DEPTH_WRITE & newFlags) ) ); } if (BGFX_STATE_DEPTH_TEST_MASK & changedFlags) { uint32_t func = (newFlags&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZENABLE, 0 != func) ); + DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, 0 != func) ); if (0 != func) { - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ZFUNC, s_depthFunc[func]) ); + DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, s_depthFunc[func]) ); } } @@ -1993,39 +1989,39 @@ namespace bgfx { uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT; alphaRef = ref/255.0f; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHAREF, ref) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHATESTENABLE, !!(BGFX_STATE_ALPHA_TEST & newFlags) ) ); + DX_CHECK(device->SetRenderState(D3DRS_ALPHAREF, ref) ); + DX_CHECK(device->SetRenderState(D3DRS_ALPHATESTENABLE, !!(BGFX_STATE_ALPHA_TEST & newFlags) ) ); } if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags) { - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_POINTSIZE, castfu( (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ) ) ); + DX_CHECK(device->SetRenderState(D3DRS_POINTSIZE, castfu( (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ) ) ); } #if BX_PLATFORM_WINDOWS if (BGFX_STATE_SRGBWRITE & changedFlags) { - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, (newFlags&BGFX_STATE_SRGBWRITE) == BGFX_STATE_SRGBWRITE) ); + DX_CHECK(device->SetRenderState(D3DRS_SRGBWRITEENABLE, (newFlags&BGFX_STATE_SRGBWRITE) == BGFX_STATE_SRGBWRITE) ); } #endif // BX_PLATFORM_WINDOWS if (BGFX_STATE_MSAA & changedFlags) { - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, (newFlags&BGFX_STATE_MSAA) == BGFX_STATE_MSAA) ); + DX_CHECK(device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, (newFlags&BGFX_STATE_MSAA) == BGFX_STATE_MSAA) ); } if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags) { uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0; writeEnable |= (newFlags&BGFX_STATE_RGB_WRITE) ? D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE : 0; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_COLORWRITEENABLE, writeEnable) ); + DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, writeEnable) ); } if (BGFX_STATE_BLEND_MASK & changedFlags) { bool alphaBlendEnabled = !!(BGFX_STATE_BLEND_MASK & newFlags); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_ALPHABLENDENABLE, alphaBlendEnabled) ); -// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, alphaBlendEnabled) ); + DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, alphaBlendEnabled) ); +// DX_CHECK(device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, alphaBlendEnabled) ); if (alphaBlendEnabled) { @@ -2033,10 +2029,10 @@ namespace bgfx uint32_t src = blend&0xf; uint32_t dst = (blend>>4)&0xf; - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SRCBLEND, s_blendFactor[src]) ); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_DESTBLEND, s_blendFactor[dst]) ); -// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_SRCALPHA) ); -// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA) ); + DX_CHECK(device->SetRenderState(D3DRS_SRCBLEND, s_blendFactor[src]) ); + DX_CHECK(device->SetRenderState(D3DRS_DESTBLEND, s_blendFactor[dst]) ); +// DX_CHECK(device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_SRCALPHA) ); +// DX_CHECK(device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA) ); } } @@ -2055,14 +2051,14 @@ namespace bgfx if (bgfx::invalidHandle == materialIdx) { - s_renderCtx.m_device->SetVertexShader(NULL); - s_renderCtx.m_device->SetPixelShader(NULL); + device->SetVertexShader(NULL); + device->SetPixelShader(NULL); } else { Material& material = s_renderCtx.m_materials[materialIdx]; - s_renderCtx.m_device->SetVertexShader( (IDirect3DVertexShader9*)material.m_vsh->m_ptr); - s_renderCtx.m_device->SetPixelShader( (IDirect3DPixelShader9*)material.m_fsh->m_ptr); + device->SetVertexShader( (IDirect3DVertexShader9*)material.m_vsh->m_ptr); + device->SetPixelShader( (IDirect3DPixelShader9*)material.m_fsh->m_ptr); } materialChanged = @@ -2220,7 +2216,7 @@ namespace bgfx } else { - DX_CHECK(s_renderCtx.m_device->SetTexture(stage, NULL) ); + DX_CHECK(device->SetTexture(stage, NULL) ); } } @@ -2240,30 +2236,31 @@ namespace bgfx uint16_t decl = vb.m_decl.idx == bgfx::invalidHandle ? state.m_vertexDecl.idx : vb.m_decl.idx; const VertexDeclaration& vertexDecl = s_renderCtx.m_vertexDecls[decl]; - DX_CHECK(s_renderCtx.m_device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) ); + DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) ); - if (invalidHandle != state.m_instanceDataBuffer.idx) + if (invalidHandle != state.m_instanceDataBuffer.idx + && s_renderCtx.m_instancing) { const VertexBuffer& inst = s_renderCtx.m_vertexBuffers[state.m_instanceDataBuffer.idx]; - DX_CHECK(s_renderCtx.m_device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA|state.m_numInstances) ); - DX_CHECK(s_renderCtx.m_device->SetStreamSourceFreq(1, D3DSTREAMSOURCE_INSTANCEDATA|1) ); - DX_CHECK(s_renderCtx.m_device->SetStreamSource(1, inst.m_ptr, state.m_instanceDataOffset, state.m_instanceDataStride) ); + DX_CHECK(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA|state.m_numInstances) ); + DX_CHECK(device->SetStreamSourceFreq(1, D3DSTREAMSOURCE_INSTANCEDATA|1) ); + DX_CHECK(device->SetStreamSource(1, inst.m_ptr, state.m_instanceDataOffset, state.m_instanceDataStride) ); IDirect3DVertexDeclaration9* ptr = createVertexDecl(vertexDecl.m_decl, state.m_instanceDataStride/16); - DX_CHECK(s_renderCtx.m_device->SetVertexDeclaration(ptr) ); + DX_CHECK(device->SetVertexDeclaration(ptr) ); DX_RELEASE(ptr, 0); } else { - DX_CHECK(s_renderCtx.m_device->SetStreamSourceFreq(0, 1) ); - DX_CHECK(s_renderCtx.m_device->SetStreamSource(1, NULL, 0, 0) ); - DX_CHECK(s_renderCtx.m_device->SetVertexDeclaration(vertexDecl.m_ptr) ); + DX_CHECK(device->SetStreamSourceFreq(0, 1) ); + DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); + DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) ); } } else { - DX_CHECK(s_renderCtx.m_device->SetStreamSource(0, NULL, 0, 0) ); - DX_CHECK(s_renderCtx.m_device->SetStreamSource(1, NULL, 0, 0) ); + DX_CHECK(device->SetStreamSource(0, NULL, 0, 0) ); + DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); } } @@ -2275,11 +2272,11 @@ namespace bgfx if (bgfx::invalidHandle != handle) { IndexBuffer& ib = s_renderCtx.m_indexBuffers[handle]; - DX_CHECK(s_renderCtx.m_device->SetIndices(ib.m_ptr) ); + DX_CHECK(device->SetIndices(ib.m_ptr) ); } else { - DX_CHECK(s_renderCtx.m_device->SetIndices(NULL) ); + DX_CHECK(device->SetIndices(NULL) ); } } @@ -2308,7 +2305,7 @@ namespace bgfx numInstances = state.m_numInstances; numPrimsRendered = numPrimsSubmitted*state.m_numInstances; - DX_CHECK(s_renderCtx.m_device->DrawIndexedPrimitive(primType + DX_CHECK(device->DrawIndexedPrimitive(primType , state.m_startVertex , 0 , numVertices @@ -2323,7 +2320,7 @@ namespace bgfx numInstances = state.m_numInstances; numPrimsRendered = numPrimsSubmitted*state.m_numInstances; - DX_CHECK(s_renderCtx.m_device->DrawIndexedPrimitive(primType + DX_CHECK(device->DrawIndexedPrimitive(primType , state.m_startVertex , 0 , numVertices @@ -2337,7 +2334,7 @@ namespace bgfx numPrimsSubmitted = numVertices/primNumVerts; numInstances = state.m_numInstances; numPrimsRendered = numPrimsSubmitted*state.m_numInstances; - DX_CHECK(s_renderCtx.m_device->DrawPrimitive(primType + DX_CHECK(device->DrawPrimitive(primType , state.m_startVertex , numPrimsSubmitted ) ); @@ -2412,7 +2409,7 @@ namespace bgfx PIX_ENDEVENT(); } - s_renderCtx.m_device->EndScene(); + device->EndScene(); } } diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index a138fc02..46edb5a9 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -23,9 +23,9 @@ # include <d3d9.h> # if BGFX_CONFIG_RENDERER_DIRECT3D9EX -typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT SDKVersion, IDirect3D9Ex**); +typedef HRESULT (WINAPI *Direct3DCreate9ExFn)(UINT SDKVersion, IDirect3D9Ex**); # else -typedef IDirect3D9* (WINAPI *Direct3DCreate9Func)(UINT SDKVersion); +typedef IDirect3D9* (WINAPI *Direct3DCreate9Fn)(UINT SDKVersion); # endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX typedef int (WINAPI *D3DPERF_BeginEventFunc)(D3DCOLOR col, LPCWSTR wszName); @@ -56,20 +56,10 @@ typedef DWORD (WINAPI *D3DPERF_GetStatusFunc)(); # define _PIX_ENDEVENT() do {} while(0) #endif // BX_PLATFORM_ +#include "renderer_d3d.h" + namespace bgfx { -# define _DX_CHECK(_call) \ - do { \ - HRESULT __hr__ = _call; \ - BX_CHECK(SUCCEEDED(__hr__), #_call " FAILED 0x%08x\n", (uint32_t)__hr__); \ - } while (0) - -#if BGFX_CONFIG_DEBUG -# define DX_CHECK(_call) _DX_CHECK(_call) -#else -# define DX_CHECK(_call) _call -#endif // BGFX_CONFIG_DEBUG - #if BGFX_CONFIG_DEBUG_PIX # define PIX_SETMARKER(_col, _name) _PIX_SETMARKER(_col, _name) # define PIX_BEGINEVENT(_col, _name) _PIX_BEGINEVENT(_col, _name) @@ -80,27 +70,6 @@ namespace bgfx # define PIX_ENDEVENT() #endif // BGFX_CONFIG_DEBUG_PIX -#if BGFX_CONFIG_DEBUG -# define DX_RELEASE(_ptr, _expected) \ - do { \ - if (NULL != _ptr) \ - { \ - ULONG count = _ptr->Release(); \ - BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \ - _ptr = NULL; \ - } \ - } while (0) -#else -# define DX_RELEASE(_ptr, _expected) \ - do { \ - if (NULL != _ptr) \ - { \ - _ptr->Release(); \ - _ptr = NULL; \ - } \ - } while (0) -#endif // BGFX_CONFIG_DEBUG - # ifndef D3DFMT_ATI1 # define D3DFMT_ATI1 ( (D3DFORMAT)MAKEFOURCC('A','T','I','1') ) # endif // D3DFMT_ATI1 diff --git a/src/renderer_null.cpp b/src/renderer_null.cpp index a3420ca3..5ff6c0d3 100644 --- a/src/renderer_null.cpp +++ b/src/renderer_null.cpp @@ -1,141 +1,145 @@ -/* - * Copyright 2011-2012 Branimir Karadzic. All rights reserved. - * License: http://www.opensource.org/licenses/BSD-2-Clause - */ - -#include "bgfx_p.h" - -#if BGFX_CONFIG_RENDERER_NULL - -namespace bgfx -{ - void ConstantBuffer::commit() - { - } - - void TextVideoMemBlitter::setup() - { - } - - void TextVideoMemBlitter::render(uint32_t /*_numIndices*/) - { - } - - void Context::flip() - { - } - - void Context::rendererInit() - { - } - - void Context::rendererShutdown() - { - } - - void Context::rendererCreateIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyIndexBuffer(IndexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) - { - } - - void Context::rendererDestroyVertexDecl(VertexDeclHandle /*_handle*/) - { - } - - void Context::rendererCreateVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/) - { - } - - void Context::rendererDestroyVertexBuffer(VertexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/) - { - } - - void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/) - { - } - - void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle /*_handle*/) - { - } - - void Context::rendererCreateVertexShader(VertexShaderHandle /*_handle*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyVertexShader(VertexShaderHandle /*_handle*/) - { - } - - void Context::rendererCreateFragmentShader(FragmentShaderHandle /*_handle*/, Memory* /*_mem*/) - { - } - - void Context::rendererDestroyFragmentShader(FragmentShaderHandle /*_handle*/) - { - } - - void Context::rendererCreateMaterial(MaterialHandle /*_handle*/, VertexShaderHandle /*_vsh*/, FragmentShaderHandle /*_fsh*/) - { - } - - void Context::rendererDestroyMaterial(FragmentShaderHandle /*_handle*/) - { - } - - void Context::rendererCreateTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/) - { - } - - void Context::rendererDestroyTexture(TextureHandle /*_handle*/) - { - } - - void Context::rendererCreateRenderTarget(RenderTargetHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint32_t /*_flags*/, uint32_t /*_textureFlags*/) - { - } - - void Context::rendererDestroyRenderTarget(RenderTargetHandle /*_handle*/) - { - } - - void Context::rendererCreateUniform(UniformHandle /*_handle*/, ConstantType::Enum /*_type*/, uint16_t /*_num*/, const char* /*_name*/) - { - } - - void Context::rendererDestroyUniform(UniformHandle /*_handle*/) - { - } - - void Context::rendererSaveScreenShot(Memory* /*_mem*/) - { - } - - void Context::rendererSubmit() - { - } -} - -#endif // BGFX_CONFIG_RENDERER_NULL +/* + * Copyright 2011-2012 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "bgfx_p.h" + +#if BGFX_CONFIG_RENDERER_NULL + +namespace bgfx +{ + void ConstantBuffer::commit() + { + } + + void TextVideoMemBlitter::setup() + { + } + + void TextVideoMemBlitter::render(uint32_t /*_numIndices*/) + { + } + + void Context::flip() + { + } + + void Context::rendererInit() + { + } + + void Context::rendererShutdown() + { + } + + void Context::rendererCreateIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/) + { + } + + void Context::rendererDestroyIndexBuffer(IndexBufferHandle /*_handle*/) + { + } + + void Context::rendererCreateVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) + { + } + + void Context::rendererDestroyVertexDecl(VertexDeclHandle /*_handle*/) + { + } + + void Context::rendererCreateVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/) + { + } + + void Context::rendererDestroyVertexBuffer(VertexBufferHandle /*_handle*/) + { + } + + void Context::rendererCreateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/) + { + } + + void Context::rendererUpdateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) + { + } + + void Context::rendererDestroyDynamicIndexBuffer(IndexBufferHandle /*_handle*/) + { + } + + void Context::rendererCreateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/) + { + } + + void Context::rendererUpdateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) + { + } + + void Context::rendererDestroyDynamicVertexBuffer(VertexBufferHandle /*_handle*/) + { + } + + void Context::rendererCreateVertexShader(VertexShaderHandle /*_handle*/, Memory* /*_mem*/) + { + } + + void Context::rendererDestroyVertexShader(VertexShaderHandle /*_handle*/) + { + } + + void Context::rendererCreateFragmentShader(FragmentShaderHandle /*_handle*/, Memory* /*_mem*/) + { + } + + void Context::rendererDestroyFragmentShader(FragmentShaderHandle /*_handle*/) + { + } + + void Context::rendererCreateMaterial(MaterialHandle /*_handle*/, VertexShaderHandle /*_vsh*/, FragmentShaderHandle /*_fsh*/) + { + } + + void Context::rendererDestroyMaterial(FragmentShaderHandle /*_handle*/) + { + } + + void Context::rendererCreateTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/) + { + } + + void Context::rendererDestroyTexture(TextureHandle /*_handle*/) + { + } + + void Context::rendererCreateRenderTarget(RenderTargetHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint32_t /*_flags*/, uint32_t /*_textureFlags*/) + { + } + + void Context::rendererDestroyRenderTarget(RenderTargetHandle /*_handle*/) + { + } + + void Context::rendererCreateUniform(UniformHandle /*_handle*/, ConstantType::Enum /*_type*/, uint16_t /*_num*/, const char* /*_name*/) + { + } + + void Context::rendererDestroyUniform(UniformHandle /*_handle*/) + { + } + + void Context::rendererSaveScreenShot(Memory* /*_mem*/) + { + } + + void Context::rendererUpdateUniform(uint16_t /*_loc*/, const void* /*_data*/, uint32_t /*_size*/) + { + } + + void Context::rendererSubmit() + { + } +} + +#endif // BGFX_CONFIG_RENDERER_NULL diff --git a/src/vs_debugfont_dx11.bin.h b/src/vs_debugfont_dx11.bin.h new file mode 100644 index 00000000..f79b8e74 --- /dev/null +++ b/src/vs_debugfont_dx11.bin.h @@ -0,0 +1,179 @@ +static const uint8_t vs_debugfont_dx11[2809] = +{ + 0x01, 0x00, 0xc0, 0x0a, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // .....u_modelView + 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x00, 0x00, 0x0a, 0x40, 0x00, 0xdc, 0x0a, 0x44, 0x58, 0x42, 0x43, // Proj....@...DXBC + 0x49, 0xc3, 0x37, 0x49, 0xa7, 0x55, 0xe6, 0x4d, 0x05, 0x66, 0x2d, 0x74, 0x33, 0xa1, 0xec, 0xf1, // I.7I.U.M.f-t3... + 0x01, 0x00, 0x00, 0x00, 0xdc, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ............4... + 0xcc, 0x07, 0x00, 0x00, 0x54, 0x08, 0x00, 0x00, 0xe0, 0x08, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x00, // ....T.......@... + 0x52, 0x44, 0x45, 0x46, 0x90, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // RDEF........h... + 0x01, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xfe, 0xff, 0x00, 0x91, 0x00, 0x00, // ....<........... + 0x5d, 0x07, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ]...RD11<....... + 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, // ...(...$....... + 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x73, 0x00, 0xab, 0xab, 0xab, // ....$Globals.... + 0x5c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x0a, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x18, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x31, 0x05, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1............... + 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x05, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........=....... + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x44, 0x05, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // D............... + 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x05, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ........O....... + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........`....... + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x84, 0x05, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .... ........... + 0x98, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x05, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ............0... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xf4, 0x05, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....@........... + 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ............P... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x10, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....`........... + 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x06, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, // ............p... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x2e, 0x06, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, // ........>....... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x49, 0x06, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // I............... + 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x53, 0x06, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, // ........S....... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x5e, 0x06, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ^............... + 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x06, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, // ........j....... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x78, 0x06, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // x............... + 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x85, 0x06, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, // ................ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x93, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........@....... + 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x06, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, // ............@... + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xf8, 0x06, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x24, 0x07, 0x00, 0x00, 0xc0, 0x09, 0x00, 0x00, // ........$....... + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // @............... + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x30, 0x07, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // 0.......@....... + 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x40, 0x07, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x00, // ........@...@... + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // @............... + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0x51, 0x07, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Q.......@....... + 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // ................ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, // ........u_alphaR + 0x65, 0x66, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x00, 0xab, 0xab, 0xab, 0x00, 0x00, 0x03, 0x00, // ef.float........ + 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x04, 0x00, 0x00, // ................ + 0x75, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x00, 0x75, 0x5f, 0x72, 0x67, 0x62, 0x64, 0x69, 0x73, 0x70, // u_time.u_rgbdisp + 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, // lacement.u_inter + 0x6c, 0x61, 0x63, 0x65, 0x00, 0x75, 0x5f, 0x7a, 0x6f, 0x6f, 0x6d, 0x00, 0x75, 0x5f, 0x73, 0x74, // lace.u_zoom.u_st + 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x00, 0x75, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x00, // rength.u_center. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, // float2.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x05, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x65, // ........X...u_me + 0x73, 0x68, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x56, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x00, // shTileUV.float3. + 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x91, 0x05, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x61, 0x74, 0x44, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, // ....u_matDiffuse + 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, // .float4......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc9, 0x05, 0x00, 0x00, 0x75, 0x5f, 0x68, 0x69, // ............u_hi + 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x75, 0x5f, 0x6c, // ghlightColor.u_l + 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, 0x72, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x41, // ightDir.u_lightA + 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, // mbient.u_lightDi + 0x66, 0x66, 0x75, 0x73, 0x65, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x70, 0x65, // ffuse.u_lightSpe + 0x63, 0x75, 0x6c, 0x61, 0x72, 0x00, 0x75, 0x5f, 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // cular.u_fogColor + 0x00, 0x75, 0x5f, 0x66, 0x6f, 0x67, 0x41, 0x72, 0x67, 0x73, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, // .u_fogArgs.u_vie + 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, // wRect.u_viewTexe + 0x6c, 0x00, 0x75, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // l.u_shadowColor. + 0x75, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x72, 0x67, 0x73, 0x00, 0x75, 0x5f, 0x63, // u_filterArgs.u_c + 0x6f, 0x6e, 0x74, 0x6f, 0x75, 0x72, 0x41, 0x72, 0x67, 0x73, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, // ontourArgs.u_vie + 0x77, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, // w.float4x4...... + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, // ................ + 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, // u_viewProj...... + 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, // ................ + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, // u_model......... + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo + 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // delView.u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // iewProj.u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x58, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // iewProjX.u_viewP + 0x72, 0x6f, 0x6a, 0x58, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // rojX.Microsoft ( + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 + 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x80, 0x00, 0x00, 0x00, // .3111...ISGN.... + 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........h....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, // ................ + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // q............... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........q....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, // ................ + 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // w............... + 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, // ........POSITION + 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, // .COLOR.TEXCOORD. + 0x4f, 0x53, 0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // OSGN............ + 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // h............... + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........t....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ + 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // t............... + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........z....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, // ................ + 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // SV_POSITION.COLO + 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x45, 0x58, // R.TEXCOORD..SHEX + 0x58, 0x01, 0x00, 0x00, 0x50, 0x00, 0x01, 0x00, 0x56, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, // X...P...V...j... + 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, // Y...F. ......... + 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, // _...r......._... + 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, // ........_....... + 0x02, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, // ...._...2....... + 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // g.... .......... + 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // e.... ......e... + 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, // . ......e...2 .. + 0x03, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, // ....h.......8... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........V....... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, // F. .........2... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F. ..... + 0xa0, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ............F... + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, // F. ............. + 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // ....F........... + 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // . ......F....... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // F. .........6... + 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // . ......F....... + 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // 6.... ......F... + 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, // ....6...2 ...... + 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, // F.......>...STAT + 0x94, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... +}; diff --git a/src/vs_debugfont_dx9.bin.h b/src/vs_debugfont_dx9.bin.h new file mode 100644 index 00000000..4b333f4d --- /dev/null +++ b/src/vs_debugfont_dx9.bin.h @@ -0,0 +1,24 @@ +static const uint8_t vs_debugfont_dx9[335] = +{ + 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // ...u_modelViewPr + 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x04, 0x00, 0x34, 0x01, 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, // oj......4....... + 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x02, // #.CTAB....W..... + 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x50, 0x00, // ..............P. + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, // ..0...........@. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, // wProj........... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......vs_2_0.Mic + 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler + 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, // 9.29.952.3111... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x02, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x05, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ........U....... + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, // ................ + 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xd0, 0x01, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xd0, 0x02, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x03, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... +}; diff --git a/tools/shaderc.cpp b/tools/shaderc.cpp index d4d8122b..50b57a5b 100644 --- a/tools/shaderc.cpp +++ b/tools/shaderc.cpp @@ -3,6 +3,7 @@ * License: http://www.opensource.org/licenses/BSD-2-Clause */ +#define NOMINMAX #include <stdio.h> #include <stdint.h> #include <stdlib.h> @@ -17,7 +18,7 @@ extern "C" { # include <fpp.h> } // extern "C" -#if 0 +#if 1 # define BX_TRACE(_format, ...) fprintf(stderr, "" _format "\n", ##__VA_ARGS__) #endif // DEBUG @@ -35,6 +36,7 @@ extern "C" { #if BX_PLATFORM_WINDOWS # include <d3dx9.h> +# include <d3dcompiler.h> #endif // BX_PLATFORM_WINDOWS long int fsize(FILE* _file) @@ -93,7 +95,7 @@ struct Uniform typedef std::vector<Uniform> UniformArray; #if BX_PLATFORM_WINDOWS -struct ConstRemap +struct ConstRemapDx9 { ConstantType::Enum id; D3DXPARAMETER_CLASS paramClass; @@ -101,23 +103,23 @@ struct ConstRemap uint32_t paramBytes; }; -static const ConstRemap s_constRemap[7] = +static const ConstRemapDx9 s_constRemapDx9[7] = { - { ConstantType::Uniform1iv, D3DXPC_SCALAR, D3DXPT_INT, 4 }, - { ConstantType::Uniform1fv, D3DXPC_SCALAR, D3DXPT_FLOAT, 4 }, - { ConstantType::Uniform2fv, D3DXPC_VECTOR, D3DXPT_FLOAT, 8 }, - { ConstantType::Uniform3fv, D3DXPC_VECTOR, D3DXPT_FLOAT, 12 }, - { ConstantType::Uniform4fv, D3DXPC_VECTOR, D3DXPT_FLOAT, 16 }, + { ConstantType::Uniform1iv, D3DXPC_SCALAR, D3DXPT_INT, 4 }, + { ConstantType::Uniform1fv, D3DXPC_SCALAR, D3DXPT_FLOAT, 4 }, + { ConstantType::Uniform2fv, D3DXPC_VECTOR, D3DXPT_FLOAT, 8 }, + { ConstantType::Uniform3fv, D3DXPC_VECTOR, D3DXPT_FLOAT, 12 }, + { ConstantType::Uniform4fv, D3DXPC_VECTOR, D3DXPT_FLOAT, 16 }, { ConstantType::Uniform3x3fv, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 36 }, { ConstantType::Uniform4x4fv, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 64 }, }; -ConstantType::Enum findConstantType(const D3DXCONSTANT_DESC& constDesc) +ConstantType::Enum findConstantTypeDx9(const D3DXCONSTANT_DESC& constDesc) { - uint32_t count = sizeof(s_constRemap)/sizeof(ConstRemap); + uint32_t count = sizeof(s_constRemapDx9)/sizeof(ConstRemapDx9); for (uint32_t ii = 0; ii < count; ++ii) { - const ConstRemap& remap = s_constRemap[ii]; + const ConstRemapDx9& remap = s_constRemapDx9[ii]; if (remap.paramClass == constDesc.Class && remap.paramType == constDesc.Type @@ -130,31 +132,117 @@ ConstantType::Enum findConstantType(const D3DXCONSTANT_DESC& constDesc) return ConstantType::Count; } -static uint32_t s_optimizationLevel[4] = +static uint32_t s_optimizationLevelDx9[4] = { D3DXSHADER_OPTIMIZATION_LEVEL0, D3DXSHADER_OPTIMIZATION_LEVEL1, D3DXSHADER_OPTIMIZATION_LEVEL2, D3DXSHADER_OPTIMIZATION_LEVEL3, }; + +struct ConstRemapDx11 +{ + ConstantType::Enum id; + D3D_SHADER_VARIABLE_CLASS paramClass; + D3D_SHADER_VARIABLE_TYPE paramType; + uint32_t paramBytes; +}; + +static const ConstRemapDx11 s_constRemapDx11[7] = +{ + { ConstantType::Uniform1iv, D3D_SVC_SCALAR, D3D_SVT_INT, 4 }, + { ConstantType::Uniform1fv, D3D_SVC_SCALAR, D3D_SVT_FLOAT, 4 }, + { ConstantType::Uniform2fv, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 8 }, + { ConstantType::Uniform3fv, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 12 }, + { ConstantType::Uniform4fv, D3D_SVC_VECTOR, D3D_SVT_FLOAT, 16 }, + { ConstantType::Uniform3x3fv, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 36 }, + { ConstantType::Uniform4x4fv, D3D_SVC_MATRIX_COLUMNS, D3D_SVT_FLOAT, 64 }, +}; + +ConstantType::Enum findConstantTypeDx11(const D3D11_SHADER_TYPE_DESC& constDesc, uint32_t _size) +{ + uint32_t count = sizeof(s_constRemapDx11)/sizeof(ConstRemapDx9); + for (uint32_t ii = 0; ii < count; ++ii) + { + const ConstRemapDx11& remap = s_constRemapDx11[ii]; + + if (remap.paramClass == constDesc.Class + && remap.paramType == constDesc.Type + && remap.paramBytes == _size) + { + return remap.id; + } + } + + return ConstantType::Count; +} + +static uint32_t s_optimizationLevelDx11[4] = +{ + D3DCOMPILE_OPTIMIZATION_LEVEL0, + D3DCOMPILE_OPTIMIZATION_LEVEL1, + D3DCOMPILE_OPTIMIZATION_LEVEL2, + D3DCOMPILE_OPTIMIZATION_LEVEL3, +}; #endif // BX_PLATFORM_WINDOWS -class Stream +class IStreamWriter { public: - Stream(FILE* _file, bool _bigEndian = false) - : m_file(_file) + virtual ~IStreamWriter() = 0; + virtual bool open() = 0; + virtual void close() = 0; + virtual void writef(const char* _format, ...) = 0; + virtual void write(const char* _str) = 0; + virtual void write(const void* _data, size_t _size) = 0; + + template<typename Ty> + void write(Ty _value) + { + write(&_value, sizeof(Ty) ); + } + +// template<typename Ty> +// void write(Ty _value) +// { +// Ty temp = m_bigEndian ? bx::bigEndian<Ty>(_value) : _value; +// write(&temp, sizeof(Ty) ); +// } +}; + +IStreamWriter::~IStreamWriter() +{ +} + +class FileWriter : public IStreamWriter +{ +public: + FileWriter(const char* _filePath, bool _bigEndian = false) + : m_filePath(_filePath) + , m_file(NULL) , m_bigEndian(_bigEndian) { } - ~Stream() + ~FileWriter() { } + bool open() + { + BX_CHECK(NULL == m_file, "Still open!"); + + m_file = fopen(m_filePath.c_str(), "wb"); + return NULL != m_file; + } + void close() { - m_file = NULL; + if (NULL != m_file) + { + fclose(m_file); + m_file = NULL; + } } void writef(const char* _format, ...) @@ -188,16 +276,116 @@ public: } } - template<typename Ty> - void write(Ty _value) +private: + std::string m_filePath; + FILE* m_file; + bool m_bigEndian; +}; + +class Bin2cStream : public IStreamWriter +{ +public: + Bin2cStream(const char* _filePath, const char* _name) + : m_filePath(_filePath) + , m_name(_name) + , m_file(NULL) { - Ty temp = m_bigEndian ? bx::bigEndian<Ty>(_value) : _value; - write(&temp, sizeof(Ty) ); + } + + ~Bin2cStream() + { + } + + bool open() + { + BX_CHECK(NULL == m_file, "Still open!"); + + m_file = fopen(m_filePath.c_str(), "wb"); + return NULL != m_file; + } + + void close() + { + if (NULL != m_file) + { +#define HEX_DUMP_WIDTH 16 +#define HEX_DUMP_SPACE_WIDTH 96 +#define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s" + const uint8_t* data = &m_buffer[0]; + uint32_t size = m_buffer.size(); + + fprintf(m_file, "static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size); + + if (NULL != data) + { + char hex[HEX_DUMP_SPACE_WIDTH+1]; + char ascii[HEX_DUMP_WIDTH+1]; + uint32_t hexPos = 0; + uint32_t asciiPos = 0; + for (uint32_t ii = 0; ii < size; ++ii) + { + _snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]); + hexPos += 6; + + ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.'; + asciiPos++; + + if (HEX_DUMP_WIDTH == asciiPos) + { + ascii[asciiPos] = '\0'; + fprintf(m_file, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + data += asciiPos; + hexPos = 0; + asciiPos = 0; + } + } + + if (0 != asciiPos) + { + ascii[asciiPos] = '\0'; + fprintf(m_file, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + } + } + + fprintf(m_file, "};\n"); +#undef HEX_DUMP_WIDTH +#undef HEX_DUMP_SPACE_WIDTH +#undef HEX_DUMP_FORMAT + + fclose(m_file); + m_file = NULL; + } + } + + void writef(const char* _format, ...) + { + va_list argList; + va_start(argList, _format); + + char temp[2048]; + int len = vsnprintf(temp, sizeof(temp), _format, argList); + m_buffer.insert(m_buffer.end(), temp, temp+len); + + va_end(argList); + } + + void write(const char* _str) + { + m_buffer.insert(m_buffer.end(), _str, _str+strlen(_str) ); + } + + void write(const void* _data, size_t _size) + { + const char* data = (const char*)_data; + m_buffer.insert(m_buffer.end(), data, data+_size); } private: + std::string m_filePath; + std::string m_name; + typedef std::vector<uint8_t> Buffer; + Buffer m_buffer; FILE* m_file; - bool m_bigEndian; }; class LineReader @@ -266,7 +454,7 @@ void printCode(const char* _code) fprintf(stderr, "---\n"); } -bool compileGLSLShader(CommandLine& _cmdLine, const std::string& _code, const char* _outFilePath) +bool compileGLSLShader(CommandLine& _cmdLine, const std::string& _code, IStreamWriter& _stream) { const glslopt_shader_type type = tolower(_cmdLine.findOption('\0', "type")[0]) == 'f' ? kGlslOptShaderFragment : kGlslOptShaderVertex; @@ -284,40 +472,28 @@ bool compileGLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch const char* optimizedShader = glslopt_get_output(shader); - FILE* out = fopen(_outFilePath, "wb"); - if (NULL == out) - { - fprintf(stderr, "Unable to open output file '%s'.", _outFilePath); - glslopt_cleanup(ctx); - return false; - } - - Stream stream(out); - const char* profile = _cmdLine.findOption('p'); if (NULL == profile) { - stream.write("#ifdef GL_ES\n"); - stream.write("precision highp float;\n"); - stream.write("#endif // GL_ES\n\n"); + _stream.write("#ifdef GL_ES\n"); + _stream.write("precision highp float;\n"); + _stream.write("#endif // GL_ES\n\n"); } else { - stream.writef("#version %s\n\n", profile); + _stream.writef("#version %s\n\n", profile); } - stream.write(optimizedShader, strlen(optimizedShader) ); + _stream.write(optimizedShader, strlen(optimizedShader) ); uint8_t nul = 0; - stream.write(nul); - stream.close(); - fclose(out); + _stream.write(nul); glslopt_cleanup(ctx); return true; } -bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const char* _outFilePath) +bool compileHLSLShaderDx9(CommandLine& _cmdLine, const std::string& _code, IStreamWriter& _stream) { #if BX_PLATFORM_WINDOWS const char* profile = _cmdLine.findOption('p'); @@ -342,8 +518,8 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch uint32_t optimization = 3; if (_cmdLine.hasArg(optimization, 'O') ) { - optimization = bx::uint32_min(optimization, countof(s_optimizationLevel)-1); - flags |= s_optimizationLevel[optimization]; + optimization = bx::uint32_min(optimization, countof(s_optimizationLevelDx9)-1); + flags |= s_optimizationLevelDx9[optimization]; } else { @@ -411,7 +587,7 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch , constDesc.RegisterCount ); - ConstantType::Enum type = findConstantType(constDesc); + ConstantType::Enum type = findConstantTypeDx9(constDesc); if (ConstantType::Count != type) { Uniform un; @@ -424,29 +600,20 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch } } - FILE* out = fopen(_outFilePath, "wb"); - if (NULL == out) - { - fprintf(stderr, "Unable to open output file '%s'.", _outFilePath); - return false; - } - - Stream stream(out, bigEndian); - uint16_t count = (uint16_t)uniforms.size(); - stream.write(count); + _stream.write(count); uint32_t fragmentBit = profile[0] == 'p' ? ConstantType::FragmentBit : 0; for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it) { const Uniform& un = *it; uint8_t nameSize = (uint8_t)un.name.size(); - stream.write(nameSize); - stream.write(un.name.c_str(), nameSize); - stream.write<uint8_t>(un.type|fragmentBit); - stream.write(un.num); - stream.write(un.regIndex); - stream.write(un.regCount); + _stream.write(nameSize); + _stream.write(un.name.c_str(), nameSize); + _stream.write<uint8_t>(un.type|fragmentBit); + _stream.write(un.num); + _stream.write(un.regIndex); + _stream.write(un.regCount); BX_TRACE("%s, %s, %d, %d, %d" , un.name.c_str() @@ -458,12 +625,10 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch } uint16_t shaderSize = (uint16_t)code->GetBufferSize(); - stream.write(shaderSize); - stream.write(code->GetBufferPointer(), shaderSize); + _stream.write(shaderSize); + _stream.write(code->GetBufferPointer(), shaderSize); uint8_t nul = 0; - stream.write(nul); - stream.close(); - fclose(out); + _stream.write(nul); if (NULL != code) { @@ -487,6 +652,231 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch #endif // BX_PLATFORM_WINDOWS } +bool compileHLSLShaderDx11(CommandLine& _cmdLine, const std::string& _code, IStreamWriter& _stream) +{ +#if BX_PLATFORM_WINDOWS + const char* profile = _cmdLine.findOption('p'); + if (NULL == profile) + { + printf("Shader profile must be specified.\n"); + return false; + } + + bool bigEndian = _cmdLine.hasArg('\0', "xbox360"); + + uint32_t flags = D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY; + flags |= _cmdLine.hasArg('\0', "debug") ? D3DCOMPILE_DEBUG : 0; + flags |= _cmdLine.hasArg('\0', "avoid-flow-control") ? D3DCOMPILE_AVOID_FLOW_CONTROL : 0; + flags |= _cmdLine.hasArg('\0', "no-preshader") ? D3DCOMPILE_NO_PRESHADER : 0; + flags |= _cmdLine.hasArg('\0', "partial-precision") ? D3DCOMPILE_PARTIAL_PRECISION : 0; + flags |= _cmdLine.hasArg('\0', "prefer-flow-control") ? D3DCOMPILE_PREFER_FLOW_CONTROL : 0; + flags |= _cmdLine.hasArg('\0', "backwards-compatibility") ? D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY : 0; + + bool werror = _cmdLine.hasArg('\0', "Werror"); + + if (werror) + { + flags |= D3DCOMPILE_WARNINGS_ARE_ERRORS; + } + + uint32_t optimization = 3; + if (_cmdLine.hasArg(optimization, 'O') ) + { + optimization = bx::uint32_min(optimization, countof(s_optimizationLevelDx11)-1); + flags |= s_optimizationLevelDx11[optimization]; + } + else + { + flags |= D3DCOMPILE_SKIP_OPTIMIZATION; + } + + BX_TRACE("Profile: %s", profile); + BX_TRACE("Flags: 0x%08x", flags); + BX_TRACE("Big Endian: %s", bigEndian?"true":"false"); + + ID3DBlob* code; + ID3DBlob* errorMsg; + + HRESULT hr = D3DCompile(_code.c_str() + , _code.size() + , NULL + , NULL + , NULL + , "main" + , profile + , flags + , 0 + , &code + , &errorMsg + ); + if (FAILED(hr) + || werror && NULL != errorMsg) + { + printCode(_code.c_str() ); + fprintf(stderr, BX_FILE_LINE_LITERAL "Error: 0x%08x %s\n", hr, errorMsg->GetBufferPointer() ); + return false; + } + + UniformArray uniforms; + + ID3D11ShaderReflection* reflect = NULL; + hr = D3DReflect(code->GetBufferPointer() + , code->GetBufferSize() + , IID_ID3D11ShaderReflection + , (void**)&reflect + ); + if (FAILED(hr) ) + { + fprintf(stderr, BX_FILE_LINE_LITERAL "Error: 0x%08x\n", hr); + return false; + } + + D3D11_SHADER_DESC desc; + hr = reflect->GetDesc(&desc); + if (FAILED(hr) ) + { + fprintf(stderr, BX_FILE_LINE_LITERAL "Error: 0x%08x\n", hr); + return false; + } + + BX_TRACE("Creator: %s 0x%08x", desc.Creator, desc.Version); + BX_TRACE("Num constant buffers: %d", desc.ConstantBuffers); + BX_TRACE("# cl ty RxC S By Name"); + +// bx::HashMurmur2A hash; +// hash.begin(); + + BX_TRACE("Input:"); + for (uint32_t ii = 0; ii < desc.InputParameters; ++ii) + { + D3D11_SIGNATURE_PARAMETER_DESC spd; + reflect->GetInputParameterDesc(ii, &spd); + BX_TRACE("\t%2d: %s%d, %d, %d", ii, spd.SemanticName, spd.SemanticIndex, spd.SystemValueType, spd.ComponentType); +// hash.add(inputSignature->GetBufferPointer(), inputSignature->GetBufferSize() ); + } + + BX_TRACE("Output:"); + for (uint32_t ii = 0; ii < desc.OutputParameters; ++ii) + { + D3D11_SIGNATURE_PARAMETER_DESC spd; + reflect->GetOutputParameterDesc(ii, &spd); + BX_TRACE("\t%2d: %s%d, %d, %d", ii, spd.SemanticName, spd.SemanticIndex, spd.SystemValueType, spd.ComponentType); +// hash.add(inputSignature->GetBufferPointer(), inputSignature->GetBufferSize() ); + } +// uint32_t inputSignatureHash = hash.end(); + + uint16_t size = 0; + + for (uint32_t ii = 0; ii < bx::uint32_min(1, desc.ConstantBuffers); ++ii) + { + ID3D11ShaderReflectionConstantBuffer* cbuffer = reflect->GetConstantBufferByIndex(ii); + D3D11_SHADER_BUFFER_DESC bufferDesc; + hr = cbuffer->GetDesc(&bufferDesc); + + size = (uint16_t)bufferDesc.Size; + + if (SUCCEEDED(hr) ) + { + BX_TRACE("%s, %d, vars %d, size %d" + , bufferDesc.Name + , bufferDesc.Type + , bufferDesc.Variables + , bufferDesc.Size + ); + + for (uint32_t jj = 0; jj < bufferDesc.Variables; ++jj) + { + ID3D11ShaderReflectionVariable* var = cbuffer->GetVariableByIndex(jj); + ID3D11ShaderReflectionType* type = var->GetType(); + D3D11_SHADER_VARIABLE_DESC varDesc; + hr = var->GetDesc(&varDesc); + if (SUCCEEDED(hr) ) + { + D3D11_SHADER_TYPE_DESC constDesc; + hr = type->GetDesc(&constDesc); + if (SUCCEEDED(hr) ) + { + ConstantType::Enum type = findConstantTypeDx11(constDesc, varDesc.Size); + + if (ConstantType::Count != type + && 0 != (varDesc.uFlags & D3D10_SVF_USED) ) + { + Uniform un; + un.name = varDesc.Name; + un.type = type; + un.num = constDesc.Elements; + un.regIndex = varDesc.StartOffset; + un.regCount = varDesc.Size; + uniforms.push_back(un); + + BX_TRACE("\t%s, %d, size %d, flags 0x%08x, %d" + , varDesc.Name + , varDesc.StartOffset + , varDesc.Size + , varDesc.uFlags + , type + ); + } + } + } + } + } + } + + uint16_t count = (uint16_t)uniforms.size(); + _stream.write(count); + + _stream.write(size); + + uint32_t fragmentBit = profile[0] == 'p' ? ConstantType::FragmentBit : 0; + for (UniformArray::const_iterator it = uniforms.begin(); it != uniforms.end(); ++it) + { + const Uniform& un = *it; + uint8_t nameSize = (uint8_t)un.name.size(); + _stream.write(nameSize); + _stream.write(un.name.c_str(), nameSize); + _stream.write<uint8_t>(un.type|fragmentBit); + _stream.write(un.num); + _stream.write(un.regIndex); + _stream.write(un.regCount); + + BX_TRACE("%s, %s, %d, %d, %d" + , un.name.c_str() + , s_constantTypeName[un.type] + , un.num + , un.regIndex + , un.regCount + ); + } + + uint16_t shaderSize = (uint16_t)code->GetBufferSize(); + _stream.write(shaderSize); + _stream.write(code->GetBufferPointer(), shaderSize); + uint8_t nul = 0; + _stream.write(nul); + + if (NULL != reflect) + { + reflect->Release(); + } + + if (NULL != code) + { + code->Release(); + } + + if (NULL != errorMsg) + { + errorMsg->Release(); + } + + return true; +#else + fprintf(stderr, "HLSL compiler is not supported on this platform.\n"); + return false; +#endif // BX_PLATFORM_WINDOWS +} + struct Preprocessor { Preprocessor(const char* _filePath) @@ -653,6 +1043,20 @@ struct Preprocessor uint32_t m_fgetsPos; }; +const char* baseName(const char* _filePath) +{ + const char* bs = strrchr(_filePath, '\\'); + const char* fs = strrchr(_filePath, '/'); + const char* column = strrchr(_filePath, ':'); + const char* basename = std::max(std::max(bs, fs), column); + if (NULL != basename) + { + return basename+1; + } + + return _filePath; +} + // OpenGL #version Features Direct3D Features Shader Model // 2.1 120 vf 9.0 vf 2.0 // 3.0 130 @@ -695,6 +1099,33 @@ int main(int _argc, const char* _argv[]) return EXIT_FAILURE; } + const char* bin2c = NULL; + if (cmdLine.hasArg("bin2c") ) + { + bin2c = cmdLine.findOption("bin2c"); + if (NULL == bin2c) + { + bin2c = baseName(outFilePath); + uint32_t len = strlen(bin2c); + char* temp = (char*)alloca(len+1); + for (char *out = temp; *bin2c != '\0';) + { + char ch = *bin2c++; + if (isalnum(ch) ) + { + *out++ = ch; + } + else + { + *out++ = '_'; + } + } + temp[len] = '\0'; + + bin2c = temp; + } + } + bool depends = cmdLine.hasArg("depends"); bool preprocessOnly = cmdLine.hasArg("preprocess"); @@ -782,14 +1213,14 @@ int main(int _argc, const char* _argv[]) if (preprocessOnly) { - FILE* out = fopen(outFilePath, "wb"); - if (NULL == out) + FileWriter stream(outFilePath); + + if (!stream.open() ) { fprintf(stderr, "Unable to open output file '%s'.", outFilePath); return false; } - Stream stream(out); if (glsl) { const char* profile = cmdLine.findOption('p'); @@ -806,20 +1237,50 @@ int main(int _argc, const char* _argv[]) } stream.write(preprocessor.m_preprocessed.c_str(), preprocessor.m_preprocessed.size() ); stream.close(); - fclose(out); return EXIT_SUCCESS; } bool compiled = false; - if (glsl) { - compiled = compileGLSLShader(cmdLine, preprocessor.m_preprocessed, outFilePath); - } - else - { - compiled = compileHLSLShader(cmdLine, preprocessor.m_preprocessed, outFilePath); + IStreamWriter* stream = NULL; + + if (NULL != bin2c) + { + stream = new Bin2cStream(outFilePath, bin2c); + } + else + { + stream = new FileWriter(outFilePath); + } + + if (!stream->open() ) + { + fprintf(stderr, "Unable to open output file '%s'.", outFilePath); + return false; + } + + if (glsl) + { + compiled = compileGLSLShader(cmdLine, preprocessor.m_preprocessed, *stream); + } + else + { + const char* profile = cmdLine.findOption('p'); + if (0 == strncmp(&profile[1], "s_4", 3) + || 0 == strncmp(&profile[1], "s_5", 3) ) + { + compiled = compileHLSLShaderDx11(cmdLine, preprocessor.m_preprocessed, *stream); + } + else + { + compiled = compileHLSLShaderDx9(cmdLine, preprocessor.m_preprocessed, *stream); + } + } + + stream->close(); + delete stream; } if (compiled @@ -827,19 +1288,18 @@ int main(int _argc, const char* _argv[]) { std::string ofp = outFilePath; ofp += ".d"; - FILE* out = fopen(ofp.c_str(), "wb"); - if (NULL != out) + FileWriter stream(ofp.c_str() ); + if (stream.open() ) { - Stream stream(out); stream.write(outFilePath); stream.write(":"); stream.write(preprocessor.m_depends.c_str() ); stream.write("\n"); stream.close(); - fclose(out); } - return EXIT_SUCCESS; } + + return EXIT_SUCCESS; } fprintf(stderr, "Failed to build shader.\n");