diff options
Diffstat (limited to '3rdparty/bgfx/src')
46 files changed, 11055 insertions, 10252 deletions
diff --git a/3rdparty/bgfx/src/amalgamated.cpp b/3rdparty/bgfx/src/amalgamated.cpp index 860f448e87e..3a940d0b176 100644 --- a/3rdparty/bgfx/src/amalgamated.cpp +++ b/3rdparty/bgfx/src/amalgamated.cpp @@ -4,15 +4,14 @@ */ #include "bgfx.cpp" +#include "debug_renderdoc.cpp" #include "glcontext_egl.cpp" #include "glcontext_glx.cpp" -#include "glcontext_ppapi.cpp" #include "glcontext_wgl.cpp" -#include "image.cpp" #include "hmd.cpp" #include "hmd_ovr.cpp" #include "hmd_openvr.cpp" -#include "debug_renderdoc.cpp" +#include "nvapi.cpp" #include "renderer_d3d9.cpp" #include "renderer_d3d11.cpp" #include "renderer_d3d12.cpp" diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index 5886e842443..64970cb7e32 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -4,22 +4,10 @@ */ #include <bx/platform.h> -#if BX_PLATFORM_WINDOWS -// BK - Remotery needs WinSock, but on VS2015/Win10 build -// fails if WinSock2 is included after Windows.h?! -# include <winsock2.h> -#endif // BX_PLATFORM_WINDOWS #include "bgfx_p.h" #include <bgfx/embedded_shader.h> - -#if BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB -# define RMT_USE_D3D11 BGFX_CONFIG_RENDERER_DIRECT3D11 -# define RMT_USE_OPENGL BGFX_CONFIG_RENDERER_OPENGL -# include <remotery/lib/Remotery.c> -#endif // BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB - -#include <bx/crtimpl.h> +#include <bx/file.h> #include <bx/mutex.h> #include "topology.h" @@ -28,15 +16,15 @@ BX_ERROR_RESULT(BGFX_ERROR_TEXTURE_VALIDATION, BX_MAKEFOURCC('b', 'g', 0, 1) ); namespace bgfx { -#define BGFX_MAIN_THREAD_MAGIC UINT32_C(0x78666762) +#define BGFX_API_THREAD_MAGIC UINT32_C(0x78666762) #if BGFX_CONFIG_MULTITHREADED -# define BGFX_CHECK_MAIN_THREAD() \ +# define BGFX_CHECK_API_THREAD() \ BX_CHECK(NULL != s_ctx, "Library is not initialized yet."); \ - BX_CHECK(BGFX_MAIN_THREAD_MAGIC == s_threadIndex, "Must be called from main thread.") -# define BGFX_CHECK_RENDER_THREAD() BX_CHECK(BGFX_MAIN_THREAD_MAGIC != s_threadIndex, "Must be called from render thread.") + BX_CHECK(BGFX_API_THREAD_MAGIC == s_threadIndex, "Must be called from main thread.") +# define BGFX_CHECK_RENDER_THREAD() BX_CHECK(BGFX_API_THREAD_MAGIC != s_threadIndex, "Must be called from render thread.") #else -# define BGFX_CHECK_MAIN_THREAD() +# define BGFX_CHECK_API_THREAD() # define BGFX_CHECK_RENDER_THREAD() #endif // BGFX_CONFIG_MULTITHREADED @@ -66,7 +54,21 @@ namespace bgfx { } - virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) BX_OVERRIDE + virtual void fatal(Fatal::Enum _code, const char* _str) override + { + if (Fatal::DebugCheck == _code) + { + bx::debugBreak(); + } + else + { + BX_TRACE("0x%08x: %s", _code, _str); + BX_UNUSED(_code, _str); + abort(); + } + } + + virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) override { char temp[2048]; char* out = temp; @@ -85,63 +87,59 @@ namespace bgfx bx::debugOutput(out); } - virtual void fatal(Fatal::Enum _code, const char* _str) BX_OVERRIDE + virtual void profilerBegin(const char* /*_name*/, uint32_t /*_abgr*/, const char* /*_filePath*/, uint16_t /*_line*/) override + { + } + + virtual void profilerBeginLiteral(const char* /*_name*/, uint32_t /*_abgr*/, const char* /*_filePath*/, uint16_t /*_line*/) override + { + } + + virtual void profilerEnd() override { - if (Fatal::DebugCheck == _code) - { - bx::debugBreak(); - } - else - { - BX_TRACE("0x%08x: %s", _code, _str); - BX_UNUSED(_code, _str); - abort(); - } } - virtual uint32_t cacheReadSize(uint64_t /*_id*/) BX_OVERRIDE + virtual uint32_t cacheReadSize(uint64_t /*_id*/) override { return 0; } - virtual bool cacheRead(uint64_t /*_id*/, void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE + virtual bool cacheRead(uint64_t /*_id*/, void* /*_data*/, uint32_t /*_size*/) override { return false; } - virtual void cacheWrite(uint64_t /*_id*/, const void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE + virtual void cacheWrite(uint64_t /*_id*/, const void* /*_data*/, uint32_t /*_size*/) override { } - virtual void screenShot(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip) BX_OVERRIDE + virtual void screenShot(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip) override { BX_UNUSED(_filePath, _width, _height, _pitch, _data, _size, _yflip); -#if BX_CONFIG_CRT_FILE_READER_WRITER - const int32_t len = bx::strnlen(_filePath)+5; + const int32_t len = bx::strLen(_filePath)+5; char* filePath = (char*)alloca(len); - bx::strlncpy(filePath, len, _filePath); - bx::strlncat(filePath, len, ".tga"); + bx::strCopy(filePath, len, _filePath); + bx::strCat(filePath, len, ".tga"); - bx::CrtFileWriter writer; + bx::FileWriter writer; if (bx::open(&writer, filePath) ) { - imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip); + bimg::imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip); bx::close(&writer); } -#endif // BX_CONFIG_CRT_FILE_READER_WRITER } - virtual void captureBegin(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, TextureFormat::Enum /*_format*/, bool /*_yflip*/) BX_OVERRIDE + virtual void captureBegin(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, TextureFormat::Enum /*_format*/, bool /*_yflip*/) override { BX_TRACE("Warning: using capture without callback (a.k.a. pointless)."); } - virtual void captureEnd() BX_OVERRIDE + virtual void captureEnd() override { } - virtual void captureFrame(const void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE + virtual void captureFrame(const void* /*_data*/, uint32_t /*_size*/) override { } }; @@ -150,6 +148,8 @@ namespace bgfx # define BGFX_CONFIG_MEMORY_TRACKING (BGFX_CONFIG_DEBUG && BX_CONFIG_SUPPORTS_THREADING) #endif // BGFX_CONFIG_MEMORY_TRACKING + const size_t kNaturalAlignment = 8; + class AllocatorStub : public bx::AllocatorI { public: @@ -161,13 +161,13 @@ namespace bgfx { } - virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE + virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) override { if (0 == _size) { if (NULL != _ptr) { - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + if (kNaturalAlignment >= _align) { #if BGFX_CONFIG_MEMORY_TRACKING { @@ -189,7 +189,7 @@ namespace bgfx } else if (NULL == _ptr) { - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + if (kNaturalAlignment >= _align) { #if BGFX_CONFIG_MEMORY_TRACKING { @@ -205,7 +205,7 @@ namespace bgfx return bx::alignedAlloc(this, _size, _align, _file, _line); } - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + if (kNaturalAlignment >= _align) { #if BGFX_CONFIG_MEMORY_TRACKING if (NULL == _ptr) @@ -465,14 +465,20 @@ namespace bgfx { for (const EmbeddedShader* es = _es; NULL != es->name; ++es) { - if (0 == bx::strncmp(_name, es->name) ) + if (0 == bx::strCmp(_name, es->name) ) { for (const EmbeddedShader::Data* esd = es->data; RendererType::Count != esd->type; ++esd) { if (_type == esd->type && 1 < esd->size) { - return createShader(makeRef(esd->data, esd->size) ); + ShaderHandle handle = createShader(makeRef(esd->data, esd->size) ); + if (isValid(handle) ) + { + setName(handle, _name); + } + + return handle; } } } @@ -504,14 +510,14 @@ namespace bgfx static uint8_t parseAttrTo(char*& _ptr, char _to, uint8_t _default) { - const char* str = bx::strnchr(_ptr, _to); + const char* str = bx::strFind(_ptr, _to); if (NULL != str && 3 > str-_ptr) { char tmp[4]; int32_t len = int32_t(str-_ptr); - bx::strlncpy(tmp, sizeof(tmp), _ptr, len); + bx::strCopy(tmp, sizeof(tmp), _ptr, len); uint8_t attr = uint8_t(atoi(tmp) ); _ptr += len+1; @@ -529,7 +535,7 @@ namespace bgfx return _default; } - if (0 == bx::strncmp(ptr, "0m", 2) ) + if (0 == bx::strCmp(ptr, "0m", 2) ) { _ptr = ptr + 2; return _default; @@ -582,7 +588,7 @@ namespace bgfx void TextVideoMemBlitter::init() { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); m_decl .begin() .add(Attrib::Position, 3, AttribType::Float) @@ -622,14 +628,14 @@ namespace bgfx void TextVideoMemBlitter::shutdown() { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); if (isValid(m_program) ) { - destroyProgram(m_program); + destroy(m_program); } - destroyTexture(m_texture); + destroy(m_texture); s_ctx->destroyTransientVertexBuffer(m_vb); s_ctx->destroyTransientIndexBuffer(m_ib); } @@ -742,7 +748,7 @@ namespace bgfx void ClearQuad::init() { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); if (RendererType::Noop != g_caps.rendererType) { @@ -761,10 +767,10 @@ namespace bgfx m_program[ii] = createProgram(vsh, fsh); BX_CHECK(isValid(m_program[ii]), "Failed to create clear quad program."); - destroyShader(fsh); + destroy(fsh); } - destroyShader(vsh); + destroy(vsh); m_vb = s_ctx->createTransientVertexBuffer(4*m_decl.m_stride, &m_decl); } @@ -772,7 +778,7 @@ namespace bgfx void ClearQuad::shutdown() { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); if (RendererType::Noop != g_caps.rendererType) { @@ -780,8 +786,8 @@ namespace bgfx { if (isValid(m_program[ii]) ) { - destroyProgram(m_program[ii]); - m_program[ii].idx = invalidHandle; + destroy(m_program[ii]); + m_program[ii].idx = kInvalidHandle; } } @@ -810,7 +816,7 @@ namespace bgfx for (uint32_t ii = 0; ii < UniformType::Count; ++ii) { if (NULL != s_uniformTypeName[ii] - && 0 == bx::strncmp(_name, s_uniformTypeName[ii]) ) + && 0 == bx::strCmp(_name, s_uniformTypeName[ii]) ) { return UniformType::Enum(ii); } @@ -844,7 +850,7 @@ namespace bgfx { for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) { - if (0 == bx::strncmp(_name, s_predefinedName[ii]) ) + if (0 == bx::strCmp(_name, s_predefinedName[ii]) ) { return PredefinedUniform::Enum(ii); } @@ -853,41 +859,75 @@ namespace bgfx return PredefinedUniform::Count; } - uint32_t Frame::submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void EncoderImpl::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) + && !_preserveState) + { + m_uniformSet.clear(); + } + + if (BX_ENABLED(BGFX_CONFIG_DEBUG_OCCLUSION) + && isValid(_occlusionQuery) ) + { + BX_CHECK(m_occlusionQuerySet.end() == m_occlusionQuerySet.find(_occlusionQuery.idx) + , "OcclusionQuery %d was already used for this frame." + , _occlusionQuery.idx + ); + m_occlusionQuerySet.insert(_occlusionQuery.idx); + } + if (m_discard) { discard(); - return m_num; + return; + } + + if (0 == m_draw.m_numVertices + && 0 == m_draw.m_numIndices) + { + discard(); + ++m_numDropped; + return; } - if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num - || (0 == m_draw.m_numVertices && 0 == m_draw.m_numIndices) ) + const uint32_t renderItemIdx = bx::atomicFetchAndAddsat<uint32_t>(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS); + if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx) { + discard(); ++m_numDropped; - return m_num; + return; } - m_uniformEnd = m_uniformBuffer->getPos(); + ++m_numSubmitted; + + UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; + m_uniformEnd = uniformBuffer->getPos(); - m_key.m_program = invalidHandle == _program.idx + m_key.m_program = kInvalidHandle == _program.idx ? 0 : _program.idx ; - m_key.m_depth = (uint32_t)_depth; - m_key.m_view = _id; - m_key.m_seq = s_ctx->m_seq[_id] & s_ctx->m_seqMask[_id]; - s_ctx->m_seq[_id]++; + m_key.m_view = _id; + + SortKey::Enum type = SortKey::SortProgram; + switch (s_ctx->m_view[_id].m_mode) + { + case ViewMode::Sequential: m_key.m_seq = s_ctx->getSeqIncr(_id); type = SortKey::SortSequence; break; + case ViewMode::DepthAscending: m_key.m_depth = (uint32_t)_depth; type = SortKey::SortDepth; break; + case ViewMode::DepthDescending: m_key.m_depth = (uint32_t)-_depth; type = SortKey::SortDepth; break; + default: break; + } + + uint64_t key = m_key.encodeDraw(type); - uint64_t key = m_key.encodeDraw(); - m_sortKeys[m_num] = key; - m_sortValues[m_num] = m_numRenderItems; - ++m_num; + m_frame->m_sortKeys[renderItemIdx] = key; + m_frame->m_sortValues[renderItemIdx] = RenderItemCount(renderItemIdx); - m_draw.m_constBegin = m_uniformBegin; - m_draw.m_constEnd = m_uniformEnd; - m_draw.m_stateFlags |= m_stateFlags; + m_draw.m_uniformIdx = m_uniformIdx; + m_draw.m_uniformBegin = m_uniformBegin; + m_draw.m_uniformEnd = m_uniformEnd; uint32_t numVertices = UINT32_MAX; for (uint32_t idx = 0, streamMask = m_draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) @@ -903,81 +943,85 @@ namespace bgfx if (isValid(_occlusionQuery) ) { - BX_CHECK(!isValid(m_draw.m_occlusionQuery), ""); - m_draw.m_stateFlags |= BGFX_STATE_INTERNAL_OCCLUSION_QUERY; m_draw.m_occlusionQuery = _occlusionQuery; } - m_renderItem[m_numRenderItems].draw = m_draw; - ++m_numRenderItems; + m_frame->m_renderItem[renderItemIdx].draw = m_draw; + m_frame->m_renderItemBind[renderItemIdx] = m_bind; if (!_preserveState) { m_draw.clear(); + m_bind.clear(); m_uniformBegin = m_uniformEnd; - m_stateFlags = BGFX_STATE_NONE; } - - return m_num; } - uint32_t Frame::dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) + void EncoderImpl::dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + { + m_uniformSet.clear(); + } + if (m_discard) { discard(); - return m_num; + return; } - if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num) + const uint32_t renderItemIdx = bx::atomicFetchAndAddsat<uint32_t>(&m_frame->m_numRenderItems, 1, BGFX_CONFIG_MAX_DRAW_CALLS); + if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= renderItemIdx) { + discard(); ++m_numDropped; - return m_num; + return; } - m_uniformEnd = m_uniformBuffer->getPos(); + ++m_numSubmitted; + + UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; + m_uniformEnd = uniformBuffer->getPos(); - m_compute.m_matrix = m_draw.m_matrix; - m_compute.m_num = m_draw.m_num; - m_compute.m_numX = bx::uint16_max(_numX, 1); - m_compute.m_numY = bx::uint16_max(_numY, 1); - m_compute.m_numZ = bx::uint16_max(_numZ, 1); + m_compute.m_startMatrix = m_draw.m_startMatrix; + m_compute.m_numMatrices = m_draw.m_numMatrices; + m_compute.m_numX = bx::uint32_max(_numX, 1); + m_compute.m_numY = bx::uint32_max(_numY, 1); + m_compute.m_numZ = bx::uint32_max(_numZ, 1); m_compute.m_submitFlags = _flags; m_key.m_program = _handle.idx; m_key.m_depth = 0; m_key.m_view = _id; - m_key.m_seq = s_ctx->m_seq[_id]; - s_ctx->m_seq[_id]++; + m_key.m_seq = s_ctx->getSeqIncr(_id); uint64_t key = m_key.encodeCompute(); - m_sortKeys[m_num] = key; - m_sortValues[m_num] = m_numRenderItems; - ++m_num; + m_frame->m_sortKeys[renderItemIdx] = key; + m_frame->m_sortValues[renderItemIdx] = RenderItemCount(renderItemIdx); - m_compute.m_constBegin = m_uniformBegin; - m_compute.m_constEnd = m_uniformEnd; - m_renderItem[m_numRenderItems].compute = m_compute; - ++m_numRenderItems; + m_compute.m_uniformIdx = m_uniformIdx; + m_compute.m_uniformBegin = m_uniformBegin; + m_compute.m_uniformEnd = m_uniformEnd; + m_frame->m_renderItem[renderItemIdx].compute = m_compute; + m_frame->m_renderItemBind[renderItemIdx] = m_bind; m_compute.clear(); + m_bind.clear(); m_uniformBegin = m_uniformEnd; - - return m_num; } - void Frame::blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) + void EncoderImpl::blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { - BX_WARN(m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS + BX_WARN(m_frame->m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS , "Exceed number of available blit items per frame. BGFX_CONFIG_MAX_BLIT_ITEMS is %d. Skipping blit." , BGFX_CONFIG_MAX_BLIT_ITEMS ); - if (m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS) + if (m_frame->m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS) { - uint16_t item = m_numBlitItems++; + uint16_t item = m_frame->m_numBlitItems++; - BlitItem& bi = m_blitItem[item]; + BlitItem& bi = m_frame->m_blitItem[item]; bi.m_srcX = _srcX; bi.m_srcY = _srcY; bi.m_srcZ = _srcZ; @@ -995,23 +1039,25 @@ namespace bgfx BlitKey key; key.m_view = _id; key.m_item = item; - m_blitKeys[item] = key.encode(); + m_frame->m_blitKeys[item] = key.encode(); } } void Frame::sort() { - uint8_t viewRemap[BGFX_CONFIG_MAX_VIEWS]; + BGFX_PROFILER_SCOPE("bgfx/Sort", 0xff2040ff); + + ViewId viewRemap[BGFX_CONFIG_MAX_VIEWS]; for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { - viewRemap[m_viewRemap[ii] ] = uint8_t(ii); + viewRemap[m_viewRemap[ii] ] = ViewId(ii); } - for (uint32_t ii = 0, num = m_num; ii < num; ++ii) + for (uint32_t ii = 0, num = m_numRenderItems; ii < num; ++ii) { m_sortKeys[ii] = SortKey::remapView(m_sortKeys[ii], viewRemap); } - bx::radixSort(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num); + bx::radixSort(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_numRenderItems); for (uint32_t ii = 0, num = m_numBlitItems; ii < num; ++ii) { @@ -1020,19 +1066,23 @@ namespace bgfx bx::radixSort(m_blitKeys, (uint32_t*)&s_ctx->m_tempKeys, m_numBlitItems); } - RenderFrame::Enum renderFrame() + RenderFrame::Enum renderFrame(int32_t _msecs) { if (BX_ENABLED(BGFX_CONFIG_MULTITHREADED) ) { if (NULL == s_ctx) { s_renderFrameCalled = true; - s_threadIndex = ~BGFX_MAIN_THREAD_MAGIC; + s_threadIndex = ~BGFX_API_THREAD_MAGIC; return RenderFrame::NoContext; } BGFX_CHECK_RENDER_THREAD(); - RenderFrame::Enum result = s_ctx->renderFrame(BGFX_CONFIG_API_SEMAPHORE_TIMEOUT); + int32_t msecs = -1 == _msecs + ? BGFX_CONFIG_API_SEMAPHORE_TIMEOUT + : _msecs + ; + RenderFrame::Enum result = s_ctx->renderFrame(msecs); if (RenderFrame::Exiting == result) { Context* ctx = s_ctx; @@ -1074,7 +1124,7 @@ namespace bgfx void UniformBuffer::writeMarker(const char* _marker) { - uint16_t num = (uint16_t)bx::strnlen(_marker)+1; + uint16_t num = (uint16_t)bx::strLen(_marker)+1; uint32_t opcode = encodeOpcode(bgfx::UniformType::Count, 0, num, true); write(opcode); write(_marker, num); @@ -1152,13 +1202,30 @@ namespace bgfx BX_TRACE(""); BX_TRACE("Sort key masks:"); - BX_TRACE("\t View %016" PRIx64, SORT_KEY_VIEW_MASK); - BX_TRACE("\t Draw bit %016" PRIx64, SORT_KEY_DRAW_BIT); - BX_TRACE("\t Seq %016" PRIx64, SORT_KEY_SEQ_MASK); - BX_TRACE("\tD Trans %016" PRIx64, SORT_KEY_DRAW_TRANS_MASK); - BX_TRACE("\tD Program %016" PRIx64, SORT_KEY_DRAW_PROGRAM_MASK); - BX_TRACE("\tC Program %016" PRIx64, SORT_KEY_COMPUTE_PROGRAM_MASK); - BX_TRACE("\tD Depth %016" PRIx64, SORT_KEY_DRAW_DEPTH_MASK); + BX_TRACE("\t View %016" PRIx64, SORT_KEY_VIEW_MASK); + BX_TRACE("\t Draw bit %016" PRIx64, SORT_KEY_DRAW_BIT); + + BX_TRACE(""); + BX_TRACE("\tD Type %016" PRIx64, SORT_KEY_DRAW_TYPE_MASK); + + BX_TRACE(""); + BX_TRACE("\tD0 Trans %016" PRIx64, SORT_KEY_DRAW_0_TRANS_MASK); + BX_TRACE("\tD0 Program %016" PRIx64, SORT_KEY_DRAW_0_PROGRAM_MASK); + BX_TRACE("\tD0 Depth %016" PRIx64, SORT_KEY_DRAW_0_DEPTH_MASK); + + BX_TRACE(""); + BX_TRACE("\tD1 Depth %016" PRIx64, SORT_KEY_DRAW_1_DEPTH_MASK); + BX_TRACE("\tD1 Trans %016" PRIx64, SORT_KEY_DRAW_1_TRANS_MASK); + BX_TRACE("\tD1 Program %016" PRIx64, SORT_KEY_DRAW_1_PROGRAM_MASK); + + BX_TRACE(""); + BX_TRACE("\tD2 Seq %016" PRIx64, SORT_KEY_DRAW_2_SEQ_MASK); + BX_TRACE("\tD2 Trans %016" PRIx64, SORT_KEY_DRAW_2_TRANS_MASK); + BX_TRACE("\tD2 Program %016" PRIx64, SORT_KEY_DRAW_2_PROGRAM_MASK); + + BX_TRACE(""); + BX_TRACE("\t C Seq %016" PRIx64, SORT_KEY_COMPUTE_SEQ_MASK); + BX_TRACE("\t C Program %016" PRIx64, SORT_KEY_COMPUTE_PROGRAM_MASK); BX_TRACE(""); BX_TRACE("Supported capabilities (renderer %s, vendor 0x%04x, device 0x%04x):" @@ -1195,6 +1262,7 @@ namespace bgfx LIMITS(maxDynamicVertexBuffers); LIMITS(maxUniforms); LIMITS(maxOcclusionQueries); + LIMITS(maxEncoders); #undef LIMITS BX_TRACE(""); @@ -1246,7 +1314,7 @@ namespace bgfx BX_TRACE(""); } - TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer) + TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer) { const uint32_t formatCaps = g_caps.formats[_imageContainer.m_format]; bool convert = 0 == formatCaps; @@ -1275,7 +1343,17 @@ namespace bgfx return TextureFormat::BGRA8; } - return _imageContainer.m_format; + return TextureFormat::Enum(_imageContainer.m_format); + } + + const char* getName(TextureFormat::Enum _fmt) + { + return bimg::getName(bimg::TextureFormat::Enum(_fmt)); + } + + const char* getName(UniformHandle _handle) + { + return s_ctx->m_uniformRef[_handle.idx].m_name.getPtr(); } static TextureFormat::Enum s_emulatedFormats[] = @@ -1307,6 +1385,7 @@ namespace bgfx m_flipped = true; m_frames = 0; m_debug = BGFX_DEBUG_NONE; + m_frameTimeLast = bx::getHPCounter(); m_submit->create(); @@ -1319,7 +1398,7 @@ namespace bgfx // should not be created. BX_TRACE("Application called bgfx::renderFrame directly, not creating render thread."); m_singleThreaded = true - && ~BGFX_MAIN_THREAD_MAGIC == s_threadIndex + && ~BGFX_API_THREAD_MAGIC == s_threadIndex ; } else @@ -1335,16 +1414,16 @@ namespace bgfx BX_TRACE("Running in %s-threaded mode", m_singleThreaded ? "single" : "multi"); - s_threadIndex = BGFX_MAIN_THREAD_MAGIC; + s_threadIndex = BGFX_API_THREAD_MAGIC; for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii) { - m_viewRemap[ii] = uint8_t(ii); + m_viewRemap[ii] = ViewId(ii); } for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { - resetView(uint8_t(ii) ); + resetView(ViewId(ii) ); } for (uint32_t ii = 0; ii < BX_COUNTOF(m_clearColor); ++ii) @@ -1362,6 +1441,11 @@ namespace bgfx frameNoRenderWait(); + uint16_t idx = m_encoderHandle.alloc(); + BX_CHECK(0 == idx, "Internal encoder handle is not 0 (idx %d).", idx); BX_UNUSED(idx); + m_encoder[0].begin(m_submit, 0); + m_encoder0 = reinterpret_cast<Encoder*>(&m_encoder[0]); + // Make sure renderer init is called from render thread. // g_caps is initialized and available after this point. frame(); @@ -1389,7 +1473,7 @@ namespace bgfx for (uint32_t ii = 0; ii < TextureFormat::UnknownDepth; ++ii) { - bool convertable = imageConvert(TextureFormat::BGRA8, TextureFormat::Enum(ii) ); + bool convertable = bimg::imageConvert(bimg::TextureFormat::BGRA8, bimg::TextureFormat::Enum(ii) ); g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_2D ) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED : 0; g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_3D ) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED : 0; g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED : 0; @@ -1447,6 +1531,8 @@ namespace bgfx getCommandBuffer(CommandBuffer::RendererShutdownEnd); frame(); + m_encoder[0].end(true); + m_dynVertexBufferAllocator.compact(); m_dynIndexBufferAllocator.compact(); @@ -1480,27 +1566,56 @@ namespace bgfx if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) { -#define CHECK_HANDLE_LEAK(_handleAlloc) \ - BX_MACRO_BLOCK_BEGIN \ - BX_WARN(0 == _handleAlloc.getNumHandles() \ - , "LEAK: " #_handleAlloc " %d (max: %d)" \ - , _handleAlloc.getNumHandles() \ - , _handleAlloc.getMaxHandles() \ - ); \ +#define CHECK_HANDLE_LEAK(_handleAlloc) \ + BX_MACRO_BLOCK_BEGIN \ + if (0 != _handleAlloc.getNumHandles() ) \ + { \ + BX_TRACE("LEAK: " #_handleAlloc " %d (max: %d)" \ + , _handleAlloc.getNumHandles() \ + , _handleAlloc.getMaxHandles() \ + ); \ + for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) \ + { \ + BX_TRACE("\t%3d: %4d", ii, _handleAlloc.getHandleAt(ii) ); \ + } \ + } \ + BX_MACRO_BLOCK_END + +#define CHECK_HANDLE_LEAK_NAME(_handleAlloc, _type, _ref) \ + BX_MACRO_BLOCK_BEGIN \ + if (0 != _handleAlloc.getNumHandles() ) \ + { \ + BX_TRACE("LEAK: " #_handleAlloc " %d (max: %d)" \ + , _handleAlloc.getNumHandles() \ + , _handleAlloc.getMaxHandles() \ + ); \ + for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) \ + { \ + uint16_t idx = _handleAlloc.getHandleAt(ii); \ + const _type& ref = _ref[idx]; BX_UNUSED(ref); \ + BX_TRACE("\t%3d: %4d %s (count %d)" \ + , ii \ + , idx \ + , ref.m_name.getPtr() \ + , ref.m_refCount \ + ); \ + } \ + } \ BX_MACRO_BLOCK_END - CHECK_HANDLE_LEAK(m_dynamicIndexBufferHandle); - CHECK_HANDLE_LEAK(m_dynamicVertexBufferHandle); - CHECK_HANDLE_LEAK(m_indexBufferHandle); - CHECK_HANDLE_LEAK(m_vertexDeclHandle); - CHECK_HANDLE_LEAK(m_vertexBufferHandle); - CHECK_HANDLE_LEAK(m_shaderHandle); - CHECK_HANDLE_LEAK(m_programHandle); - CHECK_HANDLE_LEAK(m_textureHandle); - CHECK_HANDLE_LEAK(m_frameBufferHandle); - CHECK_HANDLE_LEAK(m_uniformHandle); - CHECK_HANDLE_LEAK(m_occlusionQueryHandle); + CHECK_HANDLE_LEAK (m_dynamicIndexBufferHandle ); + CHECK_HANDLE_LEAK (m_dynamicVertexBufferHandle ); + CHECK_HANDLE_LEAK (m_indexBufferHandle ); + CHECK_HANDLE_LEAK (m_vertexDeclHandle ); + CHECK_HANDLE_LEAK (m_vertexBufferHandle ); + CHECK_HANDLE_LEAK_NAME(m_shaderHandle, ShaderRef, m_shaderRef ); + CHECK_HANDLE_LEAK (m_programHandle ); + CHECK_HANDLE_LEAK_NAME(m_textureHandle, TextureRef, m_textureRef); + CHECK_HANDLE_LEAK (m_frameBufferHandle ); + CHECK_HANDLE_LEAK_NAME(m_uniformHandle, UniformRef, m_uniformRef); + CHECK_HANDLE_LEAK (m_occlusionQueryHandle ); #undef CHECK_HANDLE_LEAK +#undef CHECK_HANDLE_LEAK_NAME } } @@ -1568,27 +1683,66 @@ namespace bgfx } } - uint32_t Context::frame(bool _capture) + Encoder* Context::begin() { - BX_CHECK(0 == m_instBufferCount, "Instance buffer allocated, but not used. This is incorrect, and causes memory leak."); + EncoderImpl* encoder = &m_encoder[0]; - if (BX_ENABLED(BGFX_CONFIG_DEBUG_OCCLUSION) ) +#if BGFX_CONFIG_MULTITHREADED + if (BGFX_API_THREAD_MAGIC != s_threadIndex) { - m_occlusionQuerySet.clear(); + bx::MutexScope scopeLock(m_encoderApiLock); + + uint16_t idx = m_encoderHandle.alloc(); + if (kInvalidHandle == idx) + { + return NULL; + } + + encoder = &m_encoder[idx]; + encoder->begin(m_submit, uint8_t(idx) ); } +#endif // BGFX_CONFIG_MULTITHREADED - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + return reinterpret_cast<Encoder*>(encoder); + } + + void Context::end(Encoder* _encoder) + { +#if BGFX_CONFIG_MULTITHREADED + if (BGFX_API_THREAD_MAGIC != s_threadIndex) { - m_uniformSet.clear(); + EncoderImpl* encoder = reinterpret_cast<EncoderImpl*>(_encoder); + encoder->end(true); + + m_encoderEndSem.post(); } +#else + BX_UNUSED(_encoder); +#endif // BGFX_CONFIG_MULTITHREADED + } + + uint32_t Context::frame(bool _capture) + { + m_encoder[0].end(true); + +#if BGFX_CONFIG_MULTITHREADED + bx::MutexScope resourceApiScope(m_resourceApiLock); + + encoderApiWait(); + bx::MutexScope encoderApiScope(m_encoderApiLock); +#else + encoderApiWait(); +#endif // BGFX_CONFIG_MULTITHREADED m_submit->m_capture = _capture; - BGFX_PROFILER_SCOPE(bgfx, main_thread_frame, 0xff2040ff); + BGFX_PROFILER_SCOPE("bgfx/API thread frame", 0xff2040ff); // wait for render thread to finish renderSemWait(); frameNoRenderWait(); + m_encoder[0].begin(m_submit, 0); + return m_frames; } @@ -1606,15 +1760,11 @@ namespace bgfx m_submit->m_resolution = m_resolution; m_resolution.m_flags &= ~BGFX_RESET_INTERNAL_FORCE; m_submit->m_debug = m_debug; + m_submit->m_perfStats.numViews = 0; bx::memCopy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) ); - bx::memCopy(m_submit->m_fb, m_fb, sizeof(m_fb) ); - bx::memCopy(m_submit->m_clear, m_clear, sizeof(m_clear) ); - bx::memCopy(m_submit->m_rect, m_rect, sizeof(m_rect) ); - bx::memCopy(m_submit->m_scissor, m_scissor, sizeof(m_scissor) ); bx::memCopy(m_submit->m_view, m_view, sizeof(m_view) ); - bx::memCopy(m_submit->m_proj, m_proj, sizeof(m_proj) ); - bx::memCopy(m_submit->m_viewFlags, m_viewFlags, sizeof(m_viewFlags) ); + if (m_colorPaletteDirty > 0) { --m_colorPaletteDirty; @@ -1643,43 +1793,69 @@ namespace bgfx , m_resolution.m_width , m_resolution.m_height ); - } - const char* Context::getName(UniformHandle _handle) const - { - return m_uniformRef[_handle.idx].m_name.getPtr(); + int64_t now = bx::getHPCounter(); + m_submit->m_perfStats.cpuTimeFrame = now - m_frameTimeLast; + m_frameTimeLast = now; } - RenderFrame::Enum Context::renderFrame(int32_t _msecs) - { - BGFX_PROFILER_SCOPE(bgfx, render_frame, 0xff2040ff); + RendererContextI* rendererCreate(RendererType::Enum _type); + void rendererDestroy(RendererContextI* _renderCtx); + void Context::flip() + { if (m_rendererInitialized - && !m_flipAfterRender && !m_flipped) { m_renderCtx->flip(m_render->m_hmd); m_flipped = true; + + if (m_renderCtx->isDeviceRemoved() ) + { + // Something horribly went wrong, fallback to noop renderer. + rendererDestroy(m_renderCtx); + + m_renderCtx = rendererCreate(RendererType::Noop); + g_caps.rendererType = RendererType::Noop; + } + } + } + + RenderFrame::Enum Context::renderFrame(int32_t _msecs) + { + BGFX_PROFILER_SCOPE("bgfx::renderFrame", 0xff2040ff); + + if (!m_flipAfterRender) + { + BGFX_PROFILER_SCOPE("bgfx/flip", 0xff2040ff); + flip(); } if (apiSemWait(_msecs) ) { - rendererExecCommands(m_render->m_cmdPre); + { + BGFX_PROFILER_SCOPE("bgfx/Exec commands pre", 0xff2040ff); + rendererExecCommands(m_render->m_cmdPre); + } + if (m_rendererInitialized) { - BGFX_PROFILER_SCOPE(bgfx, render_submit, 0xff2040ff); + BGFX_PROFILER_SCOPE("bgfx/Render submit", 0xff2040ff); m_renderCtx->submit(m_render, m_clearQuad, m_textVideoMemBlitter); m_flipped = false; } - rendererExecCommands(m_render->m_cmdPost); + + { + BGFX_PROFILER_SCOPE("bgfx/Exec commands post", 0xff2040ff); + rendererExecCommands(m_render->m_cmdPost); + } renderSemPost(); - if (m_rendererInitialized - && m_flipAfterRender) + if (m_flipAfterRender) { - m_renderCtx->flip(m_render->m_hmd); - m_flipped = true; + BGFX_PROFILER_SCOPE("bgfx/flip", 0xff2040ff); + flip(); } } else @@ -1825,7 +2001,7 @@ namespace bgfx static RendererCreator s_rendererCreator[] = { - { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NOOP_NAME, !!BGFX_CONFIG_RENDERER_NOOP }, // Noop + { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NOOP_NAME, true }, // Noop { d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9 { d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11 { d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12 @@ -1841,8 +2017,6 @@ namespace bgfx }; BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count); - static RendererDestroyFn s_rendererDestroyFn; - struct Condition { enum Enum @@ -1934,7 +2108,6 @@ namespace bgfx || BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_IOS - || BX_PLATFORM_NACL || BX_PLATFORM_RPI ) ) { @@ -1965,7 +2138,6 @@ namespace bgfx renderCtx = s_rendererCreator[renderer].createFn(); if (NULL != renderCtx) { - s_rendererDestroyFn = s_rendererCreator[renderer].destroyFn; break; } @@ -1975,9 +2147,12 @@ namespace bgfx return renderCtx; } - void rendererDestroy() + void rendererDestroy(RendererContextI* _renderCtx) { - s_rendererDestroyFn(); + if (NULL != _renderCtx) + { + s_rendererCreator[_renderCtx->getRendererType()].destroyFn(); + } } void Context::rendererExecCommands(CommandBuffer& _cmdbuf) @@ -2012,6 +2187,7 @@ namespace bgfx _cmdbuf.read(type); m_renderCtx = rendererCreate(type); + m_rendererInitialized = NULL != m_renderCtx; if (!m_rendererInitialized) @@ -2044,8 +2220,10 @@ namespace bgfx case CommandBuffer::RendererShutdownEnd: { BX_CHECK(!m_rendererInitialized && !m_exit, "This shouldn't happen! Bad synchronization?"); - rendererDestroy(); + + rendererDestroy(m_renderCtx); m_renderCtx = NULL; + m_exit = true; } // fall through @@ -2345,7 +2523,7 @@ namespace bgfx uint8_t mip; _cmdbuf.read(mip); - m_renderCtx->readTexture(handle, data,mip); + m_renderCtx->readTexture(handle, data, mip); } break; @@ -2467,7 +2645,7 @@ namespace bgfx case CommandBuffer::UpdateViewName: { - uint8_t id; + ViewId id; _cmdbuf.read(id); uint16_t len; @@ -2488,6 +2666,20 @@ namespace bgfx } break; + case CommandBuffer::SetName: + { + Handle handle; + _cmdbuf.read(handle); + + uint16_t len; + _cmdbuf.read(len); + + const char* name = (const char*)_cmdbuf.skip(len); + + m_renderCtx->setName(handle, name); + } + break; + default: BX_CHECK(false, "Invalid command: %d", command); break; @@ -2568,7 +2760,7 @@ namespace bgfx } else { - bx::CrtAllocator allocator; + bx::DefaultAllocator allocator; g_allocator = s_allocatorStub = BX_NEW(&allocator, AllocatorStub); } @@ -2584,7 +2776,7 @@ namespace bgfx } if (true - && !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL || BX_PLATFORM_PS4) + && !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_PS4) && RendererType::Noop != _type && NULL == g_platformData.ndt && NULL == g_platformData.nwh @@ -2607,7 +2799,7 @@ namespace bgfx g_caps.limits.maxTextures = BGFX_CONFIG_MAX_TEXTURES; g_caps.limits.maxTextureSamplers = BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; g_caps.limits.maxVertexDecls = BGFX_CONFIG_MAX_VERTEX_DECLS; - g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS; + g_caps.limits.maxVertexStreams = 1; g_caps.limits.maxIndexBuffers = BGFX_CONFIG_MAX_INDEX_BUFFERS; g_caps.limits.maxVertexBuffers = BGFX_CONFIG_MAX_VERTEX_BUFFERS; g_caps.limits.maxDynamicIndexBuffers = BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS; @@ -2615,6 +2807,7 @@ namespace bgfx g_caps.limits.maxUniforms = BGFX_CONFIG_MAX_UNIFORMS; g_caps.limits.maxOcclusionQueries = BGFX_CONFIG_MAX_OCCLUSION_QUERIES; g_caps.limits.maxFBAttachments = 1; + g_caps.limits.maxEncoders = BGFX_CONFIG_MAX_ENCODERS; g_caps.vendorId = _vendorId; g_caps.deviceId = _deviceId; @@ -2648,7 +2841,7 @@ error: if (NULL != s_allocatorStub) { - bx::CrtAllocator allocator; + bx::DefaultAllocator allocator; BX_DELETE(&allocator, s_allocatorStub); s_allocatorStub = NULL; } @@ -2666,7 +2859,7 @@ error: { BX_TRACE("Shutdown..."); - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); Context* ctx = s_ctx; // it's going to be NULLd inside shutdown. ctx->shutdown(); BX_CHECK(NULL == s_ctx, "bgfx is should be uninitialized here."); @@ -2688,7 +2881,7 @@ error: if (NULL != s_allocatorStub) { - bx::CrtAllocator allocator; + bx::DefaultAllocator allocator; BX_DELETE(&allocator, s_allocatorStub); s_allocatorStub = NULL; } @@ -2700,14 +2893,308 @@ error: void reset(uint32_t _width, uint32_t _height, uint32_t _flags) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); BX_CHECK(0 == (_flags&BGFX_RESET_RESERVED_MASK), "Do not set reset reserved flags!"); s_ctx->reset(_width, _height, _flags); } + Encoder* begin() + { + return s_ctx->begin(); + } + +#define BGFX_ENCODER(_func) reinterpret_cast<EncoderImpl*>(this)->_func + + void Encoder::setMarker(const char* _marker) + { + BGFX_ENCODER(setMarker(_marker) ); + } + + void Encoder::setState(uint64_t _state, uint32_t _rgba) + { + BX_CHECK(0 == (_state&BGFX_STATE_RESERVED_MASK), "Do not set state reserved flags!"); + BGFX_ENCODER(setState(_state, _rgba) ); + } + + void Encoder::setCondition(OcclusionQueryHandle _handle, bool _visible) + { + BGFX_CHECK_CAPS(BGFX_CAPS_OCCLUSION_QUERY, "Occlusion query is not supported!"); + BGFX_ENCODER(setCondition(_handle, _visible) ); + } + + void Encoder::setStencil(uint32_t _fstencil, uint32_t _bstencil) + { + BGFX_ENCODER(setStencil(_fstencil, _bstencil) ); + } + + uint16_t Encoder::setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + { + return BGFX_ENCODER(setScissor(_x, _y, _width, _height) ); + } + + void Encoder::setScissor(uint16_t _cache) + { + BGFX_ENCODER(setScissor(_cache) ); + } + + uint32_t Encoder::setTransform(const void* _mtx, uint16_t _num) + { + return BGFX_ENCODER(setTransform(_mtx, _num) ); + } + + uint32_t Encoder::allocTransform(Transform* _transform, uint16_t _num) + { + return BGFX_ENCODER(allocTransform(_transform, _num) ); + } + + void Encoder::setTransform(uint32_t _cache, uint16_t _num) + { + BGFX_ENCODER(setTransform(_cache, _num) ); + } + + void Encoder::setUniform(UniformHandle _handle, const void* _value, uint16_t _num) + { + BGFX_CHECK_HANDLE("setUniform", s_ctx->m_uniformHandle, _handle); + const Context::UniformRef& uniform = s_ctx->m_uniformRef[_handle.idx]; + BX_CHECK(isValid(_handle) && 0 < uniform.m_refCount, "Setting invalid uniform (handle %3d)!", _handle.idx); + BX_CHECK(_num == UINT16_MAX || uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num); + BGFX_ENCODER(setUniform(uniform.m_type, _handle, _value, _num) ); + } + + void Encoder::setIndexBuffer(IndexBufferHandle _handle) + { + setIndexBuffer(_handle, 0, UINT32_MAX); + } + + void Encoder::setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) + { + BGFX_CHECK_HANDLE("setIndexBuffer", s_ctx->m_indexBufferHandle, _handle); + BGFX_ENCODER(setIndexBuffer(_handle, _firstIndex, _numIndices) ); + } + + void Encoder::setIndexBuffer(DynamicIndexBufferHandle _handle) + { + setIndexBuffer(_handle, 0, UINT32_MAX); + } + + void Encoder::setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) + { + BGFX_CHECK_HANDLE("setIndexBuffer", s_ctx->m_dynamicIndexBufferHandle, _handle); + const DynamicIndexBuffer& dib = s_ctx->m_dynamicIndexBuffers[_handle.idx]; + BGFX_ENCODER(setIndexBuffer(dib, _firstIndex, _numIndices) ); + } + + void Encoder::setIndexBuffer(const TransientIndexBuffer* _tib) + { + setIndexBuffer(_tib, 0, UINT32_MAX); + } + + void Encoder::setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) + { + BX_CHECK(NULL != _tib, "_tib can't be NULL"); + BGFX_CHECK_HANDLE("setIndexBuffer", s_ctx->m_indexBufferHandle, _tib->handle); + BGFX_ENCODER(setIndexBuffer(_tib, _firstIndex, _numIndices) ); + } + + void Encoder::setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) + { + BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_vertexBufferHandle, _handle); + BGFX_ENCODER(setVertexBuffer(_stream, _handle, _startVertex, _numVertices) ); + } + + void Encoder::setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle) + { + setVertexBuffer(_stream, _handle, 0, UINT32_MAX); + } + + void Encoder::setVertexBuffer(uint8_t _stream, DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) + { + BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_dynamicVertexBufferHandle, _handle); + const DynamicVertexBuffer& dvb = s_ctx->m_dynamicVertexBuffers[_handle.idx]; + BGFX_ENCODER(setVertexBuffer(_stream, dvb, _startVertex, _numVertices) ); + } + + void Encoder::setVertexBuffer(uint8_t _stream, DynamicVertexBufferHandle _handle) + { + setVertexBuffer(_stream, _handle, 0, UINT32_MAX); + } + + void Encoder::setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) + { + BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); + BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_vertexBufferHandle, _tvb->handle); + BGFX_ENCODER(setVertexBuffer(_stream, _tvb, _startVertex, _numVertices) ); + } + + void Encoder::setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb) + { + setVertexBuffer(_stream, _tvb, 0, UINT32_MAX); + } + + void Encoder::setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) + { + BX_CHECK(NULL != _idb, "_idb can't be NULL"); + BGFX_ENCODER(setInstanceDataBuffer(_idb, _num) ); + } + + void Encoder::setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) + { + BGFX_CHECK_HANDLE("setInstanceDataBuffer", s_ctx->m_vertexBufferHandle, _handle); + const VertexBuffer& vb = s_ctx->m_vertexBuffers[_handle.idx]; + BGFX_ENCODER(setInstanceDataBuffer(_handle, _startVertex, _num, vb.m_stride) ); + } + + void Encoder::setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) + { + BGFX_CHECK_HANDLE("setInstanceDataBuffer", s_ctx->m_dynamicVertexBufferHandle, _handle); + const DynamicVertexBuffer& dvb = s_ctx->m_dynamicVertexBuffers[_handle.idx]; + BGFX_ENCODER(setInstanceDataBuffer(dvb.m_handle + , dvb.m_startVertex + _startVertex + , _num + , dvb.m_stride + ) ); + } + + void Encoder::setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) + { + BGFX_CHECK_HANDLE_INVALID_OK("setTexture/TextureHandle", s_ctx->m_textureHandle, _handle); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BGFX_ENCODER(setTexture(_stage, _sampler, _handle, _flags) ); + } + + void Encoder::touch(ViewId _id) + { + ProgramHandle handle = BGFX_INVALID_HANDLE; + submit(_id, handle); + } + + void Encoder::submit(ViewId _id, ProgramHandle _program, int32_t _depth, bool _preserveState) + { + OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; + submit(_id, _program, handle, _depth, _preserveState); + } + + void Encoder::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + { + BX_CHECK(false + || !isValid(_occlusionQuery) + || 0 != (g_caps.supported & BGFX_CAPS_OCCLUSION_QUERY) + , "Occlusion query is not supported! Use bgfx::getCaps to check BGFX_CAPS_OCCLUSION_QUERY backend renderer capabilities." + ); + BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_programHandle, _program); + BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_occlusionQueryHandle, _occlusionQuery); + BGFX_ENCODER(submit(_id, _program, _occlusionQuery, _depth, _preserveState) ); + } + + void Encoder::submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + { + BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_programHandle, _program); + BGFX_CHECK_HANDLE("submit", s_ctx->m_vertexBufferHandle, _indirectHandle); + BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Draw indirect is not supported!"); + BGFX_ENCODER(submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState) ); + } + + void Encoder::setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) + { + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_indexBufferHandle, _handle); + BGFX_ENCODER(setBuffer(_stage, _handle, _access) ); + } + + void Encoder::setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) + { + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_vertexBufferHandle, _handle); + BGFX_ENCODER(setBuffer(_stage, _handle, _access) ); + } + + void Encoder::setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) + { + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_dynamicIndexBufferHandle, _handle); + const DynamicIndexBuffer& dib = s_ctx->m_dynamicIndexBuffers[_handle.idx]; + BGFX_ENCODER(setBuffer(_stage, dib.m_handle, _access) ); + } + + void Encoder::setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) + { + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_dynamicVertexBufferHandle, _handle); + const DynamicVertexBuffer& dvb = s_ctx->m_dynamicVertexBuffers[_handle.idx]; + BGFX_ENCODER(setBuffer(_stage, dvb.m_handle, _access) ); + } + + void Encoder::setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access) + { + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_vertexBufferHandle, _handle); + VertexBufferHandle handle = { _handle.idx }; + BGFX_ENCODER(setBuffer(_stage, handle, _access) ); + } + + void Encoder::setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) + { + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + _format = TextureFormat::Count == _format + ? TextureFormat::Enum(s_ctx->m_textureRef[_handle.idx].m_format) + : _format + ; + BX_CHECK(_format != TextureFormat::BGRA8 + , "Can't use TextureFormat::BGRA8 with compute, use TextureFormat::RGBA8 instead." + ); + BGFX_ENCODER(setImage(_stage, _sampler, _handle, _mip, _access, _format) ); + } + + void Encoder::dispatch(ViewId _id, ProgramHandle _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) + { + BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported!"); + BGFX_CHECK_HANDLE_INVALID_OK("dispatch", s_ctx->m_programHandle, _program); + BGFX_ENCODER(dispatch(_id, _program, _numX, _numY, _numZ, _flags) ); + } + + void Encoder::dispatch(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) + { + BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Dispatch indirect is not supported!"); + BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported!"); + BGFX_CHECK_HANDLE_INVALID_OK("dispatch", s_ctx->m_programHandle, _program); + BGFX_CHECK_HANDLE("dispatch", s_ctx->m_vertexBufferHandle, _indirectHandle); + BGFX_ENCODER(dispatch(_id, _program, _indirectHandle, _start, _num, _flags) ); + } + + void Encoder::discard() + { + BGFX_ENCODER(discard() ); + } + + void Encoder::blit(ViewId _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) + { + blit(_id, _dst, 0, _dstX, _dstY, 0, _src, 0, _srcX, _srcY, 0, _width, _height, 0); + } + + void Encoder::blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) + { + BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_BLIT, "Texture blit is not supported!"); + const Context::TextureRef& src = s_ctx->m_textureRef[_src.idx]; + const Context::TextureRef& dst = s_ctx->m_textureRef[_dst.idx]; + BX_CHECK(src.m_format == dst.m_format + , "Texture format must match (src %s, dst %s)." + , bimg::getName(bimg::TextureFormat::Enum(src.m_format) ) + , bimg::getName(bimg::TextureFormat::Enum(dst.m_format) ) + ); + BX_UNUSED(src, dst); + BGFX_ENCODER(blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth) ); + } + +#undef BGFX_ENCODER + + void end(Encoder* _encoder) + { + s_ctx->end(_encoder); + } + uint32_t frame(bool _capture) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); return s_ctx->frame(_capture); } @@ -2787,13 +3274,13 @@ error: void setDebug(uint32_t _debug) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); s_ctx->setDebug(_debug); } void dbgTextClear(uint8_t _attr, bool _small) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); s_ctx->dbgTextClear(_attr, _small); } @@ -2804,7 +3291,7 @@ error: void dbgTextPrintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); va_list argList; va_start(argList, _format); s_ctx->dbgTextPrintfVargs(_x, _y, _attr, _format, argList); @@ -2813,116 +3300,100 @@ error: void dbgTextImage(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); s_ctx->dbgTextImage(_x, _y, _width, _height, _data, _pitch); } IndexBufferHandle createIndexBuffer(const Memory* _mem, uint16_t _flags) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); return s_ctx->createIndexBuffer(_mem, _flags); } - void destroyIndexBuffer(IndexBufferHandle _handle) + void destroy(IndexBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyIndexBuffer(_handle); } VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); - BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexDecl."); return s_ctx->createVertexBuffer(_mem, _decl, _flags); } - void destroyVertexBuffer(VertexBufferHandle _handle) + void destroy(VertexBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyVertexBuffer(_handle); } DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint16_t _flags) { - BGFX_CHECK_MAIN_THREAD(); return s_ctx->createDynamicIndexBuffer(_num, _flags); } DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint16_t _flags) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); return s_ctx->createDynamicIndexBuffer(_mem, _flags); } void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _startIndex, const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); s_ctx->updateDynamicIndexBuffer(_handle, _startIndex, _mem); } - void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle) + void destroy(DynamicIndexBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyDynamicIndexBuffer(_handle); } DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexDecl."); return s_ctx->createDynamicVertexBuffer(_num, _decl, _flags); } DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); - BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexDecl."); return s_ctx->createDynamicVertexBuffer(_mem, _decl, _flags); } void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); s_ctx->updateDynamicVertexBuffer(_handle, _startVertex, _mem); } - void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle) + void destroy(DynamicVertexBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyDynamicVertexBuffer(_handle); } uint32_t getAvailTransientIndexBuffer(uint32_t _num) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(0 < _num, "Requesting 0 indices."); return s_ctx->getAvailTransientIndexBuffer(_num); } uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(0 < _num, "Requesting 0 vertices."); - BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexDecl."); return s_ctx->getAvailTransientVertexBuffer(_num, _decl.m_stride); } uint32_t getAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(0 < _num, "Requesting 0 instances."); return s_ctx->getAvailTransientVertexBuffer(_num, _stride); } void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _tib, "_tib can't be NULL"); BX_CHECK(0 < _num, "Requesting 0 indices."); s_ctx->allocTransientIndexBuffer(_tib, _num); @@ -2934,11 +3405,10 @@ error: void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); BX_CHECK(0 < _num, "Requesting 0 vertices."); BX_CHECK(UINT16_MAX >= _num, "Requesting %d vertices (max: %d).", _num, UINT16_MAX); - BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexDecl."); s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl); BX_CHECK(_num == _tvb->size / _decl.m_stride, "Failed to allocate transient vertex buffer (requested %d, available %d). Use bgfx::checkAvailTransient* functions to ensure availability." , _num @@ -2948,6 +3418,8 @@ error: bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices) { + BGFX_MUTEX_SCOPE(s_ctx->m_resourceApiLock); + if (_numVertices == getAvailTransientVertexBuffer(_numVertices, _decl) && _numIndices == getAvailTransientIndexBuffer(_numIndices) ) { @@ -2959,53 +3431,51 @@ error: return false; } - const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride) + void allocInstanceDataBuffer(InstanceDataBuffer* _idb, uint32_t _num, uint16_t _stride) { - BGFX_CHECK_MAIN_THREAD(); BGFX_CHECK_CAPS(BGFX_CAPS_INSTANCING, "Instancing is not supported!"); + BX_CHECK(_stride == BX_ALIGN_16(_stride), "Stride must be multiple of 16."); BX_CHECK(0 < _num, "Requesting 0 instanced data vertices."); - const InstanceDataBuffer* idb = s_ctx->allocInstanceDataBuffer(_num, _stride); - BX_CHECK(_num == idb->size / _stride, "Failed to allocate instance data buffer (requested %d, available %d). Use bgfx::checkAvailTransient* functions to ensure availability." + s_ctx->allocInstanceDataBuffer(_idb, _num, _stride); + BX_CHECK(_num == _idb->size / _stride, "Failed to allocate instance data buffer (requested %d, available %d). Use bgfx::checkAvailTransient* functions to ensure availability." , _num - , idb->size / _stride + , _idb->size / _stride ); - return idb; } IndirectBufferHandle createIndirectBuffer(uint32_t _num) { - BGFX_CHECK_MAIN_THREAD(); return s_ctx->createIndirectBuffer(_num); } - void destroyIndirectBuffer(IndirectBufferHandle _handle) + void destroy(IndirectBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyIndirectBuffer(_handle); } ShaderHandle createShader(const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); return s_ctx->createShader(_mem); } uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms, uint16_t _max) { - BGFX_CHECK_MAIN_THREAD(); return s_ctx->getShaderUniforms(_handle, _uniforms, _max); } - void destroyShader(ShaderHandle _handle) + void setName(ShaderHandle _handle, const char* _name) + { + s_ctx->setName(_handle, _name); + } + + void destroy(ShaderHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyShader(_handle); } ProgramHandle createProgram(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders) { - BGFX_CHECK_MAIN_THREAD(); if (!isValid(_fsh) ) { return createProgram(_vsh, _destroyShaders); @@ -3016,13 +3486,11 @@ error: ProgramHandle createProgram(ShaderHandle _csh, bool _destroyShader) { - BGFX_CHECK_MAIN_THREAD(); return s_ctx->createProgram(_csh, _destroyShader); } - void destroyProgram(ProgramHandle _handle) + void destroy(ProgramHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyProgram(_handle); } @@ -3095,6 +3563,14 @@ error: srgbCaps = BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB; } + if (formatSupported + && 0 != (_flags & BGFX_TEXTURE_RT_MASK) ) + { + formatSupported = 0 != (g_caps.formats[_format] & (0 + | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER + ) ); + } + if (!formatSupported) { _err->setError(BGFX_ERROR_TEXTURE_VALIDATION @@ -3105,7 +3581,7 @@ error: } if (0 != (_flags & BGFX_TEXTURE_MSAA_SAMPLE) - && 0 == (g_caps.supported & BGFX_CAPS_FORMAT_TEXTURE_MSAA) ) + && 0 == (g_caps.formats[_format] & BGFX_CAPS_FORMAT_TEXTURE_MSAA) ) { _err->setError(BGFX_ERROR_TEXTURE_VALIDATION , "MSAA sampling for this texture format is not supported." @@ -3136,12 +3612,11 @@ error: void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format) { - imageGetSize(&_info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, _format); + bimg::imageGetSize( (bimg::TextureInfo*)&_info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bimg::TextureFormat::Enum(_format) ); } TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::Count); } @@ -3166,8 +3641,6 @@ error: static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); - bx::Error err; isTextureValid(0, false, _numLayers, _format, _flags, &err); BX_CHECK(err.isOk(), "%s (layers %d, format %s)" @@ -3233,8 +3706,6 @@ error: TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); - bx::Error err; isTextureValid(_depth, false, 1, _format, _flags, &err); BX_CHECK(err.isOk(), "%s", err.getMessage().getPtr() ); @@ -3276,8 +3747,6 @@ error: TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); - bx::Error err; isTextureValid(0, true, _numLayers, _format, _flags, &err); BX_CHECK(err.isOk(), "%s", err.getMessage().getPtr() ); @@ -3318,15 +3787,18 @@ error: return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count); } - void destroyTexture(TextureHandle _handle) + void setName(TextureHandle _handle, const char* _name) + { + s_ctx->setName(_handle, _name); + } + + void destroy(TextureHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyTexture(_handle); } void updateTexture2D(TextureHandle _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); if (_width == 0 || _height == 0) @@ -3341,7 +3813,6 @@ error: void updateTexture3D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const Memory* _mem) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_3D, "Texture3D is not supported!"); @@ -3359,7 +3830,6 @@ error: void updateTextureCube(TextureHandle _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); BX_CHECK(_side <= 5, "Invalid side %d.", _side); if (0 == _width @@ -3375,7 +3845,6 @@ error: uint32_t readTexture(TextureHandle _handle, void* _data, uint8_t _mip) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _data, "_data can't be NULL"); BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_READ_BACK, "Texture read-back is not supported!"); return s_ctx->readTexture(_handle, _data, _mip); @@ -3411,9 +3880,9 @@ error: FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(_num != 0, "Number of frame buffer attachments can't be 0."); - BX_CHECK(_num <= BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS, "Number of frame buffer attachments is larger than allowed %d (max: %d)." + BX_CHECK(_num <= BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS + , "Number of frame buffer attachments is larger than allowed %d (max: %d)." , _num , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS ); @@ -3423,117 +3892,113 @@ error: FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat) { - BGFX_CHECK_MAIN_THREAD(); - return s_ctx->createFrameBuffer(_nwh, _width, _height, _depthFormat); + BGFX_CHECK_CAPS(BGFX_CAPS_SWAP_CHAIN, "Swap chain is not supported!"); + BX_WARN(_width > 0 && _height > 0 + , "Invalid frame buffer dimensions (width %d, height %d)." + , _width + , _height + ); + return s_ctx->createFrameBuffer( + _nwh + , bx::uint16_max(_width, 1) + , bx::uint16_max(_height, 1) + , _depthFormat + ); } TextureHandle getTexture(FrameBufferHandle _handle, uint8_t _attachment) { - BGFX_CHECK_MAIN_THREAD(); return s_ctx->getTexture(_handle, _attachment); } - void destroyFrameBuffer(FrameBufferHandle _handle) + void destroy(FrameBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyFrameBuffer(_handle); } UniformHandle createUniform(const char* _name, UniformType::Enum _type, uint16_t _num) { - BGFX_CHECK_MAIN_THREAD(); return s_ctx->createUniform(_name, _type, _num); } void getUniformInfo(UniformHandle _handle, UniformInfo& _info) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->getUniformInfo(_handle, _info); } - void destroyUniform(UniformHandle _handle) + void destroy(UniformHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->destroyUniform(_handle); } OcclusionQueryHandle createOcclusionQuery() { - BGFX_CHECK_MAIN_THREAD(); BGFX_CHECK_CAPS(BGFX_CAPS_OCCLUSION_QUERY, "Occlusion query is not supported!"); return s_ctx->createOcclusionQuery(); } OcclusionQueryResult::Enum getResult(OcclusionQueryHandle _handle, int32_t* _result) { - BGFX_CHECK_MAIN_THREAD(); BGFX_CHECK_CAPS(BGFX_CAPS_OCCLUSION_QUERY, "Occlusion query is not supported!"); return s_ctx->getResult(_handle, _result); } - void destroyOcclusionQuery(OcclusionQueryHandle _handle) + void destroy(OcclusionQueryHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); BGFX_CHECK_CAPS(BGFX_CAPS_OCCLUSION_QUERY, "Occlusion query is not supported!"); s_ctx->destroyOcclusionQuery(_handle); } void setPaletteColor(uint8_t _index, uint32_t _rgba) { - BGFX_CHECK_MAIN_THREAD(); - const uint8_t rr = uint8_t(_rgba>>24); const uint8_t gg = uint8_t(_rgba>>16); const uint8_t bb = uint8_t(_rgba>> 8); const uint8_t aa = uint8_t(_rgba>> 0); - float rgba[4] = + const float rgba[4] = { rr * 1.0f/255.0f, gg * 1.0f/255.0f, bb * 1.0f/255.0f, aa * 1.0f/255.0f, }; + s_ctx->setPaletteColor(_index, rgba); } void setPaletteColor(uint8_t _index, float _r, float _g, float _b, float _a) { - BGFX_CHECK_MAIN_THREAD(); float rgba[4] = { _r, _g, _b, _a }; s_ctx->setPaletteColor(_index, rgba); } void setPaletteColor(uint8_t _index, const float _rgba[4]) { - BGFX_CHECK_MAIN_THREAD(); s_ctx->setPaletteColor(_index, _rgba); } - bool checkView(uint8_t _id) + bool checkView(ViewId _id) { // workaround GCC 4.9 type-limit check. const uint32_t id = _id; return id < BGFX_CONFIG_MAX_VIEWS; } - void setViewName(uint8_t _id, const char* _name) + void setViewName(ViewId _id, const char* _name) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewName(_id, _name); } - void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + void setViewRect(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewRect(_id, _x, _y, _width, _height); } - void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, BackbufferRatio::Enum _ratio) + void setViewRect(ViewId _id, uint16_t _x, uint16_t _y, BackbufferRatio::Enum _ratio) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); uint16_t width = uint16_t(s_ctx->m_resolution.m_width); @@ -3542,122 +4007,112 @@ error: setViewRect(_id, _x, _y, width, height); } - void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + void setViewScissor(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewScissor(_id, _x, _y, _width, _height); } - void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) + void setViewClear(ViewId _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewClear(_id, _flags, _rgba, _depth, _stencil); } - void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) + void setViewClear(ViewId _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewClear(_id, _flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); } - void setViewSeq(uint8_t _id, bool _enabled) + void setViewMode(ViewId _id, ViewMode::Enum _mode) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); - s_ctx->setViewSeq(_id, _enabled); + s_ctx->setViewMode(_id, _mode); } - void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) + void setViewFrameBuffer(ViewId _id, FrameBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewFrameBuffer(_id, _handle); } - void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) + void setViewTransform(ViewId _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewTransform(_id, _view, _projL, _flags, _projR); } - void setViewOrder(uint8_t _id, uint8_t _num, const void* _order) + void setViewOrder(ViewId _id, uint16_t _num, const ViewId* _order) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewOrder(_id, _num, _order); } - void resetView(uint8_t _id) + void resetView(ViewId _id) { - BGFX_CHECK_MAIN_THREAD(); BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->resetView(_id); } void setMarker(const char* _marker) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setMarker(_marker); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setMarker(_marker); } void setState(uint64_t _state, uint32_t _rgba) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(0 == (_state&BGFX_STATE_RESERVED_MASK), "Do not set state reserved flags!"); - s_ctx->setState(_state, _rgba); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setState(_state, _rgba); } void setCondition(OcclusionQueryHandle _handle, bool _visible) { - BGFX_CHECK_MAIN_THREAD(); - BGFX_CHECK_CAPS(BGFX_CAPS_OCCLUSION_QUERY, "Occlusion query is not supported!"); - s_ctx->setCondition(_handle, _visible); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setCondition(_handle, _visible); } void setStencil(uint32_t _fstencil, uint32_t _bstencil) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setStencil(_fstencil, _bstencil); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setStencil(_fstencil, _bstencil); } uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - BGFX_CHECK_MAIN_THREAD(); - return s_ctx->setScissor(_x, _y, _width, _height); + BGFX_CHECK_API_THREAD(); + return s_ctx->m_encoder0->setScissor(_x, _y, _width, _height); } void setScissor(uint16_t _cache) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setScissor(_cache); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setScissor(_cache); } uint32_t setTransform(const void* _mtx, uint16_t _num) { - BGFX_CHECK_MAIN_THREAD(); - return s_ctx->setTransform(_mtx, _num); + BGFX_CHECK_API_THREAD(); + return s_ctx->m_encoder0->setTransform(_mtx, _num); } uint32_t allocTransform(Transform* _transform, uint16_t _num) { - BGFX_CHECK_MAIN_THREAD(); - return s_ctx->allocTransform(_transform, _num); + BGFX_CHECK_API_THREAD(); + return s_ctx->m_encoder0->allocTransform(_transform, _num); } void setTransform(uint32_t _cache, uint16_t _num) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setTransform(_cache, _num); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setTransform(_cache, _num); } void setUniform(UniformHandle _handle, const void* _value, uint16_t _num) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setUniform(_handle, _value, _num); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setUniform(_handle, _value, _num); } void setIndexBuffer(IndexBufferHandle _handle) @@ -3667,8 +4122,8 @@ error: void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setIndexBuffer(_handle, _firstIndex, _numIndices); } void setIndexBuffer(DynamicIndexBufferHandle _handle) @@ -3678,8 +4133,8 @@ error: void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setIndexBuffer(_handle, _firstIndex, _numIndices); } void setIndexBuffer(const TransientIndexBuffer* _tib) @@ -3689,184 +4144,260 @@ error: void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(NULL != _tib, "_tib can't be NULL"); - uint32_t numIndices = bx::uint32_min(_numIndices, _tib->size/2); - s_ctx->setIndexBuffer(_tib, _tib->startIndex + _firstIndex, numIndices); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setIndexBuffer(_tib, _firstIndex, _numIndices); } - void setVertexBuffer(VertexBufferHandle _handle) + void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { - setVertexBuffer(_handle, 0, UINT32_MAX); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setVertexBuffer(_stream, _handle, _startVertex, _numVertices); } - void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) + void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setVertexBuffer(0, _handle, _startVertex, _numVertices); + setVertexBuffer(_stream, _handle, 0, UINT32_MAX); } - void setVertexBuffer(DynamicVertexBufferHandle _handle) + void setVertexBuffer(uint8_t _stream, DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { - setVertexBuffer(_handle, 0, UINT32_MAX); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setVertexBuffer(_stream, _handle, _startVertex, _numVertices); } - void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) + void setVertexBuffer(uint8_t _stream, DynamicVertexBufferHandle _handle) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setVertexBuffer(0, _handle, _startVertex, _numVertices); + setVertexBuffer(_stream, _handle, 0, UINT32_MAX); } - void setVertexBuffer(const TransientVertexBuffer* _tvb) + void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) { - setVertexBuffer(_tvb, 0, UINT32_MAX); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setVertexBuffer(_stream, _tvb, _startVertex, _numVertices); } - void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) + void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); - s_ctx->setVertexBuffer(0, _tvb, _startVertex, _numVertices); + setVertexBuffer(_stream, _tvb, 0, UINT32_MAX); } void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(NULL != _idb, "_idb can't be NULL"); - s_ctx->setInstanceDataBuffer(_idb, _num); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setInstanceDataBuffer(_idb, _num); } void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setInstanceDataBuffer(_handle, _startVertex, _num); } void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setInstanceDataBuffer(_handle, _startVertex, _num); } void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setTexture(_stage, _sampler, _handle, _flags); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setTexture(_stage, _sampler, _handle, _flags); } - uint32_t touch(uint8_t _id) + void touch(ViewId _id) { ProgramHandle handle = BGFX_INVALID_HANDLE; - return submit(_id, handle); + submit(_id, handle); } - uint32_t submit(uint8_t _id, ProgramHandle _program, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, int32_t _depth, bool _preserveState) { OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; - return submit(_id, _program, handle, _depth, _preserveState); + submit(_id, _program, handle, _depth, _preserveState); } - uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(false - || !isValid(_occlusionQuery) - || 0 != (g_caps.supported & BGFX_CAPS_OCCLUSION_QUERY) - , "Occlusion query is not supported! Use bgfx::getCaps to check BGFX_CAPS_OCCLUSION_QUERY backend renderer capabilities." - ); - return s_ctx->submit(_id, _program, _occlusionQuery, _depth, _preserveState); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->submit(_id, _program, _occlusionQuery, _depth, _preserveState); } - uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { - BGFX_CHECK_MAIN_THREAD(); - BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Draw indirect is not supported! Use bgfx::getCaps to check BGFX_CAPS_DRAW_INDIRECT backend renderer capabilities."); - return s_ctx->submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState); } void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setBuffer(_stage, _handle, _access); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setBuffer(_stage, _handle, _access); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setBuffer(_stage, _handle, _access); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setBuffer(_stage, _handle, _access); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setBuffer(_stage, _handle, _access); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setBuffer(_stage, _handle, _access); } void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) { - BGFX_CHECK_MAIN_THREAD(); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); - s_ctx->setImage(_stage, _sampler, _handle, _mip, _access, _format); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setImage(_stage, _sampler, _handle, _mip, _access, _format); } - uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) + void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { - BGFX_CHECK_MAIN_THREAD(); - BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported! Use bgfx::getCaps to check BGFX_CAPS_COMPUTE backend renderer capabilities."); - return s_ctx->dispatch(_id, _handle, _numX, _numY, _numZ, _flags); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->dispatch(_id, _handle, _numX, _numY, _numZ, _flags); } - uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) + void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { - BGFX_CHECK_MAIN_THREAD(); - BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Dispatch indirect is not supported! Use bgfx::getCaps to check BGFX_CAPS_DRAW_INDIRECT backend renderer capabilities."); - BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported! Use bgfx::getCaps to check BGFX_CAPS_COMPUTE backend renderer capabilities."); - return s_ctx->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags); } void discard() { - BGFX_CHECK_MAIN_THREAD(); - s_ctx->discard(); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->discard(); } - void blit(uint8_t _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) + void blit(ViewId _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) { blit(_id, _dst, 0, _dstX, _dstY, 0, _src, 0, _srcX, _srcY, 0, _width, _height, 0); } - void blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) + void blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { - BGFX_CHECK_MAIN_THREAD(); - BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_BLIT, "Texture blit is not supported!"); - s_ctx->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth); + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth); } void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) { - BGFX_CHECK_MAIN_THREAD(); + BGFX_CHECK_API_THREAD(); s_ctx->requestScreenShot(_handle, _filePath); } } // namespace bgfx +#if BX_PLATFORM_WINDOWS +extern "C" +{ + // When laptop setup has integrated and discrete GPU, following driver workarounds will + // select discrete GPU: + + // Reference: https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm + __declspec(dllexport) uint32_t NvOptimusEnablement = UINT32_C(1); + + // Reference: http://gpuopen.com/amdpowerxpressrequesthighperformance/ + __declspec(dllexport) uint32_t AmdPowerXpressRequestHighPerformance = UINT32_C(1); +} +#endif // BX_PLATFORM_WINDOWS + +#define BGFX_TEXTURE_FORMAT_BIMG(_fmt) \ + BX_STATIC_ASSERT(uint32_t(bgfx::TextureFormat::_fmt) == uint32_t(bimg::TextureFormat::_fmt) ) + +BGFX_TEXTURE_FORMAT_BIMG(BC1); +BGFX_TEXTURE_FORMAT_BIMG(BC2); +BGFX_TEXTURE_FORMAT_BIMG(BC3); +BGFX_TEXTURE_FORMAT_BIMG(BC4); +BGFX_TEXTURE_FORMAT_BIMG(BC5); +BGFX_TEXTURE_FORMAT_BIMG(BC6H); +BGFX_TEXTURE_FORMAT_BIMG(BC7); +BGFX_TEXTURE_FORMAT_BIMG(ETC1); +BGFX_TEXTURE_FORMAT_BIMG(ETC2); +BGFX_TEXTURE_FORMAT_BIMG(ETC2A); +BGFX_TEXTURE_FORMAT_BIMG(ETC2A1); +BGFX_TEXTURE_FORMAT_BIMG(PTC12); +BGFX_TEXTURE_FORMAT_BIMG(PTC14); +BGFX_TEXTURE_FORMAT_BIMG(PTC12A); +BGFX_TEXTURE_FORMAT_BIMG(PTC14A); +BGFX_TEXTURE_FORMAT_BIMG(PTC22); +BGFX_TEXTURE_FORMAT_BIMG(PTC24); +BGFX_TEXTURE_FORMAT_BIMG(Unknown); +BGFX_TEXTURE_FORMAT_BIMG(R1); +BGFX_TEXTURE_FORMAT_BIMG(A8); +BGFX_TEXTURE_FORMAT_BIMG(R8); +BGFX_TEXTURE_FORMAT_BIMG(R8I); +BGFX_TEXTURE_FORMAT_BIMG(R8U); +BGFX_TEXTURE_FORMAT_BIMG(R8S); +BGFX_TEXTURE_FORMAT_BIMG(R16); +BGFX_TEXTURE_FORMAT_BIMG(R16I); +BGFX_TEXTURE_FORMAT_BIMG(R16U); +BGFX_TEXTURE_FORMAT_BIMG(R16F); +BGFX_TEXTURE_FORMAT_BIMG(R16S); +BGFX_TEXTURE_FORMAT_BIMG(R32I); +BGFX_TEXTURE_FORMAT_BIMG(R32U); +BGFX_TEXTURE_FORMAT_BIMG(R32F); +BGFX_TEXTURE_FORMAT_BIMG(RG8); +BGFX_TEXTURE_FORMAT_BIMG(RG8I); +BGFX_TEXTURE_FORMAT_BIMG(RG8U); +BGFX_TEXTURE_FORMAT_BIMG(RG8S); +BGFX_TEXTURE_FORMAT_BIMG(RG16); +BGFX_TEXTURE_FORMAT_BIMG(RG16I); +BGFX_TEXTURE_FORMAT_BIMG(RG16U); +BGFX_TEXTURE_FORMAT_BIMG(RG16F); +BGFX_TEXTURE_FORMAT_BIMG(RG16S); +BGFX_TEXTURE_FORMAT_BIMG(RG32I); +BGFX_TEXTURE_FORMAT_BIMG(RG32U); +BGFX_TEXTURE_FORMAT_BIMG(RG32F); +BGFX_TEXTURE_FORMAT_BIMG(RGB8); +BGFX_TEXTURE_FORMAT_BIMG(RGB8I); +BGFX_TEXTURE_FORMAT_BIMG(RGB8U); +BGFX_TEXTURE_FORMAT_BIMG(RGB8S); +BGFX_TEXTURE_FORMAT_BIMG(RGB9E5F); +BGFX_TEXTURE_FORMAT_BIMG(BGRA8); +BGFX_TEXTURE_FORMAT_BIMG(RGBA8); +BGFX_TEXTURE_FORMAT_BIMG(RGBA8I); +BGFX_TEXTURE_FORMAT_BIMG(RGBA8U); +BGFX_TEXTURE_FORMAT_BIMG(RGBA8S); +BGFX_TEXTURE_FORMAT_BIMG(RGBA16); +BGFX_TEXTURE_FORMAT_BIMG(RGBA16I); +BGFX_TEXTURE_FORMAT_BIMG(RGBA16U); +BGFX_TEXTURE_FORMAT_BIMG(RGBA16F); +BGFX_TEXTURE_FORMAT_BIMG(RGBA16S); +BGFX_TEXTURE_FORMAT_BIMG(RGBA32I); +BGFX_TEXTURE_FORMAT_BIMG(RGBA32U); +BGFX_TEXTURE_FORMAT_BIMG(RGBA32F); +BGFX_TEXTURE_FORMAT_BIMG(R5G6B5); +BGFX_TEXTURE_FORMAT_BIMG(RGBA4); +BGFX_TEXTURE_FORMAT_BIMG(RGB5A1); +BGFX_TEXTURE_FORMAT_BIMG(RGB10A2); +BGFX_TEXTURE_FORMAT_BIMG(RG11B10F); +BGFX_TEXTURE_FORMAT_BIMG(UnknownDepth); +BGFX_TEXTURE_FORMAT_BIMG(D16); +BGFX_TEXTURE_FORMAT_BIMG(D24); +BGFX_TEXTURE_FORMAT_BIMG(D24S8); +BGFX_TEXTURE_FORMAT_BIMG(D32); +BGFX_TEXTURE_FORMAT_BIMG(D16F); +BGFX_TEXTURE_FORMAT_BIMG(D24F); +BGFX_TEXTURE_FORMAT_BIMG(D32F); +BGFX_TEXTURE_FORMAT_BIMG(D0S8); +BGFX_TEXTURE_FORMAT_BIMG(Count); + +#undef BGFX_TEXTURE_FORMAT_BIMG + #include <bgfx/c99/bgfx.h> #include <bgfx/c99/platform.h> @@ -3941,47 +4472,62 @@ namespace bgfx { } - virtual void fatal(Fatal::Enum _code, const char* _str) BX_OVERRIDE + virtual void fatal(Fatal::Enum _code, const char* _str) override { m_interface->vtbl->fatal(m_interface, (bgfx_fatal_t)_code, _str); } - virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) BX_OVERRIDE + virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) override { m_interface->vtbl->trace_vargs(m_interface, _filePath, _line, _format, _argList); } - virtual uint32_t cacheReadSize(uint64_t _id) BX_OVERRIDE + virtual void profilerBegin(const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line) override + { + m_interface->vtbl->profiler_begin(m_interface, _name, _abgr, _filePath, _line); + } + + virtual void profilerBeginLiteral(const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line) override + { + m_interface->vtbl->profiler_begin_literal(m_interface, _name, _abgr, _filePath, _line); + } + + virtual void profilerEnd() override + { + m_interface->vtbl->profiler_end(m_interface); + } + + virtual uint32_t cacheReadSize(uint64_t _id) override { return m_interface->vtbl->cache_read_size(m_interface, _id); } - virtual bool cacheRead(uint64_t _id, void* _data, uint32_t _size) BX_OVERRIDE + virtual bool cacheRead(uint64_t _id, void* _data, uint32_t _size) override { return m_interface->vtbl->cache_read(m_interface, _id, _data, _size); } - virtual void cacheWrite(uint64_t _id, const void* _data, uint32_t _size) BX_OVERRIDE + virtual void cacheWrite(uint64_t _id, const void* _data, uint32_t _size) override { m_interface->vtbl->cache_write(m_interface, _id, _data, _size); } - virtual void screenShot(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip) BX_OVERRIDE + virtual void screenShot(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip) override { m_interface->vtbl->screen_shot(m_interface, _filePath, _width, _height, _pitch, _data, _size, _yflip); } - virtual void captureBegin(uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format, bool _yflip) BX_OVERRIDE + virtual void captureBegin(uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format, bool _yflip) override { m_interface->vtbl->capture_begin(m_interface, _width, _height, _pitch, (bgfx_texture_format_t)_format, _yflip); } - virtual void captureEnd() BX_OVERRIDE + virtual void captureEnd() override { m_interface->vtbl->capture_end(m_interface); } - virtual void captureFrame(const void* _data, uint32_t _size) BX_OVERRIDE + virtual void captureFrame(const void* _data, uint32_t _size) override { m_interface->vtbl->capture_frame(m_interface, _data, _size); } @@ -3996,7 +4542,7 @@ namespace bgfx { } - virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE + virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) override { return m_interface->vtbl->realloc(m_interface, _ptr, _size, _align, _file, _line); } @@ -4070,16 +4616,6 @@ void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint32_ bgfx::topologySortTriList(bgfx::TopologySort::Enum(_sort), _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32); } -BGFX_C_API void bgfx_image_swizzle_bgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) -{ - bgfx::imageSwizzleBgra8(_dst, _width, _height, _pitch, _src); -} - -BGFX_C_API void bgfx_image_rgba8_downsample_2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) -{ - bgfx::imageRgba8Downsample2x2(_dst, _width, _height, _pitch, _src); -} - BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum) { return bgfx::getSupportedRenderers(_max, (bgfx::RendererType::Enum*)_enum); @@ -4199,7 +4735,7 @@ BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle) { union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle }; - bgfx::destroyIndexBuffer(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags) @@ -4213,7 +4749,7 @@ BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memo BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle) { union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; - bgfx::destroyVertexBuffer(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num, uint16_t _flags) @@ -4239,7 +4775,7 @@ BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handl BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle) { union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle }; - bgfx::destroyDynamicIndexBuffer(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags) @@ -4267,7 +4803,7 @@ BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_han BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; - bgfx::destroyDynamicVertexBuffer(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num) @@ -4303,9 +4839,9 @@ BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tv return bgfx::allocTransientBuffers( (bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices); } -BGFX_C_API const bgfx_instance_data_buffer_t* bgfx_alloc_instance_data_buffer(uint32_t _num, uint16_t _stride) +BGFX_C_API void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint32_t _num, uint16_t _stride) { - return (bgfx_instance_data_buffer_t*)bgfx::allocInstanceDataBuffer(_num, _stride); + bgfx::allocInstanceDataBuffer( (bgfx::InstanceDataBuffer*)_idb, _num, _stride); } BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num) @@ -4318,7 +4854,7 @@ BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _n BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle) { union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle }; - bgfx::destroyIndirectBuffer(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem) @@ -4334,10 +4870,16 @@ BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_ return bgfx::getShaderUniforms(handle.cpp, (bgfx::UniformHandle*)_uniforms, _max); } +BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name) +{ + union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle }; + bgfx::setName(handle.cpp, _name); +} + BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle) { union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle }; - bgfx::destroyShader(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders) @@ -4360,7 +4902,7 @@ BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_ BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; - bgfx::destroyProgram(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags) @@ -4434,10 +4976,16 @@ BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data return bgfx::readTexture(handle.cpp, _data, _mip); } +BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name) +{ + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; + bgfx::setName(handle.cpp, _name); +} + BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; - bgfx::destroyTexture(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags) @@ -4486,7 +5034,7 @@ BGFX_C_API bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _ha BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle }; - bgfx::destroyFrameBuffer(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num) @@ -4506,7 +5054,7 @@ BGFX_C_API void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_unifor BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle) { union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle }; - bgfx::destroyUniform(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query() @@ -4525,7 +5073,7 @@ BGFX_C_API bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_ha BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle) { union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle }; - bgfx::destroyOcclusionQuery(handle.cpp); + bgfx::destroy(handle.cpp); } BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]) @@ -4533,63 +5081,63 @@ BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]) bgfx::setPaletteColor(_index, _rgba); } -BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name) +BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char* _name) { bgfx::setViewName(_id, _name); } -BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +BGFX_C_API void bgfx_set_view_rect(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { bgfx::setViewRect(_id, _x, _y, _width, _height); } -BGFX_C_API void bgfx_set_view_rect_auto(uint8_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio) +BGFX_C_API void bgfx_set_view_rect_auto(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio) { bgfx::setViewRect(_id, _x, _y, bgfx::BackbufferRatio::Enum(_ratio)); } -BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +BGFX_C_API void bgfx_set_view_scissor(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { bgfx::setViewScissor(_id, _x, _y, _width, _height); } -BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) +BGFX_C_API void bgfx_set_view_clear(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) { bgfx::setViewClear(_id, _flags, _rgba, _depth, _stencil); } -BGFX_C_API void bgfx_set_view_clear_mrt(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) +BGFX_C_API void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) { bgfx::setViewClear(_id, _flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); } -BGFX_C_API void bgfx_set_view_seq(uint8_t _id, bool _enabled) +BGFX_C_API void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode) { - bgfx::setViewSeq(_id, _enabled); + bgfx::setViewMode(_id, bgfx::ViewMode::Enum(_mode) ); } -BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle) +BGFX_C_API void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle }; bgfx::setViewFrameBuffer(_id, handle.cpp); } -BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj) +BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void* _view, const void* _proj) { bgfx::setViewTransform(_id, _view, _proj); } -BGFX_C_API void bgfx_set_view_transform_stereo(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) +BGFX_C_API void bgfx_set_view_transform_stereo(bgfx_view_id_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) { bgfx::setViewTransform(_id, _view, _projL, _flags, _projR); } -BGFX_C_API void bgfx_set_view_order(uint8_t _id, uint8_t _num, const void* _order) +BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t* _order) { bgfx::setViewOrder(_id, _num, _order); } -BGFX_C_API void bgfx_reset_view(uint8_t _id) +BGFX_C_API void bgfx_reset_view(bgfx_view_id_t _id) { bgfx::resetView(_id); } @@ -4663,21 +5211,21 @@ BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffe bgfx::setIndexBuffer( (const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices); } -BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) +BGFX_C_API void bgfx_set_vertex_buffer(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) { union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; - bgfx::setVertexBuffer(handle.cpp, _startVertex, _numVertices); + bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices); } -BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) +BGFX_C_API void bgfx_set_dynamic_vertex_buffer(uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; - bgfx::setVertexBuffer(handle.cpp, _startVertex, _numVertices); + bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices); } -BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices) +BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices) { - bgfx::setVertexBuffer( (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices); + bgfx::setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices); } BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _num) @@ -4704,29 +5252,29 @@ BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx::setTexture(_stage, sampler.cpp, handle.cpp, _flags); } -BGFX_C_API uint32_t bgfx_touch(uint8_t _id) +BGFX_C_API void bgfx_touch(bgfx_view_id_t _id) { return bgfx::touch(_id); } -BGFX_C_API uint32_t bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; - return bgfx::submit(_id, handle.cpp, _depth, _preserveState); + bgfx::submit(_id, handle.cpp, _depth, _preserveState); } -BGFX_C_API uint32_t bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; - return bgfx::submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState); + bgfx::submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState); } -BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; - return bgfx::submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState); + bgfx::submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState); } BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) @@ -4766,17 +5314,17 @@ BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_b bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ); } -BGFX_C_API uint32_t bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) +BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; - return bgfx::dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags); + bgfx::dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags); } -BGFX_C_API uint32_t bgfx_dispatch_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) +BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; - return bgfx::dispatch(_id, handle.cpp, indirectHandle.cpp, _start, _num, _flags); + bgfx::dispatch(_id, handle.cpp, indirectHandle.cpp, _start, _num, _flags); } BGFX_C_API void bgfx_discard() @@ -4784,22 +5332,223 @@ BGFX_C_API void bgfx_discard() bgfx::discard(); } -BGFX_C_API void bgfx_blit(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) +BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src }; bgfx::blit(_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth); } +#define BGFX_ENCODER(_func) reinterpret_cast<bgfx::Encoder*>(_encoder)->_func + +BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder* _encoder, const char* _marker) +{ + BGFX_ENCODER(setMarker(_marker) ); +} + +BGFX_C_API void bgfx_encoder_set_state(bgfx_encoder* _encoder, uint64_t _state, uint32_t _rgba) +{ + BGFX_ENCODER(setState(_state, _rgba) ); +} + +BGFX_C_API void bgfx_encoder_set_condition(bgfx_encoder* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible) +{ + union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setCondition(handle.cpp, _visible) ); +} + +BGFX_C_API void bgfx_encoder_set_stencil(bgfx_encoder* _encoder, uint32_t _fstencil, uint32_t _bstencil) +{ + BGFX_ENCODER(setStencil(_fstencil, _bstencil) ); +} + +BGFX_C_API uint16_t bgfx_encoder_set_scissor(bgfx_encoder* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +{ + return BGFX_ENCODER(setScissor(_x, _y, _width, _height) ); +} + +BGFX_C_API void bgfx_encoder_set_scissor_cached(bgfx_encoder* _encoder, uint16_t _cache) +{ + BGFX_ENCODER(setScissor(_cache) ); +} + +BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder* _encoder, const void* _mtx, uint16_t _num) +{ + return BGFX_ENCODER(setTransform(_mtx, _num) ); +} + +BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder* _encoder, bgfx_transform_t* _transform, uint16_t _num) +{ + return BGFX_ENCODER(allocTransform( (bgfx::Transform*)_transform, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_transform_cached(bgfx_encoder* _encoder, uint32_t _cache, uint16_t _num) +{ + BGFX_ENCODER(setTransform(_cache, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num) +{ + union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setUniform(handle.cpp, _value, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_index_buffer(bgfx_encoder* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices) +{ + union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setIndexBuffer(handle.cpp, _firstIndex, _numIndices) ); +} + +BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices) +{ + union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setIndexBuffer(handle.cpp, _firstIndex, _numIndices) ); +} + +BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices) +{ + BGFX_ENCODER(setIndexBuffer( (const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices) ); +} + +BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) +{ + union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices) ); +} + +BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) +{ + union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices) ); +} + +BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices) +{ + BGFX_ENCODER(setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices) ); +} + +BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _num) +{ + BGFX_ENCODER(setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) +{ + union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setInstanceDataBuffer(handle.cpp, _startVertex, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) +{ + union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setInstanceDataBuffer(handle.cpp, _startVertex, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_texture(bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags) +{ + union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setTexture(_stage, sampler.cpp, handle.cpp, _flags) ); +} + +BGFX_C_API void bgfx_encoder_touch(bgfx_encoder* _encoder, bgfx_view_id_t _id) +{ + return BGFX_ENCODER(touch(_id) ); +} + +BGFX_C_API void bgfx_encoder_submit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) +{ + union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; + BGFX_ENCODER(submit(_id, handle.cpp, _depth, _preserveState) ); +} + +BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) +{ + union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; + union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; + BGFX_ENCODER(submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState) ); +} + +BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) +{ + union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; + union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; + BGFX_ENCODER(submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState) ); +} + +BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) +{ + union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ) ); +} + +BGFX_C_API void bgfx_encoder_set_compute_index_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access) +{ + union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); +} + +BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access) +{ + union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); +} + +BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access) +{ + union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); +} + +BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access) +{ + union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); +} + +BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access) +{ + union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle }; + BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); +} + +BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) +{ + union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; + BGFX_ENCODER(dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags) ); +} + +BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) +{ + union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; + union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; + BGFX_ENCODER(dispatch(_id, handle.cpp, indirectHandle.cpp, _start, _num, _flags) ); +} + +BGFX_C_API void bgfx_encoder_discard(bgfx_encoder* _encoder) +{ + BGFX_ENCODER(discard() ); +} + +BGFX_C_API void bgfx_encoder_blit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) +{ + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst }; + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src }; + BGFX_ENCODER(blit(_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth) ); +} + +#undef BGFX_ENCODER + BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle _handle, const char* _filePath) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle }; bgfx::requestScreenShot(handle.cpp, _filePath); } -BGFX_C_API bgfx_render_frame_t bgfx_render_frame() +BGFX_C_API bgfx_render_frame_t bgfx_render_frame(int32_t _msecs) { - return bgfx_render_frame_t(bgfx::renderFrame() ); + return bgfx_render_frame_t(bgfx::renderFrame(_msecs) ); } BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data) @@ -4828,139 +5577,139 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) { if (_version == BGFX_API_VERSION) { -#define BGFX_IMPORT \ - BGFX_IMPORT_FUNC(render_frame) \ - BGFX_IMPORT_FUNC(set_platform_data) \ - BGFX_IMPORT_FUNC(get_internal_data) \ - BGFX_IMPORT_FUNC(override_internal_texture_ptr) \ - BGFX_IMPORT_FUNC(override_internal_texture) \ - BGFX_IMPORT_FUNC(vertex_decl_begin) \ - BGFX_IMPORT_FUNC(vertex_decl_add) \ - BGFX_IMPORT_FUNC(vertex_decl_skip) \ - BGFX_IMPORT_FUNC(vertex_decl_end) \ - BGFX_IMPORT_FUNC(vertex_pack) \ - BGFX_IMPORT_FUNC(vertex_unpack) \ - BGFX_IMPORT_FUNC(vertex_convert) \ - BGFX_IMPORT_FUNC(weld_vertices) \ - BGFX_IMPORT_FUNC(topology_convert) \ - BGFX_IMPORT_FUNC(topology_sort_tri_list) \ - BGFX_IMPORT_FUNC(image_swizzle_bgra8) \ - BGFX_IMPORT_FUNC(image_rgba8_downsample_2x2) \ - BGFX_IMPORT_FUNC(get_supported_renderers) \ - BGFX_IMPORT_FUNC(get_renderer_name) \ - BGFX_IMPORT_FUNC(init) \ - BGFX_IMPORT_FUNC(shutdown) \ - BGFX_IMPORT_FUNC(reset) \ - BGFX_IMPORT_FUNC(frame) \ - BGFX_IMPORT_FUNC(get_renderer_type) \ - BGFX_IMPORT_FUNC(get_caps) \ - BGFX_IMPORT_FUNC(get_hmd) \ - BGFX_IMPORT_FUNC(get_stats) \ - BGFX_IMPORT_FUNC(alloc) \ - BGFX_IMPORT_FUNC(copy) \ - BGFX_IMPORT_FUNC(make_ref) \ - BGFX_IMPORT_FUNC(make_ref_release) \ - BGFX_IMPORT_FUNC(set_debug) \ - BGFX_IMPORT_FUNC(dbg_text_clear) \ - BGFX_IMPORT_FUNC(dbg_text_printf) \ - BGFX_IMPORT_FUNC(dbg_text_vprintf) \ - BGFX_IMPORT_FUNC(dbg_text_image) \ - BGFX_IMPORT_FUNC(create_index_buffer) \ - BGFX_IMPORT_FUNC(destroy_index_buffer) \ - BGFX_IMPORT_FUNC(create_vertex_buffer) \ - BGFX_IMPORT_FUNC(destroy_vertex_buffer) \ - BGFX_IMPORT_FUNC(create_dynamic_index_buffer) \ - BGFX_IMPORT_FUNC(create_dynamic_index_buffer_mem) \ - BGFX_IMPORT_FUNC(update_dynamic_index_buffer) \ - BGFX_IMPORT_FUNC(destroy_dynamic_index_buffer) \ - BGFX_IMPORT_FUNC(create_dynamic_vertex_buffer) \ - BGFX_IMPORT_FUNC(create_dynamic_vertex_buffer_mem) \ - BGFX_IMPORT_FUNC(update_dynamic_vertex_buffer) \ - BGFX_IMPORT_FUNC(destroy_dynamic_vertex_buffer) \ - BGFX_IMPORT_FUNC(get_avail_transient_index_buffer) \ - BGFX_IMPORT_FUNC(get_avail_transient_vertex_buffer) \ - BGFX_IMPORT_FUNC(get_avail_instance_data_buffer) \ - BGFX_IMPORT_FUNC(alloc_transient_index_buffer) \ - BGFX_IMPORT_FUNC(alloc_transient_vertex_buffer) \ - BGFX_IMPORT_FUNC(alloc_transient_buffers) \ - BGFX_IMPORT_FUNC(alloc_instance_data_buffer) \ - BGFX_IMPORT_FUNC(create_indirect_buffer) \ - BGFX_IMPORT_FUNC(destroy_indirect_buffer) \ - BGFX_IMPORT_FUNC(create_shader) \ - BGFX_IMPORT_FUNC(get_shader_uniforms) \ - BGFX_IMPORT_FUNC(destroy_shader) \ - BGFX_IMPORT_FUNC(create_program) \ - BGFX_IMPORT_FUNC(create_compute_program) \ - BGFX_IMPORT_FUNC(destroy_program) \ - BGFX_IMPORT_FUNC(is_texture_valid) \ - BGFX_IMPORT_FUNC(calc_texture_size) \ - BGFX_IMPORT_FUNC(create_texture) \ - BGFX_IMPORT_FUNC(create_texture_2d) \ - BGFX_IMPORT_FUNC(create_texture_2d_scaled) \ - BGFX_IMPORT_FUNC(create_texture_3d) \ - BGFX_IMPORT_FUNC(create_texture_cube) \ - BGFX_IMPORT_FUNC(update_texture_2d) \ - BGFX_IMPORT_FUNC(update_texture_3d) \ - BGFX_IMPORT_FUNC(update_texture_cube) \ - BGFX_IMPORT_FUNC(read_texture) \ - BGFX_IMPORT_FUNC(destroy_texture) \ - BGFX_IMPORT_FUNC(create_frame_buffer) \ - BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \ - BGFX_IMPORT_FUNC(create_frame_buffer_from_attachment) \ - BGFX_IMPORT_FUNC(create_frame_buffer_from_nwh) \ - BGFX_IMPORT_FUNC(get_texture) \ - BGFX_IMPORT_FUNC(destroy_frame_buffer) \ - BGFX_IMPORT_FUNC(create_uniform) \ - BGFX_IMPORT_FUNC(get_uniform_info) \ - BGFX_IMPORT_FUNC(destroy_uniform) \ - BGFX_IMPORT_FUNC(create_occlusion_query) \ - BGFX_IMPORT_FUNC(get_result) \ - BGFX_IMPORT_FUNC(destroy_occlusion_query) \ - BGFX_IMPORT_FUNC(set_palette_color) \ - BGFX_IMPORT_FUNC(set_view_name) \ - BGFX_IMPORT_FUNC(set_view_rect) \ - BGFX_IMPORT_FUNC(set_view_scissor) \ - BGFX_IMPORT_FUNC(set_view_clear) \ - BGFX_IMPORT_FUNC(set_view_clear_mrt) \ - BGFX_IMPORT_FUNC(set_view_seq) \ - BGFX_IMPORT_FUNC(set_view_frame_buffer) \ - BGFX_IMPORT_FUNC(set_view_transform) \ - BGFX_IMPORT_FUNC(set_view_transform_stereo) \ - BGFX_IMPORT_FUNC(set_view_order) \ - BGFX_IMPORT_FUNC(set_marker) \ - BGFX_IMPORT_FUNC(set_state) \ - BGFX_IMPORT_FUNC(set_condition) \ - BGFX_IMPORT_FUNC(set_stencil) \ - BGFX_IMPORT_FUNC(set_scissor) \ - BGFX_IMPORT_FUNC(set_scissor_cached) \ - BGFX_IMPORT_FUNC(set_transform) \ - BGFX_IMPORT_FUNC(alloc_transform) \ - BGFX_IMPORT_FUNC(set_transform_cached) \ - BGFX_IMPORT_FUNC(set_uniform) \ - BGFX_IMPORT_FUNC(set_index_buffer) \ - BGFX_IMPORT_FUNC(set_dynamic_index_buffer) \ - BGFX_IMPORT_FUNC(set_transient_index_buffer) \ - BGFX_IMPORT_FUNC(set_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_dynamic_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_transient_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_instance_data_buffer) \ - BGFX_IMPORT_FUNC(set_instance_data_from_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_instance_data_from_dynamic_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_texture) \ - BGFX_IMPORT_FUNC(touch) \ - BGFX_IMPORT_FUNC(submit) \ - BGFX_IMPORT_FUNC(submit_occlusion_query) \ - BGFX_IMPORT_FUNC(submit_indirect) \ - BGFX_IMPORT_FUNC(set_image) \ - BGFX_IMPORT_FUNC(set_compute_index_buffer) \ - BGFX_IMPORT_FUNC(set_compute_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_compute_dynamic_index_buffer) \ - BGFX_IMPORT_FUNC(set_compute_dynamic_vertex_buffer) \ - BGFX_IMPORT_FUNC(set_compute_indirect_buffer) \ - BGFX_IMPORT_FUNC(dispatch) \ - BGFX_IMPORT_FUNC(dispatch_indirect) \ - BGFX_IMPORT_FUNC(discard) \ - BGFX_IMPORT_FUNC(blit) \ +#define BGFX_IMPORT \ + BGFX_IMPORT_FUNC(render_frame) \ + BGFX_IMPORT_FUNC(set_platform_data) \ + BGFX_IMPORT_FUNC(get_internal_data) \ + BGFX_IMPORT_FUNC(override_internal_texture_ptr) \ + BGFX_IMPORT_FUNC(override_internal_texture) \ + BGFX_IMPORT_FUNC(vertex_decl_begin) \ + BGFX_IMPORT_FUNC(vertex_decl_add) \ + BGFX_IMPORT_FUNC(vertex_decl_skip) \ + BGFX_IMPORT_FUNC(vertex_decl_end) \ + BGFX_IMPORT_FUNC(vertex_pack) \ + BGFX_IMPORT_FUNC(vertex_unpack) \ + BGFX_IMPORT_FUNC(vertex_convert) \ + BGFX_IMPORT_FUNC(weld_vertices) \ + BGFX_IMPORT_FUNC(topology_convert) \ + BGFX_IMPORT_FUNC(topology_sort_tri_list) \ + BGFX_IMPORT_FUNC(get_supported_renderers) \ + BGFX_IMPORT_FUNC(get_renderer_name) \ + BGFX_IMPORT_FUNC(init) \ + BGFX_IMPORT_FUNC(shutdown) \ + BGFX_IMPORT_FUNC(reset) \ + BGFX_IMPORT_FUNC(frame) \ + BGFX_IMPORT_FUNC(get_renderer_type) \ + BGFX_IMPORT_FUNC(get_caps) \ + BGFX_IMPORT_FUNC(get_hmd) \ + BGFX_IMPORT_FUNC(get_stats) \ + BGFX_IMPORT_FUNC(alloc) \ + BGFX_IMPORT_FUNC(copy) \ + BGFX_IMPORT_FUNC(make_ref) \ + BGFX_IMPORT_FUNC(make_ref_release) \ + BGFX_IMPORT_FUNC(set_debug) \ + BGFX_IMPORT_FUNC(dbg_text_clear) \ + BGFX_IMPORT_FUNC(dbg_text_printf) \ + BGFX_IMPORT_FUNC(dbg_text_vprintf) \ + BGFX_IMPORT_FUNC(dbg_text_image) \ + BGFX_IMPORT_FUNC(create_index_buffer) \ + BGFX_IMPORT_FUNC(destroy_index_buffer) \ + BGFX_IMPORT_FUNC(create_vertex_buffer) \ + BGFX_IMPORT_FUNC(destroy_vertex_buffer) \ + BGFX_IMPORT_FUNC(create_dynamic_index_buffer) \ + BGFX_IMPORT_FUNC(create_dynamic_index_buffer_mem) \ + BGFX_IMPORT_FUNC(update_dynamic_index_buffer) \ + BGFX_IMPORT_FUNC(destroy_dynamic_index_buffer) \ + BGFX_IMPORT_FUNC(create_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(create_dynamic_vertex_buffer_mem) \ + BGFX_IMPORT_FUNC(update_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(destroy_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(get_avail_transient_index_buffer) \ + BGFX_IMPORT_FUNC(get_avail_transient_vertex_buffer) \ + BGFX_IMPORT_FUNC(get_avail_instance_data_buffer) \ + BGFX_IMPORT_FUNC(alloc_transient_index_buffer) \ + BGFX_IMPORT_FUNC(alloc_transient_vertex_buffer) \ + BGFX_IMPORT_FUNC(alloc_transient_buffers) \ + BGFX_IMPORT_FUNC(alloc_instance_data_buffer) \ + BGFX_IMPORT_FUNC(create_indirect_buffer) \ + BGFX_IMPORT_FUNC(destroy_indirect_buffer) \ + BGFX_IMPORT_FUNC(create_shader) \ + BGFX_IMPORT_FUNC(get_shader_uniforms) \ + BGFX_IMPORT_FUNC(set_shader_name) \ + BGFX_IMPORT_FUNC(destroy_shader) \ + BGFX_IMPORT_FUNC(create_program) \ + BGFX_IMPORT_FUNC(create_compute_program) \ + BGFX_IMPORT_FUNC(destroy_program) \ + BGFX_IMPORT_FUNC(is_texture_valid) \ + BGFX_IMPORT_FUNC(calc_texture_size) \ + BGFX_IMPORT_FUNC(create_texture) \ + BGFX_IMPORT_FUNC(create_texture_2d) \ + BGFX_IMPORT_FUNC(create_texture_2d_scaled) \ + BGFX_IMPORT_FUNC(create_texture_3d) \ + BGFX_IMPORT_FUNC(create_texture_cube) \ + BGFX_IMPORT_FUNC(update_texture_2d) \ + BGFX_IMPORT_FUNC(update_texture_3d) \ + BGFX_IMPORT_FUNC(update_texture_cube) \ + BGFX_IMPORT_FUNC(read_texture) \ + BGFX_IMPORT_FUNC(set_texture_name) \ + BGFX_IMPORT_FUNC(destroy_texture) \ + BGFX_IMPORT_FUNC(create_frame_buffer) \ + BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \ + BGFX_IMPORT_FUNC(create_frame_buffer_from_attachment) \ + BGFX_IMPORT_FUNC(create_frame_buffer_from_nwh) \ + BGFX_IMPORT_FUNC(get_texture) \ + BGFX_IMPORT_FUNC(destroy_frame_buffer) \ + BGFX_IMPORT_FUNC(create_uniform) \ + BGFX_IMPORT_FUNC(get_uniform_info) \ + BGFX_IMPORT_FUNC(destroy_uniform) \ + BGFX_IMPORT_FUNC(create_occlusion_query) \ + BGFX_IMPORT_FUNC(get_result) \ + BGFX_IMPORT_FUNC(destroy_occlusion_query) \ + BGFX_IMPORT_FUNC(set_palette_color) \ + BGFX_IMPORT_FUNC(set_view_name) \ + BGFX_IMPORT_FUNC(set_view_rect) \ + BGFX_IMPORT_FUNC(set_view_scissor) \ + BGFX_IMPORT_FUNC(set_view_clear) \ + BGFX_IMPORT_FUNC(set_view_clear_mrt) \ + BGFX_IMPORT_FUNC(set_view_mode) \ + BGFX_IMPORT_FUNC(set_view_frame_buffer) \ + BGFX_IMPORT_FUNC(set_view_transform) \ + BGFX_IMPORT_FUNC(set_view_transform_stereo) \ + BGFX_IMPORT_FUNC(set_view_order) \ + BGFX_IMPORT_FUNC(encoder_set_marker) \ + BGFX_IMPORT_FUNC(encoder_set_state) \ + BGFX_IMPORT_FUNC(encoder_set_condition) \ + BGFX_IMPORT_FUNC(encoder_set_stencil) \ + BGFX_IMPORT_FUNC(encoder_set_scissor) \ + BGFX_IMPORT_FUNC(encoder_set_scissor_cached) \ + BGFX_IMPORT_FUNC(encoder_set_transform) \ + BGFX_IMPORT_FUNC(encoder_alloc_transform) \ + BGFX_IMPORT_FUNC(encoder_set_transform_cached) \ + BGFX_IMPORT_FUNC(encoder_set_uniform) \ + BGFX_IMPORT_FUNC(encoder_set_index_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_dynamic_index_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_transient_index_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_transient_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_instance_data_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_instance_data_from_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_instance_data_from_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_texture) \ + BGFX_IMPORT_FUNC(encoder_touch) \ + BGFX_IMPORT_FUNC(encoder_submit) \ + BGFX_IMPORT_FUNC(encoder_submit_occlusion_query) \ + BGFX_IMPORT_FUNC(encoder_submit_indirect) \ + BGFX_IMPORT_FUNC(encoder_set_image) \ + BGFX_IMPORT_FUNC(encoder_set_compute_index_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_compute_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_compute_dynamic_index_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_compute_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_compute_indirect_buffer) \ + BGFX_IMPORT_FUNC(encoder_dispatch) \ + BGFX_IMPORT_FUNC(encoder_dispatch_indirect) \ + BGFX_IMPORT_FUNC(encoder_discard) \ + BGFX_IMPORT_FUNC(encoder_blit) \ BGFX_IMPORT_FUNC(request_screen_shot) static bgfx_interface_vtbl_t s_bgfx_interface = diff --git a/3rdparty/bgfx/src/bgfx_compute.sh b/3rdparty/bgfx/src/bgfx_compute.sh index 641dda89a31..902651e9c8c 100644 --- a/3rdparty/bgfx/src/bgfx_compute.sh +++ b/3rdparty/bgfx/src/bgfx_compute.sh @@ -10,105 +10,256 @@ #ifndef __cplusplus -#if BGFX_SHADER_LANGUAGE_HLSL +#if BGFX_SHADER_LANGUAGE_GLSL + +#define SHARED shared + +#define __IMAGE_XX(_name, _format, _reg, _image, _access) \ + layout(_format, binding=_reg) _access uniform highp _image _name + +#define readwrite +#define IMAGE2D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, readonly) +#define UIMAGE2D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, readonly) +#define IMAGE2D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, writeonly) +#define UIMAGE2D_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, writeonly) +#define IMAGE2D_RW( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, readwrite) +#define UIMAGE2D_RW(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, readwrite) + +#define IMAGE2D_ARRAY_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, readonly) +#define UIMAGE2D_ARRAY_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, readonly) +#define IMAGE2D_ARRAY_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, writeonly) +#define UIMAGE2D_ARRAY_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, writeonly) +#define IMAGE2D_ARRAY_RW( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, readwrite) +#define UIMAGE2D_ARRAY_RW(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, readwrite) + +#define IMAGE3D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, readonly) +#define UIMAGE3D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, readonly) +#define IMAGE3D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, writeonly) +#define UIMAGE3D_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, writeonly) +#define IMAGE3D_RW( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, readwrite) +#define UIMAGE3D_RW(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, readwrite) + +#define __BUFFER_XX(_name, _type, _reg, _access) \ + layout(std430, binding=_reg) _access buffer _name ## Buffer \ + { \ + _type _name[]; \ + } + +#define BUFFER_RO(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, readonly) +#define BUFFER_RW(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, readwrite) +#define BUFFER_WR(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, writeonly) + +#define NUM_THREADS(_x, _y, _z) layout (local_size_x = _x, local_size_y = _y, local_size_z = _z) in; + +#else #define SHARED groupshared -#define r32ui uint -#define r32f float -#define rg16f float2 -#define rgba16f float4 -#define rgba8 float4 -#define rgba32f float4 - -#define IMAGE2D_RO( _name, _format, _reg) Texture2D<_format> _name : register(t[_reg]) -#define UIMAGE2D_RO(_name, _format, _reg) Texture2D<_format> _name : register(t[_reg]) -#define IMAGE2D_WR( _name, _format, _reg) RWTexture2D<_format> _name : register(u[_reg]) -#define UIMAGE2D_WR(_name, _format, _reg) RWTexture2D<_format> _name : register(u[_reg]) -#define IMAGE2D_RW( _name, _reg) RWTexture2D<float> _name : register(u[_reg]) -#define UIMAGE2D_RW(_name, _reg) RWTexture2D<uint> _name : register(u[_reg]) - -#define IMAGE2D_ARRAY_RO( _name, _format, _reg) Texture2DArray<_format> _name : register(t[_reg]) -#define UIMAGE2D_ARRAY_RO(_name, _format, _reg) Texture2DArray<_format> _name : register(t[_reg]) -#define IMAGE2D_ARRAY_WR( _name, _format, _reg) RWTexture2DArray<_format> _name : register(u[_reg]) -#define UIMAGE2D_ARRAY_WR(_name, _format, _reg) RWTexture2DArray<_format> _name : register(u[_reg]) -#define IMAGE2D_ARRAY_RW( _name, _reg) RWTexture2DArray<float> _name : register(u[_reg]) -#define UIMAGE2D_ARRAY_RW(_name, _reg) RWTexture2DArray<uint> _name : register(u[_reg]) - -#define IMAGE3D_RO( _name, _format, _reg) Texture3D<_format> _name : register(t[_reg]) -#define UIMAGE3D_RO(_name, _format, _reg) Texture3D<_format> _name : register(t[_reg]) -#define IMAGE3D_WR( _name, _format, _reg) RWTexture3D<_format> _name : register(u[_reg]) -#define UIMAGE3D_WR(_name, _format, _reg) RWTexture3D<_format> _name : register(u[_reg]) -#define IMAGE3D_RW( _name, _reg) RWTexture3D<float> _name : register(u[_reg]) -#define UIMAGE3D_RW(_name, _reg) RWTexture3D<uint> _name : register(u[_reg]) - -#define BUFFER_RO(_name, _struct, _reg) Buffer<_struct> _name : register(t[_reg]) -#define BUFFER_RW(_name, _struct, _reg) RWBuffer<_struct> _name : register(u[_reg]) -#define BUFFER_WR(_name, _struct, _reg) BUFFER_RW(_name, _struct, _reg) +#define r32ui uint +#define rg32ui uint2 +#define rgba32ui uint4 +#define r32f float +#define rg16f float2 +#define rgba16f float4 +#if BGFX_SHADER_LANGUAGE_HLSL +# define rgba8 unorm float4 +#else +# define rgba8 float4 +#endif // BGFX_SHADER_LANGUAGE_HLSL +#define rgba32f float4 -#define NUM_THREADS(_x, _y, _z) [numthreads(_x, _y, _z)] +#define IMAGE2D_RO( _name, _format, _reg) \ + Texture2D<_format> _name ## Texture : REGISTER(t, _reg); \ + static BgfxROImage2D_ ## _format _name = { _name ## Texture } -#define __IMAGE_IMPL(_textureType, _storeComponents, _type, _loadComponents) \ - _type imageLoad( Texture2D<_textureType> _image, ivec2 _uv) { return _image[_uv ]._loadComponents; } \ - _type imageLoad(RWTexture2DArray<_textureType> _image, ivec3 _uvw) { return _image[_uvw ]._loadComponents; } \ - _type imageLoad( Texture3D<_textureType> _image, ivec3 _uvw) { return _image[_uvw]._loadComponents; } \ - _type imageLoad( RWTexture2D<_textureType> _image, ivec2 _uv) { return _image[_uv ]._loadComponents; } \ - _type imageLoad(RWTexture2DArray<_textureType> _image, ivec3 _uvw, _type _value) { return _image[_uvw]._loadComponents; } \ - _type imageLoad( RWTexture3D<_textureType> _image, ivec3 _uvw, _type _value) { return _image[_uvw]._loadComponents; } \ - void imageStore( RWTexture2D<_textureType> _image, ivec2 _uv, _type _value) { _image[_uv ] = _value._storeComponents; } \ - void imageStore(RWTexture2DArray<_textureType> _image, ivec3 _uvw, _type _value) { _image[_uvw] = _value._storeComponents; } \ - void imageStore( RWTexture3D<_textureType> _image, ivec3 _uvw, _type _value) { _image[_uvw] = _value._storeComponents; } - -__IMAGE_IMPL(float, x, vec4, xxxx) -__IMAGE_IMPL(vec2, xy, vec4, xyyy) -__IMAGE_IMPL(vec3, xyz, vec4, xyzz) -__IMAGE_IMPL(vec4, xyzw, vec4, xyzw) -__IMAGE_IMPL(uint, x, uvec4, xxxx) -__IMAGE_IMPL(uvec2, xy, uvec4, xyyy) -__IMAGE_IMPL(uvec3, xyz, uvec4, xyzz) -__IMAGE_IMPL(uvec4, xyzw, uvec4, xyzw) -__IMAGE_IMPL(int, x, ivec4, xxxx) -__IMAGE_IMPL(ivec2, xy, ivec4, xyyy) -__IMAGE_IMPL(ivec3, xyz, ivec4, xyzz) -__IMAGE_IMPL(ivec4, xyzw, ivec4, xyzw) - -ivec2 imageSize(Texture2D _image) -{ - ivec2 result; - _image.GetDimensions(result.x, result.y); - return result; -} +#define UIMAGE2D_RO(_name, _format, _reg) IMAGE2D_RO(_name, _format, _reg) -ivec2 imageSize(Texture2D<uint> _image) -{ - ivec2 result; - _image.GetDimensions(result.x, result.y); - return result; -} +#define IMAGE2D_RW( _name, _format, _reg) \ + RWTexture2D<_format> _name ## Texture : REGISTER(u, _reg); \ + static BgfxRWImage2D_ ## _format _name = { _name ## Texture } -ivec2 imageSize(RWTexture2D<float4> _image) -{ - ivec2 result; - _image.GetDimensions(result.x, result.y); - return result; -} +#define IMAGE2D_WR( _name, _format, _reg) IMAGE2D_RW(_name, _format, _reg) +#define UIMAGE2D_WR(_name, _format, _reg) IMAGE2D_RW(_name, _format, _reg) +#define UIMAGE2D_RW(_name, _format, _reg) IMAGE2D_RW(_name, _format, _reg) -ivec2 imageSize(RWTexture2D<uint> _image) -{ - ivec2 result; - _image.GetDimensions(result.x, result.y); - return result; -} +#define IMAGE2D_ARRAY_RO(_name, _format, _reg) \ + Texture2DArray<_format> _name ## Texture : REGISTER(t, _reg); \ + static BgfxROImage2DArray_ ## _format _name = { _name ## Texture } + +#define UIMAGE2D_ARRAY_RO(_name, _format, _reg) IMAGE2D_ARRAY_RO(_name, _format, _reg) + +#define IMAGE2D_ARRAY_RW(_name, _format, _reg) \ + RWTexture2DArray<_format> _name ## Texture : REGISTER(u, _reg); \ + static BgfxRWImage2DArray_ ## _format _name = { _name ## Texture } + +#define UIMAGE2D_ARRAY_RW(_name, _format, _reg) IMAGE2D_ARRAY_RW(_name, _format, _reg) +#define IMAGE2D_ARRAY_WR( _name, _format, _reg) IMAGE2D_ARRAY_RW(_name, _format, _reg) +#define UIMAGE2D_ARRAY_WR(_name, _format, _reg) IMAGE2D_ARRAY_RW(_name, _format, _reg) + +#define IMAGE3D_RO( _name, _format, _reg) \ + Texture3D<_format> _name ## Texture : REGISTER(t, _reg); \ + static BgfxROImage3D_ ## _format _name = { _name ## Texture } + +#define UIMAGE3D_RO(_name, _format, _reg) IMAGE3D_RO(_name, _format, _reg) + +#define IMAGE3D_RW( _name, _format, _reg) \ + RWTexture3D<_format> _name ## Texture : REGISTER(u, _reg); \ + static BgfxRWImage3D_ ## _format _name = { _name ## Texture } + +#define UIMAGE3D_RW(_name, _format, _reg) IMAGE3D_RW(_name, _format, _reg) +#define IMAGE3D_WR( _name, _format, _reg) IMAGE3D_RW(_name, _format, _reg) +#define UIMAGE3D_WR(_name, _format, _reg) IMAGE3D_RW(_name, _format, _reg) + +#define BUFFER_RO(_name, _struct, _reg) Buffer<_struct> _name : REGISTER(t, _reg) +#define BUFFER_RW(_name, _struct, _reg) RWBuffer<_struct> _name : REGISTER(u, _reg) +#define BUFFER_WR(_name, _struct, _reg) BUFFER_RW(_name, _struct, _reg) + +#define NUM_THREADS(_x, _y, _z) [numthreads(_x, _y, _z)] -#define __ATOMIC_IMPL_TYPE(_genType, _glFunc, _dxFunc) \ - _genType _glFunc(_genType _mem, _genType _data) \ - { \ - _genType result; \ - _dxFunc(_mem, _data, result); \ - return result; \ +#define __IMAGE_IMPL_S(_format, _storeComponents, _type, _loadComponents) \ + \ + struct BgfxROImage2D_ ## _format \ + { \ + Texture2D<_format> m_texture; \ + }; \ + \ + struct BgfxRWImage2D_ ## _format \ + { \ + RWTexture2D<_format> m_texture; \ + }; \ + \ + struct BgfxROImage2DArray_ ## _format \ + { \ + Texture2DArray<_format> m_texture; \ + }; \ + \ + struct BgfxRWImage2DArray_ ## _format \ + { \ + RWTexture2DArray<_format> m_texture; \ + }; \ + \ + struct BgfxROImage3D_ ## _format \ + { \ + Texture3D<_format> m_texture; \ + }; \ + \ + struct BgfxRWImage3D_ ## _format \ + { \ + RWTexture3D<_format> m_texture; \ + }; \ + +#define __IMAGE_IMPL_A(_format, _storeComponents, _type, _loadComponents) \ + __IMAGE_IMPL_S(_format, _storeComponents, _type, _loadComponents) \ + \ + _type imageLoad(BgfxROImage2D_ ## _format _image, ivec2 _uv) \ + { \ + return _image.m_texture[_uv]._loadComponents; \ + } \ + \ + ivec2 imageSize(BgfxROImage2D_ ## _format _image) \ + { \ + uvec2 result; \ + _image.m_texture.GetDimensions(result.x, result.y); \ + return ivec2(result); \ + } \ + \ + _type imageLoad(BgfxRWImage2D_ ## _format _image, ivec2 _uv) \ + { \ + return _image.m_texture[_uv]._loadComponents; \ + } \ + \ + ivec2 imageSize(BgfxRWImage2D_ ## _format _image) \ + { \ + uvec2 result; \ + _image.m_texture.GetDimensions(result.x, result.y); \ + return ivec2(result); \ + } \ + \ + void imageStore(BgfxRWImage2D_ ## _format _image, ivec2 _uv, _type _value) \ + { \ + _image.m_texture[_uv] = _value._storeComponents; \ + } \ + \ + _type imageLoad(BgfxROImage2DArray_ ## _format _image, ivec3 _uvw) \ + { \ + return _image.m_texture[_uvw]._loadComponents; \ + } \ + \ + ivec3 imageSize(BgfxROImage2DArray_ ## _format _image) \ + { \ + uvec3 result; \ + _image.m_texture.GetDimensions(result.x, result.y, result.z); \ + return ivec3(result); \ + } \ + \ + _type imageLoad(BgfxRWImage2DArray_ ## _format _image, ivec3 _uvw) \ + { \ + return _image.m_texture[_uvw]._loadComponents; \ + } \ + \ + void imageStore(BgfxRWImage2DArray_ ## _format _image, ivec3 _uvw, _type _value) \ + { \ + _image.m_texture[_uvw] = _value._storeComponents; \ + } \ + \ + ivec3 imageSize(BgfxRWImage2DArray_ ## _format _image) \ + { \ + uvec3 result; \ + _image.m_texture.GetDimensions(result.x, result.y, result.z); \ + return ivec3(result); \ + } \ + \ + _type imageLoad(BgfxROImage3D_ ## _format _image, ivec3 _uvw) \ + { \ + return _image.m_texture[_uvw]._loadComponents; \ + } \ + \ + ivec3 imageSize(BgfxROImage3D_ ## _format _image) \ + { \ + uvec3 result; \ + _image.m_texture.GetDimensions(result.x, result.y, result.z); \ + return ivec3(result); \ + } \ + \ + _type imageLoad(BgfxRWImage3D_ ## _format _image, ivec3 _uvw) \ + { \ + return _image.m_texture[_uvw]._loadComponents; \ + } \ + \ + ivec3 imageSize(BgfxRWImage3D_ ## _format _image) \ + { \ + uvec3 result; \ + _image.m_texture.GetDimensions(result.x, result.y, result.z); \ + return ivec3(result); \ + } \ + \ + void imageStore(BgfxRWImage3D_ ## _format _image, ivec3 _uvw, _type _value) \ + { \ + _image.m_texture[_uvw] = _value._storeComponents; \ + } + +__IMAGE_IMPL_A(rgba8, xyzw, vec4, xyzw) +__IMAGE_IMPL_A(rg16f, xy, vec4, xyyy) +#if BGFX_SHADER_LANGUAGE_HLSL +__IMAGE_IMPL_S(rgba16f, xyzw, vec4, xyzw) +#else +__IMAGE_IMPL_A(rgba16f, xyzw, vec4, xyzw) +#endif // BGFX_SHADER_LANGUAGE_HLSL +__IMAGE_IMPL_A(r32f, x, vec4, xxxx) +__IMAGE_IMPL_A(rgba32f, xyzw, vec4, xyzw) +__IMAGE_IMPL_A(r32ui, x, uvec4, xxxx) +__IMAGE_IMPL_A(rg32ui, xy, uvec4, xyyy) +__IMAGE_IMPL_A(rgba32ui, xyzw, uvec4, xyzw) + +#define __ATOMIC_IMPL_TYPE(_genType, _glFunc, _dxFunc) \ + _genType _glFunc(inout _genType _mem, _genType _data) \ + { \ + _genType result; \ + _dxFunc(_mem, _data, result); \ + return result; \ } -#define __ATOMIC_IMPL(_glFunc, _dxFunc) \ +#define __ATOMIC_IMPL(_glFunc, _dxFunc) \ __ATOMIC_IMPL_TYPE(int, _glFunc, _dxFunc) \ __ATOMIC_IMPL_TYPE(uint, _glFunc, _dxFunc) @@ -120,14 +271,14 @@ __ATOMIC_IMPL(atomicMin, InterlockedMin); __ATOMIC_IMPL(atomicOr, InterlockedOr); __ATOMIC_IMPL(atomicXor, InterlockedXor); -int atomicCompSwap(int _mem, int _compare, int _data) +int atomicCompSwap(inout int _mem, int _compare, int _data) { int result; InterlockedCompareExchange(_mem, _compare, _data, result); return result; } -uint atomicCompSwap(uint _mem, uint _compare, uint _data) +uint atomicCompSwap(inout uint _mem, uint _compare, uint _data) { uint result; InterlockedCompareExchange(_mem, _compare, _data, result); @@ -144,48 +295,7 @@ uint atomicCompSwap(uint _mem, uint _compare, uint _data) #define memoryBarrierShared() GroupMemoryBarrierWithGroupSync() #define groupMemoryBarrier() GroupMemoryBarrierWithGroupSync() -#else - -#define SHARED shared - -#define __IMAGE_XX(_name, _format, _reg, _image, _access) \ - layout(_format, binding=_reg) _access uniform highp _image _name - -#define readwrite -#define IMAGE2D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, readonly) -#define UIMAGE2D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, readonly) -#define IMAGE2D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2D, writeonly) -#define UIMAGE2D_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2D, writeonly) -#define IMAGE2D_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2D, readwrite) -#define UIMAGE2D_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2D, readwrite) - -#define IMAGE2D_ARRAY_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, readonly) -#define UIMAGE2D_ARRAY_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, readonly) -#define IMAGE2D_ARRAY_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, writeonly) -#define UIMAGE2D_ARRAY_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, writeonly) -#define IMAGE2D_ARRAY_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2DArray, readwrite) -#define UIMAGE2D_ARRAY_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2DArray, readwrite) - -#define IMAGE3D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, readonly) -#define UIMAGE3D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, readonly) -#define IMAGE3D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, writeonly) -#define UIMAGE3D_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, writeonly) -#define IMAGE3D_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2D, readwrite) -#define UIMAGE3D_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2D, readwrite) - -#define __BUFFER_XX(_name, _type, _reg, _access) \ - layout(std430, binding=_reg) _access buffer _name ## Buffer \ - { \ - _type _name[]; \ - } - -#define BUFFER_RO(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, readonly) -#define BUFFER_RW(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, readwrite) -#define BUFFER_WR(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, writeonly) - -#define NUM_THREADS(_x, _y, _z) layout (local_size_x = _x, local_size_y = _y, local_size_z = _z) in; - -#endif // BGFX_SHADER_LANGUAGE_HLSL +#endif // BGFX_SHADER_LANGUAGE_GLSL #define dispatchIndirect(_buffer \ , _offset \ diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index 775cd157caa..14fce4ff2a5 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -24,7 +24,7 @@ #include <inttypes.h> -// Check handle, cannot be bgfx::invalidHandle and must be valid. +// Check handle, cannot be bgfx::kInvalidHandle and must be valid. #define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \ BX_CHECK(isValid(_handle) \ && _handleAlloc.isValid(_handle.idx) \ @@ -34,7 +34,7 @@ , _handleAlloc.getMaxHandles() \ ) -// Check handle, it's ok to be bgfx::invalidHandle or must be valid. +// Check handle, it's ok to be bgfx::kInvalidHandle or must be valid. #define BGFX_CHECK_HANDLE_INVALID_OK(_desc, _handleAlloc, _handle) \ BX_CHECK(!isValid(_handle) \ || _handleAlloc.isValid(_handle.idx) \ @@ -44,31 +44,22 @@ , _handleAlloc.getMaxHandles() \ ) -#ifndef BGFX_PROFILER_SCOPE -# if BGFX_CONFIG_PROFILER_MICROPROFILE -# include <microprofile.h> -# define BGFX_PROFILER_SCOPE(_group, _name, _color) MICROPROFILE_SCOPEI(#_group, #_name, _color) -# define BGFX_PROFILER_BEGIN(_group, _name, _color) BX_NOOP() -# define BGFX_PROFILER_BEGIN_DYNAMIC(_namestr) BX_NOOP() -# define BGFX_PROFILER_END() BX_NOOP() -# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP() -# elif BGFX_CONFIG_PROFILER_REMOTERY -# define RMT_ENABLED BGFX_CONFIG_PROFILER_REMOTERY -# define RMT_USE_D3D11 BGFX_CONFIG_RENDERER_DIRECT3D11 -# define RMT_USE_OPENGL BGFX_CONFIG_RENDERER_OPENGL -# include <remotery/lib/Remotery.h> -# define BGFX_PROFILER_SCOPE(_group, _name, _color) rmt_ScopedCPUSample(_group##_##_name, RMTSF_None) -# define BGFX_PROFILER_BEGIN(_group, _name, _color) rmt_BeginCPUSample(_group##_##_name, RMTSF_None) -# define BGFX_PROFILER_BEGIN_DYNAMIC(_namestr) rmt_BeginCPUSampleDynamic(_namestr, RMTSF_None) -# define BGFX_PROFILER_END() rmt_EndCPUSample() -# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) rmt_SetCurrentThreadName(_name) -# else -# define BGFX_PROFILER_SCOPE(_group, _name, _color) BX_NOOP() -# define BGFX_PROFILER_BEGIN(_group, _name, _color) BX_NOOP() -# define BGFX_PROFILER_BEGIN_DYNAMIC(_namestr) BX_NOOP() -# define BGFX_PROFILER_END() BX_NOOP() -# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP() -# endif // BGFX_CONFIG_PROFILER_* +#if BGFX_CONFIG_MULTITHREADED +# define BGFX_MUTEX_SCOPE(_mutex) bx::MutexScope BX_CONCATENATE(mutexScope, __LINE__)(_mutex) +#else +# define BGFX_MUTEX_SCOPE(_mutex) BX_NOOP() +#endif // BGFX_CONFIG_MULTITHREADED + +#if BGFX_CONFIG_PROFILER +# define BGFX_PROFILER_SCOPE(_name, _abgr) ProfilerScope BX_CONCATENATE(profilerScope, __LINE__)(_name, _abgr, __FILE__, uint16_t(__LINE__) ) +# define BGFX_PROFILER_BEGIN(_name, _abgr) g_callback->profilerBeginLiteral(_name, _abgr, __FILE__, uint16_t(__LINE__) ) +# define BGFX_PROFILER_END() g_callback->profilerEnd() +# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP() +#else +# define BGFX_PROFILER_SCOPE(_name, _abgr) BX_NOOP() +# define BGFX_PROFILER_BEGIN(_name, _abgr) BX_NOOP() +# define BGFX_PROFILER_END() BX_NOOP() +# define BGFX_PROFILER_SET_CURRENT_THREAD_NAME(_name) BX_NOOP() #endif // BGFX_PROFILER_SCOPE namespace bgfx @@ -115,30 +106,36 @@ namespace bgfx } \ BX_MACRO_BLOCK_END +#include <bx/allocator.h> #include <bx/bx.h> +#include <bx/cpu.h> #include <bx/debug.h> -#include <bx/fpumath.h> -#include <bx/float4x4_t.h> #include <bx/endian.h> +#include <bx/float4x4_t.h> #include <bx/handlealloc.h> #include <bx/hash.h> -#include <bx/sort.h> -#include <bx/ringbuffer.h> -#include <bx/uint32_t.h> +#include <bx/maputil.h> +#include <bx/math.h> +#include <bx/mutex.h> +#include <bx/os.h> #include <bx/readerwriter.h> -#include <bx/allocator.h> +#include <bx/ringbuffer.h> +#include <bx/sort.h> #include <bx/string.h> -#include <bx/os.h> -#include <bx/maputil.h> +#include <bx/thread.h> +#include <bx/timer.h> +#include <bx/uint32_t.h> #include <bgfx/platform.h> -#include "image.h" +#include <bimg/bimg.h> #include "shader.h" +#include "vertexdecl.h" -#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2) -#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4) #define BGFX_CHUNK_MAGIC_TEX BX_MAKEFOURCC('T', 'E', 'X', 0x0) -#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4) + +#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x3) +#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x5) +#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x5) #define BGFX_CLEAR_COLOR_USE_PALETTE UINT16_C(0x8000) #define BGFX_CLEAR_MASK (0 \ @@ -177,17 +174,8 @@ namespace stl = std; # include <android/native_window.h> #elif BX_PLATFORM_WINDOWS # include <windows.h> -#elif BX_PLATFORM_XBOX360 -# include <malloc.h> -# include <xtl.h> #endif // BX_PLATFORM_* -#include <bx/cpu.h> -#include <bx/thread.h> -#include <bx/timer.h> - -#include "vertexdecl.h" - #define BGFX_DEFAULT_WIDTH 1280 #define BGFX_DEFAULT_HEIGHT 720 @@ -261,8 +249,67 @@ namespace bgfx typedef uint32_t RenderItemCount; #endif // BGFX_CONFIG_MAX_DRAW_CALLS < (64<<10) + struct Handle + { + enum Enum + { + Shader, + Texture, + + Count + }; + + uint16_t type; + uint16_t idx; + }; + + inline Handle convert(ShaderHandle _handle) + { + Handle handle = { Handle::Shader, _handle.idx }; + return handle; + } + + inline Handle convert(TextureHandle _handle) + { + Handle handle = { Handle::Texture, _handle.idx }; + return handle; + } + + inline bool isValid(const VertexDecl& _decl) + { + return 0 != _decl.m_stride; + } + struct Clear { + void set(uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) + { + m_flags = _flags; + m_index[0] = uint8_t(_rgba>>24); + m_index[1] = uint8_t(_rgba>>16); + m_index[2] = uint8_t(_rgba>> 8); + m_index[3] = uint8_t(_rgba>> 0); + m_depth = _depth; + m_stencil = _stencil; + } + + void set(uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) + { + m_flags = (_flags & ~BGFX_CLEAR_COLOR) + | (0xff != (_0&_1&_2&_3&_4&_5&_6&_7) ? BGFX_CLEAR_COLOR|BGFX_CLEAR_COLOR_USE_PALETTE : 0) + ; + m_index[0] = _0; + m_index[1] = _1; + m_index[2] = _2; + m_index[3] = _3; + m_index[4] = _4; + m_index[5] = _5; + m_index[6] = _6; + m_index[7] = _7; + m_depth = _depth; + m_stencil = _stencil; + } + uint8_t m_index[8]; float m_depth; uint8_t m_stencil; @@ -355,12 +402,27 @@ namespace bgfx typedef bx::StringT<&g_allocator> String; + struct ProfilerScope + { + ProfilerScope(const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line) + { + g_callback->profilerBeginLiteral(_name, _abgr, _filePath, _line); + } + + ~ProfilerScope() + { + g_callback->profilerEnd(); + } + }; + void setGraphicsDebuggerPresent(bool _present); bool isGraphicsDebuggerPresent(); void release(const Memory* _mem); const char* getAttribName(Attrib::Enum _attr); void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height); - TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer); + TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer); + const char* getName(TextureFormat::Enum _fmt); + const char* getName(UniformHandle _handle); inline uint32_t castfu(float _value) { @@ -557,7 +619,7 @@ namespace bgfx { for (uint32_t ii = 0; ii < BX_COUNTOF(m_program); ++ii) { - m_program[ii].idx = invalidHandle; + m_program[ii].idx = kInvalidHandle; } } @@ -633,6 +695,7 @@ namespace bgfx CreateUniform, UpdateViewName, InvalidateOcclusionQuery, + SetName, End, RendererShutdownEnd, DestroyVertexDecl, @@ -724,99 +787,211 @@ namespace bgfx uint8_t m_buffer[BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE]; }; +// +#define SORK_KEY_NUM_BITS_VIEW 10 + +#define SORT_KEY_VIEW_SHIFT (64-SORK_KEY_NUM_BITS_VIEW) +#define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT) + +#define SORT_KEY_DRAW_BIT_SHIFT (SORT_KEY_VIEW_SHIFT - 1) +#define SORT_KEY_DRAW_BIT (UINT64_C(1)<<SORT_KEY_DRAW_BIT_SHIFT) + +// +#define SORT_KEY_NUM_BITS_DRAW_TYPE 2 + +#define SORT_KEY_DRAW_TYPE_BIT_SHIFT (SORT_KEY_DRAW_BIT_SHIFT - SORT_KEY_NUM_BITS_DRAW_TYPE) +#define SORT_KEY_DRAW_TYPE_MASK (UINT64_C(3)<<SORT_KEY_DRAW_TYPE_BIT_SHIFT) + +#define SORT_KEY_DRAW_TYPE_PROGRAM (UINT64_C(0)<<SORT_KEY_DRAW_TYPE_BIT_SHIFT) +#define SORT_KEY_DRAW_TYPE_DEPTH (UINT64_C(1)<<SORT_KEY_DRAW_TYPE_BIT_SHIFT) +#define SORT_KEY_DRAW_TYPE_SEQUENCE (UINT64_C(2)<<SORT_KEY_DRAW_TYPE_BIT_SHIFT) + +// #define SORT_KEY_NUM_BITS_TRANS 2 -#define SORT_KEY_DRAW_BIT (UINT64_C(1)<<0x36) +#define SORT_KEY_DRAW_0_TRANS_SHIFT (SORT_KEY_DRAW_TYPE_BIT_SHIFT - SORT_KEY_NUM_BITS_TRANS) +#define SORT_KEY_DRAW_0_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_0_TRANS_SHIFT) -#define SORT_KEY_VIEW_SHIFT 0x37 -#define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT) +#define SORT_KEY_DRAW_0_PROGRAM_SHIFT (SORT_KEY_DRAW_0_TRANS_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM) +#define SORT_KEY_DRAW_0_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_DRAW_0_PROGRAM_SHIFT) -#define SORT_KEY_DRAW_DEPTH_SHIFT 0 -#define SORT_KEY_DRAW_DEPTH_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH)-1)<<SORT_KEY_DRAW_DEPTH_SHIFT) +#define SORT_KEY_DRAW_0_DEPTH_SHIFT (SORT_KEY_DRAW_0_PROGRAM_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH) +#define SORT_KEY_DRAW_0_DEPTH_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH)-1)<<SORT_KEY_DRAW_0_DEPTH_SHIFT) -#define SORT_KEY_DRAW_PROGRAM_SHIFT (SORT_KEY_DRAW_DEPTH_SHIFT+BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH) -#define SORT_KEY_DRAW_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_DRAW_PROGRAM_SHIFT) +// +#define SORT_KEY_DRAW_1_DEPTH_SHIFT (SORT_KEY_DRAW_TYPE_BIT_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH) +#define SORT_KEY_DRAW_1_DEPTH_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH)-1)<<SORT_KEY_DRAW_1_DEPTH_SHIFT) -#define SORT_KEY_COMPUTE_PROGRAM_SHIFT (SORT_KEY_DRAW_DEPTH_SHIFT+BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH+SORT_KEY_NUM_BITS_TRANS) -#define SORT_KEY_COMPUTE_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_COMPUTE_PROGRAM_SHIFT) +#define SORT_KEY_DRAW_1_TRANS_SHIFT (SORT_KEY_DRAW_1_DEPTH_SHIFT - SORT_KEY_NUM_BITS_TRANS) +#define SORT_KEY_DRAW_1_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_1_TRANS_SHIFT) + +#define SORT_KEY_DRAW_1_PROGRAM_SHIFT (SORT_KEY_DRAW_1_TRANS_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM) +#define SORT_KEY_DRAW_1_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_DRAW_1_PROGRAM_SHIFT) + +// +#define SORT_KEY_DRAW_2_SEQ_SHIFT (SORT_KEY_DRAW_TYPE_BIT_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ) +#define SORT_KEY_DRAW_2_SEQ_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ)-1)<<SORT_KEY_DRAW_2_SEQ_SHIFT) + +#define SORT_KEY_DRAW_2_TRANS_SHIFT (SORT_KEY_DRAW_2_SEQ_SHIFT - SORT_KEY_NUM_BITS_TRANS) +#define SORT_KEY_DRAW_2_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_2_TRANS_SHIFT) -#define SORT_KEY_DRAW_TRANS_SHIFT (SORT_KEY_DRAW_PROGRAM_SHIFT+BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM) -#define SORT_KEY_DRAW_TRANS_MASK (UINT64_C(0x3)<<SORT_KEY_DRAW_TRANS_SHIFT) +#define SORT_KEY_DRAW_2_PROGRAM_SHIFT (SORT_KEY_DRAW_2_TRANS_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM) +#define SORT_KEY_DRAW_2_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_DRAW_2_PROGRAM_SHIFT) -#define SORT_KEY_SEQ_SHIFT (SORT_KEY_DRAW_TRANS_SHIFT+SORT_KEY_NUM_BITS_TRANS) -#define SORT_KEY_SEQ_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ)-1)<<SORT_KEY_SEQ_SHIFT) +// +#define SORT_KEY_COMPUTE_SEQ_SHIFT (SORT_KEY_DRAW_BIT_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ) +#define SORT_KEY_COMPUTE_SEQ_MASK ( ( (UINT64_C(1)<<BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ)-1)<<SORT_KEY_COMPUTE_SEQ_SHIFT) - BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= 256); +#define SORT_KEY_COMPUTE_PROGRAM_SHIFT (SORT_KEY_COMPUTE_SEQ_SHIFT - BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM) +#define SORT_KEY_COMPUTE_PROGRAM_MASK ( (uint64_t(BGFX_CONFIG_MAX_PROGRAMS-1) )<<SORT_KEY_COMPUTE_PROGRAM_SHIFT) + + BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= (1<<SORK_KEY_NUM_BITS_VIEW) ); BX_STATIC_ASSERT( (BGFX_CONFIG_MAX_PROGRAMS & (BGFX_CONFIG_MAX_PROGRAMS-1) ) == 0); // Must be power of 2. BX_STATIC_ASSERT( (0 // Render key mask shouldn't overlap. + | SORT_KEY_VIEW_MASK | SORT_KEY_DRAW_BIT - | SORT_KEY_SEQ_MASK + | SORT_KEY_DRAW_TYPE_MASK + | SORT_KEY_DRAW_0_TRANS_MASK + | SORT_KEY_DRAW_0_PROGRAM_MASK + | SORT_KEY_DRAW_0_DEPTH_MASK + ) == (0 + ^ SORT_KEY_VIEW_MASK + ^ SORT_KEY_DRAW_BIT + ^ SORT_KEY_DRAW_TYPE_MASK + ^ SORT_KEY_DRAW_0_TRANS_MASK + ^ SORT_KEY_DRAW_0_PROGRAM_MASK + ^ SORT_KEY_DRAW_0_DEPTH_MASK + ) ); + BX_STATIC_ASSERT( (0 // Render key mask shouldn't overlap. | SORT_KEY_VIEW_MASK - | SORT_KEY_DRAW_TRANS_MASK - | SORT_KEY_DRAW_PROGRAM_MASK - | SORT_KEY_DRAW_DEPTH_MASK + | SORT_KEY_DRAW_BIT + | SORT_KEY_DRAW_TYPE_MASK + | SORT_KEY_DRAW_1_DEPTH_MASK + | SORT_KEY_DRAW_1_TRANS_MASK + | SORT_KEY_DRAW_1_PROGRAM_MASK ) == (0 + ^ SORT_KEY_VIEW_MASK ^ SORT_KEY_DRAW_BIT - ^ SORT_KEY_SEQ_MASK + ^ SORT_KEY_DRAW_TYPE_MASK + ^ SORT_KEY_DRAW_1_DEPTH_MASK + ^ SORT_KEY_DRAW_1_TRANS_MASK + ^ SORT_KEY_DRAW_1_PROGRAM_MASK + ) ); + BX_STATIC_ASSERT( (0 // Render key mask shouldn't overlap. + | SORT_KEY_VIEW_MASK + | SORT_KEY_DRAW_BIT + | SORT_KEY_DRAW_TYPE_MASK + | SORT_KEY_DRAW_2_SEQ_MASK + | SORT_KEY_DRAW_2_TRANS_MASK + | SORT_KEY_DRAW_2_PROGRAM_MASK + ) == (0 ^ SORT_KEY_VIEW_MASK - ^ SORT_KEY_DRAW_TRANS_MASK - ^ SORT_KEY_DRAW_PROGRAM_MASK - ^ SORT_KEY_DRAW_DEPTH_MASK + ^ SORT_KEY_DRAW_BIT + ^ SORT_KEY_DRAW_TYPE_MASK + ^ SORT_KEY_DRAW_2_SEQ_MASK + ^ SORT_KEY_DRAW_2_TRANS_MASK + ^ SORT_KEY_DRAW_2_PROGRAM_MASK ) ); BX_STATIC_ASSERT( (0 // Compute key mask shouldn't overlap. - | SORT_KEY_DRAW_BIT - | SORT_KEY_SEQ_MASK | SORT_KEY_VIEW_MASK + | SORT_KEY_DRAW_BIT + | SORT_KEY_COMPUTE_SEQ_SHIFT | SORT_KEY_COMPUTE_PROGRAM_MASK ) == (0 - ^ SORT_KEY_DRAW_BIT - ^ SORT_KEY_SEQ_MASK ^ SORT_KEY_VIEW_MASK + ^ SORT_KEY_DRAW_BIT + ^ SORT_KEY_COMPUTE_SEQ_SHIFT ^ SORT_KEY_COMPUTE_PROGRAM_MASK ) ); + // | 3 2 1 0| + // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210| Common + // |vvvvvvvvd | + // | ^^ | + // | || | + // | view-+| | + // | +-draw | + // |----------------------------------------------------------------| Draw Key 0 - Sort by program + // | |kkttpppppppppdddddddddddddddddddddddddddddddd | + // | | ^ ^ ^ | + // | | | | | | + // | | +-trans +-program depth-+ | + // | | | + // |----------------------------------------------------------------| Draw Key 1 - Sort by depth + // | |kkddddddddddddddddddddddddddddddddttppppppppp | + // | | ^^ ^ ^ | + // | | || +-trans | | + // | | depth-+ program-+ | + // | | | + // |----------------------------------------------------------------| Draw Key 2 - Sequential + // | |kkssssssssssssssssssssttppppppppp | + // | | ^ ^ ^ | + // | | | | | | + // | | seq-+ +-trans +-program | + // | | | + // |----------------------------------------------------------------| Compute Key + // | |ssssssssssssssssssssppppppppp | + // | | ^ ^ | + // | | | | | + // | | seq-+ +-program | + // | | | + // |--------+-------------------------------------------------------| + // struct SortKey { - uint64_t encodeDraw() - { - // | 3 2 1 0| - // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210| - // | vvvvvvvvdsssssssssssttpppppppppdddddddddddddddddddddddddddddddd| - // | ^^ ^ ^ ^ ^| - // | || | | | || - // | view-+| seq-+ +-trans +-program depth-+| - // | +-draw | - - const uint64_t depth = (uint64_t(m_depth ) << SORT_KEY_DRAW_DEPTH_SHIFT ) & SORT_KEY_DRAW_DEPTH_MASK; - const uint64_t program = (uint64_t(m_program) << SORT_KEY_DRAW_PROGRAM_SHIFT) & SORT_KEY_DRAW_PROGRAM_MASK; - const uint64_t trans = (uint64_t(m_trans ) << SORT_KEY_DRAW_TRANS_SHIFT ) & SORT_KEY_DRAW_TRANS_MASK; - const uint64_t seq = (uint64_t(m_seq ) << SORT_KEY_SEQ_SHIFT ) & SORT_KEY_SEQ_MASK; - const uint64_t view = (uint64_t(m_view ) << SORT_KEY_VIEW_SHIFT ) & SORT_KEY_VIEW_MASK; - const uint64_t key = depth|program|trans|SORT_KEY_DRAW_BIT|seq|view; - - BX_CHECK(seq == (uint64_t(m_seq) << SORT_KEY_SEQ_SHIFT), "SortKey error, sequence is truncated (m_seq: %d)." - , m_seq - ); + enum Enum + { + SortProgram, + SortDepth, + SortSequence, + }; + + uint64_t encodeDraw(Enum _type) + { + if (SortDepth == _type) + { + const uint64_t depth = (uint64_t(m_depth ) << SORT_KEY_DRAW_1_DEPTH_SHIFT ) & SORT_KEY_DRAW_1_DEPTH_MASK; + const uint64_t program = (uint64_t(m_program) << SORT_KEY_DRAW_1_PROGRAM_SHIFT) & SORT_KEY_DRAW_1_PROGRAM_MASK; + const uint64_t trans = (uint64_t(m_trans ) << SORT_KEY_DRAW_1_TRANS_SHIFT ) & SORT_KEY_DRAW_1_TRANS_MASK; + const uint64_t view = (uint64_t(m_view ) << SORT_KEY_VIEW_SHIFT ) & SORT_KEY_VIEW_MASK; + const uint64_t key = view|SORT_KEY_DRAW_BIT|SORT_KEY_DRAW_TYPE_DEPTH|depth|trans|program; + + return key; + } + else if (SortSequence == _type) + { + const uint64_t seq = (uint64_t(m_seq ) << SORT_KEY_DRAW_2_SEQ_SHIFT ) & SORT_KEY_DRAW_2_SEQ_MASK; + const uint64_t program = (uint64_t(m_program) << SORT_KEY_DRAW_2_PROGRAM_SHIFT) & SORT_KEY_DRAW_2_PROGRAM_MASK; + const uint64_t trans = (uint64_t(m_trans ) << SORT_KEY_DRAW_2_TRANS_SHIFT ) & SORT_KEY_DRAW_2_TRANS_MASK; + const uint64_t view = (uint64_t(m_view ) << SORT_KEY_VIEW_SHIFT ) & SORT_KEY_VIEW_MASK; + const uint64_t key = view|SORT_KEY_DRAW_BIT|SORT_KEY_DRAW_TYPE_SEQUENCE|seq|trans|program; + + BX_CHECK(seq == (uint64_t(m_seq) << SORT_KEY_DRAW_2_SEQ_SHIFT) + , "SortKey error, sequence is truncated (m_seq: %d)." + , m_seq + ); + + return key; + } + + const uint64_t depth = (uint64_t(m_depth ) << SORT_KEY_DRAW_0_DEPTH_SHIFT ) & SORT_KEY_DRAW_0_DEPTH_MASK; + const uint64_t program = (uint64_t(m_program) << SORT_KEY_DRAW_0_PROGRAM_SHIFT) & SORT_KEY_DRAW_0_PROGRAM_MASK; + const uint64_t trans = (uint64_t(m_trans ) << SORT_KEY_DRAW_0_TRANS_SHIFT ) & SORT_KEY_DRAW_0_TRANS_MASK; + const uint64_t view = (uint64_t(m_view ) << SORT_KEY_VIEW_SHIFT ) & SORT_KEY_VIEW_MASK; + const uint64_t key = view|SORT_KEY_DRAW_BIT|SORT_KEY_DRAW_TYPE_PROGRAM|trans|program|depth; return key; } uint64_t encodeCompute() { - // | 3 2 1 0| - // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210| - // | vvvvvvvvdsssssssssssppppppppp | - // | ^^ ^ ^ | - // | || | | | - // | view-+| seq-+ +-program | - // | +-draw | - const uint64_t program = (uint64_t(m_program) << SORT_KEY_COMPUTE_PROGRAM_SHIFT) & SORT_KEY_COMPUTE_PROGRAM_MASK; - const uint64_t seq = (uint64_t(m_seq ) << SORT_KEY_SEQ_SHIFT ) & SORT_KEY_SEQ_MASK; + const uint64_t seq = (uint64_t(m_seq ) << SORT_KEY_COMPUTE_SEQ_SHIFT ) & SORT_KEY_COMPUTE_SEQ_MASK; const uint64_t view = (uint64_t(m_view ) << SORT_KEY_VIEW_SHIFT ) & SORT_KEY_VIEW_MASK; const uint64_t key = program|seq|view; - BX_CHECK(seq == (uint64_t(m_seq) << SORT_KEY_SEQ_SHIFT), "SortKey error, sequence is truncated (m_seq: %d)." + BX_CHECK(seq == (uint64_t(m_seq) << SORT_KEY_COMPUTE_SEQ_SHIFT) + , "SortKey error, sequence is truncated (m_seq: %d)." , m_seq ); @@ -824,15 +999,24 @@ namespace bgfx } /// Returns true if item is compute command. - bool decode(uint64_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS]) + bool decode(uint64_t _key, ViewId _viewRemap[BGFX_CONFIG_MAX_VIEWS]) { - m_seq = uint32_t( (_key & SORT_KEY_SEQ_MASK ) >> SORT_KEY_SEQ_SHIFT); m_view = _viewRemap[(_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT]; if (_key & SORT_KEY_DRAW_BIT) { - m_depth = uint32_t( (_key & SORT_KEY_DRAW_DEPTH_MASK ) >> SORT_KEY_DRAW_DEPTH_SHIFT); - m_program = uint16_t( (_key & SORT_KEY_DRAW_PROGRAM_MASK) >> SORT_KEY_DRAW_PROGRAM_SHIFT); - m_trans = uint8_t( (_key & SORT_KEY_DRAW_TRANS_MASK ) >> SORT_KEY_DRAW_TRANS_SHIFT); + uint64_t type = _key & SORT_KEY_DRAW_TYPE_MASK; + if (type == SORT_KEY_DRAW_TYPE_DEPTH) + { + m_program = uint16_t( (_key & SORT_KEY_DRAW_1_PROGRAM_MASK) >> SORT_KEY_DRAW_1_PROGRAM_SHIFT); + return false; + } + else if (type == SORT_KEY_DRAW_TYPE_SEQUENCE) + { + m_program = uint16_t( (_key & SORT_KEY_DRAW_2_PROGRAM_MASK) >> SORT_KEY_DRAW_2_PROGRAM_SHIFT); + return false; + } + + m_program = uint16_t( (_key & SORT_KEY_DRAW_0_PROGRAM_MASK) >> SORT_KEY_DRAW_0_PROGRAM_SHIFT); return false; // draw } @@ -840,16 +1024,16 @@ namespace bgfx return true; // compute } - static uint8_t decodeView(uint64_t _key) + static ViewId decodeView(uint64_t _key) { - return uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT); + return ViewId( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT); } - static uint64_t remapView(uint64_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS]) + static uint64_t remapView(uint64_t _key, ViewId _viewRemap[BGFX_CONFIG_MAX_VIEWS]) { - const uint8_t oldView = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT); - const uint64_t view = uint64_t(_viewRemap[oldView]) << SORT_KEY_VIEW_SHIFT; - const uint64_t key = (_key & ~SORT_KEY_VIEW_MASK) | view; + const ViewId oldView = decodeView(_key); + const uint64_t view = uint64_t(_viewRemap[oldView]) << SORT_KEY_VIEW_SHIFT; + const uint64_t key = (_key & ~SORT_KEY_VIEW_MASK) | view; return key; } @@ -865,7 +1049,7 @@ namespace bgfx uint32_t m_depth; uint32_t m_seq; uint16_t m_program; - uint8_t m_view; + ViewId m_view; uint8_t m_trans; }; #undef SORT_KEY_RENDER_DRAW @@ -883,19 +1067,19 @@ namespace bgfx void decode(uint32_t _key) { m_item = uint16_t(_key & UINT16_MAX); - m_view = uint8_t(_key >> 24); + m_view = ViewId(_key >> 24); } - static uint32_t remapView(uint32_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS]) + static uint32_t remapView(uint32_t _key, ViewId _viewRemap[BGFX_CONFIG_MAX_VIEWS]) { - const uint8_t oldView = uint8_t(_key >> 24); + const ViewId oldView = ViewId(_key >> 24); const uint32_t view = uint32_t(_viewRemap[oldView]) << 24; const uint32_t key = (_key & ~UINT32_C(0xff000000) ) | view; return key; } uint16_t m_item; - uint8_t m_view; + ViewId m_view; }; BX_ALIGN_DECL_16(struct) Matrix4 @@ -929,13 +1113,9 @@ namespace bgfx uint32_t reserve(uint16_t* _num) { uint32_t num = *_num; - BX_WARN(m_num+num < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache overflow. %d (max: %d)", m_num+num, BGFX_CONFIG_MAX_MATRIX_CACHE); - num = bx::uint32_min(num, BGFX_CONFIG_MAX_MATRIX_CACHE-m_num); - uint32_t first = m_num < BGFX_CONFIG_MAX_MATRIX_CACHE - ? m_num - : BGFX_CONFIG_MAX_MATRIX_CACHE - 1 - ; - m_num += num; + uint32_t first = bx::atomicFetchAndAddsat<uint32_t>(&m_num, num, BGFX_CONFIG_MAX_MATRIX_CACHE - 1); + BX_WARN(first+num < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache overflow. %d (max: %d)", first+num, BGFX_CONFIG_MAX_MATRIX_CACHE); + num = bx::uint32_min(num, BGFX_CONFIG_MAX_MATRIX_CACHE-1-first); *_num = (uint16_t)num; return first; } @@ -984,17 +1164,16 @@ namespace bgfx uint32_t add(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - BX_CHECK(m_num+1 < BGFX_CONFIG_MAX_RECT_CACHE, "Rect cache overflow. %d (max: %d)", m_num, BGFX_CONFIG_MAX_RECT_CACHE); + const uint32_t first = bx::atomicFetchAndAddsat<uint32_t>(&m_num, 1, BGFX_CONFIG_MAX_RECT_CACHE-1); + BX_CHECK(first+1 < BGFX_CONFIG_MAX_RECT_CACHE, "Rect cache overflow. %d (max: %d)", first, BGFX_CONFIG_MAX_RECT_CACHE); - uint32_t first = m_num; - Rect& rect = m_cache[m_num]; + Rect& rect = m_cache[first]; rect.m_x = _x; rect.m_y = _y; rect.m_width = _width; rect.m_height = _height; - m_num++; return first; } @@ -1022,7 +1201,7 @@ namespace bgfx { uint32_t size = BX_ALIGN_16(bx::uint32_max(_size, sizeof(UniformBuffer) ) ); void* data = BX_ALLOC(g_allocator, size); - return ::new(data) UniformBuffer(_size); + return BX_PLACEMENT_NEW(data, UniformBuffer)(_size); } static void destroy(UniformBuffer* _uniformBuffer) @@ -1031,14 +1210,17 @@ namespace bgfx BX_FREE(g_allocator, _uniformBuffer); } - static void update(UniformBuffer*& _uniformBuffer, uint32_t _treshold = 64<<10, uint32_t _grow = 1<<20) + static void update(UniformBuffer** _uniformBuffer, uint32_t _treshold = 64<<10, uint32_t _grow = 1<<20) { - if (_treshold >= _uniformBuffer->m_size - _uniformBuffer->m_pos) + UniformBuffer* uniformBuffer = *_uniformBuffer; + if (_treshold >= uniformBuffer->m_size - uniformBuffer->m_pos) { - uint32_t size = BX_ALIGN_16(bx::uint32_max(_uniformBuffer->m_size + _grow, sizeof(UniformBuffer) ) ); - void* data = BX_REALLOC(g_allocator, _uniformBuffer, size); - _uniformBuffer = reinterpret_cast<UniformBuffer*>(data); - _uniformBuffer->m_size = size; + uint32_t size = BX_ALIGN_16(bx::uint32_max(uniformBuffer->m_size + _grow, sizeof(UniformBuffer) ) ); + void* data = BX_REALLOC(g_allocator, uniformBuffer, size); + uniformBuffer = reinterpret_cast<UniformBuffer*>(data); + uniformBuffer->m_size = size; + + *_uniformBuffer = uniformBuffer; } } @@ -1156,8 +1338,8 @@ namespace bgfx const UniformRegInfo* find(const char* _name) const { - uint16_t handle = m_uniforms.find(bx::hashMurmur2A(_name) ); - if (UniformHashMap::invalid != handle) + uint16_t handle = m_uniforms.find(bx::hash<bx::HashMurmur2A>(_name) ); + if (kInvalidHandle != handle) { return &m_info[handle]; } @@ -1168,7 +1350,7 @@ namespace bgfx const UniformRegInfo& add(UniformHandle _handle, const char* _name, const void* _data) { BX_CHECK(isValid(_handle), "Uniform handle is invalid (name: %s)!", _name); - const uint32_t key = bx::hashMurmur2A(_name); + const uint32_t key = bx::hash<bx::HashMurmur2A>(_name); m_uniforms.removeByKey(key); m_uniforms.insert(key, _handle.idx); @@ -1227,8 +1409,8 @@ namespace bgfx void clear() { m_startVertex = 0; - m_handle.idx = invalidHandle; - m_decl.idx = invalidHandle; + m_handle.idx = kInvalidHandle; + m_decl.idx = kInvalidHandle; } uint32_t m_startVertex; @@ -1236,41 +1418,50 @@ namespace bgfx VertexDeclHandle m_decl; }; - struct RenderDraw + BX_ALIGN_DECL_CACHE_LINE(struct) RenderBind { void clear() { - m_constBegin = 0; - m_constEnd = 0; - m_stateFlags = BGFX_STATE_DEFAULT; - m_stencil = packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT); - m_rgba = 0; - m_matrix = 0; - m_startIndex = 0; - m_numIndices = UINT32_MAX; - m_numVertices = UINT32_MAX; + for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii) + { + Binding& bind = m_bind[ii]; + bind.m_idx = kInvalidHandle; + bind.m_type = 0; + bind.m_un.m_draw.m_textureFlags = 0; + } + }; + + Binding m_bind[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; + }; + + BX_ALIGN_DECL_CACHE_LINE(struct) RenderDraw + { + void clear() + { + m_uniformBegin = 0; + m_uniformEnd = 0; + m_stateFlags = BGFX_STATE_DEFAULT; + m_stencil = packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT); + m_rgba = 0; + m_startMatrix = 0; + m_startIndex = 0; + m_numIndices = UINT32_MAX; + m_numVertices = UINT32_MAX; m_instanceDataOffset = 0; m_instanceDataStride = 0; m_numInstances = 1; m_startIndirect = 0; m_numIndirect = UINT16_MAX; - m_num = 1; + m_numMatrices = 1; m_submitFlags = BGFX_SUBMIT_EYE_FIRST; m_scissor = UINT16_MAX; m_streamMask = 0; m_stream[0].clear(); - m_indexBuffer.idx = invalidHandle; - m_instanceDataBuffer.idx = invalidHandle; - m_indirectBuffer.idx = invalidHandle; - m_occlusionQuery.idx = invalidHandle; - - for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii) - { - Binding& bind = m_bind[ii]; - bind.m_idx = invalidHandle; - bind.m_type = 0; - bind.m_un.m_draw.m_textureFlags = 0; - } + m_indexBuffer.idx = kInvalidHandle; + m_instanceDataBuffer.idx = kInvalidHandle; + m_indirectBuffer.idx = kInvalidHandle; + m_occlusionQuery.idx = kInvalidHandle; + m_uniformIdx = UINT8_MAX; } bool setStreamBit(uint8_t _stream, VertexBufferHandle _handle) @@ -1282,14 +1473,13 @@ namespace bgfx return 0 != tmp; } - Binding m_bind[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; Stream m_stream[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint64_t m_stateFlags; uint64_t m_stencil; uint32_t m_rgba; - uint32_t m_constBegin; - uint32_t m_constEnd; - uint32_t m_matrix; + uint32_t m_uniformBegin; + uint32_t m_uniformEnd; + uint32_t m_startMatrix; uint32_t m_startIndex; uint32_t m_numIndices; uint32_t m_numVertices; @@ -1298,10 +1488,11 @@ namespace bgfx uint16_t m_instanceDataStride; uint16_t m_startIndirect; uint16_t m_numIndirect; - uint16_t m_num; + uint16_t m_numMatrices; uint16_t m_scissor; uint8_t m_submitFlags; uint8_t m_streamMask; + uint8_t m_uniformIdx; IndexBufferHandle m_indexBuffer; VertexBufferHandle m_instanceDataBuffer; @@ -1309,42 +1500,38 @@ namespace bgfx OcclusionQueryHandle m_occlusionQuery; }; - struct RenderCompute + BX_ALIGN_DECL_CACHE_LINE(struct) RenderCompute { void clear() { - m_constBegin = 0; - m_constEnd = 0; - m_matrix = 0; - m_numX = 0; - m_numY = 0; - m_numZ = 0; - m_num = 0; - m_submitFlags = BGFX_SUBMIT_EYE_FIRST; - - m_indirectBuffer.idx = invalidHandle; + m_uniformBegin = 0; + m_uniformEnd = 0; + m_startMatrix = 0; + m_numX = 0; + m_numY = 0; + m_numZ = 0; + m_numMatrices = 0; + m_submitFlags = BGFX_SUBMIT_EYE_FIRST; + m_uniformIdx = UINT8_MAX; + + m_indirectBuffer.idx = kInvalidHandle; m_startIndirect = 0; m_numIndirect = UINT16_MAX; - - for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) - { - m_bind[ii].m_idx = invalidHandle; - } } - Binding m_bind[BGFX_MAX_COMPUTE_BINDINGS]; - uint32_t m_constBegin; - uint32_t m_constEnd; - uint32_t m_matrix; + uint32_t m_uniformBegin; + uint32_t m_uniformEnd; + uint32_t m_startMatrix; IndirectBufferHandle m_indirectBuffer; - uint16_t m_numX; - uint16_t m_numY; - uint16_t m_numZ; + uint32_t m_numX; + uint32_t m_numY; + uint32_t m_numZ; uint16_t m_startIndirect; uint16_t m_numIndirect; - uint16_t m_num; + uint16_t m_numMatrices; uint8_t m_submitFlags; + uint8_t m_uniformIdx; }; union RenderItem @@ -1353,7 +1540,7 @@ namespace bgfx RenderCompute compute; }; - struct BlitItem + BX_ALIGN_DECL_CACHE_LINE(struct) BlitItem { uint16_t m_srcX; uint16_t m_srcY; @@ -1410,22 +1597,124 @@ namespace bgfx uint16_t m_flags; }; + BX_ALIGN_DECL_CACHE_LINE(struct) View + { + void reset() + { + setRect(0, 0, 1, 1); + setScissor(0, 0, 0, 0); + setClear(BGFX_CLEAR_NONE, 0, 0.0f, 0); + setMode(ViewMode::Default); + setFrameBuffer(BGFX_INVALID_HANDLE); + setTransform(NULL, NULL, BGFX_VIEW_NONE, NULL); + } + + void setRect(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + { + m_rect.m_x = (uint16_t)bx::uint32_imax(int16_t(_x), 0); + m_rect.m_y = (uint16_t)bx::uint32_imax(int16_t(_y), 0); + m_rect.m_width = bx::uint16_max(_width, 1); + m_rect.m_height = bx::uint16_max(_height, 1); + } + + void setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + { + m_scissor.m_x = _x; + m_scissor.m_y = _y; + m_scissor.m_width = _width; + m_scissor.m_height = _height; + } + + void setClear(uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) + { + m_clear.set(_flags, _rgba, _depth, _stencil); + } + + void setClear(uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) + { + m_clear.set(_flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); + } + + void setMode(ViewMode::Enum _mode) + { + m_mode = uint8_t(_mode); + } + + void setFrameBuffer(FrameBufferHandle _handle) + { + m_fbh = _handle; + } + + void setTransform(const void* _view, const void* _proj, uint8_t _flags, const void* _proj1) + { + m_flags = _flags; + + if (NULL != _view) + { + bx::memCopy(m_view.un.val, _view, sizeof(Matrix4) ); + } + else + { + m_view.setIdentity(); + } + + if (NULL != _proj) + { + bx::memCopy(m_proj[0].un.val, _proj, sizeof(Matrix4) ); + } + else + { + m_proj[0].setIdentity(); + } + + if (NULL != _proj1) + { + bx::memCopy(m_proj[1].un.val, _proj1, sizeof(Matrix4) ); + } + else + { + bx::memCopy(m_proj[1].un.val, m_proj[0].un.val, sizeof(Matrix4) ); + } + } + + Clear m_clear; + Rect m_rect; + Rect m_scissor; + Matrix4 m_view; + Matrix4 m_proj[2]; + FrameBufferHandle m_fbh; + uint8_t m_mode; + uint8_t m_flags; + }; + + struct FrameCache + { + void reset() + { + m_matrixCache.reset(); + m_rectCache.reset(); + } + + MatrixCache m_matrixCache; + RectCache m_rectCache; + }; + BX_ALIGN_DECL_CACHE_LINE(struct) Frame { Frame() - : m_uniformMax(0) - , m_waitSubmit(0) + : m_waitSubmit(0) , m_waitRender(0) , m_hmdInitialized(false) , m_capture(false) - , m_discard(false) { SortKey term; term.reset(); - term.m_program = invalidHandle; - m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS] = term.encodeDraw(); + term.m_program = kInvalidHandle; + m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS] = term.encodeDraw(SortKey::SortProgram); m_sortValues[BGFX_CONFIG_MAX_DRAW_CALLS] = BGFX_CONFIG_MAX_DRAW_CALLS; bx::memSet(m_occlusion, 0xff, sizeof(m_occlusion) ); + + m_perfStats.viewStats = m_viewStats; } ~Frame() @@ -1434,7 +1723,11 @@ namespace bgfx void create() { - m_uniformBuffer = UniformBuffer::create(); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_uniformBuffer); ++ii) + { + m_uniformBuffer[ii] = UniformBuffer::create(); + } + reset(); start(); m_textVideoMem = BX_NEW(g_allocator, TextVideoMem); @@ -1442,7 +1735,10 @@ namespace bgfx void destroy() { - UniformBuffer::destroy(m_uniformBuffer); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_uniformBuffer); ++ii) + { + UniformBuffer::destroy(m_uniformBuffer[ii]); + } BX_DELETE(g_allocator, m_textVideoMem); } @@ -1455,25 +1751,14 @@ namespace bgfx void start() { - m_stateFlags = BGFX_STATE_NONE; - m_uniformBegin = 0; - m_uniformEnd = 0; - m_draw.clear(); - m_compute.clear(); - m_matrixCache.reset(); - m_rectCache.reset(); - m_key.reset(); - m_num = 0; + m_frameCache.reset(); m_numRenderItems = 0; - m_numDropped = 0; m_numBlitItems = 0; m_iboffset = 0; m_vboffset = 0; m_cmdPre.start(); m_cmdPost.start(); - m_uniformBuffer->reset(); m_capture = false; - m_discard = false; } void finish() @@ -1481,22 +1766,284 @@ namespace bgfx m_cmdPre.finish(); m_cmdPost.finish(); - m_uniformMax = bx::uint32_max(m_uniformMax, m_uniformBuffer->getPos() ); - m_uniformBuffer->finish(); +// if (0 < m_numDropped) +// { +// BX_TRACE("Too many draw calls: %d, dropped %d (max: %d)" +// , m_numRenderItems+m_numDropped +// , m_numDropped +// , BGFX_CONFIG_MAX_DRAW_CALLS +// ); +// } + } + + void sort(); + + uint32_t getAvailTransientIndexBuffer(uint32_t _num) + { + uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) ); + uint32_t iboffset = offset + _num*sizeof(uint16_t); + iboffset = bx::uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE); + uint32_t num = (iboffset-offset)/sizeof(uint16_t); + return num; + } + + uint32_t allocTransientIndexBuffer(uint32_t& _num) + { + uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) ); + uint32_t num = getAvailTransientIndexBuffer(_num); + m_iboffset = offset + num*sizeof(uint16_t); + _num = num; + + return offset; + } + + uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) + { + uint32_t offset = bx::strideAlign(m_vboffset, _stride); + uint32_t vboffset = offset + _num * _stride; + vboffset = bx::uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE); + uint32_t num = (vboffset-offset)/_stride; + return num; + } - if (0 < m_numDropped) + uint32_t allocTransientVertexBuffer(uint32_t& _num, uint16_t _stride) + { + uint32_t offset = bx::strideAlign(m_vboffset, _stride); + uint32_t num = getAvailTransientVertexBuffer(_num, _stride); + m_vboffset = offset + num * _stride; + _num = num; + + return offset; + } + + bool free(IndexBufferHandle _handle) + { + return m_freeIndexBuffer.queue(_handle); + } + + bool free(VertexDeclHandle _handle) + { + return m_freeVertexDecl.queue(_handle); + } + + bool free(VertexBufferHandle _handle) + { + return m_freeVertexBuffer.queue(_handle); + } + + bool free(ShaderHandle _handle) + { + return m_freeShader.queue(_handle); + } + + bool free(ProgramHandle _handle) + { + return m_freeProgram.queue(_handle); + } + + bool free(TextureHandle _handle) + { + return m_freeTexture.queue(_handle); + } + + bool free(FrameBufferHandle _handle) + { + return m_freeFrameBuffer.queue(_handle); + } + + bool free(UniformHandle _handle) + { + return m_freeUniform.queue(_handle); + } + + void resetFreeHandles() + { + m_freeIndexBuffer.reset(); + m_freeVertexDecl.reset(); + m_freeVertexBuffer.reset(); + m_freeShader.reset(); + m_freeProgram.reset(); + m_freeTexture.reset(); + m_freeFrameBuffer.reset(); + m_freeUniform.reset(); + } + + ViewId m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; + float m_colorPalette[BGFX_CONFIG_MAX_COLOR_PALETTE][4]; + + View m_view[BGFX_CONFIG_MAX_VIEWS]; + + int32_t m_occlusion[BGFX_CONFIG_MAX_OCCLUSION_QUERIES]; + + uint64_t m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS+1]; + RenderItemCount m_sortValues[BGFX_CONFIG_MAX_DRAW_CALLS+1]; + RenderItem m_renderItem[BGFX_CONFIG_MAX_DRAW_CALLS+1]; + RenderBind m_renderItemBind[BGFX_CONFIG_MAX_DRAW_CALLS + 1]; + + uint32_t m_blitKeys[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; + BlitItem m_blitItem[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; + + FrameCache m_frameCache; + UniformBuffer* m_uniformBuffer[BGFX_CONFIG_MAX_ENCODERS]; + + uint32_t m_numRenderItems; + uint16_t m_numBlitItems; + + uint32_t m_iboffset; + uint32_t m_vboffset; + TransientIndexBuffer* m_transientIb; + TransientVertexBuffer* m_transientVb; + + Resolution m_resolution; + uint32_t m_debug; + + CommandBuffer m_cmdPre; + CommandBuffer m_cmdPost; + + template<typename Ty, uint32_t Max> + struct FreeHandle + { + FreeHandle() + : m_num(0) { - BX_TRACE("Too many draw calls: %d, dropped %d (max: %d)" - , m_num+m_numDropped - , m_numDropped - , BGFX_CONFIG_MAX_DRAW_CALLS - ); + } + + bool isQueued(Ty _handle) + { + for (uint32_t ii = 0, num = m_num; ii < num; ++ii) + { + if (m_queue[ii].idx == _handle.idx) + { + return true; + } + } + + return false; + } + + bool queue(Ty _handle) + { + if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) + { + if (isQueued(_handle) ) + { + return false; + } + } + + m_queue[m_num] = _handle; + ++m_num; + + return true; + } + + void reset() + { + m_num = 0; + } + + Ty get(uint16_t _idx) const + { + return m_queue[_idx]; + } + + uint16_t getNumQueued() const + { + return m_num; + } + + Ty m_queue[Max]; + uint16_t m_num; + }; + + FreeHandle<IndexBufferHandle, BGFX_CONFIG_MAX_INDEX_BUFFERS> m_freeIndexBuffer; + FreeHandle<VertexDeclHandle, BGFX_CONFIG_MAX_VERTEX_DECLS> m_freeVertexDecl; + FreeHandle<VertexBufferHandle, BGFX_CONFIG_MAX_VERTEX_BUFFERS> m_freeVertexBuffer; + FreeHandle<ShaderHandle, BGFX_CONFIG_MAX_SHADERS> m_freeShader; + FreeHandle<ProgramHandle, BGFX_CONFIG_MAX_PROGRAMS> m_freeProgram; + FreeHandle<TextureHandle, BGFX_CONFIG_MAX_TEXTURES> m_freeTexture; + FreeHandle<FrameBufferHandle, BGFX_CONFIG_MAX_FRAME_BUFFERS> m_freeFrameBuffer; + FreeHandle<UniformHandle, BGFX_CONFIG_MAX_UNIFORMS> m_freeUniform; + + TextVideoMem* m_textVideoMem; + HMD m_hmd; + + Stats m_perfStats; + ViewStats m_viewStats[BGFX_CONFIG_MAX_VIEWS]; + + int64_t m_waitSubmit; + int64_t m_waitRender; + + bool m_hmdInitialized; + bool m_capture; + }; + + BX_ALIGN_DECL_CACHE_LINE(struct) EncoderImpl + { + EncoderImpl() + { + discard(); + } + + void begin(Frame* _frame, uint8_t _idx) + { + m_frame = _frame; + + m_cpuTimeBegin = bx::getHPCounter(); + + m_uniformIdx = _idx; + m_uniformBegin = 0; + m_uniformEnd = 0; + + UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; + uniformBuffer->reset(); + + m_numSubmitted = 0; + m_numDropped = 0; + } + + void end(bool _finalize) + { + if (_finalize) + { + UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; + uniformBuffer->finish(); + + m_cpuTimeEnd = bx::getHPCounter(); + } + + if (BX_ENABLED(BGFX_CONFIG_DEBUG_OCCLUSION) ) + { + m_occlusionQuerySet.clear(); + } + + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + { + m_uniformSet.clear(); } } void setMarker(const char* _name) { - m_uniformBuffer->writeMarker(_name); + UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; + uniformBuffer->writeMarker(_name); + } + + void setUniform(UniformType::Enum _type, UniformHandle _handle, const void* _value, uint16_t _num) + { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + { + BX_CHECK(m_uniformSet.end() == m_uniformSet.find(_handle.idx) + , "Uniform %d (%s) was already set for this draw call." + , _handle.idx + , getName(_handle) + ); + m_uniformSet.insert(_handle.idx); + } + + UniformBuffer::update(&m_frame->m_uniformBuffer[m_uniformIdx]); + UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; + uniformBuffer->writeUniform(_type, _handle.idx, _value, _num); } void setState(uint64_t _state, uint32_t _rgba) @@ -1522,7 +2069,7 @@ namespace bgfx uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - uint16_t scissor = (uint16_t)m_rectCache.add(_x, _y, _width, _height); + uint16_t scissor = (uint16_t)m_frame->m_frameCache.m_rectCache.add(_x, _y, _width, _height); m_draw.m_scissor = scissor; return scissor; } @@ -1534,16 +2081,16 @@ namespace bgfx uint32_t setTransform(const void* _mtx, uint16_t _num) { - m_draw.m_matrix = m_matrixCache.add(_mtx, _num); - m_draw.m_num = _num; + m_draw.m_startMatrix = m_frame->m_frameCache.m_matrixCache.add(_mtx, _num); + m_draw.m_numMatrices = _num; - return m_draw.m_matrix; + return m_draw.m_startMatrix; } uint32_t allocTransform(Transform* _transform, uint16_t _num) { - uint32_t first = m_matrixCache.reserve(&_num); - _transform->data = m_matrixCache.toPtr(first); + uint32_t first = m_frame->m_frameCache.m_matrixCache.reserve(&_num); + _transform->data = m_frame->m_frameCache.m_matrixCache.toPtr(first); _transform->num = _num; return first; @@ -1555,8 +2102,8 @@ namespace bgfx , _cache , BGFX_CONFIG_MAX_MATRIX_CACHE ); - m_draw.m_matrix = _cache; - m_draw.m_num = uint16_t(bx::uint32_min(_cache+_num, BGFX_CONFIG_MAX_MATRIX_CACHE-1) - _cache); + m_draw.m_startMatrix = _cache; + m_draw.m_numMatrices = uint16_t(bx::uint32_min(_cache+_num, BGFX_CONFIG_MAX_MATRIX_CACHE-1) - _cache); } void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) @@ -1576,26 +2123,29 @@ namespace bgfx void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) { + const uint32_t numIndices = bx::uint32_min(_numIndices, _tib->size/2); m_draw.m_indexBuffer = _tib->handle; - m_draw.m_startIndex = _firstIndex; - m_draw.m_numIndices = _numIndices; - m_discard = 0 == _numIndices; + m_draw.m_startIndex = _tib->startIndex + _firstIndex; + m_draw.m_numIndices = numIndices; + m_discard = 0 == numIndices; } void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { + BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); if (m_draw.setStreamBit(_stream, _handle) ) { Stream& stream = m_draw.m_stream[_stream]; stream.m_startVertex = _startVertex; stream.m_handle = _handle; - stream.m_decl.idx = invalidHandle; + stream.m_decl.idx = kInvalidHandle; m_numVertices[_stream] = _numVertices; } } void setVertexBuffer(uint8_t _stream, const DynamicVertexBuffer& _dvb, uint32_t _startVertex, uint32_t _numVertices) { + BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); if (m_draw.setStreamBit(_stream, _dvb.m_handle) ) { Stream& stream = m_draw.m_stream[_stream]; @@ -1610,12 +2160,13 @@ namespace bgfx void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) { + BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); if (m_draw.setStreamBit(_stream, _tvb->handle) ) { Stream& stream = m_draw.m_stream[_stream]; - stream.m_startVertex = _tvb->startVertex + _startVertex; - stream.m_handle = _tvb->handle; - stream.m_decl = _tvb->decl; + stream.m_startVertex = _tvb->startVertex + _startVertex; + stream.m_handle = _tvb->handle; + stream.m_decl = _tvb->decl; m_numVertices[_stream] = bx::uint32_min(bx::uint32_imax(0, _tvb->size/_tvb->stride - _startVertex), _numVertices) ; @@ -1628,7 +2179,6 @@ namespace bgfx m_draw.m_instanceDataStride = _idb->stride; m_draw.m_numInstances = bx::uint32_min(_idb->num, _num); m_draw.m_instanceDataBuffer = _idb->handle; - BX_FREE(g_allocator, const_cast<InstanceDataBuffer*>(_idb) ); } void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num, uint16_t _stride) @@ -1641,7 +2191,7 @@ namespace bgfx void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) { - Binding& bind = m_draw.m_bind[_stage]; + Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::Texture); bind.m_un.m_draw.m_textureFlags = (_flags&BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER) @@ -1652,13 +2202,13 @@ namespace bgfx if (isValid(_sampler) ) { uint32_t stage = _stage; - setUniform(_sampler, &stage); + setUniform(UniformType::Int1, _sampler, &stage, 1); } } void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) { - Binding& bind = m_compute.m_bind[_stage]; + Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::IndexBuffer); bind.m_un.m_compute.m_format = 0; @@ -1668,7 +2218,7 @@ namespace bgfx void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) { - Binding& bind = m_compute.m_bind[_stage]; + Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::VertexBuffer); bind.m_un.m_compute.m_format = 0; @@ -1678,7 +2228,7 @@ namespace bgfx void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) { - Binding& bind = m_compute.m_bind[_stage]; + Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::Image); bind.m_un.m_compute.m_format = uint8_t(_format); @@ -1688,261 +2238,69 @@ namespace bgfx if (isValid(_sampler) ) { uint32_t stage = _stage; - setUniform(_sampler, &stage); + setUniform(UniformType::Int1, _sampler, &stage, 1); } } void discard() { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + { + m_uniformSet.clear(); + } + m_discard = false; m_draw.clear(); m_compute.clear(); - m_stateFlags = BGFX_STATE_NONE; + m_bind.clear(); } - uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState); + void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState); - uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { m_draw.m_startIndirect = _start; m_draw.m_numIndirect = _num; m_draw.m_indirectBuffer = _indirectHandle; OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; - return submit(_id, _program, handle, _depth, _preserveState); + submit(_id, _program, handle, _depth, _preserveState); } - uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _ngx, uint16_t _ngy, uint16_t _ngz, uint8_t _flags); + void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _ngx, uint32_t _ngy, uint32_t _ngz, uint8_t _flags); - uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) + void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { m_compute.m_indirectBuffer = _indirectHandle; m_compute.m_startIndirect = _start; m_compute.m_numIndirect = _num; - return dispatch(_id, _handle, 0, 0, 0, _flags); - } - - void blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); - - void sort(); - - uint32_t getAvailTransientIndexBuffer(uint32_t _num) - { - uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) ); - uint32_t iboffset = offset + _num*sizeof(uint16_t); - iboffset = bx::uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE); - uint32_t num = (iboffset-offset)/sizeof(uint16_t); - return num; - } - - uint32_t allocTransientIndexBuffer(uint32_t& _num) - { - uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) ); - uint32_t num = getAvailTransientIndexBuffer(_num); - m_iboffset = offset + num*sizeof(uint16_t); - _num = num; - - return offset; - } - - uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) - { - uint32_t offset = bx::strideAlign(m_vboffset, _stride); - uint32_t vboffset = offset + _num * _stride; - vboffset = bx::uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE); - uint32_t num = (vboffset-offset)/_stride; - return num; - } - - uint32_t allocTransientVertexBuffer(uint32_t& _num, uint16_t _stride) - { - uint32_t offset = bx::strideAlign(m_vboffset, _stride); - uint32_t num = getAvailTransientVertexBuffer(_num, _stride); - m_vboffset = offset + num * _stride; - _num = num; - - return offset; + dispatch(_id, _handle, 0, 0, 0, _flags); } - void writeUniform(UniformType::Enum _type, UniformHandle _handle, const void* _value, uint16_t _num) - { - UniformBuffer::update(m_uniformBuffer); - m_uniformBuffer->writeUniform(_type, _handle.idx, _value, _num); - } + void blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); - bool free(IndexBufferHandle _handle) - { - return m_freeIndexBuffer.queue(_handle); - } - - bool free(VertexDeclHandle _handle) - { - return m_freeVertexDecl.queue(_handle); - } - - bool free(VertexBufferHandle _handle) - { - return m_freeVertexBuffer.queue(_handle); - } - - bool free(ShaderHandle _handle) - { - return m_freeShader.queue(_handle); - } - - bool free(ProgramHandle _handle) - { - return m_freeProgram.queue(_handle); - } - - bool free(TextureHandle _handle) - { - return m_freeTexture.queue(_handle); - } - - bool free(FrameBufferHandle _handle) - { - return m_freeFrameBuffer.queue(_handle); - } - - bool free(UniformHandle _handle) - { - return m_freeUniform.queue(_handle); - } - - void resetFreeHandles() - { - m_freeIndexBuffer.reset(); - m_freeVertexDecl.reset(); - m_freeVertexBuffer.reset(); - m_freeShader.reset(); - m_freeProgram.reset(); - m_freeTexture.reset(); - m_freeFrameBuffer.reset(); - m_freeUniform.reset(); - } + Frame* m_frame; SortKey m_key; - uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; - FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS]; - Clear m_clear[BGFX_CONFIG_MAX_VIEWS]; - float m_colorPalette[BGFX_CONFIG_MAX_COLOR_PALETTE][4]; - Rect m_rect[BGFX_CONFIG_MAX_VIEWS]; - Rect m_scissor[BGFX_CONFIG_MAX_VIEWS]; - Matrix4 m_view[BGFX_CONFIG_MAX_VIEWS]; - Matrix4 m_proj[2][BGFX_CONFIG_MAX_VIEWS]; - uint8_t m_viewFlags[BGFX_CONFIG_MAX_VIEWS]; - int32_t m_occlusion[BGFX_CONFIG_MAX_OCCLUSION_QUERIES]; - - uint64_t m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS+1]; - RenderItemCount m_sortValues[BGFX_CONFIG_MAX_DRAW_CALLS+1]; - RenderItem m_renderItem[BGFX_CONFIG_MAX_DRAW_CALLS+1]; - RenderDraw m_draw; + RenderDraw m_draw; RenderCompute m_compute; - uint32_t m_numVertices[BGFX_CONFIG_MAX_VERTEX_STREAMS]; - uint32_t m_blitKeys[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; - BlitItem m_blitItem[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; - uint64_t m_stateFlags; - uint32_t m_uniformBegin; - uint32_t m_uniformEnd; - uint32_t m_uniformMax; - - UniformBuffer* m_uniformBuffer; - - RenderItemCount m_num; - RenderItemCount m_numRenderItems; - RenderItemCount m_numDropped; - uint16_t m_numBlitItems; - - MatrixCache m_matrixCache; - RectCache m_rectCache; - - uint32_t m_iboffset; - uint32_t m_vboffset; - TransientIndexBuffer* m_transientIb; - TransientVertexBuffer* m_transientVb; - - Resolution m_resolution; - uint32_t m_debug; - - CommandBuffer m_cmdPre; - CommandBuffer m_cmdPost; - - template<typename Ty, uint32_t Max> - struct FreeHandle - { - FreeHandle() - : m_num(0) - { - } - - bool isQueued(Ty _handle) - { - for (uint32_t ii = 0, num = m_num; ii < num; ++ii) - { - if (m_queue[ii].idx == _handle.idx) - { - return true; - } - } - - return false; - } - - bool queue(Ty _handle) - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) - { - if (isQueued(_handle) ) - { - return false; - } - } - - m_queue[m_num] = _handle; - ++m_num; - - return true; - } - - void reset() - { - m_num = 0; - } - - Ty get(uint16_t _idx) const - { - return m_queue[_idx]; - } - - uint16_t getNumQueued() const - { - return m_num; - } - - Ty m_queue[Max]; - uint16_t m_num; - }; + RenderBind m_bind; - FreeHandle<IndexBufferHandle, BGFX_CONFIG_MAX_INDEX_BUFFERS> m_freeIndexBuffer; - FreeHandle<VertexDeclHandle, BGFX_CONFIG_MAX_VERTEX_DECLS> m_freeVertexDecl; - FreeHandle<VertexBufferHandle, BGFX_CONFIG_MAX_VERTEX_BUFFERS> m_freeVertexBuffer; - FreeHandle<ShaderHandle, BGFX_CONFIG_MAX_SHADERS> m_freeShader; - FreeHandle<ProgramHandle, BGFX_CONFIG_MAX_PROGRAMS> m_freeProgram; - FreeHandle<TextureHandle, BGFX_CONFIG_MAX_TEXTURES> m_freeTexture; - FreeHandle<FrameBufferHandle, BGFX_CONFIG_MAX_FRAME_BUFFERS> m_freeFrameBuffer; - FreeHandle<UniformHandle, BGFX_CONFIG_MAX_UNIFORMS> m_freeUniform; + uint32_t m_numSubmitted; + uint32_t m_numDropped; - TextVideoMem* m_textVideoMem; - HMD m_hmd; - Stats m_perfStats; + uint32_t m_uniformBegin; + uint32_t m_uniformEnd; + uint32_t m_numVertices[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + uint8_t m_uniformIdx; + bool m_discard; - int64_t m_waitSubmit; - int64_t m_waitRender; + typedef stl::unordered_set<uint16_t> HandleSet; + HandleSet m_uniformSet; + HandleSet m_occlusionQuerySet; - bool m_hmdInitialized; - bool m_capture; - bool m_discard; + int64_t m_cpuTimeBegin; + int64_t m_cpuTimeEnd; }; struct VertexDeclRef @@ -1953,16 +2311,20 @@ namespace bgfx void init() { - bx::memSet(m_vertexDeclRef, 0, sizeof(m_vertexDeclRef) ); - bx::memSet(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) ); + bx::memSet(m_vertexDeclRef, 0, sizeof(m_vertexDeclRef) ); + bx::memSet(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) ); + bx::memSet(m_dynamicVertexBufferRef, 0xff, sizeof(m_dynamicVertexBufferRef) ); } template <uint16_t MaxHandlesT> void shutdown(bx::HandleAllocT<MaxHandlesT>& _handleAlloc) { - for (VertexDeclMap::Iterator it = m_vertexDeclMap.first(); m_vertexDeclMap.next(it); ) + for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) { - _handleAlloc.free(it.handle); + VertexDeclHandle handle = { _handleAlloc.getHandleAt(ii) }; + m_vertexDeclRef[handle.idx] = 0; + m_vertexDeclMap.removeByHandle(handle.idx); + _handleAlloc.free(handle.idx); } m_vertexDeclMap.reset(); @@ -1974,28 +2336,59 @@ namespace bgfx return handle; } + void add(VertexDeclHandle _declHandle, uint32_t _hash) + { + m_vertexDeclRef[_declHandle.idx]++; + m_vertexDeclMap.insert(_hash, _declHandle.idx); + } + void add(VertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash) { + BX_CHECK(m_vertexBufferRef[_handle.idx].idx == kInvalidHandle, ""); m_vertexBufferRef[_handle.idx] = _declHandle; m_vertexDeclRef[_declHandle.idx]++; m_vertexDeclMap.insert(_hash, _declHandle.idx); } - VertexDeclHandle release(VertexBufferHandle _handle) + void add(DynamicVertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash) { - VertexDeclHandle declHandle = m_vertexBufferRef[_handle.idx]; - if (isValid(declHandle) ) + BX_CHECK(m_dynamicVertexBufferRef[_handle.idx].idx == kInvalidHandle, ""); + m_dynamicVertexBufferRef[_handle.idx] = _declHandle; + m_vertexDeclRef[_declHandle.idx]++; + m_vertexDeclMap.insert(_hash, _declHandle.idx); + } + + VertexDeclHandle release(VertexDeclHandle _declHandle) + { + if (isValid(_declHandle) ) { - m_vertexDeclRef[declHandle.idx]--; + m_vertexDeclRef[_declHandle.idx]--; - if (0 != m_vertexDeclRef[declHandle.idx]) + if (0 == m_vertexDeclRef[_declHandle.idx]) { - VertexDeclHandle invalid = BGFX_INVALID_HANDLE; - return invalid; + m_vertexDeclMap.removeByHandle(_declHandle.idx); + return _declHandle; } } - m_vertexDeclMap.removeByHandle(declHandle.idx); + VertexDeclHandle invalid = BGFX_INVALID_HANDLE; + return invalid; + } + + VertexDeclHandle release(VertexBufferHandle _handle) + { + VertexDeclHandle declHandle = m_vertexBufferRef[_handle.idx]; + declHandle = release(declHandle); + m_vertexBufferRef[_handle.idx].idx = kInvalidHandle; + + return declHandle; + } + + VertexDeclHandle release(DynamicVertexBufferHandle _handle) + { + VertexDeclHandle declHandle = m_dynamicVertexBufferRef[_handle.idx]; + declHandle = release(declHandle); + m_dynamicVertexBufferRef[_handle.idx].idx = kInvalidHandle; return declHandle; } @@ -2005,13 +2398,14 @@ namespace bgfx uint16_t m_vertexDeclRef[BGFX_CONFIG_MAX_VERTEX_DECLS]; VertexDeclHandle m_vertexBufferRef[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; + VertexDeclHandle m_dynamicVertexBufferRef[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS]; }; // First-fit non-local allocator. class NonLocalAllocator { public: - static const uint64_t invalidBlock = UINT64_MAX; + static const uint64_t kInvalidBlock = UINT64_MAX; NonLocalAllocator() { @@ -2071,7 +2465,7 @@ namespace bgfx } // there is no block large enough. - return invalidBlock; + return kInvalidBlock; } void free(uint64_t _block) @@ -2135,6 +2529,7 @@ namespace bgfx virtual ~RendererContextI() = 0; virtual RendererType::Enum getRendererType() const = 0; virtual const char* getRendererName() const = 0; + virtual bool isDeviceRemoved() = 0; virtual void flip(HMD& _hmd) = 0; virtual void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) = 0; virtual void destroyIndexBuffer(IndexBufferHandle _handle) = 0; @@ -2167,10 +2562,11 @@ namespace bgfx virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0; virtual void destroyUniform(UniformHandle _handle) = 0; virtual void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) = 0; - virtual void updateViewName(uint8_t _id, const char* _name) = 0; + virtual void updateViewName(ViewId _id, const char* _name) = 0; virtual void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) = 0; virtual void setMarker(const char* _marker, uint32_t _size) = 0; virtual void invalidateOcclusionQuery(OcclusionQueryHandle _handle) = 0; + virtual void setName(Handle _handle, const char* _name) = 0; virtual void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) = 0; virtual void blitSetup(TextVideoMemBlitter& _blitter) = 0; virtual void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) = 0; @@ -2197,10 +2593,11 @@ namespace bgfx , m_numFreeDynamicVertexBufferHandles(0) , m_numFreeOcclusionQueryHandles(0) , m_colorPaletteDirty(0) - , m_instBufferCount(0) , m_frames(0) , m_debug(BGFX_DEBUG_NONE) , m_renderCtx(NULL) + , m_renderMain(NULL) + , m_renderNoop(NULL) , m_rendererInitialized(false) , m_exit(false) , m_flipAfterRender(false) @@ -2212,13 +2609,13 @@ namespace bgfx { } - static int32_t renderThread(void* /*_userData*/) + static int32_t renderThread(bx::Thread* /*_self*/, void* /*_userData*/) { BX_TRACE("render thread start"); BGFX_PROFILER_SET_CURRENT_THREAD_NAME("bgfx - Render Thread"); while (RenderFrame::Exiting != bgfx::renderFrame() ) {}; BX_TRACE("render thread exit"); - return EXIT_SUCCESS; + return bx::kExitSuccess; } // game thread @@ -2252,7 +2649,10 @@ namespace bgfx m_flipAfterRender = !!(_flags & BGFX_RESET_FLIP_AFTER_RENDER); - bx::memSet(m_fb, 0xff, sizeof(m_fb) ); + for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) + { + m_view[ii].setFrameBuffer(BGFX_INVALID_HANDLE); + } for (uint16_t ii = 0, num = m_textureHandle.getNumHandles(); ii < num; ++ii) { @@ -2278,22 +2678,30 @@ namespace bgfx BGFX_API_FUNC(void dbgTextClear(uint8_t _attr, bool _small) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + m_submit->m_textVideoMem->resize(_small, (uint16_t)m_resolution.m_width, (uint16_t)m_resolution.m_height); m_submit->m_textVideoMem->clear(_attr); } BGFX_API_FUNC(void dbgTextPrintfVargs(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + m_submit->m_textVideoMem->printfVargs(_x, _y, _attr, _format, _argList); } BGFX_API_FUNC(void dbgTextImage(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + m_submit->m_textVideoMem->image(_x, _y, _width, _height, _data, _pitch); } BGFX_API_FUNC(const HMD* getHMD() ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + if (m_submit->m_hmdInitialized) { return &m_submit->m_hmd; @@ -2304,6 +2712,8 @@ namespace bgfx BGFX_API_FUNC(const Stats* getPerfStats() ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + Stats& stats = m_submit->m_perfStats; const Resolution& resolution = m_submit->m_resolution; stats.width = uint16_t(resolution.m_width); @@ -2311,11 +2721,14 @@ namespace bgfx const TextVideoMem* tvm = m_submit->m_textVideoMem; stats.textWidth = tvm->m_width; stats.textHeight = tvm->m_height; + stats.encoderStats = m_encoderStats; return &stats; } BGFX_API_FUNC(IndexBufferHandle createIndexBuffer(const Memory* _mem, uint16_t _flags) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + IndexBufferHandle handle = { m_indexBufferHandle.alloc() }; BX_WARN(isValid(handle), "Failed to allocate index buffer handle."); @@ -2326,12 +2739,18 @@ namespace bgfx cmdbuf.write(_mem); cmdbuf.write(_flags); } + else + { + release(_mem); + } return handle; } BGFX_API_FUNC(void destroyIndexBuffer(IndexBufferHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyIndexBuffer", m_indexBufferHandle, _handle); bool ok = m_submit->free(_handle); BX_UNUSED(ok); BX_CHECK(ok, "Index buffer handle %d is already destroyed!", _handle.idx); @@ -2346,8 +2765,12 @@ namespace bgfx if (!isValid(declHandle) ) { - VertexDeclHandle temp = { m_vertexDeclHandle.alloc() }; - declHandle = temp; + declHandle.idx = m_vertexDeclHandle.alloc(); + if (!isValid(declHandle) ) + { + return declHandle; + } + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexDecl); cmdbuf.write(declHandle); cmdbuf.write(_decl); @@ -2358,12 +2781,20 @@ namespace bgfx BGFX_API_FUNC(VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + VertexBufferHandle handle = { m_vertexBufferHandle.alloc() }; - BX_WARN(isValid(handle), "Failed to allocate vertex buffer handle."); if (isValid(handle) ) { VertexDeclHandle declHandle = findVertexDecl(_decl); + if (!isValid(declHandle) ) + { + BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); + m_vertexBufferHandle.free(handle.idx); + return BGFX_INVALID_HANDLE; + } + m_declRef.add(handle, declHandle, _decl.m_hash); m_vertexBuffers[handle.idx].m_stride = _decl.m_stride; @@ -2373,13 +2804,20 @@ namespace bgfx cmdbuf.write(_mem); cmdbuf.write(declHandle); cmdbuf.write(_flags); + + return handle; } - return handle; + BX_TRACE("WARNING: Failed to allocate vertex buffer handle (BGFX_CONFIG_MAX_VERTEX_BUFFERS, max: %d).", BGFX_CONFIG_MAX_VERTEX_BUFFERS); + release(_mem); + + return BGFX_INVALID_HANDLE; } BGFX_API_FUNC(void destroyVertexBuffer(VertexBufferHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyVertexBuffer", m_vertexBufferHandle, _handle); bool ok = m_submit->free(_handle); BX_UNUSED(ok); BX_CHECK(ok, "Vertex buffer handle %d is already destroyed!", _handle.idx); @@ -2404,7 +2842,7 @@ namespace bgfx uint64_t allocDynamicIndexBuffer(uint32_t _size, uint16_t _flags) { uint64_t ptr = m_dynIndexBufferAllocator.alloc(_size); - if (ptr == NonLocalAllocator::invalidBlock) + if (ptr == NonLocalAllocator::kInvalidBlock) { IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() }; BX_WARN(isValid(indexBufferHandle), "Failed to allocate index buffer handle."); @@ -2429,6 +2867,8 @@ namespace bgfx BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num, uint16_t _flags) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + DynamicIndexBufferHandle handle = BGFX_INVALID_HANDLE; const uint32_t indexSize = 0 == (_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; uint32_t size = BX_ALIGN_16(_num*indexSize); @@ -2452,7 +2892,7 @@ namespace bgfx else { ptr = allocDynamicIndexBuffer(size, _flags); - if (ptr == NonLocalAllocator::invalidBlock) + if (ptr == NonLocalAllocator::kInvalidBlock) { return handle; } @@ -2477,18 +2917,28 @@ namespace bgfx BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem, uint16_t _flags) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BX_CHECK(0 == (_flags & BGFX_BUFFER_COMPUTE_READ_WRITE), "Cannot initialize compute buffer from CPU."); const uint32_t indexSize = 0 == (_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; DynamicIndexBufferHandle handle = createDynamicIndexBuffer(_mem->size/indexSize, _flags); + if (isValid(handle) ) { updateDynamicIndexBuffer(handle, 0, _mem); } + else + { + release(_mem); + } + return handle; } BGFX_API_FUNC(void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _startIndex, const Memory* _mem) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("updateDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle); DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx]; @@ -2526,6 +2976,8 @@ namespace bgfx BGFX_API_FUNC(void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle); m_freeDynamicIndexBufferHandle[m_numFreeDynamicIndexBufferHandles++] = _handle; @@ -2558,14 +3010,14 @@ namespace bgfx uint64_t allocDynamicVertexBuffer(uint32_t _size, uint16_t _flags) { uint64_t ptr = m_dynVertexBufferAllocator.alloc(_size); - if (ptr == NonLocalAllocator::invalidBlock) + if (ptr == NonLocalAllocator::kInvalidBlock) { VertexBufferHandle vertexBufferHandle = { m_vertexBufferHandle.alloc() }; BX_WARN(isValid(vertexBufferHandle), "Failed to allocate dynamic vertex buffer handle."); if (!isValid(vertexBufferHandle) ) { - return NonLocalAllocator::invalidBlock; + return NonLocalAllocator::kInvalidBlock; } uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size); @@ -2584,15 +3036,18 @@ namespace bgfx BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE; uint32_t size = bx::strideAlign16(_num*_decl.m_stride, _decl.m_stride); uint64_t ptr = 0; - if (0 != (_flags & BGFX_BUFFER_COMPUTE_WRITE) ) + if (0 != (_flags & BGFX_BUFFER_COMPUTE_READ_WRITE) ) { VertexBufferHandle vertexBufferHandle = { m_vertexBufferHandle.alloc() }; if (!isValid(vertexBufferHandle) ) { + BX_TRACE("WARNING: Failed to allocate vertex buffer handle (BGFX_CONFIG_MAX_VERTEX_BUFFERS, max: %d).", BGFX_CONFIG_MAX_VERTEX_BUFFERS); return handle; } @@ -2606,15 +3061,26 @@ namespace bgfx else { ptr = allocDynamicVertexBuffer(size, _flags); - if (ptr == NonLocalAllocator::invalidBlock) + if (ptr == NonLocalAllocator::kInvalidBlock) { return handle; } } VertexDeclHandle declHandle = findVertexDecl(_decl); + if (!isValid(declHandle) ) + { + BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); + return handle; + } handle.idx = m_dynamicVertexBufferHandle.alloc(); + if (!isValid(handle) ) + { + BX_TRACE("WARNING: Failed to allocate dynamic vertex buffer handle (BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS, max: %d).", BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS); + return handle; + } + DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[handle.idx]; dvb.m_handle.idx = uint16_t(ptr>>32); dvb.m_offset = uint32_t(ptr); @@ -2624,24 +3090,34 @@ namespace bgfx dvb.m_stride = _decl.m_stride; dvb.m_decl = declHandle; dvb.m_flags = _flags; - m_declRef.add(dvb.m_handle, declHandle, _decl.m_hash); + m_declRef.add(handle, declHandle, _decl.m_hash); return handle; } BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + uint32_t numVertices = _mem->size/_decl.m_stride; DynamicVertexBufferHandle handle = createDynamicVertexBuffer(numVertices, _decl, _flags); + if (isValid(handle) ) { updateDynamicVertexBuffer(handle, 0, _mem); } + else + { + release(_mem); + } + return handle; } BGFX_API_FUNC(void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, const Memory* _mem) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("updateDynamicVertexBuffer", m_dynamicVertexBufferHandle, _handle); DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx]; @@ -2680,6 +3156,8 @@ namespace bgfx BGFX_API_FUNC(void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyDynamicVertexBuffer", m_dynamicVertexBufferHandle, _handle); m_freeDynamicVertexBufferHandle[m_numFreeDynamicVertexBufferHandles++] = _handle; @@ -2687,9 +3165,9 @@ namespace bgfx void destroyDynamicVertexBufferInternal(DynamicVertexBufferHandle _handle) { - DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx]; + VertexDeclHandle declHandle = m_declRef.release(_handle); + BGFX_CHECK_HANDLE_INVALID_OK("destroyDynamicVertexBufferInternal", m_vertexDeclHandle, declHandle); - VertexDeclHandle declHandle = m_declRef.release(dvb.m_handle); if (isValid(declHandle) ) { CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexDecl); @@ -2697,7 +3175,9 @@ namespace bgfx m_render->free(declHandle); } - if (0 != (dvb.m_flags & BGFX_BUFFER_COMPUTE_WRITE) ) + DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx]; + + if (0 != (dvb.m_flags & BGFX_BUFFER_COMPUTE_READ_WRITE) ) { destroyVertexBuffer(dvb.m_handle); } @@ -2717,13 +3197,17 @@ namespace bgfx m_dynamicVertexBufferHandle.free(_handle.idx); } - BGFX_API_FUNC(uint32_t getAvailTransientIndexBuffer(uint32_t _num) const) + BGFX_API_FUNC(uint32_t getAvailTransientIndexBuffer(uint32_t _num) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + return m_submit->getAvailTransientIndexBuffer(_num); } - BGFX_API_FUNC(uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) const) + BGFX_API_FUNC(uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + return m_submit->getAvailTransientVertexBuffer(_num, _stride); } @@ -2762,6 +3246,8 @@ namespace bgfx BGFX_API_FUNC(void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + uint32_t offset = m_submit->allocTransientIndexBuffer(_num); TransientIndexBuffer& tib = *m_submit->m_transientIb; @@ -2822,6 +3308,8 @@ namespace bgfx BGFX_API_FUNC(void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + VertexDeclHandle declHandle = m_declRef.find(_decl.m_hash); TransientVertexBuffer& dvb = *m_submit->m_transientVb; @@ -2833,7 +3321,7 @@ namespace bgfx CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexDecl); cmdbuf.write(declHandle); cmdbuf.write(_decl); - m_declRef.add(dvb.handle, declHandle, _decl.m_hash); + m_declRef.add(declHandle, _decl.m_hash); } uint32_t offset = m_submit->allocTransientVertexBuffer(_num, _decl.m_stride); @@ -2846,23 +3334,18 @@ namespace bgfx _tvb->decl = declHandle; } - BGFX_API_FUNC(const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride) ) + BGFX_API_FUNC(void allocInstanceDataBuffer(InstanceDataBuffer* _idb, uint32_t _num, uint16_t _stride) ) { - ++m_instBufferCount; - uint16_t stride = BX_ALIGN_16(_stride); uint32_t offset = m_submit->allocTransientVertexBuffer(_num, stride); TransientVertexBuffer& dvb = *m_submit->m_transientVb; - InstanceDataBuffer* idb = (InstanceDataBuffer*)BX_ALLOC(g_allocator, sizeof(InstanceDataBuffer) ); - idb->data = &dvb.data[offset]; - idb->size = _num * stride; - idb->offset = offset; - idb->num = _num; - idb->stride = stride; - idb->handle = dvb.handle; - - return idb; + _idb->data = &dvb.data[offset]; + _idb->size = _num * stride; + _idb->offset = offset; + _idb->num = _num; + _idb->stride = stride; + _idb->handle = dvb.handle; } IndirectBufferHandle createIndirectBuffer(uint32_t _num) @@ -2897,6 +3380,8 @@ namespace bgfx BGFX_API_FUNC(ShaderHandle createShader(const Memory* _mem) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + bx::MemoryReader reader(_mem->data, _mem->size); bx::Error err; @@ -2907,6 +3392,7 @@ namespace bgfx if (!err.isOk() ) { ShaderHandle invalid = BGFX_INVALID_HANDLE; + release(_mem); return invalid; } @@ -2921,14 +3407,28 @@ namespace bgfx , ( (uint8_t*)&magic)[3] ); ShaderHandle invalid = BGFX_INVALID_HANDLE; + release(_mem); return invalid; } + const uint32_t shaderHash = bx::hash<bx::HashMurmur2A>(_mem->data, _mem->size); + const uint16_t idx = m_shaderHashMap.find(shaderHash); + if (kInvalidHandle != idx) + { + ShaderHandle handle = { idx }; + shaderIncRef(handle); + release(_mem); + return handle; + } + ShaderHandle handle = { m_shaderHandle.alloc() }; BX_WARN(isValid(handle), "Failed to allocate shader handle."); if (isValid(handle) ) { + bool ok = m_shaderHashMap.insert(shaderHash, handle.idx); + BX_CHECK(ok, "Shader already exists!"); BX_UNUSED(ok); + uint32_t iohash; bx::read(&reader, iohash); @@ -2939,7 +3439,6 @@ namespace bgfx sr.m_refCount = 1; sr.m_hash = iohash; sr.m_num = 0; - sr.m_owned = false; sr.m_uniforms = NULL; UniformHandle* uniforms = (UniformHandle*)alloca(count*sizeof(UniformHandle) ); @@ -2985,12 +3484,18 @@ namespace bgfx cmdbuf.write(handle); cmdbuf.write(_mem); } + else + { + release(_mem); + } return handle; } BGFX_API_FUNC(uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms, uint16_t _max) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + if (!isValid(_handle) ) { BX_WARN(false, "Passing invalid shader handle to bgfx::getShaderUniforms."); @@ -3006,8 +3511,31 @@ namespace bgfx return sr.m_num; } + void setName(Handle _handle, const char* _name) + { + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::SetName); + cmdbuf.write(_handle); + uint16_t len = (uint8_t)bx::strLen(_name)+1; + cmdbuf.write(len); + cmdbuf.write(_name, len); + } + + BGFX_API_FUNC(void setName(ShaderHandle _handle, const char* _name) ) + { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + + BGFX_CHECK_HANDLE("setName", m_shaderHandle, _handle); + + ShaderRef& sr = m_shaderRef[_handle.idx]; + sr.m_name.set(_name); + + setName(convert(_handle), _name); + } + BGFX_API_FUNC(void destroyShader(ShaderHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyShader", m_shaderHandle, _handle); if (!isValid(_handle) ) @@ -3021,12 +3549,7 @@ namespace bgfx void shaderTakeOwnership(ShaderHandle _handle) { - ShaderRef& sr = m_shaderRef[_handle.idx]; - if (!sr.m_owned) - { - sr.m_owned = true; - shaderDecRef(_handle); - } + shaderDecRef(_handle); } void shaderIncRef(ShaderHandle _handle) @@ -3058,11 +3581,15 @@ namespace bgfx sr.m_uniforms = NULL; sr.m_num = 0; } + + m_shaderHashMap.removeByHandle(_handle.idx); } } BGFX_API_FUNC(ProgramHandle createProgram(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + if (!isValid(_vsh) || !isValid(_fsh) ) { @@ -3071,45 +3598,46 @@ namespace bgfx return invalid; } - uint16_t idx = m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx); - if (ProgramHashMap::invalid != idx) + ProgramHandle handle = { m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx) }; + if (isValid(handle) ) { - ProgramHandle handle = { idx }; ProgramRef& pr = m_programRef[handle.idx]; ++pr.m_refCount; - return handle; + shaderIncRef(pr.m_vsh); + shaderIncRef(pr.m_fsh); } - - const ShaderRef& vsr = m_shaderRef[_vsh.idx]; - const ShaderRef& fsr = m_shaderRef[_fsh.idx]; - if (vsr.m_hash != fsr.m_hash) - { - BX_TRACE("Vertex shader output doesn't match fragment shader input."); - ProgramHandle invalid = BGFX_INVALID_HANDLE; - return invalid; - } - - ProgramHandle handle; - handle.idx = m_programHandle.alloc(); - - BX_WARN(isValid(handle), "Failed to allocate program handle."); - if (isValid(handle) ) + else { - shaderIncRef(_vsh); - shaderIncRef(_fsh); - ProgramRef& pr = m_programRef[handle.idx]; - pr.m_vsh = _vsh; - pr.m_fsh = _fsh; - pr.m_refCount = 1; + const ShaderRef& vsr = m_shaderRef[_vsh.idx]; + const ShaderRef& fsr = m_shaderRef[_fsh.idx]; + if (vsr.m_hash != fsr.m_hash) + { + BX_TRACE("Vertex shader output doesn't match fragment shader input."); + ProgramHandle invalid = BGFX_INVALID_HANDLE; + return invalid; + } - const uint32_t key = uint32_t(_fsh.idx<<16)|_vsh.idx; - bool ok = m_programHashMap.insert(key, handle.idx); - BX_CHECK(ok, "Program already exists (key: %x, handle: %3d)!", key, handle.idx); BX_UNUSED(ok); + handle.idx = m_programHandle.alloc(); - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram); - cmdbuf.write(handle); - cmdbuf.write(_vsh); - cmdbuf.write(_fsh); + BX_WARN(isValid(handle), "Failed to allocate program handle."); + if (isValid(handle) ) + { + shaderIncRef(_vsh); + shaderIncRef(_fsh); + ProgramRef& pr = m_programRef[handle.idx]; + pr.m_vsh = _vsh; + pr.m_fsh = _fsh; + pr.m_refCount = 1; + + const uint32_t key = uint32_t(_fsh.idx<<16)|_vsh.idx; + bool ok = m_programHashMap.insert(key, handle.idx); + BX_CHECK(ok, "Program already exists (key: %x, handle: %3d)!", key, handle.idx); BX_UNUSED(ok); + + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram); + cmdbuf.write(handle); + cmdbuf.write(_vsh); + cmdbuf.write(_fsh); + } } if (_destroyShaders) @@ -3123,6 +3651,8 @@ namespace bgfx BGFX_API_FUNC(ProgramHandle createProgram(ShaderHandle _vsh, bool _destroyShader) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + if (!isValid(_vsh) ) { BX_WARN(false, "Compute shader is invalid (vsh %d).", _vsh.idx); @@ -3130,36 +3660,37 @@ namespace bgfx return invalid; } - uint16_t idx = m_programHashMap.find(_vsh.idx); - if (ProgramHashMap::invalid != idx) + ProgramHandle handle = { m_programHashMap.find(_vsh.idx) }; + + if (isValid(handle) ) { - ProgramHandle handle = { idx }; ProgramRef& pr = m_programRef[handle.idx]; ++pr.m_refCount; - return handle; + shaderIncRef(pr.m_vsh); } - - ProgramHandle handle; - handle.idx = m_programHandle.alloc(); - - BX_WARN(isValid(handle), "Failed to allocate program handle."); - if (isValid(handle) ) + else { - shaderIncRef(_vsh); - ProgramRef& pr = m_programRef[handle.idx]; - pr.m_vsh = _vsh; - ShaderHandle fsh = BGFX_INVALID_HANDLE; - pr.m_fsh = fsh; - pr.m_refCount = 1; + handle.idx = m_programHandle.alloc(); - const uint32_t key = uint32_t(_vsh.idx); - bool ok = m_programHashMap.insert(key, handle.idx); - BX_CHECK(ok, "Program already exists (key: %x, handle: %3d)!", key, handle.idx); BX_UNUSED(ok); - - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram); - cmdbuf.write(handle); - cmdbuf.write(_vsh); - cmdbuf.write(fsh); + BX_WARN(isValid(handle), "Failed to allocate program handle."); + if (isValid(handle) ) + { + shaderIncRef(_vsh); + ProgramRef& pr = m_programRef[handle.idx]; + pr.m_vsh = _vsh; + ShaderHandle fsh = BGFX_INVALID_HANDLE; + pr.m_fsh = fsh; + pr.m_refCount = 1; + + const uint32_t key = uint32_t(_vsh.idx); + bool ok = m_programHashMap.insert(key, handle.idx); + BX_CHECK(ok, "Program already exists (key: %x, handle: %3d)!", key, handle.idx); BX_UNUSED(ok); + + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram); + cmdbuf.write(handle); + cmdbuf.write(_vsh); + cmdbuf.write(fsh); + } } if (_destroyShader) @@ -3172,9 +3703,18 @@ namespace bgfx BGFX_API_FUNC(void destroyProgram(ProgramHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyProgram", m_programHandle, _handle); ProgramRef& pr = m_programRef[_handle.idx]; + shaderDecRef(pr.m_vsh); + + if (isValid(pr.m_fsh) ) + { + shaderDecRef(pr.m_fsh); + } + int32_t refs = --pr.m_refCount; if (0 == refs) { @@ -3184,29 +3724,22 @@ namespace bgfx CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyProgram); cmdbuf.write(_handle); - shaderDecRef(pr.m_vsh); - uint32_t hash = pr.m_vsh.idx; - - if (isValid(pr.m_fsh) ) - { - shaderDecRef(pr.m_fsh); - hash |= pr.m_fsh.idx << 16; - } - m_programHashMap.removeByHandle(_handle.idx); } } BGFX_API_FUNC(TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info, BackbufferRatio::Enum _ratio) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + TextureInfo ti; if (NULL == _info) { _info = &ti; } - ImageContainer imageContainer; - if (imageParse(imageContainer, _mem->data, _mem->size) ) + bimg::ImageContainer imageContainer; + if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) { calcTextureSize(*_info , (uint16_t)imageContainer.m_width @@ -3247,12 +3780,30 @@ namespace bgfx cmdbuf.write(_flags); cmdbuf.write(_skip); } + else + { + release(_mem); + } return handle; } + BGFX_API_FUNC(void setName(TextureHandle _handle, const char* _name) ) + { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + + BGFX_CHECK_HANDLE("setName", m_textureHandle, _handle); + + TextureRef& ref = m_textureRef[_handle.idx]; + ref.m_name.set(_name); + + setName(convert(_handle), _name); + } + BGFX_API_FUNC(void destroyTexture(TextureHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyTexture", m_textureHandle, _handle); if (!isValid(_handle) ) @@ -3266,6 +3817,8 @@ namespace bgfx BGFX_API_FUNC(uint32_t readTexture(TextureHandle _handle, void* _data, uint8_t _mip) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("readTexture", m_textureHandle, _handle); const TextureRef& ref = m_textureRef[_handle.idx]; @@ -3290,7 +3843,7 @@ namespace bgfx , _handle.idx , _width , _height - , bgfx::getName(TextureFormat::Enum(textureRef.m_format) ) + , bimg::getName(bimg::TextureFormat::Enum(textureRef.m_format) ) ); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::ResizeTexture); @@ -3322,6 +3875,8 @@ namespace bgfx int32_t refs = --ref.m_refCount; if (0 == refs) { + ref.m_name.clear(); + bool ok = m_submit->free(_handle); BX_UNUSED(ok); BX_CHECK(ok, "Texture handle %d is already destroyed!", _handle.idx); @@ -3344,6 +3899,8 @@ namespace bgfx , const Memory* _mem ) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateTexture); cmdbuf.write(_handle); cmdbuf.write(_side); @@ -3368,7 +3925,7 @@ namespace bgfx for (uint32_t ii = 0; ii < _num; ++ii) { TextureHandle texHandle = _attachment[ii].handle; - if (isDepth(TextureFormat::Enum(m_textureRef[texHandle.idx].m_format))) + if (bimg::isDepth(bimg::TextureFormat::Enum(m_textureRef[texHandle.idx].m_format))) { ++depth; } @@ -3385,6 +3942,8 @@ namespace bgfx BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BX_CHECK(checkFrameBuffer(_num, _attachment) , "Too many frame buffer attachments (num attachments: %d, max color attachments %d)!" , _num @@ -3432,6 +3991,8 @@ namespace bgfx BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + FrameBufferHandle handle = { m_frameBufferHandle.alloc() }; BX_WARN(isValid(handle), "Failed to allocate frame buffer handle."); @@ -3455,6 +4016,8 @@ namespace bgfx BGFX_API_FUNC(TextureHandle getTexture(FrameBufferHandle _handle, uint8_t _attachment) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("getTexture", m_frameBufferHandle, _handle); const FrameBufferRef& ref = m_frameBufferRef[_handle.idx]; @@ -3470,6 +4033,8 @@ namespace bgfx BGFX_API_FUNC(void destroyFrameBuffer(FrameBufferHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyFrameBuffer", m_frameBufferHandle, _handle); bool ok = m_submit->free(_handle); BX_UNUSED(ok); BX_CHECK(ok, "Frame buffer handle %d is already destroyed!", _handle.idx); @@ -3493,6 +4058,8 @@ namespace bgfx BGFX_API_FUNC(UniformHandle createUniform(const char* _name, UniformType::Enum _type, uint16_t _num) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BX_WARN(PredefinedUniform::Count == nameToPredefinedUniformEnum(_name), "%s is predefined uniform name.", _name); if (PredefinedUniform::Count != nameToPredefinedUniformEnum(_name) ) { @@ -3502,8 +4069,8 @@ namespace bgfx _num = bx::uint16_max(1, _num); - uint16_t idx = m_uniformHashMap.find(bx::hashMurmur2A(_name) ); - if (UniformHashMap::invalid != idx) + uint16_t idx = m_uniformHashMap.find(bx::hash<bx::HashMurmur2A>(_name) ); + if (kInvalidHandle != idx) { UniformHandle handle = { idx }; UniformRef& uniform = m_uniformRef[handle.idx]; @@ -3526,7 +4093,7 @@ namespace bgfx cmdbuf.write(handle); cmdbuf.write(uniform.m_type); cmdbuf.write(uniform.m_num); - uint8_t len = (uint8_t)bx::strnlen(_name)+1; + uint8_t len = (uint8_t)bx::strLen(_name)+1; cmdbuf.write(len); cmdbuf.write(_name, len); } @@ -3547,14 +4114,14 @@ namespace bgfx uniform.m_type = _type; uniform.m_num = _num; - bool ok = m_uniformHashMap.insert(bx::hashMurmur2A(_name), handle.idx); + bool ok = m_uniformHashMap.insert(bx::hash<bx::HashMurmur2A>(_name), handle.idx); BX_CHECK(ok, "Uniform already exists (name: %s)!", _name); BX_UNUSED(ok); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform); cmdbuf.write(handle); cmdbuf.write(_type); cmdbuf.write(_num); - uint8_t len = (uint8_t)bx::strnlen(_name)+1; + uint8_t len = (uint8_t)bx::strLen(_name)+1; cmdbuf.write(len); cmdbuf.write(_name, len); } @@ -3568,16 +4135,20 @@ namespace bgfx BGFX_API_FUNC(void getUniformInfo(UniformHandle _handle, UniformInfo& _info) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("getUniformInfo", m_uniformHandle, _handle); UniformRef& uniform = m_uniformRef[_handle.idx]; - bx::strlcpy(_info.name, uniform.m_name.getPtr(), sizeof(_info.name) ); + bx::strCopy(_info.name, sizeof(_info.name), uniform.m_name.getPtr() ); _info.type = uniform.m_type; _info.num = uniform.m_num; } BGFX_API_FUNC(void destroyUniform(UniformHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyUniform", m_uniformHandle, _handle); UniformRef& uniform = m_uniformRef[_handle.idx]; @@ -3599,6 +4170,8 @@ namespace bgfx BGFX_API_FUNC(OcclusionQueryHandle createOcclusionQuery() ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + OcclusionQueryHandle handle = { m_occlusionQueryHandle.alloc() }; if (isValid(handle) ) { @@ -3613,6 +4186,8 @@ namespace bgfx BGFX_API_FUNC(OcclusionQueryResult::Enum getResult(OcclusionQueryHandle _handle, int32_t* _result) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("getResult", m_occlusionQueryHandle, _handle); switch (m_submit->m_occlusion[_handle.idx]) @@ -3632,6 +4207,8 @@ namespace bgfx BGFX_API_FUNC(void destroyOcclusionQuery(OcclusionQueryHandle _handle) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("destroyOcclusionQuery", m_occlusionQueryHandle, _handle); m_freeOcclusionQueryHandle[m_numFreeOcclusionQueryHandles++] = _handle; @@ -3639,6 +4216,8 @@ namespace bgfx BGFX_API_FUNC(void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE_INVALID_OK("requestScreenShot", m_frameBufferHandle, _handle); if (isValid(_handle) ) @@ -3652,7 +4231,7 @@ namespace bgfx } CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::RequestScreenShot); - uint16_t len = (uint16_t)bx::strnlen(_filePath)+1; + uint16_t len = (uint16_t)bx::strLen(_filePath)+1; cmdbuf.write(_handle); cmdbuf.write(len); cmdbuf.write(_filePath, len); @@ -3660,6 +4239,8 @@ namespace bgfx BGFX_API_FUNC(void setPaletteColor(uint8_t _index, const float _rgba[4]) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BX_CHECK(_index < BGFX_CONFIG_MAX_COLOR_PALETTE, "Color palette index out of bounds %d (max: %d)." , _index , BGFX_CONFIG_MAX_COLOR_PALETTE @@ -3668,404 +4249,104 @@ namespace bgfx m_colorPaletteDirty = 2; } - BGFX_API_FUNC(void setViewName(uint8_t _id, const char* _name) ) + BGFX_API_FUNC(void setViewName(ViewId _id, const char* _name) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateViewName); cmdbuf.write(_id); - uint16_t len = (uint16_t)bx::strnlen(_name)+1; + uint16_t len = (uint16_t)bx::strLen(_name)+1; cmdbuf.write(len); cmdbuf.write(_name, len); } - BGFX_API_FUNC(void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) + BGFX_API_FUNC(void setViewRect(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) { - Rect& rect = m_rect[_id]; - rect.m_x = (uint16_t)bx::uint32_imax(int16_t(_x), 0); - rect.m_y = (uint16_t)bx::uint32_imax(int16_t(_y), 0); - rect.m_width = bx::uint16_max(_width, 1); - rect.m_height = bx::uint16_max(_height, 1); + m_view[_id].setRect(_x, _y, _width, _height); } - BGFX_API_FUNC(void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) + BGFX_API_FUNC(void setViewScissor(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) { - Rect& scissor = m_scissor[_id]; - scissor.m_x = _x; - scissor.m_y = _y; - scissor.m_width = _width; - scissor.m_height = _height; + m_view[_id].setScissor(_x, _y, _width, _height); } - BGFX_API_FUNC(void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) ) + BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) ) { BX_CHECK(bx::fequal(_depth, bx::fclamp(_depth, 0.0f, 1.0f), 0.0001f) , "Clear depth value must be between 0.0 and 1.0 (_depth %f)." , _depth ); - Clear& clear = m_clear[_id]; - clear.m_flags = _flags; - clear.m_index[0] = uint8_t(_rgba>>24); - clear.m_index[1] = uint8_t(_rgba>>16); - clear.m_index[2] = uint8_t(_rgba>> 8); - clear.m_index[3] = uint8_t(_rgba>> 0); - clear.m_depth = _depth; - clear.m_stencil = _stencil; + m_view[_id].setClear(_flags, _rgba, _depth, _stencil); } - BGFX_API_FUNC(void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) ) + BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) ) { BX_CHECK(bx::fequal(_depth, bx::fclamp(_depth, 0.0f, 1.0f), 0.0001f) , "Clear depth value must be between 0.0 and 1.0 (_depth %f)." , _depth ); - Clear& clear = m_clear[_id]; - clear.m_flags = (_flags & ~BGFX_CLEAR_COLOR) - | (0xff != (_0&_1&_2&_3&_4&_5&_6&_7) ? BGFX_CLEAR_COLOR|BGFX_CLEAR_COLOR_USE_PALETTE : 0) - ; - clear.m_index[0] = _0; - clear.m_index[1] = _1; - clear.m_index[2] = _2; - clear.m_index[3] = _3; - clear.m_index[4] = _4; - clear.m_index[5] = _5; - clear.m_index[6] = _6; - clear.m_index[7] = _7; - clear.m_depth = _depth; - clear.m_stencil = _stencil; + m_view[_id].setClear(_flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); } - BGFX_API_FUNC(void setViewSeq(uint8_t _id, bool _enabled) ) + BGFX_API_FUNC(void setViewMode(ViewId _id, ViewMode::Enum _mode) ) { - m_seqMask[_id] = _enabled ? 0xffff : 0x0; + m_view[_id].setMode(_mode); } - BGFX_API_FUNC(void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) ) + BGFX_API_FUNC(void setViewFrameBuffer(ViewId _id, FrameBufferHandle _handle) ) { BGFX_CHECK_HANDLE_INVALID_OK("setViewFrameBuffer", m_frameBufferHandle, _handle); - m_fb[_id] = _handle; + m_view[_id].setFrameBuffer(_handle); } - BGFX_API_FUNC(void setViewTransform(uint8_t _id, const void* _view, const void* _proj, uint8_t _flags, const void* _proj1) ) + BGFX_API_FUNC(void setViewTransform(ViewId _id, const void* _view, const void* _proj, uint8_t _flags, const void* _proj1) ) { - m_viewFlags[_id] = _flags; - - if (NULL != _view) - { - bx::memCopy(m_view[_id].un.val, _view, sizeof(Matrix4) ); - } - else - { - m_view[_id].setIdentity(); - } - - if (NULL != _proj) - { - bx::memCopy(m_proj[0][_id].un.val, _proj, sizeof(Matrix4) ); - } - else - { - m_proj[0][_id].setIdentity(); - } - - if (NULL != _proj1) - { - bx::memCopy(m_proj[1][_id].un.val, _proj1, sizeof(Matrix4) ); - } - else - { - bx::memCopy(m_proj[1][_id].un.val, m_proj[0][_id].un.val, sizeof(Matrix4) ); - } + m_view[_id].setTransform(_view, _proj, _flags, _proj1); } - BGFX_API_FUNC(void resetView(uint8_t _id) ) + BGFX_API_FUNC(void resetView(ViewId _id) ) { - setViewRect(_id, 0, 0, 1, 1); - setViewScissor(_id, 0, 0, 0, 0); - setViewClear(_id, BGFX_CLEAR_NONE, 0, 0.0f, 0); - setViewSeq(_id, false); - FrameBufferHandle invalid = BGFX_INVALID_HANDLE; - setViewFrameBuffer(_id, invalid); - setViewTransform(_id, NULL, NULL, BGFX_VIEW_NONE, NULL); + m_view[_id].reset(); } - BGFX_API_FUNC(void setViewOrder(uint8_t _id, uint8_t _num, const void* _order) ) + BGFX_API_FUNC(void setViewOrder(ViewId _id, uint16_t _num, const ViewId* _order) ) { const uint32_t num = bx::uint32_min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id; if (NULL == _order) { for (uint32_t ii = 0; ii < num; ++ii) { - uint8_t id = uint8_t(ii+_id); + ViewId id = ViewId(ii+_id); m_viewRemap[id] = id; } } else { - bx::memCopy(&m_viewRemap[_id], _order, num); - } - } - - BGFX_API_FUNC(void setMarker(const char* _marker) ) - { - m_submit->setMarker(_marker); - } - - BGFX_API_FUNC(void setState(uint64_t _state, uint32_t _rgba) ) - { - m_submit->setState(_state, _rgba); - } - - BGFX_API_FUNC(void setCondition(OcclusionQueryHandle _handle, bool _visible) ) - { - m_submit->setCondition(_handle, _visible); - } - - BGFX_API_FUNC(void setStencil(uint32_t _fstencil, uint32_t _bstencil) ) - { - m_submit->setStencil(_fstencil, _bstencil); - } - - BGFX_API_FUNC(uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) - { - return m_submit->setScissor(_x, _y, _width, _height); - } - - BGFX_API_FUNC(void setScissor(uint16_t _cache) ) - { - m_submit->setScissor(_cache); - } - - BGFX_API_FUNC(uint32_t setTransform(const void* _mtx, uint16_t _num) ) - { - return m_submit->setTransform(_mtx, _num); - } - - BGFX_API_FUNC(uint32_t allocTransform(Transform* _transform, uint16_t _num) ) - { - return m_submit->allocTransform(_transform, _num); - } - - BGFX_API_FUNC(void setTransform(uint32_t _cache, uint16_t _num) ) - { - m_submit->setTransform(_cache, _num); - } - - BGFX_API_FUNC(void setUniform(UniformHandle _handle, const void* _value, uint16_t _num) ) - { - BGFX_CHECK_HANDLE("setUniform", m_uniformHandle, _handle); - UniformRef& uniform = m_uniformRef[_handle.idx]; - BX_CHECK(isValid(_handle) && 0 < uniform.m_refCount, "Setting invalid uniform (handle %3d)!", _handle.idx); - BX_CHECK(_num == UINT16_MAX || uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num); - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) - { - BX_CHECK(m_uniformSet.end() == m_uniformSet.find(_handle.idx) - , "Uniform %d (%s) was already set for this draw call." - , _handle.idx - , getName(_handle) - ); - m_uniformSet.insert(_handle.idx); + bx::memCopy(&m_viewRemap[_id], _order, num*sizeof(ViewId) ); } - m_submit->writeUniform(uniform.m_type, _handle, _value, bx::uint16_min(uniform.m_num, _num) ); } - BGFX_API_FUNC(void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) ) - { - BGFX_CHECK_HANDLE("setIndexBuffer", m_indexBufferHandle, _handle); - m_submit->setIndexBuffer(_handle, _firstIndex, _numIndices); - } + BGFX_API_FUNC(Encoder* begin() ); - BGFX_API_FUNC(void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) ) - { - BGFX_CHECK_HANDLE("setIndexBuffer", m_dynamicIndexBufferHandle, _handle); - m_submit->setIndexBuffer(m_dynamicIndexBuffers[_handle.idx], _firstIndex, _numIndices); - } - - BGFX_API_FUNC(void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) ) - { - BGFX_CHECK_HANDLE("setIndexBuffer", m_indexBufferHandle, _tib->handle); - m_submit->setIndexBuffer(_tib, _firstIndex, _numIndices); - } - - BGFX_API_FUNC(void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) - { - BGFX_CHECK_HANDLE("setVertexBuffer", m_vertexBufferHandle, _handle); - BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); - m_submit->setVertexBuffer(_stream, _handle, _startVertex, _numVertices); - } - - BGFX_API_FUNC(void setVertexBuffer(uint8_t _stream, DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) - { - BGFX_CHECK_HANDLE("setVertexBuffer", m_dynamicVertexBufferHandle, _handle); - BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); - m_submit->setVertexBuffer(_stream, m_dynamicVertexBuffers[_handle.idx], _startVertex, _numVertices); - } + BGFX_API_FUNC(void end(Encoder* _encoder) ); - BGFX_API_FUNC(void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) ) - { - BGFX_CHECK_HANDLE("setVertexBuffer", m_vertexBufferHandle, _tvb->handle); - BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); - m_submit->setVertexBuffer(_stream, _tvb, _startVertex, _numVertices); - } - - BGFX_API_FUNC(void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) ) - { - --m_instBufferCount; - - m_submit->setInstanceDataBuffer(_idb, _num); - } - - BGFX_API_FUNC(void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) ) - { - BGFX_CHECK_HANDLE("setInstanceDataBuffer", m_vertexBufferHandle, _handle); - const VertexBuffer& vb = m_vertexBuffers[_handle.idx]; - m_submit->setInstanceDataBuffer(_handle, _startVertex, _num, vb.m_stride); - } - - BGFX_API_FUNC(void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) ) - { - BGFX_CHECK_HANDLE("setInstanceDataBuffer", m_dynamicVertexBufferHandle, _handle); - const DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx]; - m_submit->setInstanceDataBuffer(dvb.m_handle - , dvb.m_startVertex + _startVertex - , _num - , dvb.m_stride - ); - } - - BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) ) - { - BGFX_CHECK_HANDLE_INVALID_OK("setTexture/TextureHandle", m_textureHandle, _handle); - m_submit->setTexture(_stage, _sampler, _handle, _flags); - } - - BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) ) - { - BGFX_CHECK_HANDLE_INVALID_OK("submit", m_programHandle, _program); - BGFX_CHECK_HANDLE_INVALID_OK("submit", m_occlusionQueryHandle, _occlusionQuery); - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) - && !_preserveState) - { - m_uniformSet.clear(); - } - - if (BX_ENABLED(BGFX_CONFIG_DEBUG_OCCLUSION) - && isValid(_occlusionQuery) ) - { - BX_CHECK(m_occlusionQuerySet.end() == m_occlusionQuerySet.find(_occlusionQuery.idx) - , "OcclusionQuery %d was already used for this frame." - , _occlusionQuery.idx - ); - m_occlusionQuerySet.insert(_occlusionQuery.idx); - } - - return m_submit->submit(_id, _program, _occlusionQuery, _depth, _preserveState); - } - - BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) ) - { - BGFX_CHECK_HANDLE_INVALID_OK("submit", m_programHandle, _handle); - BGFX_CHECK_HANDLE("submit", m_vertexBufferHandle, _indirectHandle); - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) - && !_preserveState) - { - m_uniformSet.clear(); - } - return m_submit->submit(_id, _handle, _indirectHandle, _start, _num, _depth, _preserveState); - } - - BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) ) - { - BGFX_CHECK_HANDLE("setBuffer", m_indexBufferHandle, _handle); - m_submit->setBuffer(_stage, _handle, _access); - } - - BGFX_API_FUNC(void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) ) - { - BGFX_CHECK_HANDLE("setBuffer", m_vertexBufferHandle, _handle); - m_submit->setBuffer(_stage, _handle, _access); - } - - BGFX_API_FUNC(void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) ) - { - BGFX_CHECK_HANDLE("setBuffer", m_dynamicIndexBufferHandle, _handle); - const DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx]; - m_submit->setBuffer(_stage, dib.m_handle, _access); - } - - BGFX_API_FUNC(void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) ) - { - BGFX_CHECK_HANDLE("setBuffer", m_dynamicVertexBufferHandle, _handle); - const DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx]; - m_submit->setBuffer(_stage, dvb.m_handle, _access); - } - - BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access) ) - { - BGFX_CHECK_HANDLE("setBuffer", m_vertexBufferHandle, _handle); - VertexBufferHandle handle = { _handle.idx }; - m_submit->setBuffer(_stage, handle, _access); - } - - BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) ) - { - _format = TextureFormat::Count == _format ? TextureFormat::Enum(m_textureRef[_handle.idx].m_format) : _format; - BX_CHECK(_format != TextureFormat::BGRA8 - , "Can't use TextureFormat::BGRA8 with compute, use TextureFormat::RGBA8 instead." - ); - m_submit->setImage(_stage, _sampler, _handle, _mip, _access, _format); - } - - BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) ) - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) - { - m_uniformSet.clear(); - } - return m_submit->dispatch(_id, _handle, _numX, _numY, _numZ, _flags); - } - - BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) ) - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) - { - m_uniformSet.clear(); - } - return m_submit->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags); - } - - BGFX_API_FUNC(void discard() ) - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) - { - m_uniformSet.clear(); - } - m_submit->discard(); - } + BGFX_API_FUNC(uint32_t frame(bool _capture = false) ); - BGFX_API_FUNC(void blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) ) + uint32_t getSeqIncr(ViewId _id) { - const TextureRef& src = m_textureRef[_src.idx]; - const TextureRef& dst = m_textureRef[_dst.idx]; - BX_CHECK(src.m_format == dst.m_format - , "Texture format must match (src %s, dst %s)." - , bgfx::getName(TextureFormat::Enum(src.m_format) ) - , bgfx::getName(TextureFormat::Enum(dst.m_format) ) - ); - BX_UNUSED(src, dst); - m_submit->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth); + return bx::atomicFetchAndAdd<uint32_t>(&m_seq[_id], 1); } - BGFX_API_FUNC(uint32_t frame(bool _capture = false) ); - void dumpViewStats(); void freeDynamicBuffers(); void freeAllHandles(Frame* _frame); void frameNoRenderWait(); void swap(); - const char* getName(UniformHandle _handle) const; // render thread + void flip(); RenderFrame::Enum renderFrame(int32_t _msecs = -1); void flushTextureUpdateBatch(CommandBuffer& _cmdbuf); void rendererExecCommands(CommandBuffer& _cmdbuf); @@ -4086,7 +4367,7 @@ namespace bgfx return true; } - BGFX_PROFILER_SCOPE(bgfx, main_thread_wait, 0xff2040ff); + BGFX_PROFILER_SCOPE("bgfx/API thread wait", 0xff2040ff); int64_t start = bx::getHPCounter(); bool ok = m_apiSem.wait(_msecs); if (ok) @@ -4111,7 +4392,7 @@ namespace bgfx { if (!m_singleThreaded) { - BGFX_PROFILER_SCOPE(bgfx, render_thread_wait, 0xff2040ff); + BGFX_PROFILER_SCOPE("bgfx/Render thread wait", 0xff2040ff); int64_t start = bx::getHPCounter(); bool ok = m_renderSem.wait(); BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok); @@ -4120,9 +4401,35 @@ namespace bgfx } } + void encoderApiWait() + { + uint16_t numEncoders = m_encoderHandle.getNumHandles(); + + for (uint16_t ii = 1; ii < numEncoders; ++ii) + { + m_encoderEndSem.wait(); + } + + for (uint16_t ii = 0; ii < numEncoders; ++ii) + { + uint16_t idx = m_encoderHandle.getHandleAt(ii); + m_encoderStats[ii].cpuTimeBegin = m_encoder[idx].m_cpuTimeBegin; + m_encoderStats[ii].cpuTimeEnd = m_encoder[idx].m_cpuTimeEnd; + } + + m_submit->m_perfStats.numEncoders = uint8_t(numEncoders); + + m_encoderHandle.reset(); + uint16_t idx = m_encoderHandle.alloc(); + BX_CHECK(0 == idx, "Internal encoder handle is not 0 (idx %d).", idx); BX_UNUSED(idx); + } + bx::Semaphore m_renderSem; bx::Semaphore m_apiSem; - bx::Thread m_thread; + bx::Semaphore m_encoderEndSem; + bx::Mutex m_encoderApiLock; + bx::Mutex m_resourceApiLock; + bx::Thread m_thread; #else void apiSemPost() { @@ -4141,9 +4448,22 @@ namespace bgfx void renderSemWait() { } + + void encoderApiWait() + { + m_encoderStats[0].cpuTimeBegin = m_encoder[0].m_cpuTimeBegin; + m_encoderStats[0].cpuTimeEnd = m_encoder[0].m_cpuTimeEnd; + m_submit->m_perfStats.numEncoders = 1; + } #endif // BGFX_CONFIG_MULTITHREADED - Frame m_frame[1+(BGFX_CONFIG_MULTITHREADED ? 1 : 0)]; + EncoderStats m_encoderStats[BGFX_CONFIG_MAX_ENCODERS]; + Encoder* m_encoder0; + EncoderImpl m_encoder[BGFX_CONFIG_MAX_ENCODERS]; + uint32_t m_numEncoders; + bx::HandleAllocT<BGFX_CONFIG_MAX_ENCODERS> m_encoderHandle; + + Frame m_frame[1+(BGFX_CONFIG_MULTITHREADED ? 1 : 0)]; Frame* m_render; Frame* m_submit; @@ -4181,10 +4501,10 @@ namespace bgfx struct ShaderRef { UniformHandle* m_uniforms; + String m_name; uint32_t m_hash; int16_t m_refCount; uint16_t m_num; - bool m_owned; }; struct ProgramRef @@ -4204,6 +4524,7 @@ namespace bgfx struct TextureRef { + String m_name; int16_t m_refCount; uint8_t m_bbRatio; uint8_t m_format; @@ -4221,14 +4542,12 @@ namespace bgfx bool m_window; }; - typedef stl::unordered_set<uint16_t> HandleSet; - HandleSet m_uniformSet; - HandleSet m_occlusionQuerySet; - typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_UNIFORMS*2> UniformHashMap; UniformHashMap m_uniformHashMap; UniformRef m_uniformRef[BGFX_CONFIG_MAX_UNIFORMS]; + typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_SHADERS*2> ShaderHashMap; + ShaderHashMap m_shaderHashMap; ShaderRef m_shaderRef[BGFX_CONFIG_MAX_SHADERS]; typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_PROGRAMS*2> ProgramHashMap; @@ -4239,23 +4558,16 @@ namespace bgfx FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS]; VertexDeclRef m_declRef; - uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; - FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS]; - Clear m_clear[BGFX_CONFIG_MAX_VIEWS]; + ViewId m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; + uint32_t m_seq[BGFX_CONFIG_MAX_VIEWS]; + View m_view[BGFX_CONFIG_MAX_VIEWS]; float m_clearColor[BGFX_CONFIG_MAX_COLOR_PALETTE][4]; - Rect m_rect[BGFX_CONFIG_MAX_VIEWS]; - Rect m_scissor[BGFX_CONFIG_MAX_VIEWS]; - Matrix4 m_view[BGFX_CONFIG_MAX_VIEWS]; - Matrix4 m_proj[2][BGFX_CONFIG_MAX_VIEWS]; - uint8_t m_viewFlags[BGFX_CONFIG_MAX_VIEWS]; - uint16_t m_seq[BGFX_CONFIG_MAX_VIEWS]; - uint16_t m_seqMask[BGFX_CONFIG_MAX_VIEWS]; uint8_t m_colorPaletteDirty; Resolution m_resolution; - int32_t m_instBufferCount; + int64_t m_frameTimeLast; uint32_t m_frames; uint32_t m_debug; @@ -4263,6 +4575,8 @@ namespace bgfx ClearQuad m_clearQuad; RendererContextI* m_renderCtx; + RendererContextI* m_renderMain; + RendererContextI* m_renderNoop; bool m_rendererInitialized; bool m_exit; diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh index 3ee69e85e35..b8155c1d650 100644 --- a/3rdparty/bgfx/src/bgfx_shader.sh +++ b/3rdparty/bgfx/src/bgfx_shader.sh @@ -28,6 +28,14 @@ # define EARLY_DEPTH_STENCIL #endif // BGFX_SHADER_LANGUAGE_HLSL > 3 && BGFX_SHADER_TYPE_FRAGMENT +#if BGFX_SHADER_LANGUAGE_GLSL +# define ARRAY_BEGIN(_type, _name, _count) _type _name[_count] = _type[]( +# define ARRAY_END() ) +#else +# define ARRAY_BEGIN(_type, _name, _count) _type _name[_count] = { +# define ARRAY_END() } +#endif // BGFX_SHADER_LANGUAGE_GLSL + #if BGFX_SHADER_LANGUAGE_HLSL || BGFX_SHADER_LANGUAGE_PSSL || BGFX_SHADER_LANGUAGE_SPIRV # define CONST(_x) static const _x # define dFdx(_x) ddx(_x) @@ -83,12 +91,12 @@ uint4 bitfieldReverse(uint4 _x) { return reversebits(_x); } # if !BGFX_SHADER_LANGUAGE_SPIRV uint packHalf2x16(vec2 _x) { - return (f32tof16(_x.x)<<16) | f32tof16(_x.y); + return (f32tof16(_x.y)<<16) | f32tof16(_x.x); } vec2 unpackHalf2x16(uint _x) { - return vec2(f16tof32(_x >> 16), f16tof32(_x) ); + return vec2(f16tof32(_x & 0xffff), f16tof32(_x >> 16) ); } # endif // !BGFX_SHADER_LANGUAGE_SPIRV @@ -354,6 +362,10 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord) # define texture2D(_sampler, _coord) tex2D(_sampler, _coord) # define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord) +# define SAMPLER2DARRAY(_name, _reg) SAMPLER2D(_name, _reg) +# define texture2DArray(_sampler, _coord) texture2D(_sampler, (_coord).xy) +# define texture2DArrayLod(_sampler, _coord, _lod) texture2DLod(_sampler, _coord, _lod) + # define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : REGISTER(s, _reg) # define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord) # define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord) diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h index 6ee68224337..7c038715845 100644 --- a/3rdparty/bgfx/src/config.h +++ b/3rdparty/bgfx/src/config.h @@ -19,13 +19,11 @@ && !defined(BGFX_CONFIG_RENDERER_OPENGL) \ && !defined(BGFX_CONFIG_RENDERER_OPENGLES) \ && !defined(BGFX_CONFIG_RENDERER_VULKAN) \ - && !defined(BGFX_CONFIG_RENDERER_GNM) \ - && !defined(BGFX_CONFIG_RENDERER_NOOP) + && !defined(BGFX_CONFIG_RENDERER_GNM) # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \ || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_XBOX360 \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_DIRECT3D9 @@ -65,10 +63,10 @@ || BX_PLATFORM_ANDROID \ || BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_IOS \ - || BX_PLATFORM_NACL \ || BX_PLATFORM_QNX \ || BX_PLATFORM_RPI \ || BX_PLATFORM_STEAMLINK \ + || BX_PLATFORM_NX \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_OPENGLES @@ -77,6 +75,7 @@ || BX_PLATFORM_ANDROID \ || BX_PLATFORM_LINUX \ || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_NX \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_VULKAN @@ -86,18 +85,6 @@ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_GNM -# ifndef BGFX_CONFIG_RENDERER_NOOP -# define BGFX_CONFIG_RENDERER_NOOP (!(0 \ - || BGFX_CONFIG_RENDERER_DIRECT3D9 \ - || BGFX_CONFIG_RENDERER_DIRECT3D11 \ - || BGFX_CONFIG_RENDERER_DIRECT3D12 \ - || BGFX_CONFIG_RENDERER_METAL \ - || BGFX_CONFIG_RENDERER_OPENGL \ - || BGFX_CONFIG_RENDERER_OPENGLES \ - || BGFX_CONFIG_RENDERER_VULKAN \ - || BGFX_CONFIG_RENDERER_GNM \ - ? 1 : 0) ) -# endif // BGFX_CONFIG_RENDERER_NOOP #else # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 0 @@ -130,10 +117,6 @@ # ifndef BGFX_CONFIG_RENDERER_GNM # define BGFX_CONFIG_RENDERER_GNM 0 # endif // BGFX_CONFIG_RENDERER_GNM - -# ifndef BGFX_CONFIG_RENDERER_NOOP -# define BGFX_CONFIG_RENDERER_NOOP 0 -# endif // BGFX_CONFIG_RENDERER_NOOP #endif // !defined... #if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 21 @@ -220,7 +203,7 @@ #endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_DEPTH #ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ -# define BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ 11 +# define BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ 20 #endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_SEQ #ifndef BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM @@ -254,7 +237,7 @@ #endif // BGFX_CONFIG_MAX_VERTEX_BUFFERS #ifndef BGFX_CONFIG_MAX_VERTEX_STREAMS -# define BGFX_CONFIG_MAX_VERTEX_STREAMS 1 +# define BGFX_CONFIG_MAX_VERTEX_STREAMS 4 #endif // BGFX_CONFIG_MAX_VERTEX_STREAMS #ifndef BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS @@ -323,17 +306,9 @@ #define BGFX_CONFIG_DRAW_INDIRECT_STRIDE 32 -#ifndef BGFX_CONFIG_PROFILER_MICROPROFILE -# define BGFX_CONFIG_PROFILER_MICROPROFILE 0 -#endif // BGFX_CONFIG_PROFILER_MICROPROFILE - -#ifndef BGFX_CONFIG_PROFILER_REMOTERY -# define BGFX_CONFIG_PROFILER_REMOTERY 0 -#endif // BGFX_CONFIG_PROFILER_REMOTERY - -#ifndef BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB -# define BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB BGFX_CONFIG_PROFILER_REMOTERY -#endif // BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB +#ifndef BGFX_CONFIG_PROFILER +# define BGFX_CONFIG_PROFILER 0 +#endif // BGFX_CONFIG_PROFILER #ifndef BGFX_CONFIG_RENDERDOC_LOG_FILEPATH # define BGFX_CONFIG_RENDERDOC_LOG_FILEPATH "temp/bgfx" @@ -344,7 +319,15 @@ #endif // BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS #ifndef BGFX_CONFIG_API_SEMAPHORE_TIMEOUT -# define BGFX_CONFIG_API_SEMAPHORE_TIMEOUT (-1) +# define BGFX_CONFIG_API_SEMAPHORE_TIMEOUT (5000) #endif // BGFX_CONFIG_API_SEMAPHORE_TIMEOUT +#ifndef BGFX_CONFIG_MIP_LOD_BIAS +# define BGFX_CONFIG_MIP_LOD_BIAS 0 +#endif // BGFX_CONFIG_MIP_LOD_BIAS + +#ifndef BGFX_CONFIG_MAX_ENCODERS +# define BGFX_CONFIG_MAX_ENCODERS ( (0 != BGFX_CONFIG_MULTITHREADED) ? 8 : 1) +#endif // BGFX_CONFIG_MAX_ENCODERS + #endif // BGFX_CONFIG_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/debug_renderdoc.cpp b/3rdparty/bgfx/src/debug_renderdoc.cpp index a51206b8122..938af6ead14 100644 --- a/3rdparty/bgfx/src/debug_renderdoc.cpp +++ b/3rdparty/bgfx/src/debug_renderdoc.cpp @@ -43,7 +43,7 @@ namespace bgfx , BX_COUNTOF(moduleName) ); if (0 != result - && 0 == bx::strincmp(_name, moduleName) ) + && 0 == bx::strCmpI(_name, moduleName) ) { return true; } @@ -56,21 +56,27 @@ namespace bgfx } pRENDERDOC_GetAPI RENDERDOC_GetAPI; - static RENDERDOC_API_1_1_0* s_renderDoc; + static RENDERDOC_API_1_1_0* s_renderDoc = NULL; + static void* s_renderDocDll = NULL; void* loadRenderDoc() { + if (NULL != s_renderDoc) + { + return s_renderDocDll; + } + // Skip loading RenderDoc when IntelGPA is present to avoid RenderDoc crash. if (findModule(BX_ARCH_32BIT ? "shimloader32.dll" : "shimloader64.dll") ) { return NULL; } - void* renderdocdll = bx::dlopen("renderdoc.dll"); + void* renderDocDll = bx::dlopen("renderdoc.dll"); - if (NULL != renderdocdll) + if (NULL != renderDocDll) { - RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)bx::dlsym(renderdocdll, "RENDERDOC_GetAPI"); + RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)bx::dlsym(renderDocDll, "RENDERDOC_GetAPI"); if (NULL != RENDERDOC_GetAPI && 1 == RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_0, (void**)&s_renderDoc) ) { @@ -85,23 +91,29 @@ namespace bgfx s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_SaveAllInitials, 1); s_renderDoc->MaskOverlayBits(eRENDERDOC_Overlay_None, eRENDERDOC_Overlay_None); + + s_renderDocDll = renderDocDll; } else { - bx::dlclose(renderdocdll); - renderdocdll = NULL; + bx::dlclose(renderDocDll); + renderDocDll = NULL; } } - return renderdocdll; + return renderDocDll; } void unloadRenderDoc(void* _renderdocdll) { if (NULL != _renderdocdll) { - s_renderDoc->Shutdown(); - bx::dlclose(_renderdocdll); + // BK - Once RenderDoc is loaded there shouldn't be calls + // to Shutdown or unload RenderDoc DLL. + // https://github.com/bkaradzic/bgfx/issues/1192 + // + // s_renderDoc->Shutdown(); + // bx::dlclose(_renderdocdll); } } diff --git a/3rdparty/bgfx/src/fs_clear0.bin.h b/3rdparty/bgfx/src/fs_clear0.bin.h index e9e8cc6f6c1..f4a98048d35 100644 --- a/3rdparty/bgfx/src/fs_clear0.bin.h +++ b/3rdparty/bgfx/src/fs_clear0.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear0_glsl[128] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0x5a, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .Z...uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -9,76 +9,216 @@ static const uint8_t fs_clear0_glsl[128] = 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // olor = bgfx_clea 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_color[0];.}... }; -static const uint8_t fs_clear0_dx9[208] = +static const uint8_t fs_clear0_spv[2158] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x01, 0x00, 0x00, 0x01, // clear_color..... + 0x00, 0x48, 0x08, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .H.....#........ + 0x00, 0x2e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // ..a............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .main........... + 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, // n........5...vec + 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, // 4_splat(f1;..... + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4d, 0x0f, 0x00, // ....._x......M.. + 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // .@main(vf4;..... + 0x00, 0x2c, 0x41, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .,A..gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _0_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..^..param...... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // nvView.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // ewProj.......... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0xd2, 0x01, 0x00, // lphaRef4........ + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3d, 0x51, 0x00, 0x00, 0x67, 0x6c, 0x5f, // .........=Q..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_0_..... + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7d, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // _0_..G...}...... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#...`...H...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#...`...H...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#... ...H...... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xf5, 0x00, 0x00, // .........!...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... + 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... + 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x7d, 0x01, 0x00, // .j... .......}.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .e...j...+...... + 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xb2, 0x04, 0x00, // .".............. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xd2, 0x01, 0x00, // .....".......... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. + 0x00, 0x7d, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .}...e...e...... + 0x00, 0xb2, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4f, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...O...... + 0x00, 0xd2, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x04, 0x00, 0x00, 0x42, 0x13, 0x00, // .....;...O...B.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // .....6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2d, 0x61, 0x00, // .............-a. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. + 0x00, 0x39, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xe7, 0x49, 0x00, 0x00, 0x4d, 0x0f, 0x00, // .9........I..M.. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x51, 0x00, // .....=.......=Q. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x3d, 0x51, 0x00, // .....>.......=Q. + 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .....8...6...... + 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .5...........7.. + 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, // ................ + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......dW..... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........N..... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......I9..... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........9..... + 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, // .P........*..dW. + 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..N..I9...9..... + 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // ..*..8...6...... + 0x00, 0x4d, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .M...........7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2c, 0x41, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x31, 0x27, 0x00, // .....,A......1'. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........^..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....^......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5e, 0x00, // .........5....^. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x0a, 0x5a, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........Z..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0x6b, 0x2e, 0x00, 0x00, 0x0a, 0x5a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x41, 0x00, // .k....Z..>...,A. + 0x00, 0x6b, 0x2e, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .k.......8.... +}; +static const uint8_t fs_clear0_dx9[198] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x01, // clear_color..... - 0x00, 0xac, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... }; -static const uint8_t fs_clear0_dx11[339] = +static const uint8_t fs_clear0_dx11[341] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x2c, 0x01, 0x44, 0x58, 0x42, 0x43, 0x01, 0xdc, 0xf8, 0x1e, 0x7d, 0x89, 0xaa, 0x45, 0x4f, // .,.DXBC....}..EO - 0x0c, 0x79, 0x61, 0x5e, 0xe4, 0x72, 0x8d, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x04, // .ya^.r.....,.... - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xf8, // ...0...|........ - 0x00, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x44, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, // ...Aon9D...D.... - 0x02, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, // .......0.....$.. - 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .0...0...$...0.. - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0x01, // ................ - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, // ...............S - 0x48, 0x44, 0x52, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x59, // HDR@...@.......Y - 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, // ...F. .........e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // .... ......6.... - 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F. ...... - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, // ...>...ISGN,.... - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ....... ........ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, // ...............S - 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x2c, // V_POSITION.OSGN, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, // ........... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x00, // ...SV_TARGET.... - 0x00, 0x80, 0x00, // ... + 0x00, 0x2c, 0x01, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x01, 0xdc, 0xf8, 0x1e, 0x7d, 0x89, 0xaa, // .,...DXBC....}.. + 0x45, 0x4f, 0x0c, 0x79, 0x61, 0x5e, 0xe4, 0x72, 0x8d, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, // EO.ya^.r.....,.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, // .....0...|...... + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x44, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .....Aon9D...D.. + 0x00, 0x00, 0x02, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, // .........0.....$ + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, // ...0...0...$...0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, // ................ + 0xff, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, // ................ + 0x00, 0x53, 0x48, 0x44, 0x52, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .SHDR@...@...... + 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .Y...F. ........ + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .e.... ......6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, // .....>...ISGN,.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, // .SV_POSITION.OSG + 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // N,........... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, // .....SV_TARGET.. + 0xab, 0x00, 0x00, 0x80, 0x00, // ..... }; -static const uint8_t fs_clear0_mtl[426] = +static const uint8_t fs_clear0_mtl[449] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x01, 0x00, 0x00, 0x75, 0x73, // FSH...........us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // gColor;.};.struc - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // niform {. float - 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col - 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, // or[8];.};.fragme - 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // nt xlatMtlShader - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, // Output xlatMtlMa - 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // in (xlatMtlShade - 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, // rInput _mtl_i [[ - 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, // stage_in]], cons - 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // tant xlatMtlShad - 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // erUniform& _mtl_ - 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, // u [[buffer(0)]]) - 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // .{. xlatMtlShad - 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // erOutput _mtl_o; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra - 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // gColor = _mtl_u. - 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // bgfx_clear_color - 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // [0];. return _m - 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x9b, 0x01, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .....using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, // gl_FragColor;.} + 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // ;.struct xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, // ShaderUniform {. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // float4 bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, // ear_color[8];.}; + 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // .fragment xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, // lShaderOutput xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, // atMtlMain (xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, // tlShaderInput _m + 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, // tl_i [[stage_in] + 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ], constant xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform + 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, // & _mtl_u [[buffe + 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, // r(0)]]).{. xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, // MtlShaderOutput + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // _mtl_o;. _mtl_o + 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // .gl_FragColor = + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // _mtl_u.bgfx_clea + 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, // r_color[0];. re + 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // turn _mtl_o;.}.. + 0x00, // . }; extern const uint8_t* fs_clear0_pssl; extern const uint32_t fs_clear0_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear1.bin.h b/3rdparty/bgfx/src/fs_clear1.bin.h index 40bb8481160..1b7159c700b 100644 --- a/3rdparty/bgfx/src/fs_clear1.bin.h +++ b/3rdparty/bgfx/src/fs_clear1.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear1_glsl[170] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0x84, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .....uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -12,88 +12,244 @@ static const uint8_t fs_clear1_glsl[170] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[1];.}... }; -static const uint8_t fs_clear1_dx9[220] = +static const uint8_t fs_clear1_spv[2418] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x02, 0x00, 0x00, 0x02, // clear_color..... + 0x00, 0x4c, 0x09, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .L.....#........ + 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, // .main........5.. + 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, // .vec4_splat(f1;. + 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, // ........._x..... + 0x00, 0xff, 0x0f, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, // .....@main(vf4;v + 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......O0..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xa2, 0x25, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..%..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _1_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .,N..param...... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // nvView.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // ewProj.......... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x9a, 0x06, 0x00, // lphaRef4........ + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xbd, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xdf, 0x38, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..8..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa3, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _1_.......G..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xda, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // _1_..G.......... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc7, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#.......H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#...`...H...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#.......H...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#...`...H...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#.......H...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#... ...H...... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x3d, 0x0b, 0x00, // .........!...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, // ................ + 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... + 0x00, 0xda, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, // .....e...j...+.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....".......... + 0x00, 0xc7, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // ........."...... + 0x00, 0x9a, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .............e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0xda, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.......e...e.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc7, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x09, 0x00, // ......... ...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x09, 0x00, // .........;...... + 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.............. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ./.......+...... + 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... + 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // ......... ...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... + 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa3, 0x47, 0x00, // .Sa..;........G. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, // .....9........,. + 0x00, 0xff, 0x0f, 0x00, 0x00, 0xa3, 0x47, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......G......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xbd, 0x43, 0x00, 0x00, 0xa3, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdf, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......8......>.. + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xbd, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... + 0x00, 0xdf, 0x38, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ..8......8...6.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, // .....5.......... + 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. + 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, // .....=.......dW. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, // .....=........N. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, // .....=.......I9. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, // .....=........9. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, // .....P........*. + 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, // .dW...N..I9...9. + 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......*..8...6.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x0b, 0x00, // .............=.. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......O0..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x25, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xee, 0x5f, 0x00, // ......%......._. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......,N..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>...,N......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x2c, 0x4e, 0x00, // .........5...,N. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x53, 0x18, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......S...B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0x85, 0x5a, 0x00, 0x00, 0x53, 0x18, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4f, 0x30, 0x00, // ..Z..S...>...O0. + 0x00, 0x85, 0x5a, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xf9, 0x34, 0x00, // ..Z..A........4. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0xf9, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......!...4..>.. + 0x00, 0xa2, 0x25, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ..%...!......8.. + 0x00, 0x00, // .. +}; +static const uint8_t fs_clear1_dx9[210] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x02, // clear_color..... - 0x00, 0xb8, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ............ + 0x00, 0xac, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, // ................ + 0x00, 0x00, // .. }; -static const uint8_t fs_clear1_dx11[411] = +static const uint8_t fs_clear1_dx11[413] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x74, 0x01, 0x44, 0x58, 0x42, 0x43, 0x82, 0xff, 0x8b, 0x5f, 0x53, 0xa0, 0x1f, 0x3b, 0x53, // .t.DXBC..._S..;S - 0xc6, 0x2a, 0x12, 0xcf, 0xc8, 0x7f, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x04, // .*.........t.... - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x28, // ...0...........( - 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x50, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, // ...Aon9P...P.... - 0x02, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, // ... ...0.....$.. - 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .0...0...$...0.. - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0x01, // ................ - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x64, // ...........SHDRd - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, // ...@.......Y...F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // . .........e.... - 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, // ......e.... ... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ......F. ...... - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, // ...>...ISGN,.... - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ....... ........ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, // ...............S - 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x44, // V_POSITION.OSGND - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, // ...........8.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ...8............ - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, // ...........SV_TA - 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x00, 0x00, 0x80, 0x00, // RGET....... + 0x00, 0x74, 0x01, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x82, 0xff, 0x8b, 0x5f, 0x53, 0xa0, 0x1f, // .t...DXBC..._S.. + 0x3b, 0x53, 0xc6, 0x2a, 0x12, 0xcf, 0xc8, 0x7f, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, // ;S.*.........t.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, // .....0.......... + 0x00, 0x28, 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x50, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, // .(...Aon9P...P.. + 0x00, 0x00, 0x02, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, // ..... ...0.....$ + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, // ...0...0...$...0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, // ................ + 0xff, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, // .............SHD + 0x52, 0x64, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, // Rd...@.......Y.. + 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .F. .........e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, // .....>...ISGN,.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, // .SV_POSITION.OSG + 0x4e, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, // ND...........8.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....8.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, // .............SV_ + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x00, 0x00, 0x80, 0x00, // TARGET....... }; -static const uint8_t fs_clear1_mtl[531] = +static const uint8_t fs_clear1_mtl[554] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH...........us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // olor(1)]];.};.st - 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad - 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // erUniform {. fl - 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // oat4 bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, // color[8];.};.fra - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // gment xlatMtlSha - 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // derOutput xlatMt - 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // lMain (xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // aderInput _mtl_i - 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, // [[stage_in]], c - 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // onstant xlatMtlS - 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, // haderUniform& _m - 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, // tl_u [[buffer(0) - 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // ]]).{. xlatMtlS - 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // haderOutput _mtl - 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // _o;. _mtl_o.gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // FragData_0 = _mt - 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, // l_u.bgfx_clear_c - 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // olor[0];. _mtl_ - 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, // o.gl_FragData_1 - 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // = _mtl_u.bgfx_cl - 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // ear_color[1];. - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, // return _mtl_o;.} - 0x0a, 0x0a, 0x00, // ... + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x04, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .....using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ;.};.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, // {. float4 bgfx + 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, // _clear_color[8]; + 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // .};.fragment xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, // xlatMtlMain (xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, // atMtlShaderInput + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // _mtl_i [[stage_ + 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, // in]], constant x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, // orm& _mtl_u [[bu + 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, // ffer(0)]]).{. x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, // latMtlShaderOutp + 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // ut _mtl_o;. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // l_o.gl_FragData_ + 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, // 0 = _mtl_u.bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, // clear_color[0];. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // _mtl_o.gl_Frag + 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // Data_1 = _mtl_u. + 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // bgfx_clear_color + 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // [1];. return _m + 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... }; extern const uint8_t* fs_clear1_pssl; extern const uint32_t fs_clear1_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear2.bin.h b/3rdparty/bgfx/src/fs_clear2.bin.h index 7d19bb38b53..5ad3d268131 100644 --- a/3rdparty/bgfx/src/fs_clear2.bin.h +++ b/3rdparty/bgfx/src/fs_clear2.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear2_glsl[210] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0xac, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .....uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -15,99 +15,271 @@ static const uint8_t fs_clear2_glsl[210] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[2];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear2_dx9[232] = +static const uint8_t fs_clear2_spv[2678] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x03, 0x00, 0x00, 0x03, // clear_color..... + 0x00, 0x50, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .P.....#........ + 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, // ................ + 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....main....... + 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( + 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v + 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // f4;vf4;vf4;..... + 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_....../B..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... + 0x00, 0x10, 0x46, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..F..gl_FragData + 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _2_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0xf4, 0x56, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..V..param...... + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .b...$Global.... + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .b.......u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......b...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .b.......u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....b.......u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // nvView.......b.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .b.......u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......b...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .b.......u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // ewProj.......b.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .b.......u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....b...... + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....b.......u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x62, 0x0b, 0x00, // lphaRef4.....b.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x8c, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..9..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_......@,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_2_..... + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... + 0x00, 0x5f, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ._U..param...... + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // _2_..G...7...... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...b...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#.......H...b.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .b.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...b...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...b...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#...`...H...b.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .b.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...b...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...b...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#.......H...b.. + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .b.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...b...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...b...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#...`...H...b.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .b.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...b...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...b...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#.......H...b.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .b.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H...b...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#... ...H...b.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .b.......G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x91, 0x00, 0x00, // .........!...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. + 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....e.......... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, // .+.......j... .. + 0x00, 0x1c, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....7...e...j.. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, // .+......."...... + 0x00, 0x1c, 0x00, 0x04, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .............".. + 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....b.......... + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...7...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, // .e........... .. + 0x00, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........b...;.. + 0x00, 0x1c, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .....B.......... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ...../.......+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .....Sa..;...... + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..G......;...... + 0x00, 0x5f, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ._U......;...... + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, // .........9...... + 0x00, 0xbe, 0x2c, 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x5f, 0x55, 0x00, // ..,.......G.._U. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....=........C. + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8c, 0x39, 0x00, // ..G..=........9. + 0x00, 0x5f, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, // ._U..=.......@,. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....>........C. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x8c, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........9..>.. + 0x00, 0xb3, 0x15, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .....@,......8.. + 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.......5...... + 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .....7.......... + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... + 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .dW......=...... + 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ..N......=...... + 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .I9......=...... + 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ..9......P...... + 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, // ..*..dW...N..I9. + 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, // ..9.......*..8.. + 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x91, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe2, 0x2e, 0x00, // .....7.......... + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x37, 0x00, 0x03, // .7......./B..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x37, 0x1e, 0x00, // ......F......7.. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........V..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....V......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0xf4, 0x56, 0x00, // .........5....V. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x1b, 0x21, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........!..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0xce, 0x18, 0x00, 0x00, 0x1b, 0x21, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x2e, 0x00, // ......!..>...... + 0x00, 0xce, 0x18, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xc1, 0x3d, 0x00, // .....A........=. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf2, 0x1b, 0x00, 0x00, 0xc1, 0x3d, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..........=..>.. + 0x00, 0x2f, 0x42, 0x00, 0x00, 0xf2, 0x1b, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ./B......A...... + 0x00, 0xc2, 0x3d, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..=..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe6, 0x29, 0x00, 0x00, 0xc2, 0x3d, 0x00, // .=........)...=. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x10, 0x46, 0x00, 0x00, 0xe6, 0x29, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>....F...)..... + 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .8.... +}; +static const uint8_t fs_clear2_dx9[222] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x03, // clear_color..... - 0x00, 0xc4, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ........ + 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .............. }; -static const uint8_t fs_clear2_dx11[483] = +static const uint8_t fs_clear2_dx11[485] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0xbc, 0x01, 0x44, 0x58, 0x42, 0x43, 0x0e, 0x9f, 0x66, 0xdd, 0x1f, 0x67, 0xd6, 0xd1, 0x64, // ...DXBC..f..g..d - 0xb9, 0x94, 0x61, 0x3d, 0x93, 0x51, 0x1a, 0x01, 0x00, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, // ..a=.Q.......... - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x58, // ...0.......$...X - 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x5c, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, // ...Aon9......... - 0x02, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, // ...,...0.....$.. - 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .0...0...$...0.. - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0x01, // ................ - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x88, 0x00, 0x00, 0x00, 0x40, // .......SHDR....@ - 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, // ..."...Y...F. .. - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, // .......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // .... ......6.... - 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // ......F. ...... - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, // ...>...ISGN,.... - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ....... ........ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, // ...............S - 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x5c, // V_POSITION.OSGN. - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, // ...........P.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ...P............ - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x02, // ...........P.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x00, // ...SV_TARGET.... - 0x00, 0x80, 0x00, // ... + 0x00, 0xbc, 0x01, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x0e, 0x9f, 0x66, 0xdd, 0x1f, 0x67, 0xd6, // .....DXBC..f..g. + 0xd1, 0x64, 0xb9, 0x94, 0x61, 0x3d, 0x93, 0x51, 0x1a, 0x01, 0x00, 0x00, 0x00, 0xbc, 0x01, 0x00, // .d..a=.Q........ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x24, 0x01, 0x00, // .....0.......$.. + 0x00, 0x58, 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x5c, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, // .X...Aon9....... + 0x00, 0x00, 0x02, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, // .....,...0.....$ + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, // ...0...0...$...0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, // ................ + 0xff, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, // ................ + 0x80, 0x02, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x88, 0x00, 0x00, // .........SHDR... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, // .@..."...Y...F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .........e.... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .e.... ......6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, // .....>...ISGN,.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, // .SV_POSITION.OSG + 0x4e, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, // N............P.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....P.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, // .............P.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, // .....SV_TARGET.. + 0xab, 0x00, 0x00, 0x80, 0x00, // ..... }; -static const uint8_t fs_clear2_mtl[621] = +static const uint8_t fs_clear2_mtl[644] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH.......^...us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(1)]];. flo - 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // at4 gl_FragData_ - 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 2 [[color(2)]];. - 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt - 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, // . float4 bgfx_c - 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, // lear_color[8];.} - 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // ;.fragment xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, // tlShaderOutput x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, // latMtlMain (xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, // MtlShaderInput _ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, // mtl_i [[stage_in - 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // ]], constant xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor - 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, // m& _mtl_u [[buff - 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, // er(0)]]).{. xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // _mtl_o;. _mtl_ - 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, // o.gl_FragData_0 - 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // = _mtl_u.bgfx_cl - 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // ear_color[0];. - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // _mtl_o.gl_FragDa - 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, // ta_1 = _mtl_u.bg - 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, // fx_clear_color[1 - 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // ];. _mtl_o.gl_F - 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ragData_2 = _mtl - 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // _u.bgfx_clear_co - 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, // lor[2];. return - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x5e, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .^...using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. float4 gl_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // agData_2 [[color + 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, // (2)]];.};.struct + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, // xlatMtlShaderUn + 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // iform {. float4 + 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo + 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, // r[8];.};.fragmen + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // utput xlatMtlMai + 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // n (xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, // Input _mtl_i [[s + 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, // tage_in]], const + 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // ant xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // rUniform& _mtl_u + 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, // [[buffer(0)]]). + 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // {. xlatMtlShade + 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // rOutput _mtl_o;. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // _mtl_o.gl_Frag + 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // Data_0 = _mtl_u. + 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // bgfx_clear_color + 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // [0];. _mtl_o.gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // _FragData_1 = _m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // tl_u.bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // color[1];. _mtl + 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, // _o.gl_FragData_2 + 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, // = _mtl_u.bgfx_c + 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, // lear_color[2];. + 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;. + 0x7d, 0x0a, 0x0a, 0x00, // }... }; extern const uint8_t* fs_clear2_pssl; extern const uint32_t fs_clear2_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear3.bin.h b/3rdparty/bgfx/src/fs_clear3.bin.h index 82f60bc695a..67c7bce9fb8 100644 --- a/3rdparty/bgfx/src/fs_clear3.bin.h +++ b/3rdparty/bgfx/src/fs_clear3.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear3_glsl[250] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0xd4, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .....uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -17,110 +17,297 @@ static const uint8_t fs_clear3_glsl[250] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[3];.}... }; -static const uint8_t fs_clear3_dx9[244] = +static const uint8_t fs_clear3_spv[2938] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x04, 0x00, 0x00, 0x04, // clear_color..... + 0x00, 0x54, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .T.....#........ + 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, // ................ + 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, // .....5...vec4_sp + 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, // lat(f1;......... + 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0xf4, 0x0c, 0x00, 0x00, 0x40, 0x6d, 0x61, // ._x..........@ma + 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // in(vf4;vf4;vf4;v + 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8f, 0x22, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......."..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xf3, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..T..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_......NJ..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xd8, 0x4e, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..N..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _3_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0x83, 0x46, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..F..param...... + 0x00, 0x67, 0x04, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .g...$Global.... + 0x00, 0x67, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .g.......u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......g...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .g.......u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....g.......u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // nvView.......g.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0x67, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .g.......u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......g...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0x67, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .g.......u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // ewProj.......g.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0x67, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .g.......u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....g...... + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....g.......u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x67, 0x04, 0x00, // lphaRef4.....g.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .@,..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _3_.......G..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // am........U..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......I8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // _3_..G.......... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...g...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#.......H...g.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .g.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...g...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...g...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#...`...H...g.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .g.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...g...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...g...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#.......H...g.. + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .g.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...g...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...g...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#...`...H...g.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .g.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...g...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...g...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#.......H...g.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .g.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H...g...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#... ...H...g.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .g.......G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x3a, 0x04, 0x00, // .........!...:.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .........e...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....+.......j.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, // . ...........e.. + 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .j...+.......".. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf1, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x67, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, // .".......g...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .....e...e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, // .e...e...e...... + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf1, 0x04, 0x00, // .e...e.......... + 0x00, 0x20, 0x00, 0x04, 0x00, 0xe4, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x04, 0x00, // . ...........g.. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe4, 0x06, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, // .;.......B...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, // .+......./...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // .+.............. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........Sa..;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......G......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......U......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....I8......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x08, // .............9.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, 0x00, 0xf4, 0x0c, 0x00, 0x00, 0xc9, 0x47, 0x00, // ......,.......G. + 0x00, 0x85, 0x55, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..U..I8......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....y9...U..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..I8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....@,......>.. + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb3, 0x15, 0x00, 0x00, 0xed, 0x2c, 0x00, // .y9..>........,. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.......@,..... + 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....dW......=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......N......=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....I9......=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // ......9......P.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, // ......*..dW...N. + 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, // .I9...9.......*. + 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xf4, 0x0c, 0x00, // .8...6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x04, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .....:...7...... + 0x00, 0x8f, 0x22, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf3, 0x54, 0x00, // .."..7........T. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......NJ..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd8, 0x4e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x45, 0x58, 0x00, // ......N......EX. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x83, 0x46, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........F..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x83, 0x46, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....F......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x83, 0x46, 0x00, // .........5....F. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x29, 0x5b, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......)[..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0x96, 0x21, 0x00, 0x00, 0x29, 0x5b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8f, 0x22, 0x00, // ..!..)[..>....". + 0x00, 0x96, 0x21, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x46, 0x00, // ..!..A........F. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x89, 0x46, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......V...F..>.. + 0x00, 0xf3, 0x54, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..T...V..A...... + 0x00, 0x8a, 0x46, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..F..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x56, 0x00, 0x00, 0x8a, 0x46, 0x00, // .=........V...F. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x01, 0x56, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...NJ...V..A.. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0x8b, 0x46, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......F..B.../.. + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x75, 0x19, 0x00, // .....=.......u.. + 0x00, 0x8b, 0x46, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd8, 0x4e, 0x00, 0x00, 0x75, 0x19, 0x00, // ..F..>....N..u.. + 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... +}; +static const uint8_t fs_clear3_dx9[234] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x00, // .... + 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; -static const uint8_t fs_clear3_dx11[555] = +static const uint8_t fs_clear3_dx11[557] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x04, 0x02, 0x44, 0x58, 0x42, 0x43, 0xd5, 0x4f, 0xed, 0x6d, 0x3f, 0x90, 0xd6, 0xbb, 0x53, // ...DXBC.O.m?...S - 0x7b, 0xdc, 0x55, 0x0b, 0xda, 0x6f, 0x86, 0x01, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x04, // {.U..o.......... - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x88, // ...0.......T.... - 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x68, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, // ...Aon9h...h.... - 0x02, 0xff, 0xff, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, // ...8...0.....$.. - 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .0...0...$...0.. - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0x01, // ................ - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0xac, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x2b, // ...SHDR....@...+ - 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // ...Y...F. ...... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, // ......e.... ... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ......F. ...... - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, // ...>...ISGN,.... - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ....... ........ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, // ...............S - 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x74, // V_POSITION.OSGNt - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, // ...........h.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ...h............ - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x02, // ...........h.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ...h............ - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, // ...........SV_TA - 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x00, 0x00, 0x80, 0x00, // RGET....... + 0x00, 0x04, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xd5, 0x4f, 0xed, 0x6d, 0x3f, 0x90, 0xd6, // .....DXBC.O.m?.. + 0xbb, 0x53, 0x7b, 0xdc, 0x55, 0x0b, 0xda, 0x6f, 0x86, 0x01, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, // .S{.U..o........ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, // .....0.......T.. + 0x00, 0x88, 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0x68, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, // .....Aon9h...h.. + 0x00, 0x00, 0x02, 0xff, 0xff, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, // .....8...0.....$ + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x30, // ...0...0...$...0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, // ................ + 0xff, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, // ................ + 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, // ................ + 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0xac, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .....SHDR....@.. + 0x00, 0x2b, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .+...Y...F. .... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, // .....>...ISGN,.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, // .SV_POSITION.OSG + 0x4e, 0x74, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, // Nt...........h.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....h.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, // .............h.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....h.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, // .............SV_ + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x00, 0x00, 0x80, 0x00, // TARGET....... }; -static const uint8_t fs_clear3_mtl[711] = +static const uint8_t fs_clear3_mtl[734] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH...........us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(1)]];. flo - 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // at4 gl_FragData_ - 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 2 [[color(2)]];. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // float4 gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, // Data_3 [[color(3 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // )]];.};.struct x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif - 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, // orm {. float4 b + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0xb8, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .....using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. float4 gl_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // agData_2 [[color + 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // (2)]];. float4 + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, // gl_FragData_3 [[ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, // color(3)]];.};.s + 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // truct xlatMtlSha + 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, // derUniform {. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, // loat4 bgfx_clear + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, // _color[8];.};.fr + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // agment xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // aderOutput xlatM + 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // tlMain (xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // haderInput _mtl_ + 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, // i [[stage_in]], + 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // constant xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, // ShaderUniform& _ + 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, // mtl_u [[buffer(0 + 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // )]]).{. xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, // ShaderOutput _mt + 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // l_o;. _mtl_o.gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // _FragData_0 = _m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // tl_u.bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // color[0];. _mtl + 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, // _o.gl_FragData_1 + 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, // = _mtl_u.bgfx_c + 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, // lear_color[1];. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // _mtl_o.gl_FragD + 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, // ata_2 = _mtl_u.b 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, // gfx_clear_color[ - 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // 8];.};.fragment - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain - 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta - 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [ - 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, // [buffer(0)]]).{. - 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // xlatMtlShaderO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, // utput _mtl_o;. - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // _mtl_o.gl_FragDa - 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, // ta_0 = _mtl_u.bg - 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, // fx_clear_color[0 - 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // ];. _mtl_o.gl_F - 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ragData_1 = _mtl - 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // _u.bgfx_clear_co - 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // lor[1];. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, // .gl_FragData_2 = - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, // _mtl_u.bgfx_cle - 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ar_color[2];. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // mtl_o.gl_FragDat - 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, // a_3 = _mtl_u.bgf - 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, // x_clear_color[3] - 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ;. return _mtl_ - 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // o;.}... + 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // 2];. _mtl_o.gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // FragData_3 = _mt + 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, // l_u.bgfx_clear_c + 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // olor[3];. retur + 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // n _mtl_o;.}... }; extern const uint8_t* fs_clear3_pssl; extern const uint32_t fs_clear3_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear4.bin.h b/3rdparty/bgfx/src/fs_clear4.bin.h index 8d91172fc31..0fb82b48509 100644 --- a/3rdparty/bgfx/src/fs_clear4.bin.h +++ b/3rdparty/bgfx/src/fs_clear4.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear4_glsl[290] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0xfc, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .....uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -20,113 +20,316 @@ static const uint8_t fs_clear4_glsl[290] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[4];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear4_dx9[244] = +static const uint8_t fs_clear4_spv[3198] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x05, 0x00, 0x00, 0x05, // clear_color..... + 0x00, 0x58, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .X.....#........ + 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x10, 0x00, 0x03, // ................ + 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, // n........5...vec + 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, // 4_splat(f1;..... + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x66, 0x11, 0x00, // ....._x......f.. + 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // .@main(vf4;vf4;v + 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // f4;vf4;vf4;..... + 0x00, 0xbb, 0x60, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..`..gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_.......+..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... + 0x00, 0xc3, 0x44, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..D..gl_FragData + 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x16, 0x53, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_.......S..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... + 0x00, 0xa0, 0x57, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..W..gl_FragData + 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _4_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0x4b, 0x4f, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .KO..param...... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // ./...$Global.... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // ./.......u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, // ect....../...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // ./.......u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // ...../.......u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // nvView......./.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // ./.......u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, // oj......./...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // ./.......u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // ewProj......./.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // ./.......u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, // View...../...... + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // ...../.......u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x2f, 0x09, 0x00, // lphaRef4...../.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_......@,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_4_..... + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... + 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..U..param...... + 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .o8..param...... + 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .I8..param...... + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... + 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // _4_..G.......... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x06, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.../...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#.......H.../.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ./.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.../...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.../...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#...`...H.../.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // ./.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.../...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.../...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#.......H.../.. + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // ./.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.../...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.../...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#...`...H.../.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // ./.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.../...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.../...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#.......H.../.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // ./.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.../...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#... ...H.../.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // ./.......G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x08, 0x00, 0x75, 0x0a, 0x00, // .........!...u.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... + 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... + 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf1, 0x02, 0x00, // .j... .......... + 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .e...j...+...... + 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x06, 0x05, 0x00, // .".............. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x2f, 0x09, 0x00, // ....."......./.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. + 0x00, 0xf1, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....e...e...... + 0x00, 0x06, 0x05, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xac, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x2f, 0x09, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xac, 0x0b, 0x00, 0x00, 0x42, 0x13, 0x00, // ./...;.......B.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, // .....+.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, // .....+.......... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, // .....+.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x17, 0x0a, 0x00, // .....+.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd2, 0x11, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // .....6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, // .............Sa. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........G..... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........U..... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......o8..... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......I8..... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. + 0x00, 0x39, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, 0x00, 0x66, 0x11, 0x00, // .9........,..f.. + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, // ..G...U..o8..I8. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....=........C. + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, // ..G..=.......y9. + 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, // ..U..=........,. + 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, // .o8..=........,. + 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, // .I8..=.......@,. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....>........C. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>.......y9..>.. + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, // ......,..>...... + 0x00, 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x40, 0x2c, 0x00, // ..,..>.......@,. + 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .....8...6...... + 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .5...........7.. + 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, // ................ + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......dW..... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........N..... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......I9..... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........9..... + 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, // .P........*..dW. + 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..N..I9...9..... + 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // ..*..8...6...... + 0x00, 0x66, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x0a, 0x00, 0x00, 0x37, 0x00, 0x03, // .f.......u...7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbb, 0x60, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......`..7...... + 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc3, 0x44, 0x00, // ..+..7........D. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x16, 0x53, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........S..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa0, 0x57, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x0d, 0x61, 0x00, // ......W.......a. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x4b, 0x4f, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......KO..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4b, 0x4f, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>...KO......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x4b, 0x4f, 0x00, // .........5...KO. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x72, 0x19, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......r...B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0xa4, 0x5b, 0x00, 0x00, 0x72, 0x19, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbb, 0x60, 0x00, // ..[..r...>....`. + 0x00, 0xa4, 0x5b, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x18, 0x36, 0x00, // ..[..A........6. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc8, 0x5e, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......^...6..>.. + 0x00, 0x8b, 0x2b, 0x00, 0x00, 0xc8, 0x5e, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..+...^..A...... + 0x00, 0x19, 0x36, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..6..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc9, 0x5e, 0x00, 0x00, 0x19, 0x36, 0x00, // .=........^...6. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x44, 0x00, 0x00, 0xc9, 0x5e, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....D...^..A.. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0x1a, 0x36, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......6..B.../.. + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xca, 0x5e, 0x00, // .....=........^. + 0x00, 0x1a, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x16, 0x53, 0x00, 0x00, 0xca, 0x5e, 0x00, // ..6..>....S...^. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x1b, 0x36, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........6..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0x3d, 0x22, 0x00, 0x00, 0x1b, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa0, 0x57, 0x00, // .="...6..>....W. + 0x00, 0x3d, 0x22, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .="......8.... +}; +static const uint8_t fs_clear4_dx9[234] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x00, // .... + 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; -static const uint8_t fs_clear4_dx11[499] = +static const uint8_t fs_clear4_dx11[501] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0xcc, 0x01, 0x44, 0x58, 0x42, 0x43, 0x0e, 0x7a, 0x23, 0x41, 0x2a, 0x54, 0xbd, 0xa3, 0x8b, // ...DXBC.z#A*T... - 0x1e, 0xbd, 0x2e, 0x91, 0x6f, 0x8b, 0x29, 0x01, 0x00, 0x00, 0x00, 0xcc, 0x01, 0x00, 0x00, 0x03, // ....o.)......... - 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x49, // ...,...`.......I - 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, // SGN,........... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, // .......SV_POSITI - 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x8c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, // ON.OSGN......... - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, // ...........SV_TA - 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xd0, 0x00, 0x00, 0x00, 0x40, // RGET...SHDR....@ - 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, // ...4...Y...F. .. - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, // .......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x04, // ......e.... ... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, // . .........>.... - 0x00, 0x80, 0x00, // ... + 0x00, 0xcc, 0x01, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x0e, 0x7a, 0x23, 0x41, 0x2a, 0x54, 0xbd, // .....DXBC.z#A*T. + 0xa3, 0x8b, 0x1e, 0xbd, 0x2e, 0x91, 0x6f, 0x8b, 0x29, 0x01, 0x00, 0x00, 0x00, 0xcc, 0x01, 0x00, // ......o.)....... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, // .....,...`...... + 0x00, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .ISGN,.......... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // . .............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, // .........SV_POSI + 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x8c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // TION.OSGN....... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, // .............SV_ + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xd0, 0x00, 0x00, // TARGET...SHDR... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, // .@...4...Y...F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .........e.... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, // .F. .........>.. + 0x01, 0x00, 0x00, 0x80, 0x00, // ..... }; -static const uint8_t fs_clear4_mtl[801] = +static const uint8_t fs_clear4_mtl[824] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH...........us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x12, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .....using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. float4 gl_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // agData_2 [[color + 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // (2)]];. float4 + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, // gl_FragData_3 [[ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // color(3)]];. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // oat4 gl_FragData + 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, // _4 [[color(4)]]; 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(1)]];. flo - 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // at4 gl_FragData_ - 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 2 [[color(2)]];. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // float4 gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, // Data_3 [[color(3 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, // )]];. float4 gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, // _FragData_4 [[co - 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, // lor(4)]];.};.str - 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // uct xlatMtlShade - 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // rUniform {. flo - 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, // at4 bgfx_clear_c - 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, // olor[8];.};.frag - 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ment xlatMtlShad - 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // erOutput xlatMtl - 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // Main (xlatMtlSha - 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, // derInput _mtl_i - 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // nstant xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, // aderUniform& _mt - 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // l_u [[buffer(0)] - 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ - 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // o;. _mtl_o.gl_F - 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ragData_0 = _mtl - 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // _u.bgfx_clear_co - 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // lor[0];. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, // .gl_FragData_1 = - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, // _mtl_u.bgfx_cle - 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ar_color[1];. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // mtl_o.gl_FragDat - 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, // a_2 = _mtl_u.bgf - 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, // x_clear_color[2] - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr - 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // agData_3 = _mtl_ - 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // u.bgfx_clear_col - 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // or[3];. _mtl_o. - 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x3d, 0x20, // gl_FragData_4 = - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // _mtl_u.bgfx_clea - 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, // r_color[4];. re - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // turn _mtl_o;.}.. - 0x00, // . + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // tlShaderUniform + 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, // {. float4 bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, // clear_color[8];. + 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // };.fragment xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, // MtlShaderOutput + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, // xlatMtlMain (xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, // tMtlShaderInput + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, // _mtl_i [[stage_i + 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, // n]], constant xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, // atMtlShaderUnifo + 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, // rm& _mtl_u [[buf + 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // fer(0)]]).{. xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu + 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // t _mtl_o;. _mtl + 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, // _o.gl_FragData_0 + 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, // = _mtl_u.bgfx_c + 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, // lear_color[0];. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // _mtl_o.gl_FragD + 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, // ata_1 = _mtl_u.b + 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, // gfx_clear_color[ + 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // 1];. _mtl_o.gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // FragData_2 = _mt + 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, // l_u.bgfx_clear_c + 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // olor[2];. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, // o.gl_FragData_3 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // = _mtl_u.bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // ear_color[3];. + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // _mtl_o.gl_FragDa + 0x74, 0x61, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, // ta_4 = _mtl_u.bg + 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, // fx_clear_color[4 + 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ];. return _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... }; extern const uint8_t* fs_clear4_pssl; extern const uint32_t fs_clear4_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear5.bin.h b/3rdparty/bgfx/src/fs_clear5.bin.h index 455fa0b6f25..3765521e1ef 100644 --- a/3rdparty/bgfx/src/fs_clear5.bin.h +++ b/3rdparty/bgfx/src/fs_clear5.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear5_glsl[330] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0x24, 0x01, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .$...uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -22,121 +22,343 @@ static const uint8_t fs_clear5_glsl[330] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[5];.}... }; -static const uint8_t fs_clear5_dx9[244] = +static const uint8_t fs_clear5_spv[3458] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x06, 0x00, 0x00, 0x06, // clear_color..... + 0x00, 0x5c, 0x0d, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .......#........ + 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xc3, 0x15, 0x00, // ................ + 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, // .main........5.. + 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, // .vec4_splat(f1;. + 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x0a, // ........._x..... + 0x00, 0x44, 0x12, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, // .D...@main(vf4;v + 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // f4;vf4;vf4;vf4;v + 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x68, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......hT..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xa2, 0x4c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..L..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x52, 0x34, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_......R4..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0x53, 0x34, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .S4..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa5, 0x42, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......B..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0x2f, 0x47, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ./G..gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _5_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0x13, 0x58, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..X..param...... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .4...$Global.... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .4.......u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......4...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .4.......u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....4.......u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // nvView.......4.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .4.......u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......4...... + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .4.......u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // ewProj.......4.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .4.......u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....4...... + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....4.......u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x34, 0x02, 0x00, // lphaRef4.....4.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .@,..gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _5_.......G..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // am........U..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......o8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x70, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......p8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......I8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0xc3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, // _5_..G...N...... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1b, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...4...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#.......H...4.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .4.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...4...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...4...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#...`...H...4.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .4.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...4...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...4...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#.......H...4.. + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .4.......#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...4...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...4...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#...`...H...4.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .4.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...4...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...4...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#.......H...4.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .4.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H...4...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#... ...H...4.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .4.......G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x09, 0x00, 0x7f, 0x07, 0x00, // .........!...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, // ................ + 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... + 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, // .N...e...j...+.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....".......... + 0x00, 0x1b, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // ........."...... + 0x00, 0x34, 0x02, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .4...........e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...N...e...e.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1b, 0x05, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb1, 0x04, 0x00, // ......... ...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb1, 0x04, 0x00, // .....4...;...... + 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.............. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ./.......+...... + 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... + 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... + 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... + 0x00, 0x17, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... + 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // ......... ...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xd2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... + 0x00, 0xc3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... + 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, // .Sa..;........G. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, // .....;.......o8. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x70, 0x38, 0x00, // .....;.......p8. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, // .....;.......I8. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, // .....9........,. + 0x00, 0x44, 0x12, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, // .D....G...U..o8. + 0x00, 0x70, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // .p8..I8......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....y9...U..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..o8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..p8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..I8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....@,......>.. + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, // .y9..>........,. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........,..>.. + 0x00, 0xd2, 0x11, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x15, 0x00, // ......,..>...... + 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .@,......8...6.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, // .....5.......... + 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. + 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, // .....=.......dW. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, // .....=........N. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, // .....=.......I9. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, // .....=........9. + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, // .....P........*. + 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, // .dW...N..I9...9. + 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......*..8...6.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x07, 0x00, // .....D.......... + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x68, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......hT..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x4c, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......L..7...... + 0x00, 0x52, 0x34, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x53, 0x34, 0x00, // .R4..7.......S4. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa5, 0x42, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........B..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2f, 0x47, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x56, 0x1f, 0x00, // ...../G......V.. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x58, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........X..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x13, 0x58, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....X......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x58, 0x00, // .........5....X. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3a, 0x22, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......:"..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0xed, 0x19, 0x00, 0x00, 0x3a, 0x22, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x68, 0x54, 0x00, // .....:"..>...hT. + 0x00, 0xed, 0x19, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe0, 0x3e, 0x00, // .....A........>. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x11, 0x1d, 0x00, 0x00, 0xe0, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..........>..>.. + 0x00, 0xa2, 0x4c, 0x00, 0x00, 0x11, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..L......A...... + 0x00, 0xe1, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..>..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x12, 0x1d, 0x00, 0x00, 0xe1, 0x3e, 0x00, // .=............>. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x52, 0x34, 0x00, 0x00, 0x12, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...R4......A.. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe2, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......>..B.../.. + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x1d, 0x00, // .....=.......... + 0x00, 0xe2, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x53, 0x34, 0x00, 0x00, 0x13, 0x1d, 0x00, // ..>..>...S4..... + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe3, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........>..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0x14, 0x1d, 0x00, 0x00, 0xe3, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa5, 0x42, 0x00, // ......>..>....B. + 0x00, 0x14, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe4, 0x3e, 0x00, // .....A........>. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x05, 0x2b, 0x00, 0x00, 0xe4, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......+...>..>.. + 0x00, 0x2f, 0x47, 0x00, 0x00, 0x05, 0x2b, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ./G...+......8.. + 0x00, 0x00, // .. +}; +static const uint8_t fs_clear5_dx9[234] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x00, // .... + 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; -static const uint8_t fs_clear5_dx11[559] = +static const uint8_t fs_clear5_dx11[561] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x08, 0x02, 0x44, 0x58, 0x42, 0x43, 0x60, 0x35, 0x1a, 0x9f, 0xa4, 0xdc, 0x6a, 0x17, 0x97, // ...DXBC`5....j.. - 0x20, 0xbd, 0x81, 0xee, 0x84, 0xd9, 0xac, 0x01, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x03, // ............... - 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x49, // ...,...`.......I - 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, // SGN,........... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, // .......SV_POSITI - 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0xa4, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, // ON.OSGN......... - 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x01, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x05, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, // ...SV_TARGET...S - 0x48, 0x44, 0x52, 0xf4, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x59, // HDR....@...=...Y - 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x65, // ...F. .........e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, // ......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, // ......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, // .......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x04, // .......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, // .......>....... + 0x00, 0x08, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x60, 0x35, 0x1a, 0x9f, 0xa4, 0xdc, 0x6a, // .....DXBC`5....j + 0x17, 0x97, 0x20, 0xbd, 0x81, 0xee, 0x84, 0xd9, 0xac, 0x01, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, // .. ............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, // .....,...`...... + 0x00, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .ISGN,.......... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // . .............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, // .........SV_POSI + 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0xa4, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // TION.OSGN....... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, // .....SV_TARGET.. + 0xab, 0x53, 0x48, 0x44, 0x52, 0xf4, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .SHDR....@...=.. + 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // .Y...F. ........ + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .. ......6.... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....F. ........ + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .........6.... . + 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....F. ........ + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .........6.... . + 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....F. ........ + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, // .........>...... + 0x00, // . }; -static const uint8_t fs_clear5_mtl[891] = +static const uint8_t fs_clear5_mtl[914] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH.......l...us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x6c, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .l...using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. float4 gl_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // agData_2 [[color + 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // (2)]];. float4 + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, // gl_FragData_3 [[ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // color(3)]];. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // oat4 gl_FragData + 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, // _4 [[color(4)]]; 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(1)]];. flo - 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // at4 gl_FragData_ - 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 2 [[color(2)]];. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // float4 gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, // Data_3 [[color(3 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, // )]];. float4 gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, // _FragData_4 [[co - 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // lor(4)]];. floa - 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, // t4 gl_FragData_5 - 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x35, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, // [[color(5)]];.} - 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // ;.struct xlatMtl - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, // ShaderUniform {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // float4 bgfx_cl - 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, // ear_color[8];.}; - 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // .fragment xlatMt - 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, // lShaderOutput xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, // atMtlMain (xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, // tlShaderInput _m - 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, // tl_i [[stage_in] - 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ], constant xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform - 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, // & _mtl_u [[buffe - 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, // r(0)]]).{. xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, // MtlShaderOutput - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // _mtl_o;. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, // .gl_FragData_0 = + 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_5 [[color( + 0x35, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // 5)]];.};.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, // xlatMtlShaderUni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // form {. float4 + 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // bgfx_clear_color + 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, // [8];.};.fragment + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, // tput xlatMtlMain + 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // (xlatMtlShaderI + 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, // nput _mtl_i [[st + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, // age_in]], consta + 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // nt xlatMtlShader + 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, // Uniform& _mtl_u + 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, // [[buffer(0)]]).{ + 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // . xlatMtlShader + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, // Output _mtl_o;. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // _mtl_o.gl_FragD + 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, // ata_0 = _mtl_u.b + 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, // gfx_clear_color[ + 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // 0];. _mtl_o.gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // FragData_1 = _mt + 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, // l_u.bgfx_clear_c + 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // olor[1];. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, // o.gl_FragData_2 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // = _mtl_u.bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // ear_color[2];. + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // _mtl_o.gl_FragDa + 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, // ta_3 = _mtl_u.bg + 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, // fx_clear_color[3 + 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // ];. _mtl_o.gl_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ragData_4 = _mtl + 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // _u.bgfx_clear_co + 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // lor[4];. _mtl_o + 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x3d, // .gl_FragData_5 = 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, // _mtl_u.bgfx_cle - 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ar_color[0];. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // mtl_o.gl_FragDat - 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, // a_1 = _mtl_u.bgf - 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, // x_clear_color[1] - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr - 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // agData_2 = _mtl_ - 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // u.bgfx_clear_col - 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // or[2];. _mtl_o. - 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, // gl_FragData_3 = - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // _mtl_u.bgfx_clea - 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // r_color[3];. _m - 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // tl_o.gl_FragData - 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, // _4 = _mtl_u.bgfx - 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, // _clear_color[4]; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // gData_5 = _mtl_u - 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo - 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // r[5];. return _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... + 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, // ar_color[5];. r + 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, // eturn _mtl_o;.}. + 0x0a, 0x00, // .. }; extern const uint8_t* fs_clear5_pssl; extern const uint32_t fs_clear5_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear6.bin.h b/3rdparty/bgfx/src/fs_clear6.bin.h index dd845365996..50f560bad57 100644 --- a/3rdparty/bgfx/src/fs_clear6.bin.h +++ b/3rdparty/bgfx/src/fs_clear6.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear6_glsl[370] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0x4c, 0x01, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .L...uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -25,131 +25,367 @@ static const uint8_t fs_clear6_glsl[370] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x36, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[6];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear6_dx9[244] = +static const uint8_t fs_clear6_spv[3718] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x00, 0x00, 0x07, // clear_color..... + 0x00, 0x60, 0x0e, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .`.....#........ + 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xc3, 0x15, 0x00, // ................ + 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, // ................ + 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....main....... + 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( + 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. + 0x00, 0x05, 0x00, 0x0b, 0x00, 0x97, 0x0f, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v + 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // f4;vf4;vf4;vf4;v + 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // f4;vf4;vf4;..... + 0x00, 0x15, 0x48, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..H..gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3a, 0x23, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_......:#..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... + 0x00, 0x1a, 0x3d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..=..gl_FragData + 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x1b, 0x3d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_.......=..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... + 0x00, 0x1c, 0x3d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..=..gl_FragData + 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x6d, 0x4b, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _4_......mK..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_5_..... + 0x00, 0xf7, 0x4f, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..O..gl_FragData + 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _6_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0xa2, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // nvView.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // ewProj.......... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0xfc, 0x06, 0x00, // lphaRef4........ + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_......@,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_6_..... + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... + 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..U..param...... + 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .o8..param...... + 0x00, 0x70, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .p8..param...... + 0x00, 0x71, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .q8..param...... + 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .I8..param...... + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... + 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _4_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_5_..... + 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, // _6_..G.......... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x30, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G...0...... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#.......H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#...`...H...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#.......H...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#...`...H...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#.......H...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#... ...H...... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x0a, 0x00, 0x1b, 0x07, 0x00, // .........!...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. + 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....e.......... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, // .+.......j... .. + 0x00, 0x1c, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .........e...j.. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, // .+......."...... + 0x00, 0x1c, 0x00, 0x04, 0x00, 0x30, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .....0.......".. + 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e.......e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x30, 0x05, 0x00, 0x00, 0x20, 0x00, 0x04, // .e.......0... .. + 0x00, 0x79, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y...........;.. + 0x00, 0x79, 0x09, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .y...B.......... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ...../.......+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x9c, 0x02, 0x00, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .....Sa..;...... + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..G......;...... + 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..U......;...... + 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .o8......;...... + 0x00, 0x70, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .p8......;...... + 0x00, 0x71, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .q8......;...... + 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .I8......;...... + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x00, // .........9...... + 0x00, 0xbe, 0x2c, 0x00, 0x00, 0x97, 0x0f, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x85, 0x55, 0x00, // ..,.......G...U. + 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x71, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, // .o8..p8..q8..I8. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....=........C. + 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, // ..G..=.......y9. + 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, // ..U..=........,. + 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2c, 0x00, // .o8..=........,. + 0x00, 0x70, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdc, 0x2c, 0x00, // .p8..=........,. + 0x00, 0x71, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, // .q8..=........,. + 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, // .I8..=.......@,. + 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....>........C. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>.......y9..>.. + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, // ......,..>...... + 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xdc, 0x2c, 0x00, // ..,..>........,. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x15, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........,..>.. + 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .....@,......8.. + 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.......5...... + 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .....7.......... + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... + 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .dW......=...... + 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ..N......=...... + 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .I9......=...... + 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ..9......P...... + 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, // ..*..dW...N..I9. + 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, // ..9.......*..8.. + 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x97, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x1b, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x15, 0x48, 0x00, // .....7........H. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x3a, 0x23, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......:#..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1a, 0x3d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......=..7...... + 0x00, 0x1b, 0x3d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1c, 0x3d, 0x00, // ..=..7........=. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6d, 0x4b, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......mK..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf7, 0x4f, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x64, 0x59, 0x00, // ......O......dY. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xa2, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........G..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x47, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....G......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0xa2, 0x47, 0x00, // .........5....G. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x48, 0x5c, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......H...B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0xfb, 0x53, 0x00, 0x00, 0x48, 0x5c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x15, 0x48, 0x00, // ..S..H...>....H. + 0x00, 0xfb, 0x53, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xa8, 0x47, 0x00, // ..S..A........G. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x57, 0x00, 0x00, 0xa8, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......W...G..>.. + 0x00, 0x3a, 0x23, 0x00, 0x00, 0x1f, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // .:#...W..A...... + 0x00, 0xa9, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..G..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x57, 0x00, 0x00, 0xa9, 0x47, 0x00, // .=....... W...G. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1a, 0x3d, 0x00, 0x00, 0x20, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....=.. W..A.. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0xaa, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......G..B.../.. + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x57, 0x00, // .....=.......!W. + 0x00, 0xaa, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1b, 0x3d, 0x00, 0x00, 0x21, 0x57, 0x00, // ..G..>....=..!W. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xab, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........G..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0x22, 0x57, 0x00, 0x00, 0xab, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1c, 0x3d, 0x00, // ."W...G..>....=. + 0x00, 0x22, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xac, 0x47, 0x00, // ."W..A........G. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x23, 0x57, 0x00, 0x00, 0xac, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....#W...G..>.. + 0x00, 0x6d, 0x4b, 0x00, 0x00, 0x23, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // .mK..#W..A...... + 0x00, 0xad, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1d, 0x0a, 0x00, // ..G..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x94, 0x1a, 0x00, 0x00, 0xad, 0x47, 0x00, // .=............G. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x4f, 0x00, 0x00, 0x94, 0x1a, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>....O......... + 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .8.... +}; +static const uint8_t fs_clear6_dx9[234] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x00, // .... + 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; -static const uint8_t fs_clear6_dx11[619] = +static const uint8_t fs_clear6_dx11[621] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x44, 0x02, 0x44, 0x58, 0x42, 0x43, 0x68, 0xe2, 0x88, 0x87, 0x2b, 0x8c, 0x92, 0xbc, 0x98, // .D.DXBCh...+.... - 0x11, 0xb6, 0x94, 0x5c, 0x76, 0x9a, 0x47, 0x01, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x03, // ....v.G....D.... - 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x49, // ...,...`...$...I - 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, // SGN,........... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, // .......SV_POSITI - 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0xbc, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, // ON.OSGN......... - 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x01, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x05, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, // ...........SV_TA - 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x18, 0x01, 0x00, 0x00, 0x40, // RGET...SHDR....@ - 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, // ...F...Y...F. .. - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, // .......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x04, // ......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // .... ......6.... - 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // ......F. ...... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x46, // ...6.... ......F - 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // . .........6.... - 0x20, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, // ......F. ...... - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, // ...>....... + 0x00, 0x44, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x68, 0xe2, 0x88, 0x87, 0x2b, 0x8c, 0x92, // .D...DXBCh...+.. + 0xbc, 0x98, 0x11, 0xb6, 0x94, 0x5c, 0x76, 0x9a, 0x47, 0x01, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, // ......v.G....D.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x24, 0x01, 0x00, // .....,...`...$.. + 0x00, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .ISGN,.......... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // . .............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, // .........SV_POSI + 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0xbc, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // TION.OSGN....... + 0x00, 0x08, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, // .............SV_ + 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x18, 0x01, 0x00, // TARGET...SHDR... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, // .@...F...Y...F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .........e.... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .e.... ......6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, // .....6.... ..... + 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .F. .........6.. + 0x06, 0xf2, 0x20, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .. ......F. .... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, // .....>....... }; -static const uint8_t fs_clear6_mtl[981] = +static const uint8_t fs_clear6_mtl[1004] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH...........us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0xc6, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // .....using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. float4 gl_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // agData_2 [[color + 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // (2)]];. float4 + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, // gl_FragData_3 [[ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // color(3)]];. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // oat4 gl_FragData + 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, // _4 [[color(4)]]; 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(1)]];. flo - 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // at4 gl_FragData_ - 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 2 [[color(2)]];. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // float4 gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, // Data_3 [[color(3 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, // )]];. float4 gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, // _FragData_4 [[co - 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // lor(4)]];. floa - 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, // t4 gl_FragData_5 - 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x35, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // [[color(5)]];. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // float4 gl_FragD - 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x36, 0x29, // ata_6 [[color(6) - 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, // ]];.};.struct xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, // atMtlShaderUnifo - 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, // rm {. float4 bg - 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, // fx_clear_color[8 - 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, // ];.};.fragment x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, // latMtlShaderOutp - 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, // ut xlatMtlMain ( - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp - 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, // ut _mtl_i [[stag - 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, // e_in]], constant - 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, // xlatMtlShaderUn - 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, // iform& _mtl_u [[ - 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // buffer(0)]]).{. - 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu - 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // tput _mtl_o;. _ + 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_5 [[color( + 0x35, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 5)]];. float4 g + 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_6 [[c + 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x36, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // olor(6)]];.};.st + 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad + 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // erUniform {. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // oat4 bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, // color[8];.};.fra + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // gment xlatMtlSha + 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // derOutput xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // lMain (xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // aderInput _mtl_i + 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, // [[stage_in]], c + 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // onstant xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, // haderUniform& _m + 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, // tl_u [[buffer(0) + 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // ]]).{. xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // haderOutput _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // _o;. _mtl_o.gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // FragData_0 = _mt + 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, // l_u.bgfx_clear_c + 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // olor[0];. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, // o.gl_FragData_1 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // = _mtl_u.bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // ear_color[1];. + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // _mtl_o.gl_FragDa + 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, // ta_2 = _mtl_u.bg + 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, // fx_clear_color[2 + 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // ];. _mtl_o.gl_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ragData_3 = _mtl + 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // _u.bgfx_clear_co + 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // lor[3];. _mtl_o + 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x3d, // .gl_FragData_4 = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, // _mtl_u.bgfx_cle + 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ar_color[4];. _ 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // mtl_o.gl_FragDat - 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, // a_0 = _mtl_u.bgf - 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, // x_clear_color[0] + 0x61, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, // a_5 = _mtl_u.bgf + 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x35, 0x5d, // x_clear_color[5] 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr - 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // agData_1 = _mtl_ + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // agData_6 = _mtl_ 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // u.bgfx_clear_col - 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // or[1];. _mtl_o. - 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, // gl_FragData_2 = - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // _mtl_u.bgfx_clea - 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // r_color[2];. _m - 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // tl_o.gl_FragData - 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, // _3 = _mtl_u.bgfx - 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, // _clear_color[3]; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // gData_4 = _mtl_u - 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo - 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // r[4];. _mtl_o.g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x5f, // l_FragData_5 = _ - 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, // mtl_u.bgfx_clear - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // _color[5];. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // l_o.gl_FragData_ - 0x36, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, // 6 = _mtl_u.bgfx_ - 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x36, 0x5d, 0x3b, 0x0a, // clear_color[6];. - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; - 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... + 0x6f, 0x72, 0x5b, 0x36, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // or[6];. return + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... }; extern const uint8_t* fs_clear6_pssl; extern const uint32_t fs_clear6_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear7.bin.h b/3rdparty/bgfx/src/fs_clear7.bin.h index caf3798fea4..c43bccd472b 100644 --- a/3rdparty/bgfx/src/fs_clear7.bin.h +++ b/3rdparty/bgfx/src/fs_clear7.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_clear7_glsl[410] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... 0x00, 0x74, 0x01, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, // .t...uniform vec 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // 4 bgfx_clear_col @@ -27,140 +27,393 @@ static const uint8_t fs_clear7_glsl[410] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x37, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[7];.}... }; -static const uint8_t fs_clear7_dx9[244] = +static const uint8_t fs_clear7_spv[3978] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x64, 0x0f, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .d.....#........ + 0x00, 0x2d, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .-b............. + 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st + 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... + 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xc3, 0x15, 0x00, // ................ + 0x00, 0xf1, 0x0d, 0x00, 0x00, 0xe2, 0x11, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, // ................ + 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, // .....5...vec4_sp + 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, // lat(f1;......... + 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x0c, 0x00, 0xd9, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, // ._x..........@ma + 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // in(vf4;vf4;vf4;v + 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // f4;vf4;vf4;vf4;v + 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xfb, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;.......T..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x51, 0x44, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .QD..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe2, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......E..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xe3, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..E..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe4, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......E..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0xe5, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..E..gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_......5T..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_6_..... + 0x00, 0xbf, 0x58, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..X..gl_FragData + 0x5f, 0x37, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _7_..........bgf + 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... + 0x00, 0x6a, 0x50, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .jP..param...... + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR + 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. + 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i + 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // nvView.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr + 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // ewProj.......... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model + 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ + 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj + 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a + 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0xc4, 0x0b, 0x00, // lphaRef4........ + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0xdd, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_.......,..gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_6_..... + 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .@,..gl_FragData + 0x5f, 0x37, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _7_.......G..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // am........U..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......o8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x70, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......p8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x71, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......q8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x72, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......r8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......I8..par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par + 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... + 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... + 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... + 0x00, 0xc3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_..........gl_ + 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_6_..... + 0x00, 0xe2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData + 0x5f, 0x37, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // _7_..G.......... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x45, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G...E...... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#.......H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#...`...H...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#.......H...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. + 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#...`...H...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#.......H...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#... ...H...... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. + 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x15, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x0d, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe2, 0x11, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x0b, 0x00, 0x49, 0x09, 0x00, // .........!...I.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .........e...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....+.......j.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, // . ...........e.. + 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .j...+.......".. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x45, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, // .........E...... + 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, // .".............. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .....e...e...e.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x08, 0x04, 0x00, // .e...e...e...... + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x45, 0x05, 0x00, // .e...e.......E.. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x7e, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc4, 0x0b, 0x00, // . ...~.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7e, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, // .;...~...B...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, // .+......./...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, // .+.............. + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, // .+....... ...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. + 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........Sa..;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......G......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......U......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....o8......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....p8......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x71, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....q8......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x72, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....r8......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....I8......;.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x0c, // .............9.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, 0x00, 0xd9, 0x0d, 0x00, 0x00, 0xc9, 0x47, 0x00, // ......,.......G. + 0x00, 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x71, 0x38, 0x00, // ..U..o8..p8..q8. + 0x00, 0x72, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // .r8..I8......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....y9...U..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..o8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..p8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x71, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..q8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdd, 0x2c, 0x00, 0x00, 0x72, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..r8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..I8..=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....@,......>.. + 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... + 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, // .y9..>........,. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........,..>.. + 0x00, 0xd2, 0x11, 0x00, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x15, 0x00, // ......,..>...... + 0x00, 0xdd, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0xed, 0x2c, 0x00, // ..,..>........,. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x11, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.......@,..... + 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... + 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....dW......=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......N......=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....I9......=.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // ......9......P.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, // ......*..dW...N. + 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, // .I9...9.......*. + 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xd9, 0x0d, 0x00, // .8...6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .....I...7...... + 0x00, 0xfb, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x51, 0x44, 0x00, // ..T..7.......QD. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe2, 0x45, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........E..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe3, 0x45, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......E..7...... + 0x00, 0xe4, 0x45, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe5, 0x45, 0x00, // ..E..7........E. + 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x35, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......5T..7.. + 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbf, 0x58, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2c, 0x62, 0x00, // ......X......,b. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6a, 0x50, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......jP..... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6a, 0x50, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>...jP......9.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x6a, 0x50, 0x00, // .........5...jP. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x91, 0x1a, 0x00, 0x00, 0x42, 0x13, 0x00, // .A...........B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0xc3, 0x5c, 0x00, 0x00, 0x91, 0x1a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xfb, 0x54, 0x00, // .........>....T. + 0x00, 0xc3, 0x5c, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x37, 0x37, 0x00, // .....A.......77. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe7, 0x5f, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......_..77..>.. + 0x00, 0x51, 0x44, 0x00, 0x00, 0xe7, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // .QD..._..A...... + 0x00, 0x38, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // .87..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe8, 0x5f, 0x00, 0x00, 0x38, 0x37, 0x00, // .=........_..87. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x45, 0x00, 0x00, 0xe8, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....E..._..A.. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0x39, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....97..B.../.. + 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe9, 0x5f, 0x00, // .....=........_. + 0x00, 0x39, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe3, 0x45, 0x00, 0x00, 0xe9, 0x5f, 0x00, // .97..>....E..._. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3a, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......:7..B.. + 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... + 0x00, 0xea, 0x5f, 0x00, 0x00, 0x3a, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe4, 0x45, 0x00, // .._..:7..>....E. + 0x00, 0xea, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3b, 0x37, 0x00, // .._..A.......;7. + 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. + 0x00, 0x1d, 0x00, 0x00, 0x00, 0xeb, 0x5f, 0x00, 0x00, 0x3b, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......_..;7..>.. + 0x00, 0xe5, 0x45, 0x00, 0x00, 0xeb, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..E..._..A...... + 0x00, 0x3c, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1d, 0x0a, 0x00, // .<7..B.../...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xec, 0x5f, 0x00, 0x00, 0x3c, 0x37, 0x00, // .=........_..<7. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x54, 0x00, 0x00, 0xec, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...5T..._..A.. + 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3d, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....=7..B.../.. + 0x00, 0x20, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5c, 0x23, 0x00, // . ...=........#. + 0x00, 0x3d, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbf, 0x58, 0x00, 0x00, 0x5c, 0x23, 0x00, // .=7..>....X...#. + 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... +}; +static const uint8_t fs_clear7_dx9[234] = +{ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. - 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ - 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b - 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // gfx_clear_color. - 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros - 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha - 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. - 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... - 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ - 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x00, // .... + 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, // ...........".CTA + 0x42, 0x1c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, // B....[.......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, // .........T...0.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........D...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // r............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x31, 0x00, 0xab, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // 0.1............. + 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, // ................ + 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, // ................ + 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // .......... }; -static const uint8_t fs_clear7_dx11[679] = +static const uint8_t fs_clear7_dx11[681] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x80, 0x02, 0x44, 0x58, 0x42, 0x43, 0xe7, 0x1e, 0xec, 0x06, 0x0c, 0xd8, 0x43, 0x65, 0x9a, // ...DXBC......Ce. - 0x6f, 0x6f, 0xc7, 0x6f, 0x21, 0xde, 0xa4, 0x01, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, // oo.o!........... - 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x49, // ...,...`...<...I - 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, // SGN,........... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, // .......SV_POSITI - 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0xd4, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, // ON.OSGN......... - 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x01, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x05, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x07, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, // ...SV_TARGET...S - 0x48, 0x44, 0x52, 0x3c, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x59, // HDR<...@...O...Y - 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x65, // ...F. .........e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, // ......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, // ...e.... ......e - 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, // .... ......e.... - 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x06, // ......e.... ... - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x07, 0x00, 0x00, 0x00, 0x36, // ...e.... ......6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x01, // .......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x03, // .......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x05, // .......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 - 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, // .... ......F. .. - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x07, // .......6.... ... - 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, // ...F. .........> - 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, // ....... + 0x00, 0x80, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xe7, 0x1e, 0xec, 0x06, 0x0c, 0xd8, 0x43, // .....DXBC......C + 0x65, 0x9a, 0x6f, 0x6f, 0xc7, 0x6f, 0x21, 0xde, 0xa4, 0x01, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, // e.oo.o!......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, // .....,...`...<.. + 0x00, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .ISGN,.......... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // . .............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, // .........SV_POSI + 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0xd4, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // TION.OSGN....... + 0x00, 0x08, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, // .....SV_TARGET.. + 0xab, 0x53, 0x48, 0x44, 0x52, 0x3c, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, // .SHDR<...@...O.. + 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .Y...F. ........ + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, // .....e.... ..... + 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.... ......e.. + 0x03, 0xf2, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .. ......e.... . + 0x00, 0x06, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x07, 0x00, 0x00, // .....e.... ..... + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .........6.... . + 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....F. ........ + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .........6.... . + 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .....F. ........ + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .........6.... . + 0x00, 0x05, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // .....F. ........ + 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .6.... ......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, 0x20, 0x10, // .........6.... . + 0x00, 0x07, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .....F. ........ + 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, // .>....... }; -static const uint8_t fs_clear7_mtl[1071] = +static const uint8_t fs_clear7_mtl[1094] = { - 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x75, 0x73, // FSH....... ...us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { + 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ + 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x02, 0x08, 0x00, 0x00, 0x08, // clear_color..... + 0x00, 0x20, 0x04, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, // . ...using names + 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // pace metal;.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // Input {.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, // gl_FragData_0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, // [color(0)]];. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // loat4 gl_FragDat + 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, // a_1 [[color(1)]] + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. float4 gl_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // agData_2 [[color + 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // (2)]];. float4 + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, // gl_FragData_3 [[ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // color(3)]];. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // oat4 gl_FragData + 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, // _4 [[color(4)]]; 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_0 [[color( - 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 0)]];. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_1 [[c - 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(1)]];. flo + 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, // gData_5 [[color( + 0x35, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // 5)]];. float4 g + 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x5b, 0x5b, 0x63, // l_FragData_6 [[c + 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x36, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // olor(6)]];. flo 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // at4 gl_FragData_ - 0x32, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 2 [[color(2)]];. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // float4 gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x33, // Data_3 [[color(3 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, // )]];. float4 gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x5b, 0x5b, 0x63, 0x6f, // _FragData_4 [[co - 0x6c, 0x6f, 0x72, 0x28, 0x34, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // lor(4)]];. floa - 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, // t4 gl_FragData_5 - 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x35, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // [[color(5)]];. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // float4 gl_FragD - 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x36, 0x29, // ata_6 [[color(6) - 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, // ]];. float4 gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x37, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, // FragData_7 [[col - 0x6f, 0x72, 0x28, 0x37, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // or(7)]];.};.stru - 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader - 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // Uniform {. floa - 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // t4 bgfx_clear_co - 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, // lor[8];.};.fragm - 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // ent xlatMtlShade - 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // rOutput xlatMtlM - 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ain (xlatMtlShad - 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, // erInput _mtl_i [ - 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, // [stage_in]], con - 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // stant xlatMtlSha - 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // derUniform& _mtl - 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // _u [[buffer(0)]] - 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // ).{. xlatMtlSha - 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // derOutput _mtl_o + 0x37, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x37, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, // 7 [[color(7)]];. + 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, // . float4 bgfx_c + 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x38, 0x5d, 0x3b, 0x0a, 0x7d, // lear_color[8];.} + 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // ;.fragment xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, // tlShaderOutput x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, // latMtlMain (xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, // MtlShaderInput _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, // mtl_i [[stage_in + 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // ]], constant xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor + 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, // m& _mtl_u [[buff + 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, // er(0)]]).{. xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // _mtl_o;. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, // o.gl_FragData_0 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // = _mtl_u.bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // ear_color[0];. + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // _mtl_o.gl_FragDa + 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, // ta_1 = _mtl_u.bg + 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, // fx_clear_color[1 + 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // ];. _mtl_o.gl_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ragData_2 = _mtl + 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, // _u.bgfx_clear_co + 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // lor[2];. _mtl_o + 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, // .gl_FragData_3 = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, // _mtl_u.bgfx_cle + 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ar_color[3];. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // mtl_o.gl_FragDat + 0x61, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, // a_4 = _mtl_u.bgf + 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, // x_clear_color[4] 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr - 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // agData_0 = _mtl_ + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // agData_5 = _mtl_ 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, // u.bgfx_clear_col - 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // or[0];. _mtl_o. - 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x20, 0x3d, 0x20, // gl_FragData_1 = + 0x6f, 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // or[5];. _mtl_o. + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x3d, 0x20, // gl_FragData_6 = 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // _mtl_u.bgfx_clea - 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // r_color[1];. _m + 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x36, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // r_color[6];. _m 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // tl_o.gl_FragData - 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, // _2 = _mtl_u.bgfx - 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, // _clear_color[2]; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // gData_3 = _mtl_u - 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo - 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // r[3];. _mtl_o.g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x5f, // l_FragData_4 = _ - 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, // mtl_u.bgfx_clear - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // _color[4];. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // l_o.gl_FragData_ - 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, // 5 = _mtl_u.bgfx_ - 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, // clear_color[5];. - 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // _mtl_o.gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // Data_6 = _mtl_u. - 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // bgfx_clear_color - 0x5b, 0x36, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // [6];. _mtl_o.gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // _FragData_7 = _m - 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // tl_u.bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x37, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // color[7];. retu - 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... + 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x62, 0x67, 0x66, 0x78, // _7 = _mtl_u.bgfx + 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x37, 0x5d, 0x3b, // _clear_color[7]; + 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // . return _mtl_o + 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... }; extern const uint8_t* fs_clear7_pssl; extern const uint32_t fs_clear7_pssl_size; diff --git a/3rdparty/bgfx/src/fs_debugfont.bin.h b/3rdparty/bgfx/src/fs_debugfont.bin.h index eaca9aaa6da..553bc8fef58 100644 --- a/3rdparty/bgfx/src/fs_debugfont.bin.h +++ b/3rdparty/bgfx/src/fs_debugfont.bin.h @@ -1,6 +1,6 @@ static const uint8_t fs_debugfont_glsl[354] = { - 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH..."f...s_tex + 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH..."f...s_tex 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x42, 0x01, 0x00, 0x00, 0x76, // Color......B...v 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // arying highp vec 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, // 4 v_color0;.vary @@ -24,88 +24,353 @@ static const uint8_t fs_debugfont_glsl[354] = 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_debugfont_dx9[374] = +static const uint8_t fs_debugfont_spv[4195] = { - 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH..."f...s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x58, 0x01, 0x00, 0x03, 0xff, // Color0.....X.... - 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. - 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ - 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0.......... - 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo - 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr - 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 - 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. - 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, 0x00, 0x00, 0x00, // .Q.............. - 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, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // .........B...... - 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, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, // .........X...... - 0x80, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x41, 0x00, 0x00, // .......U.....A.. - 0x01, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // ................ - 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... + 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x54, 0x10, 0x00, 0x00, 0x03, 0x02, // FSH..."f..T..... + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x4a, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........Jb.... + 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. + 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ + 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, // ..w...x...t..... + 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x99, 0x0f, // ..main.......... + 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, // ..bgfxTexture2D( + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, // struct-BgfxSampl + 0x65, 0x72, 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, // er2D-p1-t211;vf2 + 0x3b, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ;.........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x6d, 0x5f, // ler......./B..m_ + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, // texture......... + 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xd2, 0x0c, // .._coord........ + 0x00, 0x00, 0x6d, 0x69, 0x78, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, // ..mix(vf4;vf4;vf + 0x34, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x5f, 0x61, // 4;............_a + 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, 0x00, 0x00, 0x05, 0x00, // .........._b.... + 0x03, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x5f, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, // ......_t......5. + 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, // ..vec4_splat(f1; + 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, // .........._x.... + 0x08, 0x00, 0xdd, 0x13, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, // ......@main(vf4; + 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, // vf4;vf2;vf4;.... + 0x05, 0x00, 0x62, 0x25, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..b%..v_color0.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x27, 0x22, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......'"..v_colo + 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x51, 0x00, 0x00, 0x76, 0x5f, // r1.........Q..v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x92, 0x55, // texcoord0......U + 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ + 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, // ......a...BgfxSa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, // mpler2D.......a. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // ......m_sampler. + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, // ......a.......m_ + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, // texture......... + 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, // ..flattenTemp... + 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor + 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, // Sampler......... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, // ..s_texColorText + 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x67, 0x12, 0x00, 0x00, 0x6d, 0x5f, // ure.......g...m_ + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa3, 0x14, // sampler......... + 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... + 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, // ......bgfx_VoidF + 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x70, 0x61, // rag.......jO..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, // ram...........co + 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x70, 0x61, // lor........+..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x70, 0x61, // ram........+..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x70, 0x61, // ram........+..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x70, 0x61, // ram.......^)..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe1, 0x2b, 0x00, 0x00, 0x76, 0x5f, // ram........+..v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, // color0........w. + 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... + 0x05, 0x00, 0xb0, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x00, 0x00, // ...<..v_color1.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......x...v_colo + 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x76, 0x5f, // r1........@,..v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, // texcoord0.....t. + 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... + 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat + 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, // a_0_.......G..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, // ram........U..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, // ram........8..pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, // ram...........pa + 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, // ram...........gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... + 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ......$Global... + 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view + 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x01, 0x00, // Rect............ + 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, // ..u_viewTexel... + 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xa0, 0x06, // invView......... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ......u_proj.... + 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, // ..........u_invP + 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, // roj............. + 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ..u_viewProj.... + 0x07, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xa0, 0x06, // iewProj......... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, // ......u_model... + 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode + 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, // lView........... + 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ..u_modelViewPro + 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, // j.............u_ + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, // alphaRef4.G..... + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, // ..".......G..... + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, // ..!.......G..... + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, // ..".......G..... + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, // ..!.......G...w. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x78, 0x0e, // ..........G...x. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, // ..........G...t. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, // ..........G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x01, // ..........G...q. + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ......@...H..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. + 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, // ..........#..... + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, // .. ...H......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#...`...H. + 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. + 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, // ......H......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. + 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. + 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, // .. ...H......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#...`...H. + 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. + 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x08, 0x00, // ......H......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. + 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. + 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, // ......H......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, // ......#... ...G. + 0x03, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x00, 0x00, // ...... ...y..... + 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x00, 0x00, // ...... ......... + 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... + 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x1d, 0x00, // ......!......... + 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, // ..y........... . + 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x06, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ + 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... + 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x08, 0x04, 0x00, 0x00, 0x08, 0x00, // ......!......... + 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ + 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, // ......a......... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x09, // .. ...........a. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, // ..;............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, // ..;...y......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, // ..;............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x67, 0x12, 0x00, 0x00, 0x00, 0x00, // ..;...y...g..... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xa3, 0x14, 0x00, 0x00, 0x00, 0x00, // ..;............. + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, // ..+............. + 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, // ................ + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7a, 0x01, 0x00, 0x00, 0x81, 0x80, 0x80, 0x3b, 0x14, 0x00, // ......z......;.. + 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... + 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, // ......;.......w. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x78, 0x0e, // ......;.......x. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... + 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, // ......;.......t. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, // ...... ......... + 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, // ......;......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..........e..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......+.......j. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x71, 0x01, 0x00, 0x00, 0x65, 0x00, // .. .......q...e. + 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x1d, 0x00, // ..j............. + 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ......e...e...e. + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x71, 0x01, // ..e...e...e...q. + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, // ..e...e.......6. + 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ......Sa..;..... + 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...G......;..... + 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, // ...U......;..... + 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...8......;..... + 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... + 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..!C......=..... + 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, // ...3......P...a. + 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, // ..^ ..!C...3..>. + 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. + 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. + 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. + 0x03, 0x00, 0x67, 0x12, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, // ..g.......A..... + 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. + 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. + 0x03, 0x00, 0xa3, 0x14, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..........=..... + 0x00, 0x00, 0xe1, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ...+..w...=..... + 0x00, 0x00, 0xb0, 0x3c, 0x00, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, // ...<..x...=..... + 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc9, 0x47, // ..@,..t...>....G + 0x00, 0x00, 0xe1, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb0, 0x3c, // ...+..>....U...< + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, // ..>....8..@,..9. + 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xdd, 0x13, 0x00, 0x00, 0xc9, 0x47, // .......&.......G + 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // ...U...8......=. + 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. + 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0xe2, 0x2e, // ......7...y..... + 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x37, 0x00, // ..7......./B..7. + 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, // ................ + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0x2f, 0x42, // ..=.........../B + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0xe2, 0x2e, // ..=........H.... + 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, // ..V........>.... + 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x24, // ...H..=........$ + 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, // ......W........Y + 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, // ...>...$.......Y + 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd2, 0x0c, // ..8...6......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ..........7..... + 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc7, 0x0e, // ......7......... + 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0xf8, 0x00, // ..7............. + 0x02, 0x00, 0x16, 0x59, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x37, 0x54, // ...Y..=.......7T + 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x07, 0x48, // ......=........H + 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0e, 0x47, // ......=........G + 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x19, // ..............e. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x37, 0x54, 0x00, 0x00, 0x07, 0x48, // ..........7T...H + 0x00, 0x00, 0x0e, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x65, 0x19, 0x00, 0x00, 0x38, 0x00, // ...G......e...8. + 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, // ..6.......5..... + 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, // ......7......... + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x19, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // .......N..=..... + 0x00, 0x00, 0x67, 0x1c, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..g.......=..... + 0x00, 0x00, 0xf2, 0x44, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ...D......=..... + 0x00, 0x00, 0x92, 0x2f, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // .../......=..... + 0x00, 0x00, 0xa5, 0x2f, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // .../......P..... + 0x00, 0x00, 0x41, 0x4a, 0x00, 0x00, 0x67, 0x1c, 0x00, 0x00, 0xf2, 0x44, 0x00, 0x00, 0x92, 0x2f, // ..AJ..g....D.../ + 0x00, 0x00, 0xa5, 0x2f, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x41, 0x4a, 0x00, 0x00, 0x38, 0x00, // .../......AJ..8. + 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xdd, 0x13, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x62, 0x25, // ......7.......b% + 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x27, 0x22, 0x00, 0x00, 0x37, 0x00, // ..7.......'"..7. + 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x08, 0x51, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // .......Q..7..... + 0x00, 0x00, 0x92, 0x55, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x5e, 0x00, 0x00, 0x3b, 0x00, // ...U.......^..;. + 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ......jO......;. + 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. + 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......+......;. + 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......+......;. + 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......+......;. + 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......^)......>. + 0x03, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, // ..jO......9..... + 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x3d, 0x00, // ......5...jO..=. + 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x08, 0x51, 0x00, 0x00, 0x3e, 0x00, // .......K...Q..>. + 0x03, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, // ...+...K..9..... + 0x00, 0x00, 0x95, 0x54, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x67, 0x12, 0x00, 0x00, 0xa3, 0x14, // ...T......g..... + 0x00, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x29, 0x4c, // ...+..=.......)L + 0x00, 0x00, 0x27, 0x22, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x29, 0x4c, // ..'"..>....+..)L + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa6, 0x1f, 0x00, 0x00, 0x62, 0x25, // ..=...........b% + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0xa6, 0x1f, 0x00, 0x00, 0x4f, 0x00, // ..>....+......O. + 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xea, 0x31, 0x00, 0x00, 0x95, 0x54, 0x00, 0x00, 0x95, 0x54, // .......1...T...T + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5e, 0x29, 0x00, 0x00, 0xea, 0x31, 0x00, 0x00, 0x39, 0x00, // ..>...^)...1..9. + 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x29, 0x00, 0x00, 0xd2, 0x0c, 0x00, 0x00, 0x8c, 0x2b, // .......).......+ + 0x00, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, // ...+..^)..>..... + 0x00, 0x00, 0x1e, 0x29, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xb7, 0x49, // ...)..A........I + 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... + 0x00, 0x00, 0x49, 0x62, 0x00, 0x00, 0xb7, 0x49, 0x00, 0x00, 0xb8, 0x00, 0x05, 0x00, 0x09, 0x00, // ..Ib...I........ + 0x00, 0x00, 0x7a, 0x44, 0x00, 0x00, 0x49, 0x62, 0x00, 0x00, 0x7a, 0x01, 0x00, 0x00, 0xf7, 0x00, // ..zD..Ib..z..... + 0x03, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x7a, 0x44, // ..............zD + 0x00, 0x00, 0xfd, 0x46, 0x00, 0x00, 0xdc, 0x19, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xfd, 0x46, // ...F...........F + 0x00, 0x00, 0xfc, 0x00, 0x01, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd8, 0x38, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x3e, 0x00, // .......8......>. + 0x03, 0x00, 0x92, 0x55, 0x00, 0x00, 0xd8, 0x38, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ...U...8......8. + 0x01, 0x00, 0x00, // ... }; -static const uint8_t fs_debugfont_dx11[772] = +static const uint8_t fs_debugfont_dx9[364] = { - 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0xf4, 0x02, 0x44, 0x58, 0x42, 0x43, // FSH..."f....DXBC - 0x1d, 0xbb, 0xb2, 0xa8, 0xff, 0x65, 0xcd, 0xa5, 0xf7, 0x85, 0xfd, 0xcb, 0xb6, 0xe1, 0x00, 0xc6, // .....e.......... - 0x01, 0x00, 0x00, 0x00, 0xf4, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ............0... - 0x28, 0x01, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, // (...4.......Aon9 - 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xc8, 0x00, 0x00, 0x00, // ................ - 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, // (.....(...(...(. - 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, // ..$...(......... - 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, 0x00, 0x00, 0x00, 0x80, // Q............... - 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ - 0x00, 0x00, 0x0f, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xb0, // ................ - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........B....... - 0x02, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0x80, // ................ - 0x01, 0x00, 0xe4, 0xb0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x81, // ................ - 0x00, 0x00, 0xe4, 0xb0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, // ................ - 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xb0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, // ................ - 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, // ........X....... - 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x41, 0x00, 0x00, 0x01, // ......U.....A... - 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, // ................ - 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x04, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // ....SHDR....@... - 0x41, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // A...Z....`...... - 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, // X....p......UU.. - 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, // b...........b... - 0xf2, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ........b...2... - 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ...... - 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, // h.......E....... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. - 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, 0x00, 0x00, // ........F....... - 0x46, 0x1e, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x09, // F...A.......2... - 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, 0x00, 0x00, // F.......F....... - 0x31, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, // 1...........:... - 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, 0x10, 0x00, // ........6.... .. - 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>... - 0x49, 0x53, 0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGN............ - 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, 0x0f, 0x00, 0x00, // ................ - 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // t............... - 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........z....... - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................ - 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // SV_POSITION.COLO - 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, // R.TEXCOORD..OSGN - 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ,........... ... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET... - 0x00, 0x00, 0x00, 0x00, // .... + 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH..."f...s_tex + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x00, // Color0.....L.... + 0x03, 0xff, 0xff, 0xfe, 0xff, 0x20, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, // ..... .CTAB....S + 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, // ................ + 0x91, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, // ...L...0........ + 0x00, 0x02, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, // ...<.......s_tex + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, // Color........... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, // .......ps_3_0.Mi + 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, // crosoft (R) HLSL + 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, // Shader Compiler + 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, // 10.1..Q........ + 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, 0x42, // ...............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, 0x58, // ...............X + 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, // .............U.. + 0x00, 0xaa, 0xa0, 0x41, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, // ...A............ + 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ............ }; -static const uint8_t fs_debugfont_mtl[820] = +static const uint8_t fs_debugfont_dx11[774] = { - 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x25, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH..."f..%...us + 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0xf4, 0x02, 0x00, 0x00, 0x44, 0x58, // FSH..."f......DX + 0x42, 0x43, 0x1d, 0xbb, 0xb2, 0xa8, 0xff, 0x65, 0xcd, 0xa5, 0xf7, 0x85, 0xfd, 0xcb, 0xb6, 0xe1, // BC.....e........ + 0x00, 0xc6, 0x01, 0x00, 0x00, 0x00, 0xf4, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, // ..............0. + 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x00, 0x41, 0x6f, // ..(...4.......Ao + 0x6e, 0x39, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xc8, 0x00, // n9.............. + 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, // ..(.....(...(... + 0x28, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // (...$...(....... + 0xff, 0xff, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, 0x00, 0x00, // ..Q............. + 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0xb0, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xb0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, // ..........B..... + 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xb0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................ + 0xe4, 0x81, 0x00, 0x00, 0xe4, 0xb0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xb0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, // ................ + 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, // ..........X..... + 0x0f, 0x80, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x41, 0x00, // ........U.....A. + 0x00, 0x01, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x04, 0x01, 0x00, 0x00, 0x40, 0x00, // ......SHDR....@. + 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..A...Z....`.... + 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X....p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, // ..b...........b. + 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, // ..........b...2. + 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......e.... .... + 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, // ..h.......E..... + 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, 0x49, 0x53, 0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, // ..ISGN.......... + 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, // ..h............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........t..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, // ................ + 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..t............. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........z..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, // ................ + 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO + 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS + 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. + 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, // ...... +}; +static const uint8_t fs_debugfont_mtl[745] = +{ + 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0xda, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH..."f......us 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { @@ -114,49 +379,44 @@ static const uint8_t fs_debugfont_mtl[820] = 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // olor1;. float2 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // v_texcoord0;.};. 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // struct xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x68, // aderOutput {. h - 0x61, 0x6c, 0x66, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, // alf4 gl_FragColo - 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, // r;.};.struct xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor - 0x6d, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // m {.};.fragment - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain - 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta - 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [ - 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. , - 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, 0x6f, // texture2d<flo - 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, // at> s_texColor [ - 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, // [texture(0)]], s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, // ampler _mtlsmp_s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, // _texColor [[samp - 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // ler(0)]]).{. xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu - 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // t _mtl_o;. half - 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_1 = 0;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, // tmpvar_1 = hal - 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, // f4(s_texColor.sa - 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, // mple(_mtlsmp_s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // exColor, (float2 - 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // )(_mtl_i.v_texco - 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // ord0)));. half4 - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_2 = 0;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, // tmpvar_2 = ((ha - 0x6c, 0x66, 0x34, 0x29, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // lf4)mix (_mtl_i. - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // v_color1, _mtl_i - 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // .v_color0, (floa - 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x78, 0x78, 0x78, // t4)tmpvar_1.xxxx - 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // ));. if ((tmpva - 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x30, // r_2.w < (half)(0 - 0x2e, 0x30, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, 0x36, 0x39, 0x29, 0x29, 0x29, 0x20, 0x7b, 0x0a, // .003921569))) {. - 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, // discard_frag - 0x6d, 0x65, 0x6e, 0x74, 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ment();. };. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol - 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // or = tmpvar_2;. - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;. - 0x7d, 0x0a, 0x0a, 0x00, // }... + 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, // aderOutput {. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // loat4 gl_FragCol + 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, // or;.};.struct xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, // atMtlShaderUnifo + 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, // rm {.};.fragment + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, // tput xlatMtlMain + 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // (xlatMtlShaderI + 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, // nput _mtl_i [[st + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, // age_in]], consta + 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // nt xlatMtlShader + 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, // Uniform& _mtl_u + 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, // [[buffer(0)]]. + 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, // , texture2d<fl + 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // oat> s_texColor + 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, // [[texture(0)]], + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // sampler _mtlsmp_ + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, // s_texColor [[sam + 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, // pler(0)]]).{. x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, // latMtlShaderOutp + 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // ut _mtl_o;. flo + 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, // at4 tmpvar_1 = 0 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x6d, // ;. tmpvar_1 = m + 0x69, 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ix (_mtl_i.v_col + 0x6f, 0x72, 0x31, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, // or1, _mtl_i.v_co + 0x6c, 0x6f, 0x72, 0x30, 0x2c, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // lor0, s_texColor + 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // .sample(_mtlsmp_ + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, // s_texColor, (flo + 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, // at2)(_mtl_i.v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x29, 0x3b, // xcoord0)).xxxx); + 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // . if ((tmpvar_1 + 0x2e, 0x77, 0x20, 0x3c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, 0x36, 0x39, // .w < 0.003921569 + 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, // )) {. discard + 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, // _fragment();. } + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr + 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar + 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // _1;. return _mt + 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... }; extern const uint8_t* fs_debugfont_pssl; extern const uint32_t fs_debugfont_pssl_size; diff --git a/3rdparty/bgfx/src/glcontext_eagl.mm b/3rdparty/bgfx/src/glcontext_eagl.mm index ff5467450a2..541cc40b08f 100644 --- a/3rdparty/bgfx/src/glcontext_eagl.mm +++ b/3rdparty/bgfx/src/glcontext_eagl.mm @@ -20,21 +20,25 @@ namespace bgfx { namespace gl struct SwapChainGL { SwapChainGL(EAGLContext *_context, CAEAGLLayer *_layer) - : m_context(_context) - , m_fbo(0) - , m_colorRbo(0) - , m_depthStencilRbo(0) + : m_context(_context) + , m_fbo(0) + , m_colorRbo(0) + , m_depthStencilRbo(0) { _layer.contentsScale = [UIScreen mainScreen].scale; - _layer.opaque = [_layer.style valueForKey:@"opaque"] == nil ? true : [[_layer.style valueForKey:@"opaque"] boolValue]; + _layer.opaque = [_layer.style valueForKey:@"opaque"] == nil + ? true + : [[_layer.style valueForKey:@"opaque"] boolValue] + ; _layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys - : [NSNumber numberWithBool:false] - , kEAGLDrawablePropertyRetainedBacking - , kEAGLColorFormatRGBA8 - , kEAGLDrawablePropertyColorFormat - , nil]; + : [NSNumber numberWithBool:false] + , kEAGLDrawablePropertyRetainedBacking + , kEAGLColorFormatRGBA8 + , kEAGLDrawablePropertyColorFormat + , nil + ]; [EAGLContext setCurrentContext:_context]; @@ -72,20 +76,20 @@ namespace bgfx { namespace gl GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0) ); if (0 != m_fbo) { - GL_CHECK(glDeleteFramebuffers(1, &m_fbo) ); - m_fbo = 0; + GL_CHECK(glDeleteFramebuffers(1, &m_fbo) ); + m_fbo = 0; } if (0 != m_colorRbo) { - GL_CHECK(glDeleteRenderbuffers(1, &m_colorRbo) ); - m_colorRbo = 0; + GL_CHECK(glDeleteRenderbuffers(1, &m_colorRbo) ); + m_colorRbo = 0; } if (0 != m_depthStencilRbo) { - GL_CHECK(glDeleteRenderbuffers(1, &m_depthStencilRbo) ); - m_depthStencilRbo = 0; + GL_CHECK(glDeleteRenderbuffers(1, &m_depthStencilRbo) ); + m_depthStencilRbo = 0; } } @@ -93,20 +97,23 @@ namespace bgfx { namespace gl { GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) ); GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) ); - GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, _width, _height) ); // from OES_packed_depth_stencil + GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, _width, _height) ); GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) ); GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) ); - BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER) - , "glCheckFramebufferStatus failed 0x%08x" - , glCheckFramebufferStatus(GL_FRAMEBUFFER) - ); + GLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER); + BX_CHECK(GL_FRAMEBUFFER_COMPLETE == err, "glCheckFramebufferStatus failed 0x%08x", err); + BX_UNUSED(err); makeCurrent(); + GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f) ); GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) ); + swapBuffers(); + GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) ); + swapBuffers(); } @@ -162,15 +169,24 @@ namespace bgfx { namespace gl layer.opaque = [layer.style valueForKey:@"opaque"] == nil ? true : [[layer.style valueForKey:@"opaque"] boolValue]; layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys - : [NSNumber numberWithBool:false] - , kEAGLDrawablePropertyRetainedBacking - , kEAGLColorFormatRGBA8 - , kEAGLDrawablePropertyColorFormat - , nil - ]; - - EAGLContext* context = [ [EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - BX_CHECK(NULL != context, "Failed to create kEAGLRenderingAPIOpenGLES2 context."); + : [NSNumber numberWithBool:false] + , kEAGLDrawablePropertyRetainedBacking + , kEAGLColorFormatRGBA8 + , kEAGLDrawablePropertyColorFormat + , nil + ]; + + EAGLContext* context = (EAGLContext*)g_platformData.context; + if (NULL == context) + { + context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; + if (NULL == context) + { + context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + } + } + BX_CHECK(NULL != context, "No valid OpenGLES context."); + m_context = (void*)context; [EAGLContext setCurrentContext:context]; @@ -191,7 +207,7 @@ namespace bgfx { namespace gl GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) ); GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) ); - GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, width, height) ); // from OES_packed_depth_stencil + GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height) ); GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) ); GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) ); @@ -278,7 +294,7 @@ namespace bgfx { namespace gl GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) ); GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) ); - GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, width, height) ); // from OES_packed_depth_stencil + GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height) ); GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) ); GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) ); @@ -340,18 +356,20 @@ namespace bgfx { namespace gl void GlContext::import() { BX_TRACE("Import:"); -# define GL_EXTENSION(_optional, _proto, _func, _import) \ - { \ - if (_func == NULL) \ - { \ - _func = (_proto)bx::dlsym(s_opengles, #_import); \ - BX_TRACE("%p " #_func " (" #_import ")", _func); \ - } \ - BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. EAGLGetProcAddress(\"%s\")", #_import); \ +# define GL_EXTENSION(_optional, _proto, _func, _import) \ + { \ + if (_func == NULL) \ + { \ + _func = (_proto)bx::dlsym(s_opengles, #_import); \ + BX_TRACE("%p " #_func " (" #_import ")", _func); \ + } \ + BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize \ + , "Failed to create OpenGLES context. EAGLGetProcAddress(\"%s\")" \ + , #_import); \ } # include "glimports.h" } } /* namespace gl */ } // namespace bgfx -#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL) +#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL) diff --git a/3rdparty/bgfx/src/glcontext_ppapi.cpp b/3rdparty/bgfx/src/glcontext_ppapi.cpp deleted file mode 100644 index b23d92bb86b..00000000000 --- a/3rdparty/bgfx/src/glcontext_ppapi.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#include "bgfx_p.h" - -#if BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) -# include <bgfx/platform.h> -# include "renderer_gl.h" - -namespace bgfx { namespace gl -{ -# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func -# include "glimports.h" - - void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/); - - PP_CompletionCallback naclSwapComplete = - { - naclSwapCompleteCb, - NULL, - PP_COMPLETIONCALLBACK_FLAG_NONE - }; - - struct Ppapi - { - Ppapi() - : m_context(0) - , m_instance(0) - , m_instInterface(NULL) - , m_graphicsInterface(NULL) - , m_instancedArrays(NULL) - , m_query(NULL) - , m_postSwapBuffers(NULL) - , m_forceSwap(true) - { - } - - bool setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers); - - void resize(uint32_t _width, uint32_t _height, uint32_t /*_flags*/) - { - m_graphicsInterface->ResizeBuffers(m_context, _width, _height); - } - - void swap() - { - glSetCurrentContextPPAPI(m_context); - m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete); - } - - bool isValid() const - { - return 0 != m_context; - } - - PP_Resource m_context; - PP_Instance m_instance; - const PPB_Instance* m_instInterface; - const PPB_Graphics3D* m_graphicsInterface; - const PPB_OpenGLES2InstancedArrays* m_instancedArrays; - const PPB_OpenGLES2Query* m_query; - PostSwapBuffersFn m_postSwapBuffers; - bool m_forceSwap; - }; - - static Ppapi s_ppapi; - - void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/) - { - // For NaCl bgfx doesn't create render thread, but rendering is always - // multithreaded. Frame rendering is done on main thread, and context - // is initialized when PPAPI interfaces are set. Force swap is there to - // keep calling swap complete callback, so that initialization doesn't - // deadlock on semaphores. - if (s_ppapi.m_forceSwap) - { - s_ppapi.swap(); - } - - renderFrame(); - } - - static void GL_APIENTRY naclVertexAttribDivisor(GLuint _index, GLuint _divisor) - { - s_ppapi.m_instancedArrays->VertexAttribDivisorANGLE(s_ppapi.m_context, _index, _divisor); - } - - static void GL_APIENTRY naclDrawArraysInstanced(GLenum _mode, GLint _first, GLsizei _count, GLsizei _primcount) - { - s_ppapi.m_instancedArrays->DrawArraysInstancedANGLE(s_ppapi.m_context, _mode, _first, _count, _primcount); - } - - static void GL_APIENTRY naclDrawElementsInstanced(GLenum _mode, GLsizei _count, GLenum _type, const GLvoid* _indices, GLsizei _primcount) - { - s_ppapi.m_instancedArrays->DrawElementsInstancedANGLE(s_ppapi.m_context, _mode, _count, _type, _indices, _primcount); - } - - static void GL_APIENTRY naclGenQueries(GLsizei _n, GLuint* _queries) - { - s_ppapi.m_query->GenQueriesEXT(s_ppapi.m_context, _n, _queries); - } - - static void GL_APIENTRY naclDeleteQueries(GLsizei _n, const GLuint* _queries) - { - s_ppapi.m_query->DeleteQueriesEXT(s_ppapi.m_context, _n, _queries); - } - - static void GL_APIENTRY naclBeginQuery(GLenum _target, GLuint _id) - { - BX_UNUSED(_target); - s_ppapi.m_query->BeginQueryEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, _id); - } - - static void GL_APIENTRY naclEndQuery(GLenum _target) - { - BX_UNUSED(_target); - s_ppapi.m_query->EndQueryEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT); - } - - static void GL_APIENTRY naclGetQueryObjectiv(GLuint _id, GLenum _pname, GLint* _params) - { - BX_UNUSED(_id, _pname); - s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, _params); - } - - static void GL_APIENTRY naclGetQueryObjectui64v(GLuint _id, GLenum _pname, GLuint64* _params) - { - BX_UNUSED(_id, _pname); - GLint params; - s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, ¶ms); - *_params = params; - } - - bool Ppapi::setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers) - { - BX_TRACE("PPAPI Interfaces"); - - m_instance = _instance; - m_instInterface = _instInterface; - m_graphicsInterface = _graphicsInterface; - m_instancedArrays = glGetInstancedArraysInterfacePPAPI(); - m_query = glGetQueryInterfacePPAPI(); - m_postSwapBuffers = _postSwapBuffers; - - int32_t attribs[] = - { - PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, - PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24, - PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8, - PP_GRAPHICS3DATTRIB_SAMPLES, 0, - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, - PP_GRAPHICS3DATTRIB_WIDTH, BGFX_DEFAULT_WIDTH, - PP_GRAPHICS3DATTRIB_HEIGHT, BGFX_DEFAULT_HEIGHT, - PP_GRAPHICS3DATTRIB_NONE - }; - - m_context = m_graphicsInterface->Create(m_instance, 0, attribs); - if (0 == m_context) - { - BX_TRACE("Failed to create context!"); - return false; - } - - m_instInterface->BindGraphics(m_instance, m_context); - glSetCurrentContextPPAPI(m_context); - m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete); - - if (NULL != m_instancedArrays) - { - glVertexAttribDivisor = naclVertexAttribDivisor; - glDrawArraysInstanced = naclDrawArraysInstanced; - glDrawElementsInstanced = naclDrawElementsInstanced; - } - - if (NULL != m_query) - { - glGenQueries = naclGenQueries; - glDeleteQueries = naclDeleteQueries; - glBeginQuery = naclBeginQuery; - glEndQuery = naclEndQuery; - glGetQueryObjectiv = naclGetQueryObjectiv; - glGetQueryObjectui64v = naclGetQueryObjectui64v; - } - - // Prevent render thread creation. - RenderFrame::Enum result = renderFrame(); - return RenderFrame::NoContext == result; - } - - void GlContext::create(uint32_t _width, uint32_t _height) - { - BX_UNUSED(_width, _height); - BX_TRACE("GlContext::create"); - - g_internalData.context = &s_ppapi.m_context; - } - - void GlContext::destroy() - { - } - - void GlContext::resize(uint32_t _width, uint32_t _height, uint32_t _flags) - { - s_ppapi.m_forceSwap = false; - s_ppapi.resize(_width, _height, _flags); - } - - uint64_t GlContext::getCaps() const - { - return 0; - } - - SwapChainGL* GlContext::createSwapChain(void* /*_nwh*/) - { - BX_CHECK(false, "Shouldn't be called!"); - return NULL; - } - - void GlContext::destroySwapChain(SwapChainGL* /*_swapChain*/) - { - BX_CHECK(false, "Shouldn't be called!"); - } - - void GlContext::swap(SwapChainGL* /*_swapChain*/) - { - s_ppapi.swap(); - } - - void GlContext::makeCurrent(SwapChainGL* /*_swapChain*/) - { - } - - void GlContext::import() - { - } - - bool GlContext::isValid() const - { - return s_ppapi.isValid(); - } - -} /* namespace gl */ } // namespace bgfx - -namespace bgfx -{ - bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers) - { - return gl::s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers); - } -} // namespace bgfx - -#endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) diff --git a/3rdparty/bgfx/src/glcontext_ppapi.h b/3rdparty/bgfx/src/glcontext_ppapi.h deleted file mode 100644 index 59da4552355..00000000000 --- a/3rdparty/bgfx/src/glcontext_ppapi.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#ifndef BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD -#define BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD - -#if BX_PLATFORM_NACL - -# include <ppapi/gles2/gl2ext_ppapi.h> -# include <ppapi/c/pp_completion_callback.h> -# include <ppapi/c/ppb_instance.h> -# include <ppapi/c/ppb_graphics_3d.h> - -namespace bgfx { namespace gl -{ - struct SwapChainGL; - - struct GlContext - { - GlContext() - { - } - - void create(uint32_t _width, uint32_t _height); - void destroy(); - void resize(uint32_t _width, uint32_t _height, uint32_t _flags); - - uint64_t getCaps() const; - SwapChainGL* createSwapChain(void* _nwh); - void destroySwapChain(SwapChainGL* _swapChain); - void swap(SwapChainGL* _swapChain = NULL); - void makeCurrent(SwapChainGL* _swapChain = NULL); - - void import(); - bool isValid() const; - }; -} /* namespace gl */ } // namespace bgfx - -#endif // BX_PLATFORM_NACL - -#endif // BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/hmd.h b/3rdparty/bgfx/src/hmd.h index 6a688197795..d2360ed2903 100644 --- a/3rdparty/bgfx/src/hmd.h +++ b/3rdparty/bgfx/src/hmd.h @@ -48,7 +48,7 @@ namespace bgfx virtual void updateInput(HMD& _hmd) = 0; virtual void recenter() = 0; - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight); + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) = 0; virtual void destroySwapChain() = 0; virtual void destroyMirror() = 0; virtual void makeRenderTargetActive(const VRDesc& _desc) = 0; diff --git a/3rdparty/bgfx/src/hmd_ovr.h b/3rdparty/bgfx/src/hmd_ovr.h index 7a0f482aa7b..f41d429df10 100644 --- a/3rdparty/bgfx/src/hmd_ovr.h +++ b/3rdparty/bgfx/src/hmd_ovr.h @@ -35,25 +35,25 @@ namespace bgfx VRImplOVR(); virtual ~VRImplOVR() = 0; - virtual bool init() BX_OVERRIDE; - virtual void shutdown() BX_OVERRIDE; - virtual void connect(VRDesc* _desc) BX_OVERRIDE; - virtual void disconnect() BX_OVERRIDE; + virtual bool init() override; + virtual void shutdown() override; + virtual void connect(VRDesc* _desc) override; + virtual void disconnect() override; - virtual bool isConnected() const BX_OVERRIDE + virtual bool isConnected() const override { return NULL != m_session; } - virtual bool updateTracking(HMD& _hmd) BX_OVERRIDE; - virtual void updateInput(HMD& _hmd) BX_OVERRIDE; - virtual void recenter() BX_OVERRIDE; + virtual bool updateTracking(HMD& _hmd) override; + virtual void updateInput(HMD& _hmd) override; + virtual void recenter() override; - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) BX_OVERRIDE = 0; - virtual void destroySwapChain() BX_OVERRIDE = 0; - virtual void destroyMirror() BX_OVERRIDE = 0; - virtual void makeRenderTargetActive(const VRDesc& _desc) BX_OVERRIDE = 0; - virtual bool submitSwapChain(const VRDesc& _desc) BX_OVERRIDE = 0; + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override = 0; + virtual void destroySwapChain() override = 0; + virtual void destroyMirror() override = 0; + virtual void makeRenderTargetActive(const VRDesc& _desc) override = 0; + virtual bool submitSwapChain(const VRDesc& _desc) override = 0; protected: ovrSession m_session; diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp deleted file mode 100644 index e6c9e074a2c..00000000000 --- a/3rdparty/bgfx/src/image.cpp +++ /dev/null @@ -1,3261 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#include "bgfx_p.h" -#include "image.h" - -namespace bgfx -{ - static const ImageBlockInfo s_imageBlockInfo[] = - { - // +-------------------------------------------- bits per pixel - // | +----------------------------------------- block width - // | | +-------------------------------------- block height - // | | | +---------------------------------- block size - // | | | | +------------------------------- min blocks x - // | | | | | +---------------------------- min blocks y - // | | | | | | +------------------------ depth bits - // | | | | | | | +--------------------- stencil bits - // | | | | | | | | +---+---+---+----- r, g, b, a bits - // | | | | | | | | r g b a +-- encoding type - // | | | | | | | | | | | | | - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC1 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC2 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC3 - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC4 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC5 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC6H - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC7 - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC1 - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2A - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2A1 - { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC12 - { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC14 - { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC12A - { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC14A - { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC22 - { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC24 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Count) }, // Unknown - { 1, 8, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R1 - { 8, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 8, uint8_t(bx::EncodingType::Unorm) }, // A8 - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R8 - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R8I - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R8U - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // R8S - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R16 - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R16I - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R16U - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // R16F - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // R16S - { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R32I - { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R32U - { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // R32F - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // RG8 - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG8I - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG8U - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // RG8S - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // RG16 - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG16I - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG16U - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Float) }, // RG16F - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // RG16S - { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG32I - { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG32U - { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Float) }, // RG32F - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Unorm) }, // RGB8 - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Int ) }, // RGB8I - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Uint ) }, // RGB8U - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Snorm) }, // RGB8S - { 32, 1, 1, 4, 1, 1, 0, 0, 9, 9, 9, 5, uint8_t(bx::EncodingType::Float) }, // RGB9E5F - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Unorm) }, // BGRA8 - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Unorm) }, // RGBA8 - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Int ) }, // RGBA8I - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Uint ) }, // RGBA8U - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Snorm) }, // RGBA8S - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Unorm) }, // RGBA16 - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Int ) }, // RGBA16I - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Uint ) }, // RGBA16U - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Float) }, // RGBA16F - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Snorm) }, // RGBA16S - { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Int ) }, // RGBA32I - { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Uint ) }, // RGBA32U - { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Float) }, // RGBA32F - { 16, 1, 1, 2, 1, 1, 0, 0, 5, 6, 5, 0, uint8_t(bx::EncodingType::Unorm) }, // R5G6B5 - { 16, 1, 1, 2, 1, 1, 0, 0, 4, 4, 4, 4, uint8_t(bx::EncodingType::Unorm) }, // RGBA4 - { 16, 1, 1, 2, 1, 1, 0, 0, 5, 5, 5, 1, uint8_t(bx::EncodingType::Unorm) }, // RGB5A1 - { 32, 1, 1, 4, 1, 1, 0, 0, 10, 10, 10, 2, uint8_t(bx::EncodingType::Unorm) }, // RGB10A2 - { 32, 1, 1, 4, 1, 1, 0, 0, 11, 11, 10, 0, uint8_t(bx::EncodingType::Unorm) }, // R11G11B10F - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Count) }, // UnknownDepth - { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D16 - { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D24 - { 32, 1, 1, 4, 1, 1, 24, 8, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D24S8 - { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D32 - { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D16F - { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D24F - { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D32F - { 8, 1, 1, 1, 1, 1, 0, 8, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D0S8 - }; - BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) ); - - static const char* s_textureFormatName[] = - { - "BC1", // BC1 - "BC2", // BC2 - "BC3", // BC3 - "BC4", // BC4 - "BC5", // BC5 - "BC6H", // BC6H - "BC7", // BC7 - "ETC1", // ETC1 - "ETC2", // ETC2 - "ETC2A", // ETC2A - "ETC2A1", // ETC2A1 - "PTC12", // PTC12 - "PTC14", // PTC14 - "PTC12A", // PTC12A - "PTC14A", // PTC14A - "PTC22", // PTC22 - "PTC24", // PTC24 - "<unknown>", // Unknown - "R1", // R1 - "A8", // A8 - "R8", // R8 - "R8I", // R8I - "R8U", // R8U - "R8S", // R8S - "R16", // R16 - "R16I", // R16I - "R16U", // R16U - "R16F", // R16F - "R16S", // R16S - "R32I", // R32I - "R32U", // R32U - "R32F", // R32F - "RG8", // RG8 - "RG8I", // RG8I - "RG8U", // RG8U - "RG8S", // RG8S - "RG16", // RG16 - "RG16I", // RG16I - "RG16U", // RG16U - "RG16F", // RG16F - "RG16S", // RG16S - "RG32I", // RG32I - "RG32U", // RG32U - "RG32F", // RG32F - "RGB8", // RGB8 - "RGB8I", // RGB8I - "RGB8U", // RGB8U - "RGB8S", // RGB8S - "RGB9E5", // RGB9E5F - "BGRA8", // BGRA8 - "RGBA8", // RGBA8 - "RGBA8I", // RGBA8I - "RGBA8U", // RGBA8U - "RGBA8S", // RGBA8S - "RGBA16", // RGBA16 - "RGBA16I", // RGBA16I - "RGBA16U", // RGBA16U - "RGBA16F", // RGBA16F - "RGBA16S", // RGBA16S - "RGBA32I", // RGBA32I - "RGBA32U", // RGBA32U - "RGBA32F", // RGBA32F - "R5G6B5", // R5G6B5 - "RGBA4", // RGBA4 - "RGB5A1", // RGB5A1 - "RGB10A2", // RGB10A2 - "R11G11B10F", // R11G11B10F - "<unknown>", // UnknownDepth - "D16", // D16 - "D24", // D24 - "D24S8", // D24S8 - "D32", // D32 - "D16F", // D16F - "D24F", // D24F - "D32F", // D32F - "D0S8", // D0S8 - }; - BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormatName) ); - - bool isCompressed(TextureFormat::Enum _format) - { - return _format < TextureFormat::Unknown; - } - - bool isColor(TextureFormat::Enum _format) - { - return _format > TextureFormat::Unknown - && _format < TextureFormat::UnknownDepth - ; - } - - bool isDepth(TextureFormat::Enum _format) - { - return _format > TextureFormat::UnknownDepth - && _format < TextureFormat::Count - ; - } - - bool isValid(TextureFormat::Enum _format) - { - return _format != TextureFormat::Unknown - && _format != TextureFormat::UnknownDepth - && _format != TextureFormat::Count - ; - } - - uint8_t getBitsPerPixel(TextureFormat::Enum _format) - { - return s_imageBlockInfo[_format].bitsPerPixel; - } - - const ImageBlockInfo& getBlockInfo(TextureFormat::Enum _format) - { - return s_imageBlockInfo[_format]; - } - - uint8_t getBlockSize(TextureFormat::Enum _format) - { - return s_imageBlockInfo[_format].blockSize; - } - - const char* getName(TextureFormat::Enum _format) - { - return s_textureFormatName[_format]; - } - - TextureFormat::Enum getFormat(const char* _name) - { - for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) - { - const TextureFormat::Enum fmt = TextureFormat::Enum(ii); - if (isValid(fmt) ) - { - if (0 == bx::strincmp(s_textureFormatName[ii], _name) ) - { - return fmt; - } - } - } - - return TextureFormat::Unknown; - } - - uint8_t imageGetNumMips(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth) - { - const ImageBlockInfo& blockInfo = getBlockInfo(_format); - const uint16_t blockWidth = blockInfo.blockWidth; - const uint16_t blockHeight = blockInfo.blockHeight; - const uint16_t minBlockX = blockInfo.minBlockX; - const uint16_t minBlockY = blockInfo.minBlockY; - - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); - - uint32_t max = bx::uint32_max(_width, bx::uint32_max(_height, _depth) ); - uint32_t numMips = bx::uint32_max(1, uint8_t(bx::flog2(float(max) ) ) ); - - return uint8_t(numMips); - } - - uint32_t imageGetSize(TextureInfo* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format) - { - const ImageBlockInfo& blockInfo = getBlockInfo(_format); - const uint8_t bpp = blockInfo.bitsPerPixel; - const uint16_t blockWidth = blockInfo.blockWidth; - const uint16_t blockHeight = blockInfo.blockHeight; - const uint16_t minBlockX = blockInfo.minBlockX; - const uint16_t minBlockY = blockInfo.minBlockY; - - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); - const uint8_t numMips = calcNumMips(_hasMips, _width, _height, _depth); - const uint32_t sides = _cubeMap ? 6 : 1; - - uint32_t width = _width; - uint32_t height = _height; - uint32_t depth = _depth; - uint32_t size = 0; - - for (uint32_t lod = 0; lod < numMips; ++lod) - { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); - - size += width*height*depth*bpp/8 * sides; - - width >>= 1; - height >>= 1; - depth >>= 1; - } - - size *= _numLayers; - - if (NULL != _info) - { - _info->format = _format; - _info->width = _width; - _info->height = _height; - _info->depth = _depth; - _info->numMips = numMips; - _info->numLayers = _numLayers; - _info->cubeMap = _cubeMap; - _info->storageSize = size; - _info->bitsPerPixel = bpp; - } - - return size; - } - - void imageSolid(void* _dst, uint32_t _width, uint32_t _height, uint32_t _solid) - { - uint32_t* dst = (uint32_t*)_dst; - for (uint32_t ii = 0, num = _width*_height; ii < num; ++ii) - { - *dst++ = _solid; - } - } - - void imageCheckerboard(void* _dst, uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1) - { - uint32_t* dst = (uint32_t*)_dst; - for (uint32_t yy = 0; yy < _height; ++yy) - { - for (uint32_t xx = 0; xx < _width; ++xx) - { - uint32_t abgr = ( (xx/_step)&1) ^ ( (yy/_step)&1) ? _1 : _0; - *dst++ = abgr; - } - } - } - - void imageRgba8Downsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint32_t dstwidth = _width/2; - const uint32_t dstheight = _height/2; - - if (0 == dstwidth - || 0 == dstheight) - { - return; - } - - uint8_t* dst = (uint8_t*)_dst; - const uint8_t* src = (const uint8_t*)_src; - - for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep) - { - const uint8_t* rgba = src; - for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4) - { - float rr = bx::fpow(rgba[ 0], 2.2f); - float gg = bx::fpow(rgba[ 1], 2.2f); - float bb = bx::fpow(rgba[ 2], 2.2f); - float aa = rgba[ 3]; - rr += bx::fpow(rgba[ 4], 2.2f); - gg += bx::fpow(rgba[ 5], 2.2f); - bb += bx::fpow(rgba[ 6], 2.2f); - aa += rgba[ 7]; - rr += bx::fpow(rgba[_pitch+0], 2.2f); - gg += bx::fpow(rgba[_pitch+1], 2.2f); - bb += bx::fpow(rgba[_pitch+2], 2.2f); - aa += rgba[_pitch+3]; - rr += bx::fpow(rgba[_pitch+4], 2.2f); - gg += bx::fpow(rgba[_pitch+5], 2.2f); - bb += bx::fpow(rgba[_pitch+6], 2.2f); - aa += rgba[_pitch+7]; - - rr *= 0.25f; - gg *= 0.25f; - bb *= 0.25f; - aa *= 0.25f; - rr = bx::fpow(rr, 1.0f/2.2f); - gg = bx::fpow(gg, 1.0f/2.2f); - bb = bx::fpow(bb, 1.0f/2.2f); - dst[0] = (uint8_t)rr; - dst[1] = (uint8_t)gg; - dst[2] = (uint8_t)bb; - dst[3] = (uint8_t)aa; - } - } - } - - void imageRgba8Downsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint32_t dstwidth = _width/2; - const uint32_t dstheight = _height/2; - - if (0 == dstwidth - || 0 == dstheight) - { - return; - } - - uint8_t* dst = (uint8_t*)_dst; - const uint8_t* src = (const uint8_t*)_src; - - using namespace bx; - const simd128_t unpack = simd_ld(1.0f, 1.0f/256.0f, 1.0f/65536.0f, 1.0f/16777216.0f); - const simd128_t pack = simd_ld(1.0f, 256.0f*0.5f, 65536.0f, 16777216.0f*0.5f); - const simd128_t umask = simd_ild(0xff, 0xff00, 0xff0000, 0xff000000); - const simd128_t pmask = simd_ild(0xff, 0x7f80, 0xff0000, 0x7f800000); - const simd128_t wflip = simd_ild(0, 0, 0, 0x80000000); - const simd128_t wadd = simd_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f); - const simd128_t gamma = simd_ld(1.0f/2.2f, 1.0f/2.2f, 1.0f/2.2f, 1.0f); - const simd128_t linear = simd_ld(2.2f, 2.2f, 2.2f, 1.0f); - const simd128_t quater = simd_splat(0.25f); - - for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep) - { - const uint8_t* rgba = src; - for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4) - { - const simd128_t abgr0 = simd_splat(rgba); - const simd128_t abgr1 = simd_splat(rgba+4); - const simd128_t abgr2 = simd_splat(rgba+_pitch); - const simd128_t abgr3 = simd_splat(rgba+_pitch+4); - - const simd128_t abgr0m = simd_and(abgr0, umask); - const simd128_t abgr1m = simd_and(abgr1, umask); - const simd128_t abgr2m = simd_and(abgr2, umask); - const simd128_t abgr3m = simd_and(abgr3, umask); - const simd128_t abgr0x = simd_xor(abgr0m, wflip); - const simd128_t abgr1x = simd_xor(abgr1m, wflip); - const simd128_t abgr2x = simd_xor(abgr2m, wflip); - const simd128_t abgr3x = simd_xor(abgr3m, wflip); - const simd128_t abgr0f = simd_itof(abgr0x); - const simd128_t abgr1f = simd_itof(abgr1x); - const simd128_t abgr2f = simd_itof(abgr2x); - const simd128_t abgr3f = simd_itof(abgr3x); - const simd128_t abgr0c = simd_add(abgr0f, wadd); - const simd128_t abgr1c = simd_add(abgr1f, wadd); - const simd128_t abgr2c = simd_add(abgr2f, wadd); - const simd128_t abgr3c = simd_add(abgr3f, wadd); - const simd128_t abgr0n = simd_mul(abgr0c, unpack); - const simd128_t abgr1n = simd_mul(abgr1c, unpack); - const simd128_t abgr2n = simd_mul(abgr2c, unpack); - const simd128_t abgr3n = simd_mul(abgr3c, unpack); - - const simd128_t abgr0l = simd_pow(abgr0n, linear); - const simd128_t abgr1l = simd_pow(abgr1n, linear); - const simd128_t abgr2l = simd_pow(abgr2n, linear); - const simd128_t abgr3l = simd_pow(abgr3n, linear); - - const simd128_t sum0 = simd_add(abgr0l, abgr1l); - const simd128_t sum1 = simd_add(abgr2l, abgr3l); - const simd128_t sum2 = simd_add(sum0, sum1); - const simd128_t avg0 = simd_mul(sum2, quater); - const simd128_t avg1 = simd_pow(avg0, gamma); - - const simd128_t avg2 = simd_mul(avg1, pack); - const simd128_t ftoi0 = simd_ftoi(avg2); - const simd128_t ftoi1 = simd_and(ftoi0, pmask); - const simd128_t zwxy = simd_swiz_zwxy(ftoi1); - const simd128_t tmp0 = simd_or(ftoi1, zwxy); - const simd128_t yyyy = simd_swiz_yyyy(tmp0); - const simd128_t tmp1 = simd_iadd(yyyy, yyyy); - const simd128_t result = simd_or(tmp0, tmp1); - - simd_stx(dst, result); - } - } - } - - void imageRgba32fToLinear(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - uint8_t* dst = ( uint8_t*)_dst; - const uint8_t* src = (const uint8_t*)_src; - - for (uint32_t yy = 0; yy < _height; ++yy, src += _pitch) - { - for (uint32_t xx = 0; xx < _width; ++xx, dst += 16) - { - float* fd = ( float*)dst; - const float* fs = (const float*)src; - - fd[0] = bx::fpow(fs[0], 1.0f/2.2f); - fd[1] = bx::fpow(fs[1], 1.0f/2.2f); - fd[2] = bx::fpow(fs[2], 1.0f/2.2f); - fd[3] = fs[3]; - } - } - } - - void imageRgba32fToGamma(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - uint8_t* dst = ( uint8_t*)_dst; - const uint8_t* src = (const uint8_t*)_src; - - for (uint32_t yy = 0; yy < _height; ++yy, src += _pitch) - { - for (uint32_t xx = 0; xx < _width; ++xx, dst += 16) - { - float* fd = ( float*)dst; - const float* fs = (const float*)src; - - fd[0] = bx::fpow(fs[0], 2.2f); - fd[1] = bx::fpow(fs[1], 2.2f); - fd[2] = bx::fpow(fs[2], 2.2f); - fd[3] = fs[3]; - } - } - } - - void imageRgba32fLinearDownsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint32_t dstwidth = _width/2; - const uint32_t dstheight = _height/2; - - if (0 == dstwidth - || 0 == dstheight) - { - return; - } - - const uint8_t* src = (const uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep) - { - const float* rgba0 = (const float*)&src[0]; - const float* rgba1 = (const float*)&src[_pitch]; - for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba0 += 8, rgba1 += 8, dst += 16) - { - float xyz[4]; - xyz[0] = rgba0[0]; - xyz[1] = rgba0[1]; - xyz[2] = rgba0[2]; - xyz[3] = rgba0[3]; - - xyz[0] += rgba0[4]; - xyz[1] += rgba0[5]; - xyz[2] += rgba0[6]; - xyz[3] += rgba0[7]; - - xyz[0] += rgba1[0]; - xyz[1] += rgba1[1]; - xyz[2] += rgba1[2]; - xyz[3] += rgba1[3]; - - xyz[0] += rgba1[4]; - xyz[1] += rgba1[5]; - xyz[2] += rgba1[6]; - xyz[3] += rgba1[7]; - - xyz[0] *= 0.25f; - xyz[1] *= 0.25f; - xyz[2] *= 0.25f; - xyz[3] *= 0.25f; - } - } - } - - void imageRgba32fLinearDownsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - imageRgba32fLinearDownsample2x2Ref(_dst, _width, _height, _pitch, _src); - } - - void imageRgba32fDownsample2x2NormalMapRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint32_t dstwidth = _width/2; - const uint32_t dstheight = _height/2; - - if (0 == dstwidth - || 0 == dstheight) - { - return; - } - - const uint8_t* src = (const uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - for (uint32_t yy = 0, ystep = _pitch*2; yy < dstheight; ++yy, src += ystep) - { - const float* rgba0 = (const float*)&src[0]; - const float* rgba1 = (const float*)&src[_pitch]; - for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba0 += 8, rgba1 += 8, dst += 16) - { - float xyz[3]; - xyz[0] = rgba0[0]; - xyz[1] = rgba0[1]; - xyz[2] = rgba0[2]; - xyz[0] += rgba0[4]; - xyz[1] += rgba0[5]; - xyz[2] += rgba0[6]; - xyz[0] += rgba1[0]; - xyz[1] += rgba1[1]; - xyz[2] += rgba1[2]; - xyz[0] += rgba1[4]; - xyz[1] += rgba1[5]; - xyz[2] += rgba1[6]; - bx::vec3Norm( (float*)dst, xyz); - } - } - } - - void imageRgba32fDownsample2x2NormalMap(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - imageRgba32fDownsample2x2NormalMapRef(_dst, _width, _height, _pitch, _src); - } - - void imageSwizzleBgra8Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint8_t* src = (uint8_t*) _src; - const uint8_t* next = src + _pitch; - uint8_t* dst = (uint8_t*)_dst; - - for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _pitch) - { - for (uint32_t xx = 0; xx < _width; ++xx, src += 4, dst += 4) - { - uint8_t rr = src[0]; - uint8_t gg = src[1]; - uint8_t bb = src[2]; - uint8_t aa = src[3]; - dst[0] = bb; - dst[1] = gg; - dst[2] = rr; - dst[3] = aa; - } - } - } - - void imageSwizzleBgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - // Test can we do four 4-byte pixels at the time. - if (0 != (_width&0x3) - || _width < 4 - || !bx::isAligned(_src, 16) - || !bx::isAligned(_dst, 16) ) - { - BX_WARN(false, "Image swizzle is taking slow path."); - BX_WARN(bx::isAligned(_src, 16), "Source %p is not 16-byte aligned.", _src); - BX_WARN(bx::isAligned(_dst, 16), "Destination %p is not 16-byte aligned.", _dst); - BX_WARN(_width < 4, "Image width must be multiple of 4 (width %d).", _width); - imageSwizzleBgra8Ref(_dst, _width, _height, _pitch, _src); - return; - } - - using namespace bx; - - const simd128_t mf0f0 = simd_isplat(0xff00ff00); - const simd128_t m0f0f = simd_isplat(0x00ff00ff); - const uint8_t* src = (uint8_t*) _src; - const uint8_t* next = src + _pitch; - uint8_t* dst = (uint8_t*)_dst; - - const uint32_t width = _width/4; - - for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _pitch) - { - for (uint32_t xx = 0; xx < width; ++xx, src += 16, dst += 16) - { - const simd128_t tabgr = simd_ld(src); - const simd128_t t00ab = simd_srl(tabgr, 16); - const simd128_t tgr00 = simd_sll(tabgr, 16); - const simd128_t tgrab = simd_or(t00ab, tgr00); - const simd128_t ta0g0 = simd_and(tabgr, mf0f0); - const simd128_t t0r0b = simd_and(tgrab, m0f0f); - const simd128_t targb = simd_or(ta0g0, t0r0b); - simd_st(dst, targb); - } - } - } - - void imageCopy(void* _dst, uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch) - { - const uint32_t pitch = bx::uint32_min(_srcPitch, _dstPitch); - const uint8_t* src = (uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += _dstPitch) - { - bx::memCopy(dst, src, pitch); - } - } - - void imageCopy(void* _dst, uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src) - { - const uint32_t dstPitch = _width*_bpp/8; - imageCopy(_dst, _height, _pitch, _src, dstPitch); - } - - struct PackUnpack - { - bx::PackFn pack; - bx::UnpackFn unpack; - }; - - static const PackUnpack s_packUnpack[] = - { - { NULL, NULL }, // BC1 - { NULL, NULL }, // BC2 - { NULL, NULL }, // BC3 - { NULL, NULL }, // BC4 - { NULL, NULL }, // BC5 - { NULL, NULL }, // BC6H - { NULL, NULL }, // BC7 - { NULL, NULL }, // ETC1 - { NULL, NULL }, // ETC2 - { NULL, NULL }, // ETC2A - { NULL, NULL }, // ETC2A1 - { NULL, NULL }, // PTC12 - { NULL, NULL }, // PTC14 - { NULL, NULL }, // PTC12A - { NULL, NULL }, // PTC14A - { NULL, NULL }, // PTC22 - { NULL, NULL }, // PTC24 - { NULL, NULL }, // Unknown - { NULL, NULL }, // R1 - { bx::packR8, bx::unpackR8 }, // A8 - { bx::packR8, bx::unpackR8 }, // R8 - { bx::packR8I, bx::unpackR8I }, // R8I - { bx::packR8U, bx::unpackR8U }, // R8U - { bx::packR8S, bx::unpackR8S }, // R8S - { bx::packR16, bx::unpackR16 }, // R16 - { bx::packR16I, bx::unpackR16I }, // R16I - { bx::packR16U, bx::unpackR16U }, // R16U - { bx::packR16F, bx::unpackR16F }, // R16F - { bx::packR16S, bx::unpackR16S }, // R16S - { bx::packR32I, bx::unpackR32I }, // R32I - { bx::packR32U, bx::unpackR32U }, // R32U - { bx::packR32F, bx::unpackR32F }, // R32F - { bx::packRg8, bx::unpackRg8 }, // RG8 - { bx::packRg8I, bx::unpackRg8I }, // RG8I - { bx::packRg8U, bx::unpackRg8U }, // RG8U - { bx::packRg8S, bx::unpackRg8S }, // RG8S - { bx::packRg16, bx::unpackRg16 }, // RG16 - { bx::packRg16I, bx::unpackRg16I }, // RG16I - { bx::packRg16U, bx::unpackRg16U }, // RG16U - { bx::packRg16F, bx::unpackRg16F }, // RG16F - { bx::packRg16S, bx::unpackRg16S }, // RG16S - { bx::packRg32I, bx::unpackRg32I }, // RG32I - { bx::packRg32U, bx::unpackRg32U }, // RG32U - { bx::packRg32F, bx::unpackRg32F }, // RG32F - { bx::packRgb8, bx::unpackRgb8 }, // RGB8 - { bx::packRgb8S, bx::unpackRgb8S }, // RGB8S - { bx::packRgb8I, bx::unpackRgb8I }, // RGB8I - { bx::packRgb8U, bx::unpackRgb8U }, // RGB8U - { bx::packRgb9E5F, bx::unpackRgb9E5F }, // RGB9E5F - { bx::packBgra8, bx::unpackBgra8 }, // BGRA8 - { bx::packRgba8, bx::unpackRgba8 }, // RGBA8 - { bx::packRgba8I, bx::unpackRgba8I }, // RGBA8I - { bx::packRgba8U, bx::unpackRgba8U }, // RGBA8U - { bx::packRgba8S, bx::unpackRgba8S }, // RGBA8S - { bx::packRgba16, bx::unpackRgba16 }, // RGBA16 - { bx::packRgba16I, bx::unpackRgba16I }, // RGBA16I - { bx::packRgba16U, bx::unpackRgba16U }, // RGBA16U - { bx::packRgba16F, bx::unpackRgba16F }, // RGBA16F - { bx::packRgba16S, bx::unpackRgba16S }, // RGBA16S - { bx::packRgba32I, bx::unpackRgba32I }, // RGBA32I - { bx::packRgba32U, bx::unpackRgba32U }, // RGBA32U - { bx::packRgba32F, bx::unpackRgba32F }, // RGBA32F - { bx::packR5G6B5, bx::unpackR5G6B5 }, // R5G6B5 - { bx::packRgba4, bx::unpackRgba4 }, // RGBA4 - { bx::packRgb5a1, bx::unpackRgb5a1 }, // RGB5A1 - { bx::packRgb10A2, bx::unpackRgb10A2 }, // RGB10A2 - { bx::packR11G11B10F, bx::unpackR11G11B10F }, // R11G11B10F - { NULL, NULL }, // UnknownDepth - { bx::packR16, bx::unpackR16 }, // D16 - { bx::packR24, bx::unpackR24 }, // D24 - { bx::packR24G8, bx::unpackR24G8 }, // D24S8 - { NULL, NULL }, // D32 - { bx::packR16F, bx::unpackR16F }, // D16F - { NULL, NULL }, // D24F - { bx::packR32F, bx::unpackR32F }, // D32F - { bx::packR8, bx::unpackR8 }, // D0S8 - }; - BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_packUnpack) ); - - bool imageConvert(TextureFormat::Enum _dstFormat, TextureFormat::Enum _srcFormat) - { - bx::UnpackFn unpack = s_packUnpack[_srcFormat].unpack; - bx::PackFn pack = s_packUnpack[_dstFormat].pack; - return NULL != pack - && NULL != unpack - ; - } - - void imageConvert(void* _dst, uint32_t _bpp, bx::PackFn _pack, const void* _src, bx::UnpackFn _unpack, uint32_t _size) - { - const uint8_t* src = (uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - const uint32_t size = _size * 8 / _bpp; - - for (uint32_t ii = 0; ii < size; ++ii) - { - float rgba[4]; - _unpack(rgba, &src[ii*_bpp/8]); - _pack(&dst[ii*_bpp/8], rgba); - } - } - - void imageConvert(void* _dst, uint32_t _dstBpp, bx::PackFn _pack, const void* _src, uint32_t _srcBpp, bx::UnpackFn _unpack, uint32_t _width, uint32_t _height, uint32_t _srcPitch) - { - const uint8_t* src = (uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - const uint32_t dstPitch = _width * _dstBpp / 8; - - for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += dstPitch) - { - for (uint32_t xx = 0; xx < _width; ++xx) - { - float rgba[4]; - _unpack(rgba, &src[xx*_srcBpp/8]); - _pack(&dst[xx*_dstBpp/8], rgba); - } - } - } - - bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _srcPitch) - { - bx::UnpackFn unpack = s_packUnpack[_srcFormat].unpack; - bx::PackFn pack = s_packUnpack[_dstFormat].pack; - if (NULL == pack - || NULL == unpack) - { - return false; - } - - const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; - const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel; - imageConvert(_dst, dstBpp, pack, _src, srcBpp, unpack, _width, _height, _srcPitch); - - return true; - } - - bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height) - { - const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; - - if (_dstFormat == _srcFormat) - { - bx::memCopy(_dst, _src, _width*_height*srcBpp/8); - return true; - } - - return imageConvert(_dst, _dstFormat, _src, _srcFormat, _width, _height, _width*srcBpp/8); - } - - ImageContainer* imageConvert(bx::AllocatorI* _allocator, TextureFormat::Enum _dstFormat, const ImageContainer& _input) - { - ImageContainer* output = imageAlloc(_allocator - , _dstFormat - , uint16_t(_input.m_width) - , uint16_t(_input.m_height) - , uint16_t(_input.m_depth) - , _input.m_numLayers - , _input.m_cubeMap - , 1 < _input.m_numMips - ); - - const uint8_t bpp = getBitsPerPixel(_dstFormat); - const uint16_t numSides = _input.m_numLayers * (_input.m_cubeMap ? 6 : 1); - - uint8_t* dst = (uint8_t*)output->m_data ; - for (uint16_t side = 0; side < numSides; ++side) - { - for (uint8_t lod = 0, num = _input.m_numMips; lod < num; ++lod) - { - ImageMip mip; - if (imageGetRawData(_input, side, lod, _input.m_data, _input.m_size, mip) ) - { - bool ok = imageConvert(dst - , _dstFormat - , mip.m_data - , mip.m_format - , mip.m_width - , mip.m_height - ); - BX_CHECK(ok, "Conversion from %s to %s failed!" - , getName(_input.m_format) - , getName(output->m_format) - ); - BX_UNUSED(ok); - - dst += mip.m_width*mip.m_height*bpp/8; - } - } - } - - return output; - } - - ImageContainer* imageParseBgfx(bx::AllocatorI* _allocator, const void* _src, uint32_t _size) - { - ImageContainer imageContainer; - if (!imageParse(imageContainer, _src, _size) ) - { - return NULL; - } - - ImageContainer* output = imageAlloc(_allocator - , imageContainer.m_format - , uint16_t(imageContainer.m_width) - , uint16_t(imageContainer.m_height) - , uint16_t(imageContainer.m_depth) - , imageContainer.m_numLayers - , imageContainer.m_cubeMap - , 1 < imageContainer.m_numMips - ); - - const uint16_t numSides = imageContainer.m_numLayers * (imageContainer.m_cubeMap ? 6 : 1); - uint8_t* dst = (uint8_t*)output->m_data; - - for (uint16_t side = 0; side < numSides; ++side) - { - for (uint8_t lod = 0, num = imageContainer.m_numMips; lod < num; ++lod) - { - ImageMip mip; - if (imageGetRawData(imageContainer, side, lod, _src, _size, mip) ) - { - bx::memCopy(dst, mip.m_data, mip.m_size); - dst += mip.m_size; - } - } - } - - return output; - } - - uint8_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to) - { - using namespace bx; - uint32_t tmp0 = uint32_sll(1, _to); - uint32_t tmp1 = uint32_sll(1, _from); - uint32_t tmp2 = uint32_dec(tmp0); - uint32_t tmp3 = uint32_dec(tmp1); - uint32_t tmp4 = uint32_mul(_in, tmp2); - uint32_t tmp5 = uint32_add(tmp3, tmp4); - uint32_t tmp6 = uint32_srl(tmp5, _from); - uint32_t tmp7 = uint32_add(tmp5, tmp6); - uint32_t result = uint32_srl(tmp7, _from); - - return uint8_t(result); - } - - void decodeBlockDxt(uint8_t _dst[16*4], const uint8_t _src[8]) - { - uint8_t colors[4*3]; - - uint32_t c0 = _src[0] | (_src[1] << 8); - colors[0] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8); - colors[1] = bitRangeConvert( (c0>> 5)&0x3f, 6, 8); - colors[2] = bitRangeConvert( (c0>>11)&0x1f, 5, 8); - - uint32_t c1 = _src[2] | (_src[3] << 8); - colors[3] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8); - colors[4] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8); - colors[5] = bitRangeConvert( (c1>>11)&0x1f, 5, 8); - - colors[6] = (2*colors[0] + colors[3]) / 3; - colors[7] = (2*colors[1] + colors[4]) / 3; - colors[8] = (2*colors[2] + colors[5]) / 3; - - colors[ 9] = (colors[0] + 2*colors[3]) / 3; - colors[10] = (colors[1] + 2*colors[4]) / 3; - colors[11] = (colors[2] + 2*colors[5]) / 3; - - for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2) - { - int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 3; - _dst[ii+0] = colors[idx+0]; - _dst[ii+1] = colors[idx+1]; - _dst[ii+2] = colors[idx+2]; - } - } - - void decodeBlockDxt1(uint8_t _dst[16*4], const uint8_t _src[8]) - { - uint8_t colors[4*4]; - - uint32_t c0 = _src[0] | (_src[1] << 8); - colors[0] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8); - colors[1] = bitRangeConvert( (c0>> 5)&0x3f, 6, 8); - colors[2] = bitRangeConvert( (c0>>11)&0x1f, 5, 8); - colors[3] = 255; - - uint32_t c1 = _src[2] | (_src[3] << 8); - colors[4] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8); - colors[5] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8); - colors[6] = bitRangeConvert( (c1>>11)&0x1f, 5, 8); - colors[7] = 255; - - if (c0 > c1) - { - colors[ 8] = (2*colors[0] + colors[4]) / 3; - colors[ 9] = (2*colors[1] + colors[5]) / 3; - colors[10] = (2*colors[2] + colors[6]) / 3; - colors[11] = 255; - - colors[12] = (colors[0] + 2*colors[4]) / 3; - colors[13] = (colors[1] + 2*colors[5]) / 3; - colors[14] = (colors[2] + 2*colors[6]) / 3; - colors[15] = 255; - } - else - { - colors[ 8] = (colors[0] + colors[4]) / 2; - colors[ 9] = (colors[1] + colors[5]) / 2; - colors[10] = (colors[2] + colors[6]) / 2; - colors[11] = 255; - - colors[12] = 0; - colors[13] = 0; - colors[14] = 0; - colors[15] = 0; - } - - for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2) - { - int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 4; - _dst[ii+0] = colors[idx+0]; - _dst[ii+1] = colors[idx+1]; - _dst[ii+2] = colors[idx+2]; - _dst[ii+3] = colors[idx+3]; - } - } - - void decodeBlockDxt23A(uint8_t _dst[16*4], const uint8_t _src[8]) - { - for (uint32_t ii = 0, next = 0; ii < 16*4; ii += 4, next += 4) - { - uint32_t c0 = (_src[next>>3] >> (next&7) ) & 0xf; - _dst[ii] = bitRangeConvert(c0, 4, 8); - } - } - - void decodeBlockDxt45A(uint8_t _dst[16*4], const uint8_t _src[8]) - { - uint8_t alpha[8]; - alpha[0] = _src[0]; - alpha[1] = _src[1]; - - if (alpha[0] > alpha[1]) - { - alpha[2] = (6*alpha[0] + 1*alpha[1]) / 7; - alpha[3] = (5*alpha[0] + 2*alpha[1]) / 7; - alpha[4] = (4*alpha[0] + 3*alpha[1]) / 7; - alpha[5] = (3*alpha[0] + 4*alpha[1]) / 7; - alpha[6] = (2*alpha[0] + 5*alpha[1]) / 7; - alpha[7] = (1*alpha[0] + 6*alpha[1]) / 7; - } - else - { - alpha[2] = (4*alpha[0] + 1*alpha[1]) / 5; - alpha[3] = (3*alpha[0] + 2*alpha[1]) / 5; - alpha[4] = (2*alpha[0] + 3*alpha[1]) / 5; - alpha[5] = (1*alpha[0] + 4*alpha[1]) / 5; - alpha[6] = 0; - alpha[7] = 255; - } - - uint32_t idx0 = _src[2]; - uint32_t idx1 = _src[5]; - idx0 |= uint32_t(_src[3])<<8; - idx1 |= uint32_t(_src[6])<<8; - idx0 |= uint32_t(_src[4])<<16; - idx1 |= uint32_t(_src[7])<<16; - for (uint32_t ii = 0; ii < 8*4; ii += 4) - { - _dst[ii] = alpha[idx0&7]; - _dst[ii+32] = alpha[idx1&7]; - idx0 >>= 3; - idx1 >>= 3; - } - } - - static const int32_t s_etc1Mod[8][4] = - { - { 2, 8, -2, -8}, - { 5, 17, -5, -17}, - { 9, 29, -9, -29}, - { 13, 42, -13, -42}, - { 18, 60, -18, -60}, - { 24, 80, -24, -80}, - { 33, 106, -33, -106}, - { 47, 183, -47, -183}, - }; - - static const uint8_t s_etc2Mod[8] = { 3, 6, 11, 16, 23, 32, 41, 64 }; - - uint8_t uint8_sat(int32_t _a) - { - using namespace bx; - const uint32_t min = uint32_imin(_a, 255); - const uint32_t result = uint32_imax(min, 0); - return (uint8_t)result; - } - - uint8_t uint8_satadd(int32_t _a, int32_t _b) - { - const int32_t add = _a + _b; - return uint8_sat(add); - } - - void decodeBlockEtc2ModeT(uint8_t _dst[16*4], const uint8_t _src[8]) - { - uint8_t rgb[16]; - - // 0 1 2 3 4 5 6 7 - // 7654321076543210765432107654321076543210765432107654321076543210 - // ...rr.rrggggbbbbrrrrggggbbbbDDD.mmmmmmmmmmmmmmmmllllllllllllllll - // ^ ^ ^ ^ ^ - // +-- c0 +-- c1 | +-- msb +-- lsb - // +-- dist - - rgb[ 0] = ( (_src[0] >> 1) & 0xc) - | (_src[0] & 0x3) - ; - rgb[ 1] = _src[1] >> 4; - rgb[ 2] = _src[1] & 0xf; - - rgb[ 8] = _src[2] >> 4; - rgb[ 9] = _src[2] & 0xf; - rgb[10] = _src[3] >> 4; - - rgb[ 0] = bitRangeConvert(rgb[ 0], 4, 8); - rgb[ 1] = bitRangeConvert(rgb[ 1], 4, 8); - rgb[ 2] = bitRangeConvert(rgb[ 2], 4, 8); - rgb[ 8] = bitRangeConvert(rgb[ 8], 4, 8); - rgb[ 9] = bitRangeConvert(rgb[ 9], 4, 8); - rgb[10] = bitRangeConvert(rgb[10], 4, 8); - - uint8_t dist = (_src[3] >> 1) & 0x7; - int32_t mod = s_etc2Mod[dist]; - - rgb[ 4] = uint8_satadd(rgb[ 8], mod); - rgb[ 5] = uint8_satadd(rgb[ 9], mod); - rgb[ 6] = uint8_satadd(rgb[10], mod); - - rgb[12] = uint8_satadd(rgb[ 8], -mod); - rgb[13] = uint8_satadd(rgb[ 9], -mod); - rgb[14] = uint8_satadd(rgb[10], -mod); - - uint32_t indexMsb = (_src[4]<<8) | _src[5]; - uint32_t indexLsb = (_src[6]<<8) | _src[7]; - - for (uint32_t ii = 0; ii < 16; ++ii) - { - const uint32_t idx = (ii&0xc) | ( (ii & 0x3)<<4); - const uint32_t lsbi = indexLsb & 1; - const uint32_t msbi = (indexMsb & 1)<<1; - const uint32_t pal = (lsbi | msbi)<<2; - - _dst[idx + 0] = rgb[pal+2]; - _dst[idx + 1] = rgb[pal+1]; - _dst[idx + 2] = rgb[pal+0]; - _dst[idx + 3] = 255; - - indexLsb >>= 1; - indexMsb >>= 1; - } - } - - void decodeBlockEtc2ModeH(uint8_t _dst[16*4], const uint8_t _src[8]) - { - uint8_t rgb[16]; - - // 0 1 2 3 4 5 6 7 - // 7654321076543210765432107654321076543210765432107654321076543210 - // .rrrrggg...gb.bbbrrrrggggbbbbDD.mmmmmmmmmmmmmmmmllllllllllllllll - // ^ ^ ^ ^ ^ - // +-- c0 +-- c1 | +-- msb +-- lsb - // +-- dist - - rgb[ 0] = (_src[0] >> 3) & 0xf; - rgb[ 1] = ( (_src[0] << 1) & 0xe) - | ( (_src[1] >> 4) & 0x1) - ; - rgb[ 2] = (_src[1] & 0x8) - | ( (_src[1] << 1) & 0x6) - | (_src[2] >> 7) - ; - - rgb[ 8] = (_src[2] >> 3) & 0xf; - rgb[ 9] = ( (_src[2] << 1) & 0xe) - | (_src[3] >> 7) - ; - rgb[10] = (_src[2] >> 3) & 0xf; - - rgb[ 0] = bitRangeConvert(rgb[ 0], 4, 8); - rgb[ 1] = bitRangeConvert(rgb[ 1], 4, 8); - rgb[ 2] = bitRangeConvert(rgb[ 2], 4, 8); - rgb[ 8] = bitRangeConvert(rgb[ 8], 4, 8); - rgb[ 9] = bitRangeConvert(rgb[ 9], 4, 8); - rgb[10] = bitRangeConvert(rgb[10], 4, 8); - - uint32_t col0 = uint32_t(rgb[0]<<16) | uint32_t(rgb[1]<<8) | uint32_t(rgb[ 2]); - uint32_t col1 = uint32_t(rgb[8]<<16) | uint32_t(rgb[9]<<8) | uint32_t(rgb[10]); - uint8_t dist = (_src[3] & 0x6) | (col0 >= col1); - int32_t mod = s_etc2Mod[dist]; - - rgb[ 4] = uint8_satadd(rgb[ 0], -mod); - rgb[ 5] = uint8_satadd(rgb[ 1], -mod); - rgb[ 6] = uint8_satadd(rgb[ 2], -mod); - - rgb[ 0] = uint8_satadd(rgb[ 0], mod); - rgb[ 1] = uint8_satadd(rgb[ 1], mod); - rgb[ 2] = uint8_satadd(rgb[ 2], mod); - - rgb[12] = uint8_satadd(rgb[ 8], -mod); - rgb[13] = uint8_satadd(rgb[ 9], -mod); - rgb[14] = uint8_satadd(rgb[10], -mod); - - rgb[ 8] = uint8_satadd(rgb[ 8], mod); - rgb[ 9] = uint8_satadd(rgb[ 9], mod); - rgb[10] = uint8_satadd(rgb[10], mod); - - uint32_t indexMsb = (_src[4]<<8) | _src[5]; - uint32_t indexLsb = (_src[6]<<8) | _src[7]; - - for (uint32_t ii = 0; ii < 16; ++ii) - { - const uint32_t idx = (ii&0xc) | ( (ii & 0x3)<<4); - const uint32_t lsbi = indexLsb & 1; - const uint32_t msbi = (indexMsb & 1)<<1; - const uint32_t pal = (lsbi | msbi)<<2; - - _dst[idx + 0] = rgb[pal+2]; - _dst[idx + 1] = rgb[pal+1]; - _dst[idx + 2] = rgb[pal+0]; - _dst[idx + 3] = 255; - - indexLsb >>= 1; - indexMsb >>= 1; - } - } - - void decodeBlockEtc2ModePlanar(uint8_t _dst[16*4], const uint8_t _src[8]) - { - // 0 1 2 3 4 5 6 7 - // 7654321076543210765432107654321076543210765432107654321076543210 - // .rrrrrrg.ggggggb...bb.bbbrrrrr.rgggggggbbbbbbrrrrrrgggggggbbbbbb - // ^ ^ ^ - // +-- c0 +-- cH +-- cV - - uint8_t c0[3]; - uint8_t cH[3]; - uint8_t cV[3]; - - c0[0] = (_src[0] >> 1) & 0x3f; - c0[1] = ( (_src[0] & 1) << 6) - | ( (_src[1] >> 1) & 0x3f) - ; - c0[2] = ( (_src[1] & 1) << 5) - | ( (_src[2] & 0x18) ) - | ( (_src[2] << 1) & 6) - | ( (_src[3] >> 7) ) - ; - - cH[0] = ( (_src[3] >> 1) & 0x3e) - | (_src[3] & 1) - ; - cH[1] = _src[4] >> 1; - cH[2] = ( (_src[4] & 1) << 5) - | (_src[5] >> 3) - ; - - cV[0] = ( (_src[5] & 0x7) << 3) - | (_src[6] >> 5) - ; - cV[1] = ( (_src[6] & 0x1f) << 2) - | (_src[7] >> 5) - ; - cV[2] = _src[7] & 0x3f; - - c0[0] = bitRangeConvert(c0[0], 6, 8); - c0[1] = bitRangeConvert(c0[1], 7, 8); - c0[2] = bitRangeConvert(c0[2], 6, 8); - - cH[0] = bitRangeConvert(cH[0], 6, 8); - cH[1] = bitRangeConvert(cH[1], 7, 8); - cH[2] = bitRangeConvert(cH[2], 6, 8); - - cV[0] = bitRangeConvert(cV[0], 6, 8); - cV[1] = bitRangeConvert(cV[1], 7, 8); - cV[2] = bitRangeConvert(cV[2], 6, 8); - - int16_t dy[3]; - dy[0] = cV[0] - c0[0]; - dy[1] = cV[1] - c0[1]; - dy[2] = cV[2] - c0[2]; - - int16_t sx[3]; - sx[0] = int16_t(c0[0])<<2; - sx[1] = int16_t(c0[1])<<2; - sx[2] = int16_t(c0[2])<<2; - - int16_t ex[3]; - ex[0] = int16_t(cH[0])<<2; - ex[1] = int16_t(cH[1])<<2; - ex[2] = int16_t(cH[2])<<2; - - for (int32_t vv = 0; vv < 4; ++vv) - { - int16_t dx[3]; - dx[0] = (ex[0] - sx[0])>>2; - dx[1] = (ex[1] - sx[1])>>2; - dx[2] = (ex[2] - sx[2])>>2; - - for (int32_t hh = 0; hh < 4; ++hh) - { - const uint32_t idx = (vv<<4) + (hh<<2); - - _dst[idx + 0] = uint8_sat( (sx[2] + dx[2]*hh)>>2); - _dst[idx + 1] = uint8_sat( (sx[1] + dx[1]*hh)>>2); - _dst[idx + 2] = uint8_sat( (sx[0] + dx[0]*hh)>>2); - _dst[idx + 3] = 255; - } - - sx[0] += dy[0]; - sx[1] += dy[1]; - sx[2] += dy[2]; - - ex[0] += dy[0]; - ex[1] += dy[1]; - ex[2] += dy[2]; - } - } - - void decodeBlockEtc12(uint8_t _dst[16*4], const uint8_t _src[8]) - { - bool flipBit = 0 != (_src[3] & 0x1); - bool diffBit = 0 != (_src[3] & 0x2); - - uint8_t rgb[8]; - - if (diffBit) - { - rgb[0] = _src[0] >> 3; - rgb[1] = _src[1] >> 3; - rgb[2] = _src[2] >> 3; - - int8_t diff[3]; - diff[0] = int8_t( (_src[0] & 0x7)<<5)>>5; - diff[1] = int8_t( (_src[1] & 0x7)<<5)>>5; - diff[2] = int8_t( (_src[2] & 0x7)<<5)>>5; - - int8_t rr = rgb[0] + diff[0]; - int8_t gg = rgb[1] + diff[1]; - int8_t bb = rgb[2] + diff[2]; - - // Etc2 3-modes - if (rr < 0 || rr > 31) - { - decodeBlockEtc2ModeT(_dst, _src); - return; - } - if (gg < 0 || gg > 31) - { - decodeBlockEtc2ModeH(_dst, _src); - return; - } - if (bb < 0 || bb > 31) - { - decodeBlockEtc2ModePlanar(_dst, _src); - return; - } - - // Etc1 - rgb[0] = bitRangeConvert(rgb[0], 5, 8); - rgb[1] = bitRangeConvert(rgb[1], 5, 8); - rgb[2] = bitRangeConvert(rgb[2], 5, 8); - rgb[4] = bitRangeConvert(rr, 5, 8); - rgb[5] = bitRangeConvert(gg, 5, 8); - rgb[6] = bitRangeConvert(bb, 5, 8); - } - else - { - rgb[0] = _src[0] >> 4; - rgb[1] = _src[1] >> 4; - rgb[2] = _src[2] >> 4; - - rgb[4] = _src[0] & 0xf; - rgb[5] = _src[1] & 0xf; - rgb[6] = _src[2] & 0xf; - - rgb[0] = bitRangeConvert(rgb[0], 4, 8); - rgb[1] = bitRangeConvert(rgb[1], 4, 8); - rgb[2] = bitRangeConvert(rgb[2], 4, 8); - rgb[4] = bitRangeConvert(rgb[4], 4, 8); - rgb[5] = bitRangeConvert(rgb[5], 4, 8); - rgb[6] = bitRangeConvert(rgb[6], 4, 8); - } - - uint32_t table[2]; - table[0] = (_src[3] >> 5) & 0x7; - table[1] = (_src[3] >> 2) & 0x7; - - uint32_t indexMsb = (_src[4]<<8) | _src[5]; - uint32_t indexLsb = (_src[6]<<8) | _src[7]; - - if (flipBit) - { - for (uint32_t ii = 0; ii < 16; ++ii) - { - const uint32_t block = (ii>>1)&1; - const uint32_t color = block<<2; - const uint32_t idx = (ii&0xc) | ( (ii & 0x3)<<4); - const uint32_t lsbi = indexLsb & 1; - const uint32_t msbi = (indexMsb & 1)<<1; - const int32_t mod = s_etc1Mod[table[block] ][lsbi | msbi]; - - _dst[idx + 0] = uint8_satadd(rgb[color+2], mod); - _dst[idx + 1] = uint8_satadd(rgb[color+1], mod); - _dst[idx + 2] = uint8_satadd(rgb[color+0], mod); - _dst[idx + 3] = 255; - - indexLsb >>= 1; - indexMsb >>= 1; - } - } - else - { - for (uint32_t ii = 0; ii < 16; ++ii) - { - const uint32_t block = ii>>3; - const uint32_t color = block<<2; - const uint32_t idx = (ii&0xc) | ( (ii & 0x3)<<4); - const uint32_t lsbi = indexLsb & 1; - const uint32_t msbi = (indexMsb & 1)<<1; - const int32_t mod = s_etc1Mod[table[block] ][lsbi | msbi]; - - _dst[idx + 0] = uint8_satadd(rgb[color+2], mod); - _dst[idx + 1] = uint8_satadd(rgb[color+1], mod); - _dst[idx + 2] = uint8_satadd(rgb[color+0], mod); - _dst[idx + 3] = 255; - - indexLsb >>= 1; - indexMsb >>= 1; - } - } - } - - static const uint8_t s_pvrtcFactors[16][4] = - { - { 4, 4, 4, 4 }, - { 2, 6, 2, 6 }, - { 8, 0, 8, 0 }, - { 6, 2, 6, 2 }, - - { 2, 2, 6, 6 }, - { 1, 3, 3, 9 }, - { 4, 0, 12, 0 }, - { 3, 1, 9, 3 }, - - { 8, 8, 0, 0 }, - { 4, 12, 0, 0 }, - { 16, 0, 0, 0 }, - { 12, 4, 0, 0 }, - - { 6, 6, 2, 2 }, - { 3, 9, 1, 3 }, - { 12, 0, 4, 0 }, - { 9, 3, 3, 1 }, - }; - - static const uint8_t s_pvrtcWeights[8][4] = - { - { 8, 0, 8, 0 }, - { 5, 3, 5, 3 }, - { 3, 5, 3, 5 }, - { 0, 8, 0, 8 }, - - { 8, 0, 8, 0 }, - { 4, 4, 4, 4 }, - { 4, 4, 4, 4 }, - { 0, 8, 0, 8 }, - }; - - uint32_t morton2d(uint32_t _x, uint32_t _y) - { - using namespace bx; - const uint32_t tmpx = uint32_part1by1(_x); - const uint32_t xbits = uint32_sll(tmpx, 1); - const uint32_t ybits = uint32_part1by1(_y); - const uint32_t result = uint32_or(xbits, ybits); - return result; - } - - uint32_t getColor(const uint8_t _src[8]) - { - return 0 - | _src[7]<<24 - | _src[6]<<16 - | _src[5]<<8 - | _src[4] - ; - } - - void decodeBlockPtc14RgbAddA(uint32_t _block, uint32_t* _r, uint32_t* _g, uint32_t* _b, uint8_t _factor) - { - if (0 != (_block & (1<<15) ) ) - { - *_r += bitRangeConvert( (_block >> 10) & 0x1f, 5, 8) * _factor; - *_g += bitRangeConvert( (_block >> 5) & 0x1f, 5, 8) * _factor; - *_b += bitRangeConvert( (_block >> 1) & 0x0f, 4, 8) * _factor; - } - else - { - *_r += bitRangeConvert( (_block >> 8) & 0xf, 4, 8) * _factor; - *_g += bitRangeConvert( (_block >> 4) & 0xf, 4, 8) * _factor; - *_b += bitRangeConvert( (_block >> 1) & 0x7, 3, 8) * _factor; - } - } - - void decodeBlockPtc14RgbAddB(uint32_t _block, uint32_t* _r, uint32_t* _g, uint32_t* _b, uint8_t _factor) - { - if (0 != (_block & (1<<31) ) ) - { - *_r += bitRangeConvert( (_block >> 26) & 0x1f, 5, 8) * _factor; - *_g += bitRangeConvert( (_block >> 21) & 0x1f, 5, 8) * _factor; - *_b += bitRangeConvert( (_block >> 16) & 0x1f, 5, 8) * _factor; - } - else - { - *_r += bitRangeConvert( (_block >> 24) & 0xf, 4, 8) * _factor; - *_g += bitRangeConvert( (_block >> 20) & 0xf, 4, 8) * _factor; - *_b += bitRangeConvert( (_block >> 16) & 0xf, 4, 8) * _factor; - } - } - - void decodeBlockPtc14(uint8_t _dst[16*4], const uint8_t* _src, uint32_t _x, uint32_t _y, uint32_t _width, uint32_t _height) - { - // 0 1 2 3 4 5 6 7 - // 7654321076543210765432107654321076543210765432107654321076543210 - // mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmyrrrrrgggggbbbbbxrrrrrgggggbbbbp - // ^ ^^ ^^ ^ - // +-- modulation data |+- B color |+- A color | - // +-- B opaque +-- A opaque | - // alpha punchthrough --+ - - const uint8_t* bc = &_src[morton2d(_x, _y) * 8]; - - uint32_t mod = 0 - | bc[3]<<24 - | bc[2]<<16 - | bc[1]<<8 - | bc[0] - ; - - const bool punchthrough = !!(bc[7] & 1); - const uint8_t* weightTable = s_pvrtcWeights[4 * punchthrough]; - const uint8_t* factorTable = s_pvrtcFactors[0]; - - for (int yy = 0; yy < 4; ++yy) - { - const uint32_t yOffset = (yy < 2) ? -1 : 0; - const uint32_t y0 = (_y + yOffset) % _height; - const uint32_t y1 = (y0 + 1) % _height; - - for (int xx = 0; xx < 4; ++xx) - { - const uint32_t xOffset = (xx < 2) ? -1 : 0; - const uint32_t x0 = (_x + xOffset) % _width; - const uint32_t x1 = (x0 + 1) % _width; - - const uint32_t bc0 = getColor(&_src[morton2d(x0, y0) * 8]); - const uint32_t bc1 = getColor(&_src[morton2d(x1, y0) * 8]); - const uint32_t bc2 = getColor(&_src[morton2d(x0, y1) * 8]); - const uint32_t bc3 = getColor(&_src[morton2d(x1, y1) * 8]); - - const uint8_t f0 = factorTable[0]; - const uint8_t f1 = factorTable[1]; - const uint8_t f2 = factorTable[2]; - const uint8_t f3 = factorTable[3]; - - uint32_t ar = 0, ag = 0, ab = 0; - decodeBlockPtc14RgbAddA(bc0, &ar, &ag, &ab, f0); - decodeBlockPtc14RgbAddA(bc1, &ar, &ag, &ab, f1); - decodeBlockPtc14RgbAddA(bc2, &ar, &ag, &ab, f2); - decodeBlockPtc14RgbAddA(bc3, &ar, &ag, &ab, f3); - - uint32_t br = 0, bg = 0, bb = 0; - decodeBlockPtc14RgbAddB(bc0, &br, &bg, &bb, f0); - decodeBlockPtc14RgbAddB(bc1, &br, &bg, &bb, f1); - decodeBlockPtc14RgbAddB(bc2, &br, &bg, &bb, f2); - decodeBlockPtc14RgbAddB(bc3, &br, &bg, &bb, f3); - - const uint8_t* weight = &weightTable[(mod & 3)*4]; - const uint8_t wa = weight[0]; - const uint8_t wb = weight[1]; - - _dst[(yy*4 + xx)*4+0] = uint8_t( (ab * wa + bb * wb) >> 7); - _dst[(yy*4 + xx)*4+1] = uint8_t( (ag * wa + bg * wb) >> 7); - _dst[(yy*4 + xx)*4+2] = uint8_t( (ar * wa + br * wb) >> 7); - _dst[(yy*4 + xx)*4+3] = 255; - - mod >>= 2; - factorTable += 4; - } - } - } - - void decodeBlockPtc14ARgbaAddA(uint32_t _block, uint32_t* _r, uint32_t* _g, uint32_t* _b, uint32_t* _a, uint8_t _factor) - { - if (0 != (_block & (1<<15) ) ) - { - *_r += bitRangeConvert( (_block >> 10) & 0x1f, 5, 8) * _factor; - *_g += bitRangeConvert( (_block >> 5) & 0x1f, 5, 8) * _factor; - *_b += bitRangeConvert( (_block >> 1) & 0x0f, 4, 8) * _factor; - *_a += 255 * _factor; - } - else - { - *_r += bitRangeConvert( (_block >> 8) & 0xf, 4, 8) * _factor; - *_g += bitRangeConvert( (_block >> 4) & 0xf, 4, 8) * _factor; - *_b += bitRangeConvert( (_block >> 1) & 0x7, 3, 8) * _factor; - *_a += bitRangeConvert( (_block >> 12) & 0x7, 3, 8) * _factor; - } - } - - void decodeBlockPtc14ARgbaAddB(uint32_t _block, uint32_t* _r, uint32_t* _g, uint32_t* _b, uint32_t* _a, uint8_t _factor) - { - if (0 != (_block & (1<<31) ) ) - { - *_r += bitRangeConvert( (_block >> 26) & 0x1f, 5, 8) * _factor; - *_g += bitRangeConvert( (_block >> 21) & 0x1f, 5, 8) * _factor; - *_b += bitRangeConvert( (_block >> 16) & 0x1f, 5, 8) * _factor; - *_a += 255 * _factor; - } - else - { - *_r += bitRangeConvert( (_block >> 24) & 0xf, 4, 8) * _factor; - *_g += bitRangeConvert( (_block >> 20) & 0xf, 4, 8) * _factor; - *_b += bitRangeConvert( (_block >> 16) & 0xf, 4, 8) * _factor; - *_a += bitRangeConvert( (_block >> 28) & 0x7, 3, 8) * _factor; - } - } - - void decodeBlockPtc14A(uint8_t _dst[16*4], const uint8_t* _src, uint32_t _x, uint32_t _y, uint32_t _width, uint32_t _height) - { - // 0 1 2 3 4 5 6 7 - // 7654321076543210765432107654321076543210765432107654321076543210 - // mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmyrrrrrgggggbbbbbxrrrrrgggggbbbbp - // ^ ^^ ^^ ^ - // +-- modulation data |+- B color |+- A color | - // +-- B opaque +-- A opaque | - // alpha punchthrough --+ - - const uint8_t* bc = &_src[morton2d(_x, _y) * 8]; - - uint32_t mod = 0 - | bc[3]<<24 - | bc[2]<<16 - | bc[1]<<8 - | bc[0] - ; - - const bool punchthrough = !!(bc[7] & 1); - const uint8_t* weightTable = s_pvrtcWeights[4 * punchthrough]; - const uint8_t* factorTable = s_pvrtcFactors[0]; - - for (int yy = 0; yy < 4; ++yy) - { - const uint32_t yOffset = (yy < 2) ? -1 : 0; - const uint32_t y0 = (_y + yOffset) % _height; - const uint32_t y1 = (y0 + 1) % _height; - - for (int xx = 0; xx < 4; ++xx) - { - const uint32_t xOffset = (xx < 2) ? -1 : 0; - const uint32_t x0 = (_x + xOffset) % _width; - const uint32_t x1 = (x0 + 1) % _width; - - const uint32_t bc0 = getColor(&_src[morton2d(x0, y0) * 8]); - const uint32_t bc1 = getColor(&_src[morton2d(x1, y0) * 8]); - const uint32_t bc2 = getColor(&_src[morton2d(x0, y1) * 8]); - const uint32_t bc3 = getColor(&_src[morton2d(x1, y1) * 8]); - - const uint8_t f0 = factorTable[0]; - const uint8_t f1 = factorTable[1]; - const uint8_t f2 = factorTable[2]; - const uint8_t f3 = factorTable[3]; - - uint32_t ar = 0, ag = 0, ab = 0, aa = 0; - decodeBlockPtc14ARgbaAddA(bc0, &ar, &ag, &ab, &aa, f0); - decodeBlockPtc14ARgbaAddA(bc1, &ar, &ag, &ab, &aa, f1); - decodeBlockPtc14ARgbaAddA(bc2, &ar, &ag, &ab, &aa, f2); - decodeBlockPtc14ARgbaAddA(bc3, &ar, &ag, &ab, &aa, f3); - - uint32_t br = 0, bg = 0, bb = 0, ba = 0; - decodeBlockPtc14ARgbaAddB(bc0, &br, &bg, &bb, &ba, f0); - decodeBlockPtc14ARgbaAddB(bc1, &br, &bg, &bb, &ba, f1); - decodeBlockPtc14ARgbaAddB(bc2, &br, &bg, &bb, &ba, f2); - decodeBlockPtc14ARgbaAddB(bc3, &br, &bg, &bb, &ba, f3); - - const uint8_t* weight = &weightTable[(mod & 3)*4]; - const uint8_t wa = weight[0]; - const uint8_t wb = weight[1]; - const uint8_t wc = weight[2]; - const uint8_t wd = weight[3]; - - _dst[(yy*4 + xx)*4+0] = uint8_t( (ab * wa + bb * wb) >> 7); - _dst[(yy*4 + xx)*4+1] = uint8_t( (ag * wa + bg * wb) >> 7); - _dst[(yy*4 + xx)*4+2] = uint8_t( (ar * wa + br * wb) >> 7); - _dst[(yy*4 + xx)*4+3] = uint8_t( (aa * wc + ba * wd) >> 7); - - mod >>= 2; - factorTable += 4; - } - } - } - - ImageContainer* imageAlloc(bx::AllocatorI* _allocator, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, bool _hasMips, const void* _data) - { - const ImageBlockInfo& blockInfo = getBlockInfo(_format); - const uint16_t blockWidth = blockInfo.blockWidth; - const uint16_t blockHeight = blockInfo.blockHeight; - const uint16_t minBlockX = blockInfo.minBlockX; - const uint16_t minBlockY = blockInfo.minBlockY; - - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); - _numLayers = bx::uint16_max(1, _numLayers); - - const uint8_t numMips = _hasMips ? imageGetNumMips(_format, _width, _height) : 1; - uint32_t size = imageGetSize(NULL, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, _format); - - ImageContainer* imageContainer = (ImageContainer*)BX_ALLOC(_allocator, size + sizeof(ImageContainer) ); - - imageContainer->m_allocator = _allocator; - imageContainer->m_data = imageContainer + 1; - imageContainer->m_format = _format; - imageContainer->m_size = size; - imageContainer->m_offset = 0; - imageContainer->m_width = _width; - imageContainer->m_height = _height; - imageContainer->m_depth = _depth; - imageContainer->m_numLayers = _numLayers; - imageContainer->m_numMips = numMips; - imageContainer->m_hasAlpha = false; - imageContainer->m_cubeMap = _cubeMap; - imageContainer->m_ktx = false; - imageContainer->m_ktxLE = false; - imageContainer->m_srgb = false; - - if (NULL != _data) - { - bx::memCopy(imageContainer->m_data, _data, imageContainer->m_size); - } - - return imageContainer; - } - - void imageFree(ImageContainer* _imageContainer) - { - BX_FREE(_imageContainer->m_allocator, _imageContainer); - } - -// DDS -#define DDS_MAGIC BX_MAKEFOURCC('D', 'D', 'S', ' ') -#define DDS_HEADER_SIZE 124 - -#define DDS_DXT1 BX_MAKEFOURCC('D', 'X', 'T', '1') -#define DDS_DXT2 BX_MAKEFOURCC('D', 'X', 'T', '2') -#define DDS_DXT3 BX_MAKEFOURCC('D', 'X', 'T', '3') -#define DDS_DXT4 BX_MAKEFOURCC('D', 'X', 'T', '4') -#define DDS_DXT5 BX_MAKEFOURCC('D', 'X', 'T', '5') -#define DDS_ATI1 BX_MAKEFOURCC('A', 'T', 'I', '1') -#define DDS_BC4U BX_MAKEFOURCC('B', 'C', '4', 'U') -#define DDS_ATI2 BX_MAKEFOURCC('A', 'T', 'I', '2') -#define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U') -#define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0') - -#define DDS_A8R8G8B8 21 -#define DDS_R5G6B5 23 -#define DDS_A1R5G5B5 25 -#define DDS_A4R4G4B4 26 -#define DDS_A2B10G10R10 31 -#define DDS_G16R16 34 -#define DDS_A2R10G10B10 35 -#define DDS_A16B16G16R16 36 -#define DDS_A8L8 51 -#define DDS_R16F 111 -#define DDS_G16R16F 112 -#define DDS_A16B16G16R16F 113 -#define DDS_R32F 114 -#define DDS_G32R32F 115 -#define DDS_A32B32G32R32F 116 - -#define DDS_FORMAT_R32G32B32A32_FLOAT 2 -#define DDS_FORMAT_R32G32B32A32_UINT 3 -#define DDS_FORMAT_R16G16B16A16_FLOAT 10 -#define DDS_FORMAT_R16G16B16A16_UNORM 11 -#define DDS_FORMAT_R16G16B16A16_UINT 12 -#define DDS_FORMAT_R32G32_FLOAT 16 -#define DDS_FORMAT_R32G32_UINT 17 -#define DDS_FORMAT_R10G10B10A2_UNORM 24 -#define DDS_FORMAT_R11G11B10_FLOAT 26 -#define DDS_FORMAT_R8G8B8A8_UNORM 28 -#define DDS_FORMAT_R8G8B8A8_UNORM_SRGB 29 -#define DDS_FORMAT_R16G16_FLOAT 34 -#define DDS_FORMAT_R16G16_UNORM 35 -#define DDS_FORMAT_R32_FLOAT 41 -#define DDS_FORMAT_R32_UINT 42 -#define DDS_FORMAT_R8G8_UNORM 49 -#define DDS_FORMAT_R16_FLOAT 54 -#define DDS_FORMAT_R16_UNORM 56 -#define DDS_FORMAT_R8_UNORM 61 -#define DDS_FORMAT_R1_UNORM 66 -#define DDS_FORMAT_BC1_UNORM 71 -#define DDS_FORMAT_BC1_UNORM_SRGB 72 -#define DDS_FORMAT_BC2_UNORM 74 -#define DDS_FORMAT_BC2_UNORM_SRGB 75 -#define DDS_FORMAT_BC3_UNORM 77 -#define DDS_FORMAT_BC3_UNORM_SRGB 78 -#define DDS_FORMAT_BC4_UNORM 80 -#define DDS_FORMAT_BC5_UNORM 83 -#define DDS_FORMAT_B5G6R5_UNORM 85 -#define DDS_FORMAT_B5G5R5A1_UNORM 86 -#define DDS_FORMAT_B8G8R8A8_UNORM 87 -#define DDS_FORMAT_B8G8R8A8_UNORM_SRGB 91 -#define DDS_FORMAT_BC6H_SF16 96 -#define DDS_FORMAT_BC7_UNORM 98 -#define DDS_FORMAT_BC7_UNORM_SRGB 99 -#define DDS_FORMAT_B4G4R4A4_UNORM 115 - -#define DDSD_CAPS 0x00000001 -#define DDSD_HEIGHT 0x00000002 -#define DDSD_WIDTH 0x00000004 -#define DDSD_PITCH 0x00000008 -#define DDSD_PIXELFORMAT 0x00001000 -#define DDSD_MIPMAPCOUNT 0x00020000 -#define DDSD_LINEARSIZE 0x00080000 -#define DDSD_DEPTH 0x00800000 - -#define DDPF_ALPHAPIXELS 0x00000001 -#define DDPF_ALPHA 0x00000002 -#define DDPF_FOURCC 0x00000004 -#define DDPF_INDEXED 0x00000020 -#define DDPF_RGB 0x00000040 -#define DDPF_YUV 0x00000200 -#define DDPF_LUMINANCE 0x00020000 - -#define DDSCAPS_COMPLEX 0x00000008 -#define DDSCAPS_TEXTURE 0x00001000 -#define DDSCAPS_MIPMAP 0x00400000 - -#define DDSCAPS2_CUBEMAP 0x00000200 -#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 -#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 -#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 -#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 -#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 -#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 - -#define DDS_CUBEMAP_ALLFACES (DDSCAPS2_CUBEMAP_POSITIVEX|DDSCAPS2_CUBEMAP_NEGATIVEX \ - |DDSCAPS2_CUBEMAP_POSITIVEY|DDSCAPS2_CUBEMAP_NEGATIVEY \ - |DDSCAPS2_CUBEMAP_POSITIVEZ|DDSCAPS2_CUBEMAP_NEGATIVEZ) - -#define DDSCAPS2_VOLUME 0x00200000 - - struct TranslateDdsFormat - { - uint32_t m_format; - TextureFormat::Enum m_textureFormat; - bool m_srgb; - }; - - static const TranslateDdsFormat s_translateDdsFourccFormat[] = - { - { DDS_DXT1, TextureFormat::BC1, false }, - { DDS_DXT2, TextureFormat::BC2, false }, - { DDS_DXT3, TextureFormat::BC2, false }, - { DDS_DXT4, TextureFormat::BC3, false }, - { DDS_DXT5, TextureFormat::BC3, false }, - { DDS_ATI1, TextureFormat::BC4, false }, - { DDS_BC4U, TextureFormat::BC4, false }, - { DDS_ATI2, TextureFormat::BC5, false }, - { DDS_BC5U, TextureFormat::BC5, false }, - { DDS_A16B16G16R16, TextureFormat::RGBA16, false }, - { DDS_A16B16G16R16F, TextureFormat::RGBA16F, false }, - { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8, false }, - { DDPF_INDEXED, TextureFormat::R8, false }, - { DDPF_LUMINANCE, TextureFormat::R8, false }, - { DDPF_ALPHA, TextureFormat::R8, false }, - { DDS_R16F, TextureFormat::R16F, false }, - { DDS_R32F, TextureFormat::R32F, false }, - { DDS_A8L8, TextureFormat::RG8, false }, - { DDS_G16R16, TextureFormat::RG16, false }, - { DDS_G16R16F, TextureFormat::RG16F, false }, - { DDS_G32R32F, TextureFormat::RG32F, false }, - { DDS_A8R8G8B8, TextureFormat::BGRA8, false }, - { DDS_A16B16G16R16, TextureFormat::RGBA16, false }, - { DDS_A16B16G16R16F, TextureFormat::RGBA16F, false }, - { DDS_A32B32G32R32F, TextureFormat::RGBA32F, false }, - { DDS_R5G6B5, TextureFormat::R5G6B5, false }, - { DDS_A4R4G4B4, TextureFormat::RGBA4, false }, - { DDS_A1R5G5B5, TextureFormat::RGB5A1, false }, - { DDS_A2B10G10R10, TextureFormat::RGB10A2, false }, - }; - - static const TranslateDdsFormat s_translateDxgiFormat[] = - { - { DDS_FORMAT_BC1_UNORM, TextureFormat::BC1, false }, - { DDS_FORMAT_BC1_UNORM_SRGB, TextureFormat::BC1, true }, - { DDS_FORMAT_BC2_UNORM, TextureFormat::BC2, false }, - { DDS_FORMAT_BC2_UNORM_SRGB, TextureFormat::BC2, true }, - { DDS_FORMAT_BC3_UNORM, TextureFormat::BC3, false }, - { DDS_FORMAT_BC3_UNORM_SRGB, TextureFormat::BC3, true }, - { DDS_FORMAT_BC4_UNORM, TextureFormat::BC4, false }, - { DDS_FORMAT_BC5_UNORM, TextureFormat::BC5, false }, - { DDS_FORMAT_BC6H_SF16, TextureFormat::BC6H, false }, - { DDS_FORMAT_BC7_UNORM, TextureFormat::BC7, false }, - { DDS_FORMAT_BC7_UNORM_SRGB, TextureFormat::BC7, true }, - - { DDS_FORMAT_R1_UNORM, TextureFormat::R1, false }, - { DDS_FORMAT_R8_UNORM, TextureFormat::R8, false }, - { DDS_FORMAT_R16_UNORM, TextureFormat::R16, false }, - { DDS_FORMAT_R16_FLOAT, TextureFormat::R16F, false }, - { DDS_FORMAT_R32_UINT, TextureFormat::R32U, false }, - { DDS_FORMAT_R32_FLOAT, TextureFormat::R32F, false }, - { DDS_FORMAT_R8G8_UNORM, TextureFormat::RG8, false }, - { DDS_FORMAT_R16G16_UNORM, TextureFormat::RG16, false }, - { DDS_FORMAT_R16G16_FLOAT, TextureFormat::RG16F, false }, - { DDS_FORMAT_R32G32_UINT, TextureFormat::RG32U, false }, - { DDS_FORMAT_R32G32_FLOAT, TextureFormat::RG32F, false }, - { DDS_FORMAT_B8G8R8A8_UNORM, TextureFormat::BGRA8, false }, - { DDS_FORMAT_B8G8R8A8_UNORM_SRGB, TextureFormat::BGRA8, true }, - { DDS_FORMAT_R8G8B8A8_UNORM, TextureFormat::RGBA8, false }, - { DDS_FORMAT_R8G8B8A8_UNORM_SRGB, TextureFormat::RGBA8, true }, - { DDS_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16, false }, - { DDS_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F, false }, - { DDS_FORMAT_R32G32B32A32_UINT, TextureFormat::RGBA32U, false }, - { DDS_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F, false }, - { DDS_FORMAT_B5G6R5_UNORM, TextureFormat::R5G6B5, false }, - { DDS_FORMAT_B4G4R4A4_UNORM, TextureFormat::RGBA4, false }, - { DDS_FORMAT_B5G5R5A1_UNORM, TextureFormat::RGB5A1, false }, - { DDS_FORMAT_R10G10B10A2_UNORM, TextureFormat::RGB10A2, false }, - { DDS_FORMAT_R11G11B10_FLOAT, TextureFormat::R11G11B10F, false }, - }; - - struct TranslateDdsPixelFormat - { - uint32_t m_bitCount; - uint32_t m_bitmask[4]; - TextureFormat::Enum m_textureFormat; - }; - - static const TranslateDdsPixelFormat s_translateDdsPixelFormat[] = - { - { 8, { 0x000000ff, 0x00000000, 0x00000000, 0x00000000 }, TextureFormat::R8 }, - { 16, { 0x0000ffff, 0x00000000, 0x00000000, 0x00000000 }, TextureFormat::R16U }, - { 16, { 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000 }, TextureFormat::RGBA4 }, - { 16, { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 }, TextureFormat::R5G6B5 }, - { 16, { 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 }, TextureFormat::RGB5A1 }, - { 24, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, TextureFormat::RGB8 }, - { 32, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, TextureFormat::BGRA8 }, - { 32, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, TextureFormat::BGRA8 }, - { 32, { 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 }, TextureFormat::RGB10A2 }, - { 32, { 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000 }, TextureFormat::RG16 }, - { 32, { 0xffffffff, 0x00000000, 0x00000000, 0x00000000 }, TextureFormat::R32U }, - }; - - bool imageParseDds(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader) - { - uint32_t headerSize; - bx::read(_reader, headerSize); - - if (headerSize < DDS_HEADER_SIZE) - { - return false; - } - - uint32_t flags; - bx::read(_reader, flags); - - if ( (flags & (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT) ) != (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT) ) - { - return false; - } - - uint32_t height; - bx::read(_reader, height); - - uint32_t width; - bx::read(_reader, width); - - uint32_t pitch; - bx::read(_reader, pitch); - - uint32_t depth; - bx::read(_reader, depth); - - uint32_t mips; - bx::read(_reader, mips); - - bx::skip(_reader, 44); // reserved - - uint32_t pixelFormatSize; - bx::read(_reader, pixelFormatSize); - - uint32_t pixelFlags; - bx::read(_reader, pixelFlags); - - uint32_t fourcc; - bx::read(_reader, fourcc); - - uint32_t bitCount; - bx::read(_reader, bitCount); - - uint32_t bitmask[4]; - bx::read(_reader, bitmask, sizeof(bitmask) ); - - uint32_t caps[4]; - bx::read(_reader, caps); - - bx::skip(_reader, 4); // reserved - - uint32_t dxgiFormat = 0; - uint32_t arraySize = 1; - if (DDPF_FOURCC == pixelFlags - && DDS_DX10 == fourcc) - { - bx::read(_reader, dxgiFormat); - - uint32_t dims; - bx::read(_reader, dims); - - uint32_t miscFlags; - bx::read(_reader, miscFlags); - - bx::read(_reader, arraySize); - - uint32_t miscFlags2; - bx::read(_reader, miscFlags2); - } - - if ( (caps[0] & DDSCAPS_TEXTURE) == 0) - { - return false; - } - - bool cubeMap = 0 != (caps[1] & DDSCAPS2_CUBEMAP); - if (cubeMap) - { - if ( (caps[1] & DDS_CUBEMAP_ALLFACES) != DDS_CUBEMAP_ALLFACES) - { - // partial cube map is not supported. - return false; - } - } - - TextureFormat::Enum format = TextureFormat::Unknown; - bool hasAlpha = pixelFlags & DDPF_ALPHAPIXELS; - bool srgb = false; - - if (dxgiFormat == 0) - { - if (DDPF_FOURCC == (pixelFlags & DDPF_FOURCC) ) - { - for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFourccFormat); ++ii) - { - if (s_translateDdsFourccFormat[ii].m_format == fourcc) - { - format = s_translateDdsFourccFormat[ii].m_textureFormat; - break; - } - } - } - else - { - for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsPixelFormat); ++ii) - { - const TranslateDdsPixelFormat& pf = s_translateDdsPixelFormat[ii]; - if (pf.m_bitCount == bitCount - && pf.m_bitmask[0] == bitmask[0] - && pf.m_bitmask[1] == bitmask[1] - && pf.m_bitmask[2] == bitmask[2] - && pf.m_bitmask[3] == bitmask[3]) - { - format = pf.m_textureFormat; - break; - } - } - } - } - else - { - for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDxgiFormat); ++ii) - { - if (s_translateDxgiFormat[ii].m_format == dxgiFormat) - { - format = s_translateDxgiFormat[ii].m_textureFormat; - srgb = s_translateDxgiFormat[ii].m_srgb; - break; - } - } - } - - _imageContainer.m_allocator = NULL; - _imageContainer.m_data = NULL; - _imageContainer.m_size = 0; - _imageContainer.m_offset = (uint32_t)bx::seek(_reader); - _imageContainer.m_width = width; - _imageContainer.m_height = height; - _imageContainer.m_depth = depth; - _imageContainer.m_format = format; - _imageContainer.m_numLayers = uint16_t(arraySize); - _imageContainer.m_numMips = uint8_t( (caps[0] & DDSCAPS_MIPMAP) ? mips : 1); - _imageContainer.m_hasAlpha = hasAlpha; - _imageContainer.m_cubeMap = cubeMap; - _imageContainer.m_ktx = false; - _imageContainer.m_ktxLE = false; - _imageContainer.m_srgb = srgb; - - return TextureFormat::Unknown != format; - } - -// KTX -#define KTX_MAGIC BX_MAKEFOURCC(0xAB, 'K', 'T', 'X') -#define KTX_HEADER_SIZE 64 - -#define KTX_ETC1_RGB8_OES 0x8D64 -#define KTX_COMPRESSED_R11_EAC 0x9270 -#define KTX_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define KTX_COMPRESSED_RG11_EAC 0x9272 -#define KTX_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define KTX_COMPRESSED_RGB8_ETC2 0x9274 -#define KTX_COMPRESSED_SRGB8_ETC2 0x9275 -#define KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define KTX_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 -#define KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 -#define KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 -#define KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#define KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D -#define KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E -#define KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F -#define KTX_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 -#define KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 -#define KTX_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C -#define KTX_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D -#define KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E -#define KTX_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F -#define KTX_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 -#define KTX_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 -#define KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 -#define KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 - -#define KTX_A8 0x803C -#define KTX_R8 0x8229 -#define KTX_R16 0x822A -#define KTX_RG8 0x822B -#define KTX_RG16 0x822C -#define KTX_R16F 0x822D -#define KTX_R32F 0x822E -#define KTX_RG16F 0x822F -#define KTX_RG32F 0x8230 -#define KTX_RGBA8 0x8058 -#define KTX_RGBA16 0x805B -#define KTX_RGBA16F 0x881A -#define KTX_R32UI 0x8236 -#define KTX_RG32UI 0x823C -#define KTX_RGBA32UI 0x8D70 -#define KTX_RGBA32F 0x8814 -#define KTX_RGB565 0x8D62 -#define KTX_RGBA4 0x8056 -#define KTX_RGB5_A1 0x8057 -#define KTX_RGB10_A2 0x8059 -#define KTX_R8I 0x8231 -#define KTX_R8UI 0x8232 -#define KTX_R16I 0x8233 -#define KTX_R16UI 0x8234 -#define KTX_R32I 0x8235 -#define KTX_R32UI 0x8236 -#define KTX_RG8I 0x8237 -#define KTX_RG8UI 0x8238 -#define KTX_RG16I 0x8239 -#define KTX_RG16UI 0x823A -#define KTX_RG32I 0x823B -#define KTX_RG32UI 0x823C -#define KTX_R8_SNORM 0x8F94 -#define KTX_RG8_SNORM 0x8F95 -#define KTX_RGB8_SNORM 0x8F96 -#define KTX_RGBA8_SNORM 0x8F97 -#define KTX_R16_SNORM 0x8F98 -#define KTX_RG16_SNORM 0x8F99 -#define KTX_RGB16_SNORM 0x8F9A -#define KTX_RGBA16_SNORM 0x8F9B -#define KTX_SRGB8 0x8C41 -#define KTX_SRGB8_ALPHA8 0x8C43 -#define KTX_RGBA32UI 0x8D70 -#define KTX_RGB32UI 0x8D71 -#define KTX_RGBA16UI 0x8D76 -#define KTX_RGB16UI 0x8D77 -#define KTX_RGBA8UI 0x8D7C -#define KTX_RGB8UI 0x8D7D -#define KTX_RGBA32I 0x8D82 -#define KTX_RGB32I 0x8D83 -#define KTX_RGBA16I 0x8D88 -#define KTX_RGB16I 0x8D89 -#define KTX_RGBA8I 0x8D8E -#define KTX_RGB8 0x8051 -#define KTX_RGB8I 0x8D8F -#define KTX_RGB9_E5 0x8C3D -#define KTX_R11F_G11F_B10F 0x8C3A - -#define KTX_ZERO 0 -#define KTX_RED 0x1903 -#define KTX_ALPHA 0x1906 -#define KTX_RGB 0x1907 -#define KTX_RGBA 0x1908 -#define KTX_BGRA 0x80E1 -#define KTX_RG 0x8227 - -#define KTX_BYTE 0x1400 -#define KTX_UNSIGNED_BYTE 0x1401 -#define KTX_SHORT 0x1402 -#define KTX_UNSIGNED_SHORT 0x1403 -#define KTX_INT 0x1404 -#define KTX_UNSIGNED_INT 0x1405 -#define KTX_FLOAT 0x1406 -#define KTX_HALF_FLOAT 0x140B -#define KTX_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define KTX_UNSIGNED_SHORT_5_6_5 0x8363 -#define KTX_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define KTX_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define KTX_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define KTX_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B - - struct KtxFormatInfo - { - uint32_t m_internalFmt; - uint32_t m_internalFmtSrgb; - uint32_t m_fmt; - uint32_t m_type; - }; - - static const KtxFormatInfo s_translateKtxFormat[] = - { - { KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT, KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT, KTX_ZERO, }, // BC1 - { KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT, KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT, KTX_ZERO, }, // BC2 - { KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT, KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT, KTX_ZERO, }, // BC3 - { KTX_COMPRESSED_LUMINANCE_LATC1_EXT, KTX_ZERO, KTX_COMPRESSED_LUMINANCE_LATC1_EXT, KTX_ZERO, }, // BC4 - { KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, KTX_ZERO, KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, KTX_ZERO, }, // BC5 - { KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, KTX_ZERO, KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB, KTX_ZERO, }, // BC6H - { KTX_COMPRESSED_RGBA_BPTC_UNORM_ARB, KTX_ZERO, KTX_COMPRESSED_RGBA_BPTC_UNORM_ARB, KTX_ZERO, }, // BC7 - { KTX_ETC1_RGB8_OES, KTX_ZERO, KTX_ETC1_RGB8_OES, KTX_ZERO, }, // ETC1 - { KTX_COMPRESSED_RGB8_ETC2, KTX_ZERO, KTX_COMPRESSED_RGB8_ETC2, KTX_ZERO, }, // ETC2 - { KTX_COMPRESSED_RGBA8_ETC2_EAC, KTX_COMPRESSED_SRGB8_ETC2, KTX_COMPRESSED_RGBA8_ETC2_EAC, KTX_ZERO, }, // ETC2A - { KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, KTX_ZERO, }, // ETC2A1 - { KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, KTX_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, KTX_ZERO, }, // PTC12 - { KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, KTX_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT, KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, KTX_ZERO, }, // PTC14 - { KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, KTX_ZERO, }, // PTC12A - { KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, KTX_ZERO, }, // PTC14A - { KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG, KTX_ZERO, KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG, KTX_ZERO, }, // PTC22 - { KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG, KTX_ZERO, KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG, KTX_ZERO, }, // PTC24 - { KTX_ZERO, KTX_ZERO, KTX_ZERO, KTX_ZERO, }, // Unknown - { KTX_ZERO, KTX_ZERO, KTX_ZERO, KTX_ZERO, }, // R1 - { KTX_ALPHA, KTX_ZERO, KTX_ALPHA, KTX_UNSIGNED_BYTE, }, // A8 - { KTX_R8, KTX_ZERO, KTX_RED, KTX_UNSIGNED_BYTE, }, // R8 - { KTX_R8I, KTX_ZERO, KTX_RED, KTX_BYTE, }, // R8S - { KTX_R8UI, KTX_ZERO, KTX_RED, KTX_UNSIGNED_BYTE, }, // R8S - { KTX_R8_SNORM, KTX_ZERO, KTX_RED, KTX_BYTE, }, // R8S - { KTX_R16, KTX_ZERO, KTX_RED, KTX_UNSIGNED_SHORT, }, // R16 - { KTX_R16I, KTX_ZERO, KTX_RED, KTX_SHORT, }, // R16I - { KTX_R16UI, KTX_ZERO, KTX_RED, KTX_UNSIGNED_SHORT, }, // R16U - { KTX_R16F, KTX_ZERO, KTX_RED, KTX_HALF_FLOAT, }, // R16F - { KTX_R16_SNORM, KTX_ZERO, KTX_RED, KTX_SHORT, }, // R16S - { KTX_R32I, KTX_ZERO, KTX_RED, KTX_INT, }, // R32I - { KTX_R32UI, KTX_ZERO, KTX_RED, KTX_UNSIGNED_INT, }, // R32U - { KTX_R32F, KTX_ZERO, KTX_RED, KTX_FLOAT, }, // R32F - { KTX_RG8, KTX_ZERO, KTX_RG, KTX_UNSIGNED_BYTE, }, // RG8 - { KTX_RG8I, KTX_ZERO, KTX_RG, KTX_BYTE, }, // RG8I - { KTX_RG8UI, KTX_ZERO, KTX_RG, KTX_UNSIGNED_BYTE, }, // RG8U - { KTX_RG8_SNORM, KTX_ZERO, KTX_RG, KTX_BYTE, }, // RG8S - { KTX_RG16, KTX_ZERO, KTX_RG, KTX_UNSIGNED_SHORT, }, // RG16 - { KTX_RG16I, KTX_ZERO, KTX_RG, KTX_SHORT, }, // RG16 - { KTX_RG16UI, KTX_ZERO, KTX_RG, KTX_UNSIGNED_SHORT, }, // RG16 - { KTX_RG16F, KTX_ZERO, KTX_RG, KTX_FLOAT, }, // RG16F - { KTX_RG16_SNORM, KTX_ZERO, KTX_RG, KTX_SHORT, }, // RG16S - { KTX_RG32I, KTX_ZERO, KTX_RG, KTX_INT, }, // RG32I - { KTX_RG32UI, KTX_ZERO, KTX_RG, KTX_UNSIGNED_INT, }, // RG32U - { KTX_RG32F, KTX_ZERO, KTX_RG, KTX_FLOAT, }, // RG32F - { KTX_RGB8, KTX_SRGB8, KTX_RGB, KTX_UNSIGNED_BYTE, }, // RGB8 - { KTX_RGB8I, KTX_ZERO, KTX_RGB, KTX_BYTE, }, // RGB8I - { KTX_RGB8UI, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_BYTE, }, // RGB8U - { KTX_RGB8_SNORM, KTX_ZERO, KTX_RGB, KTX_BYTE, }, // RGB8S - { KTX_RGB9_E5, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_INT_5_9_9_9_REV, }, // RGB9E5F - { KTX_BGRA, KTX_SRGB8_ALPHA8, KTX_BGRA, KTX_UNSIGNED_BYTE, }, // BGRA8 - { KTX_RGBA8, KTX_SRGB8_ALPHA8, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8 - { KTX_RGBA8I, KTX_ZERO, KTX_RGBA, KTX_BYTE, }, // RGBA8I - { KTX_RGBA8UI, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8U - { KTX_RGBA8_SNORM, KTX_ZERO, KTX_RGBA, KTX_BYTE, }, // RGBA8S - { KTX_RGBA16, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_SHORT, }, // RGBA16 - { KTX_RGBA16I, KTX_ZERO, KTX_RGBA, KTX_SHORT, }, // RGBA16I - { KTX_RGBA16UI, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_SHORT, }, // RGBA16U - { KTX_RGBA16F, KTX_ZERO, KTX_RGBA, KTX_HALF_FLOAT, }, // RGBA16F - { KTX_RGBA16_SNORM, KTX_ZERO, KTX_RGBA, KTX_SHORT, }, // RGBA16S - { KTX_RGBA32I, KTX_ZERO, KTX_RGBA, KTX_INT, }, // RGBA32I - { KTX_RGBA32UI, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_INT, }, // RGBA32U - { KTX_RGBA32F, KTX_ZERO, KTX_RGBA, KTX_FLOAT, }, // RGBA32F - { KTX_RGB565, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_SHORT_5_6_5, }, // R5G6B5 - { KTX_RGBA4, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_SHORT_4_4_4_4, }, // RGBA4 - { KTX_RGB5_A1, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_SHORT_5_5_5_1, }, // RGB5A1 - { KTX_RGB10_A2, KTX_ZERO, KTX_RGBA, KTX_UNSIGNED_INT_2_10_10_10_REV, }, // RGB10A2 - { KTX_R11F_G11F_B10F, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_INT_10F_11F_11F_REV, }, // R11G11B10F - }; - BX_STATIC_ASSERT(TextureFormat::UnknownDepth == BX_COUNTOF(s_translateKtxFormat) ); - - struct KtxFormatInfo2 - { - uint32_t m_internalFmt; - TextureFormat::Enum m_format; - }; - - static const KtxFormatInfo2 s_translateKtxFormat2[] = - { - { KTX_A8, TextureFormat::A8 }, - { KTX_RED, TextureFormat::R8 }, - { KTX_RGB, TextureFormat::RGB8 }, - }; - - bool imageParseKtx(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader) - { - uint8_t identifier[8]; - bx::read(_reader, identifier); - - if (identifier[1] != '1' - && identifier[2] != '1') - { - return false; - } - - uint32_t endianness; - bx::read(_reader, endianness); - - bool fromLittleEndian = 0x04030201 == endianness; - - uint32_t glType; - bx::readHE(_reader, glType, fromLittleEndian); - - uint32_t glTypeSize; - bx::readHE(_reader, glTypeSize, fromLittleEndian); - - uint32_t glFormat; - bx::readHE(_reader, glFormat, fromLittleEndian); - - uint32_t glInternalFormat; - bx::readHE(_reader, glInternalFormat, fromLittleEndian); - - uint32_t glBaseInternalFormat; - bx::readHE(_reader, glBaseInternalFormat, fromLittleEndian); - - uint32_t width; - bx::readHE(_reader, width, fromLittleEndian); - - uint32_t height; - bx::readHE(_reader, height, fromLittleEndian); - - uint32_t depth; - bx::readHE(_reader, depth, fromLittleEndian); - - uint32_t numberOfArrayElements; - bx::readHE(_reader, numberOfArrayElements, fromLittleEndian); - - uint32_t numFaces; - bx::readHE(_reader, numFaces, fromLittleEndian); - - uint32_t numMips; - bx::readHE(_reader, numMips, fromLittleEndian); - - uint32_t metaDataSize; - bx::readHE(_reader, metaDataSize, fromLittleEndian); - - // skip meta garbage... - int64_t offset = bx::skip(_reader, metaDataSize); - - TextureFormat::Enum format = TextureFormat::Unknown; - bool hasAlpha = false; - - for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateKtxFormat); ++ii) - { - if (s_translateKtxFormat[ii].m_internalFmt == glInternalFormat) - { - format = TextureFormat::Enum(ii); - break; - } - } - - if (TextureFormat::Unknown == format) - { - for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateKtxFormat2); ++ii) - { - if (s_translateKtxFormat2[ii].m_internalFmt == glInternalFormat) - { - format = s_translateKtxFormat2[ii].m_format; - break; - } - } - } - - _imageContainer.m_allocator = NULL; - _imageContainer.m_data = NULL; - _imageContainer.m_size = 0; - _imageContainer.m_offset = (uint32_t)offset; - _imageContainer.m_width = width; - _imageContainer.m_height = height; - _imageContainer.m_depth = depth; - _imageContainer.m_format = format; - _imageContainer.m_numLayers = uint16_t(bx::uint32_max(numberOfArrayElements, 1) ); - _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) ); - _imageContainer.m_hasAlpha = hasAlpha; - _imageContainer.m_cubeMap = numFaces > 1; - _imageContainer.m_ktx = true; - _imageContainer.m_ktxLE = fromLittleEndian; - _imageContainer.m_srgb = false; - - return TextureFormat::Unknown != format; - } - -// PVR3 -#define PVR3_MAKE8CC(_a, _b, _c, _d, _e, _f, _g, _h) (uint64_t(BX_MAKEFOURCC(_a, _b, _c, _d) ) | (uint64_t(BX_MAKEFOURCC(_e, _f, _g, _h) )<<32) ) - -#define PVR3_MAGIC BX_MAKEFOURCC('P', 'V', 'R', 3) -#define PVR3_HEADER_SIZE 52 - -#define PVR3_PVRTC1_2BPP_RGB 0 -#define PVR3_PVRTC1_2BPP_RGBA 1 -#define PVR3_PVRTC1_4BPP_RGB 2 -#define PVR3_PVRTC1_4BPP_RGBA 3 -#define PVR3_PVRTC2_2BPP_RGBA 4 -#define PVR3_PVRTC2_4BPP_RGBA 5 -#define PVR3_ETC1 6 -#define PVR3_DXT1 7 -#define PVR3_DXT2 8 -#define PVR3_DXT3 9 -#define PVR3_DXT4 10 -#define PVR3_DXT5 11 -#define PVR3_BC4 12 -#define PVR3_BC5 13 -#define PVR3_R8 PVR3_MAKE8CC('r', 0, 0, 0, 8, 0, 0, 0) -#define PVR3_R16 PVR3_MAKE8CC('r', 0, 0, 0, 16, 0, 0, 0) -#define PVR3_R32 PVR3_MAKE8CC('r', 0, 0, 0, 32, 0, 0, 0) -#define PVR3_RG8 PVR3_MAKE8CC('r', 'g', 0, 0, 8, 8, 0, 0) -#define PVR3_RG16 PVR3_MAKE8CC('r', 'g', 0, 0, 16, 16, 0, 0) -#define PVR3_RG32 PVR3_MAKE8CC('r', 'g', 0, 0, 32, 32, 0, 0) -#define PVR3_BGRA8 PVR3_MAKE8CC('b', 'g', 'r', 'a', 8, 8, 8, 8) -#define PVR3_RGBA16 PVR3_MAKE8CC('r', 'g', 'b', 'a', 16, 16, 16, 16) -#define PVR3_RGBA32 PVR3_MAKE8CC('r', 'g', 'b', 'a', 32, 32, 32, 32) -#define PVR3_RGB565 PVR3_MAKE8CC('r', 'g', 'b', 0, 5, 6, 5, 0) -#define PVR3_RGBA4 PVR3_MAKE8CC('r', 'g', 'b', 'a', 4, 4, 4, 4) -#define PVR3_RGBA51 PVR3_MAKE8CC('r', 'g', 'b', 'a', 5, 5, 5, 1) -#define PVR3_RGB10A2 PVR3_MAKE8CC('r', 'g', 'b', 'a', 10, 10, 10, 2) - -#define PVR3_CHANNEL_TYPE_ANY UINT32_MAX -#define PVR3_CHANNEL_TYPE_FLOAT UINT32_C(12) - - struct TranslatePvr3Format - { - uint64_t m_format; - uint32_t m_channelTypeMask; - TextureFormat::Enum m_textureFormat; - }; - - static const TranslatePvr3Format s_translatePvr3Format[] = - { - { PVR3_PVRTC1_2BPP_RGB, PVR3_CHANNEL_TYPE_ANY, TextureFormat::PTC12 }, - { PVR3_PVRTC1_2BPP_RGBA, PVR3_CHANNEL_TYPE_ANY, TextureFormat::PTC12A }, - { PVR3_PVRTC1_4BPP_RGB, PVR3_CHANNEL_TYPE_ANY, TextureFormat::PTC14 }, - { PVR3_PVRTC1_4BPP_RGBA, PVR3_CHANNEL_TYPE_ANY, TextureFormat::PTC14A }, - { PVR3_PVRTC2_2BPP_RGBA, PVR3_CHANNEL_TYPE_ANY, TextureFormat::PTC22 }, - { PVR3_PVRTC2_4BPP_RGBA, PVR3_CHANNEL_TYPE_ANY, TextureFormat::PTC24 }, - { PVR3_ETC1, PVR3_CHANNEL_TYPE_ANY, TextureFormat::ETC1 }, - { PVR3_DXT1, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC1 }, - { PVR3_DXT2, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC2 }, - { PVR3_DXT3, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC2 }, - { PVR3_DXT4, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC3 }, - { PVR3_DXT5, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC3 }, - { PVR3_BC4, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC4 }, - { PVR3_BC5, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BC5 }, - { PVR3_R8, PVR3_CHANNEL_TYPE_ANY, TextureFormat::R8 }, - { PVR3_R16, PVR3_CHANNEL_TYPE_ANY, TextureFormat::R16U }, - { PVR3_R16, PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::R16F }, - { PVR3_R32, PVR3_CHANNEL_TYPE_ANY, TextureFormat::R32U }, - { PVR3_R32, PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::R32F }, - { PVR3_RG8, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RG8 }, - { PVR3_RG16, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RG16 }, - { PVR3_RG16, PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RG16F }, - { PVR3_RG32, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RG16 }, - { PVR3_RG32, PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RG32F }, - { PVR3_BGRA8, PVR3_CHANNEL_TYPE_ANY, TextureFormat::BGRA8 }, - { PVR3_RGBA16, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RGBA16 }, - { PVR3_RGBA16, PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RGBA16F }, - { PVR3_RGBA32, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RGBA32U }, - { PVR3_RGBA32, PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RGBA32F }, - { PVR3_RGB565, PVR3_CHANNEL_TYPE_ANY, TextureFormat::R5G6B5 }, - { PVR3_RGBA4, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RGBA4 }, - { PVR3_RGBA51, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RGB5A1 }, - { PVR3_RGB10A2, PVR3_CHANNEL_TYPE_ANY, TextureFormat::RGB10A2 }, - }; - - bool imageParsePvr3(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader) - { - uint32_t flags; - bx::read(_reader, flags); - - uint64_t pixelFormat; - bx::read(_reader, pixelFormat); - - uint32_t colorSpace; - bx::read(_reader, colorSpace); // 0 - linearRGB, 1 - sRGB - - uint32_t channelType; - bx::read(_reader, channelType); - - uint32_t height; - bx::read(_reader, height); - - uint32_t width; - bx::read(_reader, width); - - uint32_t depth; - bx::read(_reader, depth); - - uint32_t numSurfaces; - bx::read(_reader, numSurfaces); - - uint32_t numFaces; - bx::read(_reader, numFaces); - - uint32_t numMips; - bx::read(_reader, numMips); - - uint32_t metaDataSize; - bx::read(_reader, metaDataSize); - - // skip meta garbage... - int64_t offset = bx::skip(_reader, metaDataSize); - - TextureFormat::Enum format = TextureFormat::Unknown; - bool hasAlpha = false; - - for (uint32_t ii = 0; ii < BX_COUNTOF(s_translatePvr3Format); ++ii) - { - if (s_translatePvr3Format[ii].m_format == pixelFormat - && channelType == (s_translatePvr3Format[ii].m_channelTypeMask & channelType) ) - { - format = s_translatePvr3Format[ii].m_textureFormat; - break; - } - } - - _imageContainer.m_allocator = NULL; - _imageContainer.m_data = NULL; - _imageContainer.m_size = 0; - _imageContainer.m_offset = (uint32_t)offset; - _imageContainer.m_width = width; - _imageContainer.m_height = height; - _imageContainer.m_depth = depth; - _imageContainer.m_format = format; - _imageContainer.m_numLayers = 1; - _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) ); - _imageContainer.m_hasAlpha = hasAlpha; - _imageContainer.m_cubeMap = numFaces > 1; - _imageContainer.m_ktx = false; - _imageContainer.m_ktxLE = false; - _imageContainer.m_srgb = colorSpace > 0; - - return TextureFormat::Unknown != format; - } - - bool imageParse(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader) - { - uint32_t magic; - bx::read(_reader, magic); - - if (DDS_MAGIC == magic) - { - return imageParseDds(_imageContainer, _reader); - } - else if (KTX_MAGIC == magic) - { - return imageParseKtx(_imageContainer, _reader); - } - else if (PVR3_MAGIC == magic) - { - return imageParsePvr3(_imageContainer, _reader); - } - else if (BGFX_CHUNK_MAGIC_TEX == magic) - { - TextureCreate tc; - bx::read(_reader, tc); - - _imageContainer.m_format = tc.m_format; - _imageContainer.m_offset = UINT32_MAX; - _imageContainer.m_allocator = NULL; - if (NULL == tc.m_mem) - { - _imageContainer.m_data = NULL; - _imageContainer.m_size = 0; - } - else - { - _imageContainer.m_data = tc.m_mem->data; - _imageContainer.m_size = tc.m_mem->size; - } - _imageContainer.m_width = tc.m_width; - _imageContainer.m_height = tc.m_height; - _imageContainer.m_depth = tc.m_depth; - _imageContainer.m_numLayers = tc.m_numLayers; - _imageContainer.m_numMips = tc.m_numMips; - _imageContainer.m_hasAlpha = false; - _imageContainer.m_cubeMap = tc.m_cubeMap; - _imageContainer.m_ktx = false; - _imageContainer.m_ktxLE = false; - _imageContainer.m_srgb = false; - - return true; - } - - BX_TRACE("Unrecognized image format (magic: 0x%08x)!", magic); - return false; - } - - bool imageParse(ImageContainer& _imageContainer, const void* _data, uint32_t _size) - { - bx::MemoryReader reader(_data, _size); - return imageParse(_imageContainer, &reader); - } - - void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format) - { - const uint8_t* src = (const uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - uint32_t width = _width/4; - uint32_t height = _height/4; - - uint8_t temp[16*4]; - - switch (_format) - { - case TextureFormat::BC1: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockDxt1(temp, src); - src += 8; - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::BC2: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockDxt23A(temp+3, src); - src += 8; - decodeBlockDxt(temp, src); - src += 8; - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::BC3: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockDxt45A(temp+3, src); - src += 8; - decodeBlockDxt(temp, src); - src += 8; - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::BC4: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockDxt45A(temp, src); - src += 8; - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::BC5: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockDxt45A(temp+2, src); - src += 8; - decodeBlockDxt45A(temp+1, src); - src += 8; - - for (uint32_t ii = 0; ii < 16; ++ii) - { - float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; - float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; - float nz = bx::fsqrt(1.0f - nx*nx - ny*ny); - temp[ii*4+0] = uint8_t( (nz + 1.0f)*255.0f/2.0f); - temp[ii*4+3] = 0; - } - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::ETC1: - case TextureFormat::ETC2: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockEtc12(temp, src); - src += 8; - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::ETC2A: - BX_WARN(false, "ETC2A decoder is not implemented."); - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ff00) ); - break; - - case TextureFormat::ETC2A1: - BX_WARN(false, "ETC2A1 decoder is not implemented."); - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff0000) ); - break; - - case TextureFormat::PTC12: - BX_WARN(false, "PTC12 decoder is not implemented."); - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff00ff) ); - break; - - case TextureFormat::PTC12A: - BX_WARN(false, "PTC12A decoder is not implemented."); - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00) ); - break; - - case TextureFormat::PTC14: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockPtc14(temp, src, xx, yy, width, height); - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::PTC14A: - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - decodeBlockPtc14A(temp, src, xx, yy, width, height); - - uint8_t* block = &dst[(yy*_pitch+xx*4)*4]; - bx::memCopy(&block[0*_pitch], &temp[ 0], 16); - bx::memCopy(&block[1*_pitch], &temp[16], 16); - bx::memCopy(&block[2*_pitch], &temp[32], 16); - bx::memCopy(&block[3*_pitch], &temp[48], 16); - } - } - break; - - case TextureFormat::PTC22: - BX_WARN(false, "PTC22 decoder is not implemented."); - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff00ff00), UINT32_C(0xff0000ff) ); - break; - - case TextureFormat::PTC24: - BX_WARN(false, "PTC24 decoder is not implemented."); - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff) ); - break; - - case TextureFormat::RGBA8: - imageSwizzleBgra8(_dst, _width, _height, _pitch, _src); - break; - - case TextureFormat::BGRA8: - bx::memCopy(_dst, _src, _pitch*_height); - break; - - default: - { - const uint32_t srcBpp = s_imageBlockInfo[_format].bitsPerPixel; - const uint32_t srcPitch = _width * srcBpp / 8; - if (!imageConvert(_dst, TextureFormat::BGRA8, _src, _format, _width, _height, srcPitch) ) - { - // Failed to convert, just make ugly red-yellow checkerboard texture. - imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00) ); - } - } - break; - } - } - - void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format) - { - switch (_format) - { - case TextureFormat::RGBA8: - bx::memCopy(_dst, _src, _pitch*_height); - break; - - case TextureFormat::BGRA8: - imageSwizzleBgra8(_dst, _width, _height, _pitch, _src); - break; - - default: - imageDecodeToBgra8(_dst, _src, _width, _height, _pitch, _format); - imageSwizzleBgra8(_dst, _width, _height, _width*4, _dst); - break; - } - } - - void imageRgba8ToRgba32fRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint32_t dstwidth = _width; - const uint32_t dstheight = _height; - - if (0 == dstwidth - || 0 == dstheight) - { - return; - } - - float* dst = (float*)_dst; - const uint8_t* src = (const uint8_t*)_src; - - for (uint32_t yy = 0, ystep = _pitch; yy < dstheight; ++yy, src += ystep) - { - const uint8_t* rgba = src; - for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4) - { - dst[0] = bx::fpow(rgba[0], 2.2f); - dst[1] = bx::fpow(rgba[1], 2.2f); - dst[2] = bx::fpow(rgba[2], 2.2f); - dst[3] = rgba[3]; - } - } - } - - void imageRgba8ToRgba32f(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src) - { - const uint32_t dstwidth = _width; - const uint32_t dstheight = _height; - - if (0 == dstwidth - || 0 == dstheight) - { - return; - } - - float* dst = (float*)_dst; - const uint8_t* src = (const uint8_t*)_src; - - using namespace bx; - const simd128_t unpack = simd_ld(1.0f, 1.0f/256.0f, 1.0f/65536.0f, 1.0f/16777216.0f); - const simd128_t umask = simd_ild(0xff, 0xff00, 0xff0000, 0xff000000); - const simd128_t wflip = simd_ild(0, 0, 0, 0x80000000); - const simd128_t wadd = simd_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f); - - for (uint32_t yy = 0, ystep = _pitch; yy < dstheight; ++yy, src += ystep) - { - const uint8_t* rgba = src; - for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 4, dst += 4) - { - const simd128_t abgr0 = simd_splat(rgba); - const simd128_t abgr0m = simd_and(abgr0, umask); - const simd128_t abgr0x = simd_xor(abgr0m, wflip); - const simd128_t abgr0f = simd_itof(abgr0x); - const simd128_t abgr0c = simd_add(abgr0f, wadd); - const simd128_t abgr0n = simd_mul(abgr0c, unpack); - - simd_st(dst, abgr0n); - } - } - } - - void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format) - { - const uint8_t* src = (const uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; - - switch (_format) - { - case TextureFormat::BC5: - { - uint32_t width = _width/4; - uint32_t height = _height/4; - - for (uint32_t yy = 0; yy < height; ++yy) - { - for (uint32_t xx = 0; xx < width; ++xx) - { - uint8_t temp[16*4]; - - decodeBlockDxt45A(temp+2, src); - src += 8; - decodeBlockDxt45A(temp+1, src); - src += 8; - - for (uint32_t ii = 0; ii < 16; ++ii) - { - float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; - float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; - float nz = bx::fsqrt(1.0f - nx*nx - ny*ny); - - const uint32_t offset = (yy*4 + ii/4)*_width*16 + (xx*4 + ii%4)*16; - float* block = (float*)&dst[offset]; - block[0] = nx; - block[1] = ny; - block[2] = nz; - block[3] = 0.0f; - } - } - } - } - break; - - case TextureFormat::RGBA32F: - bx::memCopy(_dst, _src, _pitch*_height); - break; - - case TextureFormat::RGBA8: - imageRgba8ToRgba32f(_dst, _width, _height, _pitch, _src); - break; - - default: - if (isCompressed(_format) ) - { - uint32_t size = imageGetSize(NULL, uint16_t(_pitch/4), uint16_t(_height), 0, false, false, 1, _format); - void* temp = BX_ALLOC(_allocator, size); - imageDecodeToRgba8(temp, _src, _width, _height, _pitch, _format); - imageRgba8ToRgba32f(_dst, _width, _height, _pitch, temp); - BX_FREE(_allocator, temp); - } - else - { - imageConvert(_dst, TextureFormat::RGBA32F, _src, _format, _width, _height, _pitch); - } - break; - } - } - - bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip) - { - uint32_t offset = _imageContainer.m_offset; - TextureFormat::Enum format = TextureFormat::Enum(_imageContainer.m_format); - bool hasAlpha = _imageContainer.m_hasAlpha; - - const ImageBlockInfo& blockInfo = s_imageBlockInfo[format]; - const uint8_t bpp = blockInfo.bitsPerPixel; - const uint32_t blockSize = blockInfo.blockSize; - const uint32_t blockWidth = blockInfo.blockWidth; - const uint32_t blockHeight = blockInfo.blockHeight; - const uint32_t minBlockX = blockInfo.minBlockX; - const uint32_t minBlockY = blockInfo.minBlockY; - - if (UINT32_MAX == _imageContainer.m_offset) - { - if (NULL == _imageContainer.m_data) - { - return false; - } - - offset = 0; - _data = _imageContainer.m_data; - _size = _imageContainer.m_size; - } - - const uint8_t* data = (const uint8_t*)_data; - const uint16_t numSides = _imageContainer.m_numLayers * (_imageContainer.m_cubeMap ? 6 : 1); - - if (_imageContainer.m_ktx) - { - uint32_t width = _imageContainer.m_width; - uint32_t height = _imageContainer.m_height; - uint32_t depth = _imageContainer.m_depth; - - for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod) - { - uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE) / _imageContainer.m_numLayers; - offset += sizeof(uint32_t); - - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); - - uint32_t size = width*height*depth*bpp/8; - BX_CHECK(size == imageSize, "KTX: Image size mismatch %d (expected %d).", size, imageSize); - - for (uint16_t side = 0; side < numSides; ++side) - { - if (side == _side - && lod == _lod) - { - _mip.m_width = width; - _mip.m_height = height; - _mip.m_blockSize = blockSize; - _mip.m_size = size; - _mip.m_data = &data[offset]; - _mip.m_bpp = bpp; - _mip.m_format = format; - _mip.m_hasAlpha = hasAlpha; - return true; - } - - offset += imageSize; - - BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size); - BX_UNUSED(_size); - } - - width >>= 1; - height >>= 1; - depth >>= 1; - } - } - else - { - for (uint16_t side = 0; side < numSides; ++side) - { - uint32_t width = _imageContainer.m_width; - uint32_t height = _imageContainer.m_height; - uint32_t depth = _imageContainer.m_depth; - - for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod) - { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); - - uint32_t size = width*height*depth*bpp/8; - - if (side == _side - && lod == _lod) - { - _mip.m_width = width; - _mip.m_height = height; - _mip.m_blockSize = blockSize; - _mip.m_size = size; - _mip.m_data = &data[offset]; - _mip.m_bpp = bpp; - _mip.m_format = format; - _mip.m_hasAlpha = hasAlpha; - return true; - } - - offset += size; - - BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size); - BX_UNUSED(_size); - - width >>= 1; - height >>= 1; - depth >>= 1; - } - } - } - - return false; - } - - void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip, bx::Error* _err) - { - BX_ERROR_SCOPE(_err); - - uint8_t type = _grayscale ? 3 : 2; - uint8_t bpp = _grayscale ? 8 : 32; - - uint8_t header[18] = {}; - header[ 2] = type; - header[12] = _width &0xff; - header[13] = (_width >>8)&0xff; - header[14] = _height &0xff; - header[15] = (_height>>8)&0xff; - header[16] = bpp; - header[17] = 32; - - bx::write(_writer, header, sizeof(header), _err); - - uint32_t dstPitch = _width*bpp/8; - if (_yflip) - { - uint8_t* data = (uint8_t*)_src + _pitch*_height - _pitch; - for (uint32_t yy = 0; yy < _height; ++yy) - { - bx::write(_writer, data, dstPitch, _err); - data -= _pitch; - } - } - else if (_pitch == dstPitch) - { - bx::write(_writer, _src, _height*_pitch, _err); - } - else - { - uint8_t* data = (uint8_t*)_src; - for (uint32_t yy = 0; yy < _height; ++yy) - { - bx::write(_writer, data, dstPitch, _err); - data += _pitch; - } - } - } - - static int32_t imageWriteKtxHeader(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, bx::Error* _err) - { - BX_ERROR_SCOPE(_err); - - const KtxFormatInfo& tfi = s_translateKtxFormat[_format]; - - int32_t size = 0; - size += bx::write(_writer, "\xabKTX 11\xbb\r\n\x1a\n", 12, _err); - size += bx::write(_writer, uint32_t(0x04030201), _err); - size += bx::write(_writer, uint32_t(0), _err); // glType - size += bx::write(_writer, uint32_t(1), _err); // glTypeSize - size += bx::write(_writer, uint32_t(0), _err); // glFormat - size += bx::write(_writer, tfi.m_internalFmt, _err); // glInternalFormat - size += bx::write(_writer, tfi.m_fmt, _err); // glBaseInternalFormat - size += bx::write(_writer, _width, _err); - size += bx::write(_writer, _height, _err); - size += bx::write(_writer, _depth, _err); - size += bx::write(_writer, uint32_t(0), _err); // numberOfArrayElements - size += bx::write(_writer, _cubeMap ? uint32_t(6) : uint32_t(0), _err); - size += bx::write(_writer, uint32_t(_numMips), _err); - size += bx::write(_writer, uint32_t(0), _err); // Meta-data size. - - BX_WARN(size == 64, "KTX: Failed to write header size %d (expected: %d).", size, 64); - return size; - } - - void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src, bx::Error* _err) - { - BX_ERROR_SCOPE(_err); - - imageWriteKtxHeader(_writer, _format, _cubeMap, _width, _height, _depth, _numMips, _err); - - const ImageBlockInfo& blockInfo = s_imageBlockInfo[_format]; - const uint8_t bpp = blockInfo.bitsPerPixel; - const uint32_t blockWidth = blockInfo.blockWidth; - const uint32_t blockHeight = blockInfo.blockHeight; - const uint32_t minBlockX = blockInfo.minBlockX; - const uint32_t minBlockY = blockInfo.minBlockY; - - const uint8_t* src = (const uint8_t*)_src; - uint32_t width = _width; - uint32_t height = _height; - uint32_t depth = _depth; - - for (uint8_t lod = 0, num = _numMips; lod < num; ++lod) - { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); - - uint32_t size = width*height*depth*bpp/8; - bx::write(_writer, size, _err); - - for (uint8_t side = 0, numSides = _cubeMap ? 6 : 1; side < numSides; ++side) - { - bx::write(_writer, src, size, _err); - src += size; - } - - width >>= 1; - height >>= 1; - depth >>= 1; - } - } - - void imageWriteKtx(bx::WriterI* _writer, ImageContainer& _imageContainer, const void* _data, uint32_t _size, bx::Error* _err) - { - BX_ERROR_SCOPE(_err); - - imageWriteKtxHeader(_writer - , TextureFormat::Enum(_imageContainer.m_format) - , _imageContainer.m_cubeMap - , _imageContainer.m_width - , _imageContainer.m_height - , _imageContainer.m_depth - , _imageContainer.m_numMips - , _err - ); - - for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod) - { - ImageMip mip; - imageGetRawData(_imageContainer, 0, lod, _data, _size, mip); - bx::write(_writer, mip.m_size, _err); - - for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) - { - if (imageGetRawData(_imageContainer, side, lod, _data, _size, mip) ) - { - bx::write(_writer, mip.m_data, mip.m_size, _err); - } - } - } - } - -} // namespace bgfx diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h deleted file mode 100644 index ef05a1f2ba7..00000000000 --- a/3rdparty/bgfx/src/image.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#ifndef BGFX_IMAGE_H_HEADER_GUARD -#define BGFX_IMAGE_H_HEADER_GUARD - -#include <bx/pixelformat.h> - -namespace bgfx -{ - struct ImageContainer - { - bx::AllocatorI* m_allocator; - void* m_data; - - TextureFormat::Enum m_format; - - uint32_t m_size; - uint32_t m_offset; - uint32_t m_width; - uint32_t m_height; - uint32_t m_depth; - uint16_t m_numLayers; - uint8_t m_numMips; - bool m_hasAlpha; - bool m_cubeMap; - bool m_ktx; - bool m_ktxLE; - bool m_srgb; - }; - - struct ImageMip - { - TextureFormat::Enum m_format; - uint32_t m_width; - uint32_t m_height; - uint32_t m_blockSize; - uint32_t m_size; - uint8_t m_bpp; - bool m_hasAlpha; - const uint8_t* m_data; - }; - - struct ImageBlockInfo - { - uint8_t bitsPerPixel; - uint8_t blockWidth; - uint8_t blockHeight; - uint8_t blockSize; - uint8_t minBlockX; - uint8_t minBlockY; - uint8_t depthBits; - uint8_t stencilBits; - uint8_t rBits; - uint8_t gBits; - uint8_t bBits; - uint8_t aBits; - uint8_t encoding; - }; - - /// Returns true if texture format is compressed. - bool isCompressed(TextureFormat::Enum _format); - - /// Returns true if texture format is uncompressed. - bool isColor(TextureFormat::Enum _format); - - /// Returns true if texture format is depth. - bool isDepth(TextureFormat::Enum _format); - - /// Returns true if texture format is valid. - bool isValid(TextureFormat::Enum _format); - - /// Returns bits per pixel. - uint8_t getBitsPerPixel(TextureFormat::Enum _format); - - /// Returns texture block info. - const ImageBlockInfo& getBlockInfo(TextureFormat::Enum _format); - - /// Converts format to string. - const char* getName(TextureFormat::Enum _format); - - /// Converts string to format. - TextureFormat::Enum getFormat(const char* _name); - - /// Returns number of mip-maps required for complete mip-map chain. - uint8_t imageGetNumMips( - TextureFormat::Enum _format - , uint16_t _width - , uint16_t _height - , uint16_t _depth = 0 - ); - - /// Returns image size. - uint32_t imageGetSize( - TextureInfo* _info - , uint16_t _width - , uint16_t _height - , uint16_t _depth - , bool _cubeMap - , bool _hasMips - , uint16_t _numLayers - , TextureFormat::Enum _format - ); - - /// - void imageSolid(void* _dst, uint32_t _width, uint32_t _height, uint32_t _solid); - - /// - void imageCheckerboard(void* _dst, uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1); - - /// - void imageRgba8Downsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src); - - /// - void imageRgba32fToLinear(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src); - - /// - void imageRgba32fToGamma(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src); - - /// - void imageRgba32fLinearDownsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src); - - /// - void imageRgba32fDownsample2x2NormalMap(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src); - - /// - void imageSwizzleBgra8(void* _dst, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src); - - /// - void imageCopy(void* _dst, uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch); - - /// - void imageCopy(void* _dst, uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src); - - /// - bool imageConvert(TextureFormat::Enum _dstFormat, TextureFormat::Enum _srcFormat); - - /// - void imageConvert( - void* _dst - , uint32_t _bpp - , bx::PackFn _pack - , const void* _src - , bx::UnpackFn _unpack - , uint32_t _size - ); - - /// - void imageConvert( - void* _dst - , uint32_t _dstBpp - , bx::PackFn _pack - , const void* _src - , uint32_t _srcBpp - , bx::UnpackFn _unpack - , uint32_t _width - , uint32_t _height - , uint32_t _srcPitch - ); - - /// - bool imageConvert( - void* _dst - , TextureFormat::Enum _dstFormat - , const void* _src - , TextureFormat::Enum _srcFormat - , uint32_t _width - , uint32_t _height - ); - - /// - ImageContainer* imageConvert( - bx::AllocatorI* _allocator - , TextureFormat::Enum _dstFormat - , const void* _src - , uint32_t _size - ); - - /// - ImageContainer* imageAlloc( - bx::AllocatorI* _allocator - , TextureFormat::Enum _format - , uint16_t _width - , uint16_t _height - , uint16_t _depth - , uint16_t _numLayers - , bool _cubeMap - , bool _hasMips - , const void* _data = NULL - ); - - /// - void imageFree(ImageContainer* _imageContainer); - - /// - void imageWriteTga( - bx::WriterI* _writer - , uint32_t _width - , uint32_t _height - , uint32_t _pitch - , const void* _src - , bool _grayscale - , bool _yflip - , bx::Error* _err = NULL - ); - - /// - void imageWriteKtx( - bx::WriterI* _writer - , TextureFormat::Enum _format - , bool _cubeMap - , uint32_t _width - , uint32_t _height - , uint32_t _depth - , uint8_t _numMips - , const void* _src - , bx::Error* _err = NULL - ); - - /// - void imageWriteKtx( - bx::WriterI* _writer - , ImageContainer& _imageContainer - , const void* _data - , uint32_t _size - , bx::Error* _err = NULL - ); - - /// - bool imageParse(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader); - - /// - bool imageParse(ImageContainer& _imageContainer, const void* _data, uint32_t _size); - - /// - void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); - - /// - void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); - - /// - void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); - - /// - bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip); - -} // namespace bgfx - -#endif // BGFX_IMAGE_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/nvapi.cpp b/3rdparty/bgfx/src/nvapi.cpp new file mode 100644 index 00000000000..e4205c112df --- /dev/null +++ b/3rdparty/bgfx/src/nvapi.cpp @@ -0,0 +1,183 @@ +/* + * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_p.h" +#include "nvapi.h" + +namespace bgfx +{ + /* + * NVAPI + * + * Reference: + * http://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/index.html + * https://github.com/jNizM/AHK_NVIDIA_NvAPI/blob/master/info/NvAPI_IDs.txt + */ + struct NvPhysicalGpuHandle; + +#define NVAPI_MAX_PHYSICAL_GPUS 64 + +#if BX_PLATFORM_WINDOWS +# define NVAPICALL __cdecl +#else +# define NVAPICALL +#endif // BX_PLATFORM_WINDOWS + + enum NvApiStatus + { + NVAPI_OK = 0, + NVAPI_ERROR = -1, + }; + + struct NvMemoryInfoV2 + { + NvMemoryInfoV2() + : version(sizeof(NvMemoryInfoV2) | (2 << 16) ) + { + } + + uint32_t version; + uint32_t dedicatedVideoMemory; + uint32_t availableDedicatedVideoMemory; + uint32_t systemVideoMemory; + uint32_t sharedSystemMemory; + uint32_t curAvailableDedicatedVideoMemory; + }; + + typedef void* (NVAPICALL* PFN_NVAPI_QUERYINTERFACE)(uint32_t _functionOffset); + typedef NvApiStatus (NVAPICALL* PFN_NVAPI_INITIALIZE)(); + typedef NvApiStatus (NVAPICALL* PFN_NVAPI_UNLOAD)(); + typedef NvApiStatus (NVAPICALL* PFN_NVAPI_ENUMPHYSICALGPUS)(NvPhysicalGpuHandle* _handle[NVAPI_MAX_PHYSICAL_GPUS], uint32_t* _gpuCount); + typedef NvApiStatus (NVAPICALL* PFN_NVAPI_GPUGETMEMORYINFO)(NvPhysicalGpuHandle* _handle, NvMemoryInfoV2* _memoryInfo); + typedef NvApiStatus (NVAPICALL* PFN_NVAPI_GPUGETFULLNAME)(NvPhysicalGpuHandle* _physicalGpu, char _name[64]); + +#define NVAPI_INITIALIZE UINT32_C(0x0150e828) +#define NVAPI_UNLOAD UINT32_C(0xd22bdd7e) +#define NVAPI_ENUMPHYSICALGPUS UINT32_C(0xe5ac921f) +#define NVAPI_GPUGETMEMORYINFO UINT32_C(0x07f9b368) +#define NVAPI_GPUGETFULLNAME UINT32_C(0xceee8e9f) + + static PFN_NVAPI_QUERYINTERFACE nvApiQueryInterface; + static PFN_NVAPI_INITIALIZE nvApiInitialize; + static PFN_NVAPI_UNLOAD nvApiUnload; + static PFN_NVAPI_ENUMPHYSICALGPUS nvApiEnumPhysicalGPUs; + static PFN_NVAPI_GPUGETMEMORYINFO nvApiGpuGetMemoryInfo; + static PFN_NVAPI_GPUGETFULLNAME nvApiGpuGetFullName; + + NvApi::NvApi() + : m_nvApiDll(NULL) + , m_nvGpu(NULL) + { + } + + void NvApi::init() + { + m_nvGpu = NULL; + m_nvApiDll = bx::dlopen( +#if BX_ARCH_32BIT + "nvapi.dll" +#else + "nvapi64.dll" +#endif // BX_ARCH_32BIT + ); + + if (NULL != m_nvApiDll) + { + nvApiQueryInterface = (PFN_NVAPI_QUERYINTERFACE)bx::dlsym(m_nvApiDll, "nvapi_QueryInterface"); + + bool initialized = NULL != nvApiQueryInterface; + + if (initialized) + { + nvApiInitialize = (PFN_NVAPI_INITIALIZE )nvApiQueryInterface(NVAPI_INITIALIZE); + nvApiUnload = (PFN_NVAPI_UNLOAD )nvApiQueryInterface(NVAPI_UNLOAD); + nvApiEnumPhysicalGPUs = (PFN_NVAPI_ENUMPHYSICALGPUS )nvApiQueryInterface(NVAPI_ENUMPHYSICALGPUS); + nvApiGpuGetMemoryInfo = (PFN_NVAPI_GPUGETMEMORYINFO )nvApiQueryInterface(NVAPI_GPUGETMEMORYINFO); + nvApiGpuGetFullName = (PFN_NVAPI_GPUGETFULLNAME )nvApiQueryInterface(NVAPI_GPUGETFULLNAME); + + initialized = true + && NULL != nvApiInitialize + && NULL != nvApiUnload + && NULL != nvApiEnumPhysicalGPUs + && NULL != nvApiGpuGetMemoryInfo + && NULL != nvApiGpuGetFullName + && NVAPI_OK == nvApiInitialize() + ; + + if (initialized) + { + NvPhysicalGpuHandle* physicalGpus[NVAPI_MAX_PHYSICAL_GPUS]; + uint32_t numGpus = 0; + nvApiEnumPhysicalGPUs(physicalGpus, &numGpus); + + initialized = 0 < numGpus; + if (initialized) + { + m_nvGpu = physicalGpus[0]; + } + + char name[64]; + nvApiGpuGetFullName(m_nvGpu, name); + BX_TRACE("%s", name); + } + + initialized = NULL != m_nvGpu; + + if (!initialized) + { + nvApiUnload(); + } + } + + if (!initialized) + { + bx::dlclose(m_nvApiDll); + m_nvApiDll = NULL; + } + + BX_WARN(!initialized, "NVAPI supported."); + } + } + + void NvApi::shutdown() + { + if (NULL != m_nvGpu) + { + nvApiUnload(); + m_nvGpu = NULL; + } + + if (NULL != m_nvApiDll) + { + bx::dlclose(m_nvApiDll); + m_nvApiDll = NULL; + } + } + + void NvApi::getMemoryInfo(int64_t& _gpuMemoryUsed, int64_t& _gpuMemoryMax) + { + if (NULL != m_nvGpu) + { + NvMemoryInfoV2 memInfo; + NvApiStatus status = nvApiGpuGetMemoryInfo(m_nvGpu, &memInfo); + if (NVAPI_OK == status) + { + _gpuMemoryMax = 1024 * memInfo.availableDedicatedVideoMemory; + _gpuMemoryUsed = 1024 * (memInfo.availableDedicatedVideoMemory - memInfo.curAvailableDedicatedVideoMemory); +// BX_TRACE(" dedicatedVideoMemory: %d KiB", memInfo.dedicatedVideoMemory); +// BX_TRACE(" availableDedicatedVideoMemory: %d KiB", memInfo.availableDedicatedVideoMemory); +// BX_TRACE(" systemVideoMemory: %d KiB", memInfo.systemVideoMemory); +// BX_TRACE(" sharedSystemMemory: %d KiB", memInfo.sharedSystemMemory); +// BX_TRACE("curAvailableDedicatedVideoMemory: %d KiB", memInfo.curAvailableDedicatedVideoMemory); + } + } + else + { + _gpuMemoryMax = -INT64_MAX; + _gpuMemoryUsed = -INT64_MAX; + } + } + +} // namespace bgfx diff --git a/3rdparty/bgfx/src/nvapi.h b/3rdparty/bgfx/src/nvapi.h new file mode 100644 index 00000000000..ce08052b3aa --- /dev/null +++ b/3rdparty/bgfx/src/nvapi.h @@ -0,0 +1,34 @@ +/* + * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#ifndef BGFX_NVAPI_H_HEADER_GUARD +#define BGFX_NVAPI_H_HEADER_GUARD + +namespace bgfx +{ + struct NvPhysicalGpuHandle; + + /// + struct NvApi + { + /// + NvApi(); + + /// + void init(); + + /// + void shutdown(); + + /// + void getMemoryInfo(int64_t& _gpuMemoryUsed, int64_t& _gpuMemoryMax); + + void* m_nvApiDll; + NvPhysicalGpuHandle* m_nvGpu; + }; + +} // namespace bgfx + +#endif // BGFX_NVAPI_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/renderer.h b/3rdparty/bgfx/src/renderer.h index 1bf8fbba072..e5c1cbd4c2f 100644 --- a/3rdparty/bgfx/src/renderer.h +++ b/3rdparty/bgfx/src/renderer.h @@ -10,6 +10,37 @@ namespace bgfx { + struct BlitState + { + BlitState(const Frame* _frame) + : m_frame(_frame) + , m_item(0) + { + m_key.decode(_frame->m_blitKeys[0]); + } + + bool hasItem(uint16_t _view) const + { + return m_item < m_frame->m_numBlitItems + && m_key.m_view <= _view + ; + } + + const BlitItem& advance() + { + const BlitItem& bi = m_frame->m_blitItem[m_key.m_item]; + + ++m_item; + m_key.decode(m_frame->m_blitKeys[m_item]); + + return bi; + } + + const Frame* m_frame; + BlitKey m_key; + uint16_t m_item; + }; + struct ViewState { ViewState() @@ -28,7 +59,7 @@ namespace bgfx m_invProjCached = UINT16_MAX; m_invViewProjCached = UINT16_MAX; - m_view[0] = _frame->m_view; + m_view[0] = m_viewTmp[0]; m_view[1] = m_viewTmp[1]; if (_hmdEnabled) @@ -48,20 +79,27 @@ namespace bgfx for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { - if (BGFX_VIEW_STEREO == (_frame->m_viewFlags[ii] & BGFX_VIEW_STEREO) ) + if (BGFX_VIEW_STEREO == (_frame->m_view[ii].m_flags & BGFX_VIEW_STEREO) ) { bx::float4x4_mul(&m_view[eye][ii].un.f4x4 - , &_frame->m_view[ii].un.f4x4 + , &_frame->m_view[ii].m_view.un.f4x4 , &viewAdjust.un.f4x4 ); } else { - bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].un.f4x4, sizeof(Matrix4) ); + bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].m_view.un.f4x4, sizeof(Matrix4) ); } } } } + else + { + for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) + { + bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].m_view.un.f4x4, sizeof(Matrix4) ); + } + } for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { @@ -69,18 +107,20 @@ namespace bgfx { bx::float4x4_mul(&m_viewProj[eye][ii].un.f4x4 , &m_view[eye][ii].un.f4x4 - , &_frame->m_proj[eye][ii].un.f4x4 + , &_frame->m_view[ii].m_proj[eye].un.f4x4 ); } } } template<uint16_t mtxRegs, typename RendererContext, typename Program, typename Draw> - void setPredefined(RendererContext* _renderer, uint16_t _view, uint8_t _eye, Program& _program, Frame* _frame, const Draw& _draw) + void setPredefined(RendererContext* _renderer, uint16_t _view, uint8_t _eye, const Program& _program, const Frame* _frame, const Draw& _draw) { + const FrameCache& frameCache = _frame->m_frameCache; + for (uint32_t ii = 0, num = _program.m_numPredefined; ii < num; ++ii) { - PredefinedUniform& predefined = _program.m_predefined[ii]; + const PredefinedUniform& predefined = _program.m_predefined[ii]; uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT; switch (predefined.m_type&(~BGFX_UNIFORM_FRAGMENTBIT) ) { @@ -147,7 +187,7 @@ namespace bgfx { _renderer->setShaderUniform4x4f(flags , predefined.m_loc - , _frame->m_proj[_eye][_view].un.val + , _frame->m_view[_view].m_proj[_eye].un.val , bx::uint32_min(mtxRegs, predefined.m_count) ); } @@ -160,7 +200,7 @@ namespace bgfx { m_invProjCached = viewEye; bx::float4x4_inverse(&m_invProj.un.f4x4 - , &_frame->m_proj[_eye][_view].un.f4x4 + , &_frame->m_view[_view].m_proj[_eye].un.f4x4 ); } @@ -203,11 +243,11 @@ namespace bgfx case PredefinedUniform::Model: { - const Matrix4& model = _frame->m_matrixCache.m_cache[_draw.m_matrix]; + const Matrix4& model = frameCache.m_matrixCache.m_cache[_draw.m_startMatrix]; _renderer->setShaderUniform4x4f(flags , predefined.m_loc , model.un.val - , bx::uint32_min(_draw.m_num*mtxRegs, predefined.m_count) + , bx::uint32_min(_draw.m_numMatrices*mtxRegs, predefined.m_count) ); } break; @@ -215,7 +255,7 @@ namespace bgfx case PredefinedUniform::ModelView: { Matrix4 modelView; - const Matrix4& model = _frame->m_matrixCache.m_cache[_draw.m_matrix]; + const Matrix4& model = frameCache.m_matrixCache.m_cache[_draw.m_startMatrix]; bx::float4x4_mul(&modelView.un.f4x4 , &model.un.f4x4 , &m_view[_eye][_view].un.f4x4 @@ -231,7 +271,7 @@ namespace bgfx case PredefinedUniform::ModelViewProj: { Matrix4 modelViewProj; - const Matrix4& model = _frame->m_matrixCache.m_cache[_draw.m_matrix]; + const Matrix4& model = frameCache.m_matrixCache.m_cache[_draw.m_startMatrix]; bx::float4x4_mul(&modelViewProj.un.f4x4 , &model.un.f4x4 , &m_viewProj[_eye][_view].un.f4x4 @@ -436,6 +476,95 @@ namespace bgfx HashMap m_hashMap; }; + inline bool hasVertexStreamChanged(const RenderDraw& _current, const RenderDraw& _new) + { + if (_current.m_streamMask != _new.m_streamMask + || _current.m_instanceDataBuffer.idx != _new.m_instanceDataBuffer.idx + || _current.m_instanceDataOffset != _new.m_instanceDataOffset + || _current.m_instanceDataStride != _new.m_instanceDataStride) + { + return true; + } + + for (uint32_t idx = 0, streamMask = _new.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) + ) + { + streamMask >>= ntz; + idx += ntz; + + if (_current.m_stream[idx].m_handle.idx != _new.m_stream[idx].m_handle.idx + || _current.m_stream[idx].m_startVertex != _new.m_stream[idx].m_startVertex) + { + return true; + } + } + + return false; + } + + template<typename Ty> + struct Profiler + { + Profiler(Frame* _frame, Ty& _gpuTimer, const char (*_viewName)[BGFX_CONFIG_MAX_VIEW_NAME], bool _enabled = true) + : m_viewName(_viewName) + , m_frame(_frame) + , m_gpuTimer(_gpuTimer) + , m_queryIdx(UINT32_MAX) + , m_numViews(0) + , m_enabled(_enabled && 0 != (_frame->m_debug & BGFX_DEBUG_PROFILER) ) + { + } + + ~Profiler() + { + m_frame->m_perfStats.numViews = m_numViews; + } + + void begin(uint16_t _view) + { + if (m_enabled) + { + ViewStats& viewStats = m_frame->m_perfStats.viewStats[m_numViews]; + viewStats.cpuTimeElapsed = -bx::getHPCounter(); + + m_queryIdx = m_gpuTimer.begin(_view); + + viewStats.view = ViewId(_view); + bx::strCopy(viewStats.name + , BGFX_CONFIG_MAX_VIEW_NAME + , &m_viewName[_view][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] + ); + } + } + + void end() + { + if (m_enabled + && UINT32_MAX != m_queryIdx) + { + m_gpuTimer.end(m_queryIdx); + + ViewStats& viewStats = m_frame->m_perfStats.viewStats[m_numViews]; + const typename Ty::Result& result = m_gpuTimer.m_result[viewStats.view]; + + viewStats.cpuTimeElapsed += bx::getHPCounter(); + viewStats.gpuTimeElapsed = result.m_end - result.m_begin; + + ++m_numViews; + m_queryIdx = UINT32_MAX; + } + } + + const char (*m_viewName)[BGFX_CONFIG_MAX_VIEW_NAME]; + Frame* m_frame; + Ty& m_gpuTimer; + uint32_t m_queryIdx; + uint16_t m_numViews; + bool m_enabled; + }; + } // namespace bgfx #endif // BGFX_RENDERER_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/renderer_d3d.h b/3rdparty/bgfx/src/renderer_d3d.h index 3b0f48a0c65..a654ab073b9 100644 --- a/3rdparty/bgfx/src/renderer_d3d.h +++ b/3rdparty/bgfx/src/renderer_d3d.h @@ -71,10 +71,10 @@ namespace bgfx #define DX_RELEASE(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_CHECK) #define DX_RELEASE_WARNONLY(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_WARN) - typedef int (WINAPI* PFN_D3DPERF_BEGIN_EVENT)(DWORD _color, LPCWSTR _wszName); + typedef int (WINAPI* PFN_D3DPERF_BEGIN_EVENT)(DWORD _color, LPCWSTR _name); typedef int (WINAPI* PFN_D3DPERF_END_EVENT)(); - typedef void (WINAPI* PFN_D3DPERF_SET_MARKER)(DWORD _color, LPCWSTR _wszName); - typedef void (WINAPI* PFN_D3DPERF_SET_REGION)(DWORD _color, LPCWSTR _wszName); + typedef void (WINAPI* PFN_D3DPERF_SET_MARKER)(DWORD _color, LPCWSTR _name); + typedef void (WINAPI* PFN_D3DPERF_SET_REGION)(DWORD _color, LPCWSTR _name); typedef BOOL (WINAPI* PFN_D3DPERF_QUERY_REPEAT_FRAME)(); typedef void (WINAPI* PFN_D3DPERF_SET_OPTIONS)(DWORD _options); typedef DWORD (WINAPI* PFN_D3DPERF_GET_STATUS)(); diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 2a65c2a2c1d..0a22fa4b443 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -15,20 +15,6 @@ # endif // BX_PLATFORM_WINRT #endif // !BX_PLATFORM_WINDOWS -#if BGFX_CONFIG_PROFILER_REMOTERY -# define BGFX_GPU_PROFILER_BIND(_device, _context) rmt_BindD3D11(_device, _context) -# define BGFX_GPU_PROFILER_UNBIND() rmt_UnbindD3D11() -# define BGFX_GPU_PROFILER_BEGIN(_group, _name, _color) rmt_BeginD3D11Sample(_group##_##_name) -# define BGFX_GPU_PROFILER_BEGIN_DYNAMIC(_namestr) rmt_BeginD3D11SampleDynamic(_namestr) -# define BGFX_GPU_PROFILER_END() rmt_EndD3D11Sample() -#else -# define BGFX_GPU_PROFILER_BIND(_device, _context) BX_NOOP() -# define BGFX_GPU_PROFILER_UNBIND() BX_NOOP() -# define BGFX_GPU_PROFILER_BEGIN(_group, _name, _color) BX_NOOP() -# define BGFX_GPU_PROFILER_BEGIN_DYNAMIC(_namestr) BX_NOOP() -# define BGFX_GPU_PROFILER_END() BX_NOOP() -#endif - #if BGFX_CONFIG_USE_OVR # include "hmd_ovr.h" #endif // BGFX_CONFIG_USE_OVR @@ -287,7 +273,7 @@ namespace bgfx { namespace d3d11 { DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA4 { DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB5A1 { DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB10A2 - { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R11G11B10F + { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG11B10F { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // UnknownDepth { DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_UNKNOWN }, // D16 { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24 @@ -308,6 +294,8 @@ namespace bgfx { namespace d3d11 { "BITANGENT", 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 }, + { "COLOR", 2, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 3, 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 }, @@ -356,7 +344,7 @@ namespace bgfx { namespace d3d11 }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(D3D11_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) + static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(uint8_t _stream, D3D11_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) { D3D11_INPUT_ELEMENT_DESC* elem = _out; @@ -366,6 +354,8 @@ namespace bgfx { namespace d3d11 { bx::memCopy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) ); + elem->InputSlot = _stream; + if (0 == _decl.m_attributes[attr]) { elem->AlignedByteOffset = 0; @@ -409,19 +399,20 @@ namespace bgfx { namespace d3d11 BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunused-const-variable"); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration"); - static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } }; - static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } }; - static const GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } }; - static const GUID IID_IDXGIDevice0 = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } }; - static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; - static const GUID IID_IDXGIDevice2 = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } }; - static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; - static const GUID IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } }; - static const GUID IID_ID3D11Device2 = { 0x9d06dffa, 0xd1e5, 0x4d07, { 0x83, 0xa8, 0x1b, 0xb1, 0x23, 0xf2, 0xf8, 0x41 } }; - static const GUID IID_ID3D11Device3 = { 0xa05c8c37, 0xd2c6, 0x4732, { 0xb3, 0xa0, 0x9c, 0xe0, 0xb0, 0xdc, 0x9a, 0xe6 } }; - static const GUID IID_IDXGIAdapter = { 0x2411e7e1, 0x12ac, 0x4ccf, { 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0 } }; - static const GUID IID_ID3D11InfoQueue = { 0x6543dbb6, 0x1b48, 0x42f5, { 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6 } }; - static const GUID IID_IDXGIDeviceRenderDoc = { 0xa7aa6116, 0x9c8d, 0x4bba, { 0x90, 0x83, 0xb4, 0xd8, 0x16, 0xb7, 0x1b, 0x78 } }; + static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } }; + static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } }; + static const GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } }; + static const GUID IID_IDXGIDevice0 = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } }; + static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; + static const GUID IID_IDXGIDevice2 = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } }; + static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; + static const GUID IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } }; + static const GUID IID_ID3D11Device2 = { 0x9d06dffa, 0xd1e5, 0x4d07, { 0x83, 0xa8, 0x1b, 0xb1, 0x23, 0xf2, 0xf8, 0x41 } }; + static const GUID IID_ID3D11Device3 = { 0xa05c8c37, 0xd2c6, 0x4732, { 0xb3, 0xa0, 0x9c, 0xe0, 0xb0, 0xdc, 0x9a, 0xe6 } }; + static const GUID IID_IDXGIAdapter = { 0x2411e7e1, 0x12ac, 0x4ccf, { 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0 } }; + static const GUID IID_ID3D11InfoQueue = { 0x6543dbb6, 0x1b48, 0x42f5, { 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6 } }; + static const GUID IID_IDXGIDeviceRenderDoc = { 0xa7aa6116, 0x9c8d, 0x4bba, { 0x90, 0x83, 0xb4, 0xd8, 0x16, 0xb7, 0x1b, 0x78 } }; + static const GUID IID_ID3DUserDefinedAnnotation = { 0xb2daad8b, 0x03d4, 0x4dbf, { 0x95, 0xeb, 0x32, 0xab, 0x4b, 0x63, 0xd0, 0xab } }; enum D3D11_FORMAT_SUPPORT2 { @@ -455,6 +446,35 @@ namespace bgfx { namespace d3d11 ; } + static const char* getLostReason(HRESULT _hr) + { + switch (_hr) + { + // The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. + case DXGI_ERROR_DEVICE_REMOVED: return "DXGI_ERROR_DEVICE_REMOVED"; + + // The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application. + case DXGI_ERROR_DEVICE_HUNG: return "DXGI_ERROR_DEVICE_HUNG"; + + // The GPU will not respond to more commands, most likely because some other application submitted invalid commands. + // The calling application should re-create the device and continue. + case DXGI_ERROR_DEVICE_RESET: return "DXGI_ERROR_DEVICE_RESET"; + + // An internal issue prevented the driver from carrying out the specified operation. The driver's state is probably + // suspect, and the application should not continue. + case DXGI_ERROR_DRIVER_INTERNAL_ERROR: return "DXGI_ERROR_DRIVER_INTERNAL_ERROR"; + + // A resource is not available at the time of the call, but may become available later. + case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE: return "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE"; + + case S_OK: return "S_OK"; + + default: break; + } + + return "Unknown HRESULT?"; + } + template <typename Ty> static BX_NO_INLINE void setDebugObjectName(Ty* _interface, const char* _format, ...) { @@ -543,8 +563,12 @@ namespace bgfx { namespace d3d11 #endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT } - // Reference: - // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK + /* + * AMD GPU Services (AGS) library + * + * Reference: + * https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK + */ enum AGS_RETURN_CODE { AGS_SUCCESS, @@ -616,17 +640,21 @@ namespace bgfx { namespace d3d11 static PFN_GET_DEBUG_INTERFACE1 DXGIGetDebugInterface1; #endif // USE_D3D11_DYNAMIC_LIB + int WINAPI d3d11Annotation_BeginEvent(DWORD _color, LPCWSTR _name); + int WINAPI d3d11Annotation_EndEvent(); + void WINAPI d3d11Annotation_SetMarker(DWORD _color, LPCWSTR _name); + #if BGFX_CONFIG_USE_OVR class VRImplOVRD3D11 : public VRImplOVR { public: VRImplOVRD3D11(); - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) BX_OVERRIDE; - virtual void destroySwapChain() BX_OVERRIDE; - virtual void destroyMirror() BX_OVERRIDE; - virtual void makeRenderTargetActive(const VRDesc& _desc) BX_OVERRIDE; - virtual bool submitSwapChain(const VRDesc& _desc) BX_OVERRIDE; + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override; + virtual void destroySwapChain() override; + virtual void destroyMirror() override; + virtual void makeRenderTargetActive(const VRDesc& _desc) override; + virtual bool submitSwapChain(const VRDesc& _desc) override; private: ID3D11DepthStencilView* m_depthBuffer; @@ -654,10 +682,11 @@ namespace bgfx { namespace d3d11 , m_adapter(NULL) , m_factory(NULL) , m_swapChain(NULL) - , m_lost(0) + , m_lost(false) , m_numWindows(0) , m_device(NULL) , m_deviceCtx(NULL) + , m_annotation(NULL) , m_infoQueue(NULL) , m_backBufferColor(NULL) , m_backBufferDepthStencil(NULL) @@ -674,7 +703,7 @@ namespace bgfx { namespace d3d11 , m_rtMsaa(false) , m_timerQuerySupport(false) { - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); bx::memSet(&m_scd, 0, sizeof(m_scd) ); bx::memSet(&m_windows, 0xff, sizeof(m_windows) ); @@ -711,18 +740,18 @@ namespace bgfx { namespace d3d11 m_renderdocdll = loadRenderDoc(); } - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); m_ags = NULL; m_agsdll = bx::dlopen( #if BX_ARCH_32BIT - "amd_ags_x86.dll" + "amd_ags_x86.dll" #else - "amd_ags_x64.dll" + "amd_ags_x64.dll" #endif // BX_ARCH_32BIT - ); + ); if (NULL != m_agsdll) { agsInit = (PFN_AGS_INIT )bx::dlsym(m_agsdll, "agsInit"); @@ -795,12 +824,14 @@ namespace bgfx { namespace d3d11 } } + m_nvapi.init(); + #if USE_D3D11_DYNAMIC_LIB m_d3d11dll = bx::dlopen("d3d11.dll"); if (NULL == m_d3d11dll) { - BX_TRACE("Failed to load d3d11.dll."); + BX_TRACE("Init error: Failed to load d3d11.dll."); goto error; } @@ -829,14 +860,14 @@ namespace bgfx { namespace d3d11 D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)bx::dlsym(m_d3d11dll, "D3D11CreateDevice"); if (NULL == D3D11CreateDevice) { - BX_TRACE("Function D3D11CreateDevice not found."); + BX_TRACE("Init error: Function D3D11CreateDevice not found."); goto error; } m_dxgidll = bx::dlopen("dxgi.dll"); if (NULL == m_dxgidll) { - BX_TRACE("Failed to load dxgi.dll."); + BX_TRACE("Init error: Failed to load dxgi.dll."); goto error; } @@ -849,7 +880,7 @@ namespace bgfx { namespace d3d11 } if (NULL == CreateDXGIFactory) { - BX_TRACE("Function CreateDXGIFactory not found."); + BX_TRACE("Init error: Function CreateDXGIFactory not found."); goto error; } @@ -884,7 +915,7 @@ namespace bgfx { namespace d3d11 #endif // BX_PLATFORM_* if (FAILED(hr) ) { - BX_TRACE("Unable to create DXGI factory."); + BX_TRACE("Init error: Unable to create DXGI factory."); goto error; } @@ -945,7 +976,7 @@ namespace bgfx { namespace d3d11 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != strstr(description, "PerfHUD") ) + && 0 != bx::strFind(description, "PerfHUD") ) { m_adapter = adapter; m_driverType = D3D_DRIVER_TYPE_REFERENCE; @@ -1026,7 +1057,7 @@ namespace bgfx { namespace d3d11 if (FAILED(hr) ) { - BX_TRACE("Unable to create Direct3D11 device."); + BX_TRACE("Init error: Unable to create Direct3D11 device."); goto error; } @@ -1041,7 +1072,7 @@ namespace bgfx { namespace d3d11 if (NULL == m_deviceCtx) { - BX_TRACE("Unable to retrieve Direct3D11 ImmediateContext."); + BX_TRACE("Init error: Unable to retrieve Direct3D11 ImmediateContext."); goto error; } @@ -1102,7 +1133,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (FAILED(hr) ) { - BX_TRACE("Unable to create Direct3D11 device."); + BX_TRACE("Init error: Unable to create Direct3D11 device."); goto error; } @@ -1141,7 +1172,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(adapter, 2); if (FAILED(hr) ) { - BX_TRACE("Unable to create Direct3D11 device."); + BX_TRACE("Init error: Unable to create Direct3D11 device."); goto error; } @@ -1201,7 +1232,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(adapter, 2); if (FAILED(hr) ) { - BX_TRACE("Unable to create Direct3D11 device."); + BX_TRACE("Init error: Unable to create Direct3D11 device."); goto error; } @@ -1230,7 +1261,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #endif // BX_PLATFORM_* if (FAILED(hr) ) { - BX_TRACE("Failed to create swap chain."); + BX_TRACE("Init error: Failed to create swap chain."); goto error; } } @@ -1247,6 +1278,20 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_numWindows = 1; +#if USE_D3D11_DYNAMIC_LIB + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + hr = m_deviceCtx->QueryInterface(IID_ID3DUserDefinedAnnotation, (void**)&m_annotation); + + if (SUCCEEDED(hr) ) + { + D3DPERF_BeginEvent = d3d11Annotation_BeginEvent; + D3DPERF_EndEvent = d3d11Annotation_EndEvent; + D3DPERF_SetMarker = d3d11Annotation_SetMarker; + } + } +#endif // USE_D3D11_DYNAMIC_LIB + if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) { hr = m_device->QueryInterface(IID_ID3D11InfoQueue, (void**)&m_infoQueue); @@ -1264,8 +1309,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { D3D11_MESSAGE_CATEGORY_STATE_CREATION, }; + filter.DenyList.NumCategories = BX_COUNTOF(catlist); filter.DenyList.pCategoryList = catlist; + + D3D11_MESSAGE_ID idlist[] = + { + D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET, + D3D11_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS, + }; + + filter.DenyList.NumIDs = BX_COUNTOF(idlist); + filter.DenyList.pIDList = idlist; + m_infoQueue->PushStorageFilter(&filter); DX_RELEASE(m_infoQueue, 3); @@ -1296,18 +1352,39 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (m_featureLevel <= D3D_FEATURE_LEVEL_9_2) { g_caps.limits.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min( + D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT + , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS + ) ); + g_caps.limits.maxVertexStreams = uint8_t(bx::uint32_min( + 16 + , BGFX_CONFIG_MAX_VERTEX_STREAMS + ) ); } else if (m_featureLevel == D3D_FEATURE_LEVEL_9_3) { g_caps.limits.maxTextureSize = D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min( + D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT + , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS + ) ); + g_caps.limits.maxVertexStreams = uint8_t(bx::uint32_min( + 16 + , BGFX_CONFIG_MAX_VERTEX_STREAMS + ) ); } else { g_caps.supported |= BGFX_CAPS_TEXTURE_COMPARE_ALL; g_caps.limits.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min( + D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT + , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS + ) ); + g_caps.limits.maxVertexStreams = uint8_t(bx::uint32_min( + D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT + , BGFX_CONFIG_MAX_VERTEX_STREAMS + ) ); } // 32-bit indices only supported on 9_2+. @@ -1386,7 +1463,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { uint16_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE; - const DXGI_FORMAT fmt = isDepth(TextureFormat::Enum(ii) ) + const DXGI_FORMAT fmt = bimg::isDepth(bimg::TextureFormat::Enum(ii) ) ? s_textureFormat[ii].m_fmtDsv : s_textureFormat[ii].m_fmt ; @@ -1615,8 +1692,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); postReset(); } - BGFX_GPU_PROFILER_BIND(m_device, m_deviceCtx); - g_internalData.context = m_device; return true; @@ -1653,12 +1728,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); case ErrorState::Default: default: + m_nvapi.shutdown(); + if (NULL != m_ags) { agsDeInit(m_ags); + m_ags = NULL; } + bx::dlclose(m_agsdll); m_agsdll = NULL; + unloadRenderDoc(m_renderdocdll); m_ovr.shutdown(); break; @@ -1669,11 +1749,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void shutdown() { - BGFX_GPU_PROFILER_UNBIND(); - preReset(); m_ovr.shutdown(); + m_nvapi.shutdown(); + if (NULL != m_ags) { agsDeInit(m_ags); @@ -1712,6 +1792,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_textures[ii].destroy(); } + DX_RELEASE(m_annotation, 1); DX_RELEASE(m_swapChain, 0); DX_RELEASE(m_deviceCtx, 0); DX_RELEASE(m_device, 0); @@ -1740,117 +1821,117 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #endif // USE_D3D11_DYNAMIC_LIB } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { return RendererType::Direct3D11; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { return BGFX_RENDERER_DIRECT3D11_NAME; } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } - void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override { VertexDecl& decl = m_vertexDecls[_handle.idx]; bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } - void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { VertexDeclHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE + void createShader(ShaderHandle _handle, Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } - void destroyShader(ShaderHandle _handle) BX_OVERRIDE + void destroyShader(ShaderHandle _handle) override { m_shaders[_handle.idx].destroy(); } - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE + void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL); } - void destroyProgram(ProgramHandle _handle) BX_OVERRIDE + void destroyProgram(ProgramHandle _handle) override { m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE + void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); } - void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE + void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override { } - void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE + void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override { m_textures[_handle.idx].update(_side, _mip, _rect, _z, _depth, _pitch, _mem); } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { } - void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override { const TextureD3D11& texture = m_textures[_handle.idx]; D3D11_MAPPED_SUBRESOURCE mapped; @@ -1861,7 +1942,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint8_t* src = (uint8_t*)mapped.pData; uint32_t srcPitch = mapped.RowPitch; - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; uint32_t dstPitch = srcWidth*bpp/8; @@ -1878,7 +1959,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_deviceCtx->Unmap(texture.m_ptr, _mip); } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override { TextureD3D11& texture = m_textures[_handle.idx]; @@ -1906,7 +1987,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); release(mem); } - void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override { // Resource ref. counts might be messed up outside of bgfx. // Disabling ref. count check once texture is overridden. @@ -1914,7 +1995,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_textures[_handle.idx].overrideInternal(_ptr); } - uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + uintptr_t getInternal(TextureHandle _handle) override { // Resource ref. counts might be messed up outside of bgfx. // Disabling ref. count check once texture is overridden. @@ -1922,24 +2003,24 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return uintptr_t(m_textures[_handle.idx].m_ptr); } - void destroyTexture(TextureHandle _handle) BX_OVERRIDE + void destroyTexture(TextureHandle _handle) override { m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) override { m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); } - void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle _handle) override { uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); if (UINT16_MAX != denseIdx) @@ -1954,7 +2035,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE + void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override { if (NULL != m_uniforms[_handle.idx]) { @@ -1968,14 +2049,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_uniformReg.add(_handle, _name, data); } - void destroyUniform(UniformHandle _handle) BX_OVERRIDE + void destroyUniform(UniformHandle _handle) override { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; m_uniformReg.remove(_handle); } - void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { IDXGISwapChain* swapChain = isValid(_handle) ? m_frameBuffers[_handle.idx].m_swapChain @@ -2026,12 +2107,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_MAPPED_SUBRESOURCE mapped; DX_CHECK(m_deviceCtx->Map(texture, 0, D3D11_MAP_READ, 0, &mapped) ); - imageSwizzleBgra8( + bimg::imageSwizzleBgra8( mapped.pData + , mapped.RowPitch , backBufferDesc.Width , backBufferDesc.Height - , mapped.RowPitch , mapped.pData + , mapped.RowPitch ); g_callback->screenShot(_filePath , backBufferDesc.Width @@ -2049,7 +2131,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(backBuffer, 0); } - void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE + void updateViewName(ViewId _id, const char* _name) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { @@ -2059,18 +2141,18 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); } - bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name + bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + , _name ); } - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE + void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override { bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE + void setMarker(const char* _marker, uint32_t _size) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { @@ -2081,14 +2163,34 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override { m_occlusionQuery.invalidate(_handle); } - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE; + virtual void setName(Handle _handle, const char* _name) override + { + switch (_handle.type) + { + case Handle::Shader: + setDebugObjectName(m_shaders[_handle.idx].m_ptr, _name); + break; + + case Handle::Texture: + setDebugObjectName(m_textures[_handle.idx].m_ptr, _name); + break; + + default: + BX_CHECK(false, "Invalid handle type?! %d", _handle.type); + break; + } + } + + void submitBlit(BlitState& _bs, uint16_t _view); + + void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; - void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE + void blitSetup(TextVideoMemBlitter& _blitter) override { ID3D11DeviceContext* deviceCtx = m_deviceCtx; @@ -2134,7 +2236,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0); float proj[16]; - bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); + bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, false); PredefinedUniform& predefined = program.m_predefined[0]; uint8_t flags = predefined.m_type; @@ -2145,7 +2247,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); commitTextureStage(); } - void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override { const uint32_t numVertices = _numIndices*4/6; if (0 < numVertices) @@ -2263,9 +2365,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); capturePostReset(); } - void flip(HMD& _hmd) BX_OVERRIDE + bool isDeviceRemoved() override { - if (NULL != m_swapChain) + return m_lost; + } + + void flip(HMD& _hmd) override + { + if (NULL != m_swapChain + && !m_lost) { HRESULT hr = S_OK; uint32_t syncInterval = BX_ENABLED(!BX_PLATFORM_WINDOWS) @@ -2298,15 +2406,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - if (isLost(hr) ) - { - ++m_lost; - BGFX_FATAL(10 > m_lost, bgfx::Fatal::DeviceLost, "Device is lost. FAILED 0x%08x", hr); - } - else - { - m_lost = 0; - } + m_lost = isLost(hr); + BGFX_FATAL(!m_lost + , bgfx::Fatal::DeviceLost + , "Device is lost. FAILED 0x%08x %s (%s)" + , hr + , getLostReason(hr) + , DXGI_ERROR_DEVICE_REMOVED == hr ? getLostReason(m_device->GetDeviceRemovedReason() ) : "no info" + ); } } @@ -2654,34 +2761,58 @@ BX_PRAGMA_DIAGNOSTIC_POP(); && (BGFX_CLEAR_DEPTH|BGFX_CLEAR_STENCIL) & _clear.m_flags) { DWORD flags = 0; - flags |= (_clear.m_flags & BGFX_CLEAR_DEPTH) ? D3D11_CLEAR_DEPTH : 0; + flags |= (_clear.m_flags & BGFX_CLEAR_DEPTH) ? D3D11_CLEAR_DEPTH : 0; flags |= (_clear.m_flags & BGFX_CLEAR_STENCIL) ? D3D11_CLEAR_STENCIL : 0; m_deviceCtx->ClearDepthStencilView(m_currentDepthStencil, flags, _clear.m_depth, _clear.m_stencil); } } } - void setInputLayout(const VertexDecl& _vertexDecl, const ProgramD3D11& _program, uint16_t _numInstanceData) + void setInputLayout(uint8_t _numStreams, const VertexDecl** _vertexDecls, const ProgramD3D11& _program, uint16_t _numInstanceData) { - uint64_t layoutHash = (uint64_t(_vertexDecl.m_hash)<<32) | _program.m_vsh->m_hash; - layoutHash ^= _numInstanceData; + bx::HashMurmur2A murmur; + murmur.begin(); + murmur.add(_numInstanceData); + for (uint8_t stream = 0; stream < _numStreams; ++stream) + { + murmur.add(_vertexDecls[stream]->m_hash); + } + uint64_t layoutHash = (uint64_t(_program.m_vsh->m_hash)<<32) | murmur.end(); + 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 = vertexElements; - VertexDecl decl; - bx::memCopy(&decl, &_vertexDecl, sizeof(VertexDecl) ); - const uint16_t* attrMask = _program.m_vsh->m_attrMask; + uint16_t attrMask[Attrib::Count]; + bx::memCopy(attrMask, _program.m_vsh->m_attrMask, sizeof(attrMask) ); - for (uint32_t ii = 0; ii < Attrib::Count; ++ii) + for (uint8_t stream = 0; stream < _numStreams; ++stream) { - uint16_t mask = attrMask[ii]; - uint16_t attr = (decl.m_attributes[ii] & mask); - decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr; + VertexDecl decl; + bx::memCopy(&decl, _vertexDecls[stream], sizeof(VertexDecl) ); + + const bool last = stream == _numStreams-1; + + for (uint32_t ii = 0; ii < Attrib::Count; ++ii) + { + uint16_t mask = attrMask[ii]; + uint16_t attr = (decl.m_attributes[ii] & mask); + if (0 == attr + || UINT16_MAX == attr) + { + decl.m_attributes[ii] = last ? ~attr : UINT16_MAX; + } + else + { + attrMask[ii] = 0; + } + } + + elem = fillVertexDecl(stream, elem, decl); } - D3D11_INPUT_ELEMENT_DESC* elem = fillVertexDecl(vertexElements, decl); uint32_t num = uint32_t(elem-vertexElements); const D3D11_INPUT_ELEMENT_DESC inst = { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1 }; @@ -2695,7 +2826,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); for (jj = 0; jj < num; ++jj) { curr = &vertexElements[jj]; - if (0 == bx::strncmp(curr->SemanticName, "TEXCOORD") + if (0 == bx::strCmp(curr->SemanticName, "TEXCOORD") && curr->SemanticIndex == index) { break; @@ -2709,7 +2840,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } bx::memCopy(curr, &inst, sizeof(D3D11_INPUT_ELEMENT_DESC) ); - curr->InputSlot = 1; + curr->InputSlot = _numStreams; curr->SemanticIndex = index; curr->AlignedByteOffset = ii*16; } @@ -2727,6 +2858,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_deviceCtx->IASetInputLayout(layout); } + void setInputLayout(const VertexDecl& _vertexDecl, const ProgramD3D11& _program, uint16_t _numInstanceData) + { + const VertexDecl* decls[1] = { &_vertexDecl }; + setInputLayout(BX_COUNTOF(decls), decls, _program, _numInstanceData); + } + void setBlendState(uint64_t _state, uint32_t _rgba = 0) { _state &= BGFX_D3D11_BLEND_STATE_MASK; @@ -3021,7 +3158,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); sd.AddressU = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; sd.AddressV = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; sd.AddressW = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; - sd.MipLODBias = 0.0f; + sd.MipLODBias = float(BGFX_CONFIG_MIP_LOD_BIAS); sd.MaxAnisotropy = m_maxAnisotropy; sd.ComparisonFunc = 0 == cmpFunc ? D3D11_COMPARISON_NEVER : s_cmpFunc[cmpFunc]; sd.BorderColor[0] = _rgba[0]; @@ -3109,7 +3246,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); murmur.begin(); murmur.add(_handle); murmur.add(_mip); - murmur.add(0); + murmur.add(1); uint32_t hash = murmur.end(); IUnknown** ptr = m_srvUavLru.find(hash); @@ -3119,7 +3256,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); TextureD3D11& texture = m_textures[_handle.idx]; D3D11_UNORDERED_ACCESS_VIEW_DESC desc; - desc.Format = s_textureFormat[texture.m_textureFormat].m_fmtSrv; + desc.Format = texture.getSrvFormat(); switch (texture.m_type) { case TextureD3D11::Texture2D: @@ -3154,13 +3291,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return uav; } - ID3D11ShaderResourceView* getCachedSrv(TextureHandle _handle, uint8_t _mip) + ID3D11ShaderResourceView* getCachedSrv(TextureHandle _handle, uint8_t _mip, bool _compute = false) { bx::HashMurmur2A murmur; murmur.begin(); murmur.add(_handle); murmur.add(_mip); murmur.add(0); + murmur.add(_compute); uint32_t hash = murmur.end(); IUnknown** ptr = m_srvUavLru.find(hash); @@ -3173,7 +3311,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const bool msaaSample = 1 < msaa.Count && 0 != (texture.m_flags&BGFX_TEXTURE_MSAA_SAMPLE); D3D11_SHADER_RESOURCE_VIEW_DESC desc; - desc.Format = s_textureFormat[texture.m_textureFormat].m_fmtSrv; + desc.Format = texture.getSrvFormat(); switch (texture.m_type) { case TextureD3D11::Texture2D: @@ -3186,9 +3324,20 @@ BX_PRAGMA_DIAGNOSTIC_POP(); break; case TextureD3D11::TextureCube: - desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; - desc.TextureCube.MostDetailedMip = _mip; - desc.TextureCube.MipLevels = 1; + if (_compute) + { + desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; + desc.Texture2DArray.MostDetailedMip = _mip; + desc.Texture2DArray.MipLevels = 1; + desc.Texture2DArray.FirstArraySlice = 0; + desc.Texture2DArray.ArraySize = 6; + } + else + { + desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; + desc.TextureCube.MostDetailedMip = _mip; + desc.TextureCube.MipLevels = 1; + } break; case TextureD3D11::Texture3D: @@ -3294,12 +3443,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_MAPPED_SUBRESOURCE mapped; DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) ); - imageSwizzleBgra8( + bimg::imageSwizzleBgra8( mapped.pData + , mapped.RowPitch , getBufferWidth() , getBufferHeight() - , mapped.RowPitch , mapped.pData + , mapped.RowPitch ); g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch); @@ -3537,6 +3687,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void* m_agsdll; AGSContext* m_ags; + NvApi m_nvapi; D3D_DRIVER_TYPE m_driverType; D3D_FEATURE_LEVEL m_featureLevel; @@ -3551,15 +3702,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #endif // BX_PLATFORM_WINDOWS bool m_needPresent; - uint16_t m_lost; + bool m_lost; uint16_t m_numWindows; FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS]; - ID3D11Device* m_device; - ID3D11DeviceContext* m_deviceCtx; - ID3D11InfoQueue* m_infoQueue; - TimerQueryD3D11 m_gpuTimer; - OcclusionQueryD3D11 m_occlusionQuery; + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceCtx; + ID3DUserDefinedAnnotation* m_annotation; + ID3D11InfoQueue* m_infoQueue; + + TimerQueryD3D11 m_gpuTimer; + OcclusionQueryD3D11 m_occlusionQuery; uint32_t m_deviceInterfaceVersion; @@ -3673,6 +3826,23 @@ BX_PRAGMA_DIAGNOSTIC_POP(); agsDriverExtensions_MultiDrawIndexedInstancedIndirect(s_renderD3D11->m_ags, _numDrawIndirect, _ptr, _offset, _stride); } + int WINAPI d3d11Annotation_BeginEvent(DWORD _color, LPCWSTR _name) + { + BX_UNUSED(_color); + return s_renderD3D11->m_annotation->BeginEvent(_name); + } + + int WINAPI d3d11Annotation_EndEvent() + { + return s_renderD3D11->m_annotation->EndEvent(); + } + + void WINAPI d3d11Annotation_SetMarker(DWORD _color, LPCWSTR _name) + { + BX_UNUSED(_color); + s_renderD3D11->m_annotation->SetMarker(_name); + } + #if BGFX_CONFIG_USE_OVR VRImplOVRD3D11::VRImplOVRD3D11() @@ -3904,7 +4074,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); }; static const UavFormat s_uavFormat[] = - { // BGFX_BUFFER_COMPUTE_TYPE_UINT, BGFX_BUFFER_COMPUTE_TYPE_INT, BGFX_BUFFER_COMPUTE_TYPE_FLOAT + { // BGFX_BUFFER_COMPUTE_TYPE_INT, BGFX_BUFFER_COMPUTE_TYPE_UINT, BGFX_BUFFER_COMPUTE_TYPE_FLOAT { { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, 0 }, // ignored { { DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN }, 1 }, // BGFX_BUFFER_COMPUTE_FORMAT_8x1 { { DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN }, 2 }, // BGFX_BUFFER_COMPUTE_FORMAT_8x2 @@ -3982,6 +4152,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ID3D11Device* device = s_renderD3D11->m_device; + D3D11_SUBRESOURCE_DATA srd; + srd.pSysMem = _data; + srd.SysMemPitch = 0; + srd.SysMemSlicePitch = 0; + if (needUav) { desc.Usage = D3D11_USAGE_DEFAULT; @@ -3989,7 +4164,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); desc.StructureByteStride = _stride; DX_CHECK(device->CreateBuffer(&desc - , NULL + , NULL == _data ? NULL : &srd , &m_ptr ) ); @@ -4006,24 +4181,38 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else if (m_dynamic) { - desc.Usage = D3D11_USAGE_DYNAMIC; +#if USE_D3D11_STAGING_BUFFER + desc.Usage = D3D11_USAGE_DEFAULT; + desc.CPUAccessFlags = 0; + + DX_CHECK(device->CreateBuffer(&desc + , NULL + , &m_ptr + ) ); + + desc.BindFlags = 0; + desc.Usage = D3D11_USAGE_STAGING; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + + DX_CHECK(device->CreateBuffer(&desc + , NULL + , &m_staging + ) ); +#else + desc.Usage = D3D11_USAGE_DYNAMIC; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; DX_CHECK(device->CreateBuffer(&desc , NULL , &m_ptr ) ); +#endif // USE_D3D11_STAGING_BUFFER } else { desc.Usage = D3D11_USAGE_IMMUTABLE; desc.CPUAccessFlags = 0; - D3D11_SUBRESOURCE_DATA srd; - srd.pSysMem = _data; - srd.SysMemPitch = 0; - srd.SysMemSlicePitch = 0; - DX_CHECK(device->CreateBuffer(&desc , &srd , &m_ptr @@ -4049,54 +4238,79 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; BX_CHECK(m_dynamic, "Must be dynamic!"); -#if 0 +#if USE_D3D11_STAGING_BUFFER BX_UNUSED(_discard); - D3D11_BUFFER_DESC desc; - desc.ByteWidth = _size; - desc.Usage = D3D11_USAGE_STAGING; - desc.BindFlags = 0; - desc.MiscFlags = 0; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - desc.StructureByteStride = 0; - - D3D11_SUBRESOURCE_DATA srd; - srd.pSysMem = _data; - srd.SysMemPitch = 0; - srd.SysMemSlicePitch = 0; - - D3D11_BOX srcBox; - srcBox.left = 0; - srcBox.top = 0; - srcBox.front = 0; - srcBox.right = _size; - srcBox.bottom = 1; - srcBox.back = 1; - ID3D11Device* device = s_renderD3D11->m_device; + D3D11_MAPPED_SUBRESOURCE mapped; + DX_CHECK(deviceCtx->Map(m_staging, 0, D3D11_MAP_WRITE, 0, &mapped) ); + bx::memCopy( (uint8_t*)mapped.pData + _offset, _data, _size); + deviceCtx->Unmap(m_staging, 0); - ID3D11Buffer* ptr; - DX_CHECK(device->CreateBuffer(&desc, &srd, &ptr) ); + D3D11_BOX box; + box.left = _offset; + box.top = 0; + box.front = 0; + box.right = _offset + _size; + box.bottom = 1; + box.back = 1; deviceCtx->CopySubresourceRegion(m_ptr , 0 , _offset , 0 , 0 - , ptr + , m_staging , 0 - , &srcBox + , &box ); - - DX_RELEASE(ptr, 0); #else - D3D11_MAPPED_SUBRESOURCE mapped; - D3D11_MAP type = _discard - ? D3D11_MAP_WRITE_DISCARD - : D3D11_MAP_WRITE_NO_OVERWRITE - ; - DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) ); - bx::memCopy( (uint8_t*)mapped.pData + _offset, _data, _size); - deviceCtx->Unmap(m_ptr, 0); + if (_discard) + { + D3D11_MAPPED_SUBRESOURCE mapped; + DX_CHECK(deviceCtx->Map(m_ptr, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped) ); + bx::memCopy( (uint8_t*)mapped.pData + _offset, _data, _size); + deviceCtx->Unmap(m_ptr, 0); + } + else + { + D3D11_BUFFER_DESC desc; + desc.ByteWidth = _size; + desc.Usage = D3D11_USAGE_STAGING; + desc.BindFlags = 0; + desc.MiscFlags = 0; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + desc.StructureByteStride = 0; + + D3D11_SUBRESOURCE_DATA srd; + srd.pSysMem = _data; + srd.SysMemPitch = 0; + srd.SysMemSlicePitch = 0; + + D3D11_BOX srcBox; + srcBox.left = 0; + srcBox.top = 0; + srcBox.front = 0; + srcBox.right = _size; + srcBox.bottom = 1; + srcBox.back = 1; + + ID3D11Device* device = s_renderD3D11->m_device; + + ID3D11Buffer* ptr; + DX_CHECK(device->CreateBuffer(&desc, &srd, &ptr) ); + + deviceCtx->CopySubresourceRegion(m_ptr + , 0 + , _offset + , 0 + , 0 + , ptr + , 0 + , &srcBox + ); + + DX_RELEASE(ptr, 0); + } #endif // 0 } @@ -4257,7 +4471,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - uint16_t shaderSize; + uint32_t shaderSize; bx::read(&reader, shaderSize); const void* code = reader.getDataPtr(); @@ -4271,7 +4485,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else if (BGFX_CHUNK_MAGIC_VSH == magic) { - m_hash = bx::hashMurmur2A(code, shaderSize); + m_hash = bx::hash<bx::HashMurmur2A>(code, shaderSize); m_code = copy(code, shaderSize); DX_CHECK(s_renderD3D11->m_device->CreateVertexShader(code, shaderSize, NULL, &m_vertexShader) ); @@ -4319,14 +4533,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void TextureD3D11::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) { - ImageContainer imageContainer; + bimg::ImageContainer imageContainer; - if (imageParse(imageContainer, _mem->data, _mem->size) ) + if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) { uint8_t numMips = imageContainer.m_numMips; const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) ); numMips -= startLod; - const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) ); + const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(imageContainer.m_format) ); const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod); const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod); const uint16_t numLayers = imageContainer.m_numLayers; @@ -4338,7 +4552,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_requestedFormat = uint8_t(imageContainer.m_format); m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); const bool convert = m_textureFormat != m_requestedFormat; - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); if (imageContainer.m_cubeMap) { @@ -4361,7 +4575,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t kk = 0; - const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) ); + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) ); const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s%s%s." @@ -4388,8 +4602,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); height = bx::uint32_max(1, height); depth = bx::uint32_max(1, depth); - ImageMip mip; - if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) + bimg::ImageMip mip; + if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { srd[kk].pSysMem = mip.m_data; @@ -4397,7 +4611,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { uint32_t srcpitch = mip.m_width*bpp/8; uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, mip.m_width*mip.m_height*bpp/8); - imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format); + bimg::imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format); srd[kk].pSysMem = temp; srd[kk].SysMemPitch = srcpitch; @@ -4412,11 +4626,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); srd[kk].SysMemPitch = mip.m_width*mip.m_bpp/8; } - if (swizzle) - { -// imageSwizzleBgra8(temp, width, height, mip.m_width*4, data); - } - srd[kk].SysMemSlicePitch = mip.m_height*srd[kk].SysMemPitch; ++kk; } @@ -4430,7 +4639,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const bool writeOnly = 0 != (m_flags&(BGFX_TEXTURE_RT_WRITE_ONLY|BGFX_TEXTURE_READ_BACK) ); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); - const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb; + const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB); const bool blit = 0 != (m_flags&BGFX_TEXTURE_BLIT_DST); const bool readBack = 0 != (m_flags&BGFX_TEXTURE_READ_BACK); const uint32_t msaaQuality = bx::uint32_satsub( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1); @@ -4466,7 +4675,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { // not swizzled and not sRGB, or sRGB unsupported format = s_textureFormat[m_textureFormat].m_fmt; - srvd.Format = s_textureFormat[m_textureFormat].m_fmtSrv; + srvd.Format = getSrvFormat(); } switch (m_type) @@ -4486,7 +4695,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); desc.CPUAccessFlags = 0; desc.MiscFlags = 0; - if (isDepth( (TextureFormat::Enum)m_textureFormat) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) ) ) { desc.BindFlags |= D3D11_BIND_DEPTH_STENCIL; desc.Usage = D3D11_USAGE_DEFAULT; @@ -4684,7 +4893,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } const uint32_t subres = _mip + ( (layer + _side) * m_numMips); - const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t rectpitch = _rect.m_width*bpp/8; const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; const uint32_t slicepitch = rectpitch*_rect.m_height; @@ -4697,7 +4906,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch); - imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, TextureFormat::Enum(m_requestedFormat) ); + bimg::imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; } @@ -4754,6 +4963,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return handle; } + DXGI_FORMAT TextureD3D11::getSrvFormat() const + { + if (bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) ) ) + { + return s_textureFormat[m_textureFormat].m_fmtSrv; + } + + return 0 != (m_flags&BGFX_TEXTURE_SRGB) + ? s_textureFormat[m_textureFormat].m_fmtSrgb + : s_textureFormat[m_textureFormat].m_fmt + ; + } + void FrameBufferD3D11::create(uint8_t _num, const Attachment* _attachment) { for (uint32_t ii = 0; ii < BX_COUNTOF(m_rtv); ++ii) @@ -4793,7 +5015,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_CHECK(device->CreateRenderTargetView(ptr, NULL, &m_rtv[0]) ); DX_RELEASE(ptr, 0); - DXGI_FORMAT fmtDsv = isDepth(_depthFormat) + DXGI_FORMAT fmtDsv = bimg::isDepth(bimg::TextureFormat::Enum(_depthFormat) ) ? s_textureFormat[_depthFormat].m_fmtDsv : DXGI_FORMAT_D24_UNORM_S8_UINT ; @@ -4893,7 +5115,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const uint32_t msaaQuality = bx::uint32_satsub( (texture.m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1); const DXGI_SAMPLE_DESC& msaa = s_msaa[msaaQuality]; - if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) { BX_CHECK(NULL == m_dsv, "Frame buffer already has depth-stencil attached."); @@ -4943,62 +5165,52 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { + D3D11_RENDER_TARGET_VIEW_DESC desc; + desc.Format = texture.getSrvFormat(); switch (texture.m_type) { default: case TextureD3D11::Texture2D: + if (1 < msaa.Count) { - D3D11_RENDER_TARGET_VIEW_DESC desc; - desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt; - if (1 < msaa.Count) - { - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; - } - else - { - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - desc.Texture2D.MipSlice = m_attachment[ii].mip; - } - - DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView( - NULL == texture.m_rt ? texture.m_ptr : texture.m_rt - , &desc - , &m_rtv[m_num] - ) ); + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; } + else + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipSlice = m_attachment[ii].mip; + } + + DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView( + NULL == texture.m_rt ? texture.m_ptr : texture.m_rt + , &desc + , &m_rtv[m_num] + ) ); break; case TextureD3D11::TextureCube: + if (1 < msaa.Count) { - D3D11_RENDER_TARGET_VIEW_DESC desc; - desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt; - if (1 < msaa.Count) - { - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; - desc.Texture2DMSArray.ArraySize = 1; - desc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer; - } - else - { - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; - desc.Texture2DArray.ArraySize = 1; - desc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer; - desc.Texture2DArray.MipSlice = m_attachment[ii].mip; - } - DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; + desc.Texture2DMSArray.ArraySize = 1; + desc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer; } + else + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + desc.Texture2DArray.ArraySize = 1; + desc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer; + desc.Texture2DArray.MipSlice = m_attachment[ii].mip; + } + DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); break; case TextureD3D11::Texture3D: - { - D3D11_RENDER_TARGET_VIEW_DESC desc; - desc.Format = s_textureFormat[texture.m_textureFormat].m_fmt; - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; - desc.Texture3D.MipSlice = m_attachment[ii].mip; - desc.Texture3D.WSize = 1; - desc.Texture3D.FirstWSlice = m_attachment[ii].layer; - DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); - } + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; + desc.Texture3D.MipSlice = m_attachment[ii].mip; + desc.Texture3D.WSize = 1; + desc.Texture3D.FirstWSlice = m_attachment[ii].layer; + DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); break; } @@ -5098,68 +5310,94 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { ID3D11Device* device = s_renderD3D11->m_device; - D3D11_QUERY_DESC query; - query.MiscFlags = 0; - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii) + D3D11_QUERY_DESC qd; + qd.MiscFlags = 0; + for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) { - Frame& frame = m_frame[ii]; + Query& query = m_query[ii]; + query.m_ready = false; - query.Query = D3D11_QUERY_TIMESTAMP_DISJOINT; - DX_CHECK(device->CreateQuery(&query, &frame.m_disjoint) ); + qd.Query = D3D11_QUERY_TIMESTAMP_DISJOINT; + DX_CHECK(device->CreateQuery(&qd, &query.m_disjoint) ); + + qd.Query = D3D11_QUERY_TIMESTAMP; + DX_CHECK(device->CreateQuery(&qd, &query.m_begin) ); + DX_CHECK(device->CreateQuery(&qd, &query.m_end) ); + } - query.Query = D3D11_QUERY_TIMESTAMP; - DX_CHECK(device->CreateQuery(&query, &frame.m_begin) ); - DX_CHECK(device->CreateQuery(&query, &frame.m_end) ); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_result); ++ii) + { + Result& result = m_result[ii]; + result.reset(); } - m_elapsed = 0; - m_frequency = 1; m_control.reset(); } void TimerQueryD3D11::preReset() { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii) + for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) { - Frame& frame = m_frame[ii]; - DX_RELEASE(frame.m_disjoint, 0); - DX_RELEASE(frame.m_begin, 0); - DX_RELEASE(frame.m_end, 0); + Query& query = m_query[ii]; + DX_RELEASE(query.m_disjoint, 0); + DX_RELEASE(query.m_begin, 0); + DX_RELEASE(query.m_end, 0); } } - void TimerQueryD3D11::begin() + uint32_t TimerQueryD3D11::begin(uint32_t _resultIdx) { ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; while (0 == m_control.reserve(1) ) { - get(); + update(); } - Frame& frame = m_frame[m_control.m_current]; - deviceCtx->Begin(frame.m_disjoint); - deviceCtx->End(frame.m_begin); + Result& result = m_result[_resultIdx]; + ++result.m_pending; + + const uint32_t idx = m_control.m_current; + Query& query = m_query[idx]; + query.m_resultIdx = _resultIdx; + query.m_ready = false; + + deviceCtx->Begin(query.m_disjoint); + deviceCtx->End(query.m_begin); + + m_control.commit(1); + + return idx; } - void TimerQueryD3D11::end() + void TimerQueryD3D11::end(uint32_t _idx) { ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; - Frame& frame = m_frame[m_control.m_current]; - deviceCtx->End(frame.m_end); - deviceCtx->End(frame.m_disjoint); - m_control.commit(1); + Query& query = m_query[_idx]; + query.m_ready = true; + + deviceCtx->End(query.m_end); + deviceCtx->End(query.m_disjoint); + + while (update() ) + { + } } - bool TimerQueryD3D11::get() + bool TimerQueryD3D11::update() { if (0 != m_control.available() ) { - ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; - Frame& frame = m_frame[m_control.m_read]; + Query& query = m_query[m_control.m_read]; + + if (!query.m_ready) + { + return false; + } uint64_t timeEnd; - HRESULT hr = deviceCtx->GetData(frame.m_end, &timeEnd, sizeof(timeEnd), D3D11_ASYNC_GETDATA_DONOTFLUSH); + ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; + HRESULT hr = deviceCtx->GetData(query.m_end, &timeEnd, sizeof(timeEnd), D3D11_ASYNC_GETDATA_DONOTFLUSH); if (S_OK == hr || isLost(hr) ) { @@ -5172,15 +5410,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); }; D3D11_QUERY_DATA_TIMESTAMP_DISJOINT disjoint; - deviceCtx->GetData(frame.m_disjoint, &disjoint, sizeof(disjoint), 0); + DX_CHECK(deviceCtx->GetData(query.m_disjoint, &disjoint, sizeof(disjoint), 0) ); uint64_t timeBegin; - deviceCtx->GetData(frame.m_begin, &timeBegin, sizeof(timeBegin), 0); + DX_CHECK(deviceCtx->GetData(query.m_begin, &timeBegin, sizeof(timeBegin), 0) ); - m_frequency = disjoint.Frequency; - m_begin = timeBegin; - m_end = timeEnd; - m_elapsed = timeEnd - timeBegin; + Result& result = m_result[query.m_resultIdx]; + --result.m_pending; + + result.m_frequency = disjoint.Frequency; + result.m_begin = timeBegin; + result.m_end = timeEnd; return true; } @@ -5266,14 +5506,94 @@ BX_PRAGMA_DIAGNOSTIC_POP(); Query& query = m_query[(m_control.m_read + ii) % size]; if (query.m_handle.idx == _handle.idx) { - query.m_handle.idx = bgfx::invalidHandle; + query.m_handle.idx = bgfx::kInvalidHandle; + } + } + } + + void RendererContextD3D11::submitBlit(BlitState& _bs, uint16_t _view) + { + ID3D11DeviceContext* deviceCtx = m_deviceCtx; + + while (_bs.hasItem(_view) ) + { + const BlitItem& blit = _bs.advance(); + + const TextureD3D11& src = m_textures[blit.m_src.idx]; + const TextureD3D11& dst = m_textures[blit.m_dst.idx]; + + uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; + uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; + uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; + uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; + uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; + uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; + uint32_t width = bx::uint32_min(srcWidth, dstWidth); + uint32_t height = bx::uint32_min(srcHeight, dstHeight); + uint32_t depth = bx::uint32_min(srcDepth, dstDepth); + + if (TextureD3D11::Texture3D == src.m_type) + { + D3D11_BOX box; + box.left = blit.m_srcX; + box.top = blit.m_srcY; + box.front = blit.m_srcZ; + box.right = blit.m_srcX + width; + box.bottom = blit.m_srcY + height;; + box.back = blit.m_srcZ + bx::uint32_imax(1, depth); + + deviceCtx->CopySubresourceRegion(dst.m_ptr + , blit.m_dstMip + , blit.m_dstX + , blit.m_dstY + , blit.m_dstZ + , src.m_ptr + , blit.m_srcMip + , &box + ); + } + else + { + bool depthStencil = bimg::isDepth(bimg::TextureFormat::Enum(src.m_textureFormat) ); + BX_CHECK(!depthStencil + || (width == src.m_width && height == src.m_height) + , "When blitting depthstencil surface, source resolution must match destination." + ); + + D3D11_BOX box; + box.left = blit.m_srcX; + box.top = blit.m_srcY; + box.front = 0; + box.right = blit.m_srcX + width; + box.bottom = blit.m_srcY + height; + box.back = 1; + + const uint32_t srcZ = TextureD3D11::TextureCube == src.m_type + ? blit.m_srcZ + : 0 + ; + const uint32_t dstZ = TextureD3D11::TextureCube == dst.m_type + ? blit.m_dstZ + : 0 + ; + + deviceCtx->CopySubresourceRegion(dst.m_ptr + , dstZ*dst.m_numMips+blit.m_dstMip + , blit.m_dstX + , blit.m_dstY + , 0 + , src.m_ptr + , srcZ*src.m_numMips+blit.m_srcMip + , depthStencil ? NULL : &box + ); } } } void RendererContextD3D11::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) { - if (updateResolution(_render->m_resolution) ) + if (m_lost + || updateResolution(_render->m_resolution) ) { return; } @@ -5284,16 +5604,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit"); - BGFX_GPU_PROFILER_BEGIN_DYNAMIC("rendererSubmit"); ID3D11DeviceContext* deviceCtx = m_deviceCtx; - int64_t elapsed = -bx::getHPCounter(); + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; + uint32_t frameQueryIdx = UINT32_MAX; + if (m_timerQuerySupport) { - m_gpuTimer.begin(); + frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS); } if (0 < _render->m_iboffset) @@ -5315,6 +5636,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); + RenderBind currentBind; + currentBind.clear(); + _render->m_hmdInitialized = m_ovr.isInitialized(); const bool hmdEnabled = m_ovr.isEnabled(); @@ -5325,15 +5649,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bool scissorEnabled = false; setDebugWireframe(wireframe); - uint16_t programIdx = invalidHandle; + uint16_t programIdx = kInvalidHandle; SortKey key; uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; - BlitKey blitKey; - blitKey.decode(_render->m_blitKeys[0]); - uint16_t numBlitItems = _render->m_numBlitItems; - uint16_t blitItem = 0; + BlitState bs(_render); const uint64_t primType = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0; uint8_t primIndex = uint8_t(primType >> BGFX_STATE_PT_SHIFT); @@ -5352,6 +5673,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t statsNumIndices = 0; uint32_t statsKeyType[2] = {}; + Profiler<TimerQueryD3D11> profiler( + _render + , m_gpuTimer + , s_viewName + , m_timerQuerySupport + ); + m_occlusionQuery.resolve(_render); if (0 == (_render->m_debug&BGFX_DEBUG_IFH) ) @@ -5364,9 +5692,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bool viewRestart = false; uint8_t eye = 0; uint8_t restartState = 0; - viewState.m_rect = _render->m_rect[0]; + viewState.m_rect = _render->m_view[0].m_rect; - int32_t numItems = _render->m_num; + int32_t numItems = _render->m_numRenderItems; for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;) { const uint64_t encodedKey = _render->m_sortKeys[item]; @@ -5378,7 +5706,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); || item == numItems ; - const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ]; + const uint32_t itemIdx = _render->m_sortValues[item]; + const RenderItem& renderItem = _render->m_renderItem[itemIdx]; + const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; ++item; if (viewChanged) @@ -5393,15 +5723,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } view = key.m_view; - programIdx = invalidHandle; + programIdx = kInvalidHandle; - if (_render->m_fb[view].idx != fbh.idx) + if (_render->m_view[view].m_fbh.idx != fbh.idx) { - fbh = _render->m_fb[view]; + fbh = _render->m_view[view].m_fbh; setFrameBuffer(fbh); } - viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_viewFlags[view] & BGFX_VIEW_STEREO) ) ); + viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_view[view].m_flags & BGFX_VIEW_STEREO) ) ); viewRestart &= hmdEnabled; if (viewRestart) { @@ -5422,13 +5752,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); PIX_ENDEVENT(); if (item > 1) { - BGFX_GPU_PROFILER_END(); - BGFX_PROFILER_END(); + profiler.end(); } - BGFX_PROFILER_BEGIN_DYNAMIC(s_viewName[view]); - BGFX_GPU_PROFILER_BEGIN_DYNAMIC(s_viewName[view]); - viewState.m_rect = _render->m_rect[view]; + profiler.begin(view); + + viewState.m_rect = _render->m_view[view].m_rect; if (viewRestart) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) @@ -5464,7 +5793,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - const Rect& scissorRect = _render->m_scissor[view]; + const Rect& scissorRect = _render->m_view[view].m_scissor; viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; @@ -5476,7 +5805,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; deviceCtx->RSSetViewports(1, &vp); - Clear& clr = _render->m_clear[view]; + Clear& clr = _render->m_view[view].m_clear; if (BGFX_CLEAR_NONE != (clr.m_flags & BGFX_CLEAR_MASK) ) { @@ -5484,81 +5813,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update after clear quad. } - const uint8_t blitView = SortKey::decodeView(encodedKey); - for (; blitItem < numBlitItems && blitKey.m_view <= blitView; blitItem++) - { - const BlitItem& blit = _render->m_blitItem[blitItem]; - blitKey.decode(_render->m_blitKeys[blitItem+1]); - - const TextureD3D11& src = m_textures[blit.m_src.idx]; - const TextureD3D11& dst = m_textures[blit.m_dst.idx]; - - uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; - uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; - uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; - uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; - uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; - uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; - uint32_t width = bx::uint32_min(srcWidth, dstWidth); - uint32_t height = bx::uint32_min(srcHeight, dstHeight); - uint32_t depth = bx::uint32_min(srcDepth, dstDepth); - - if (TextureD3D11::Texture3D == src.m_type) - { - D3D11_BOX box; - box.left = blit.m_srcX; - box.top = blit.m_srcY; - box.front = blit.m_srcZ; - box.right = blit.m_srcX + width; - box.bottom = blit.m_srcY + height;; - box.back = blit.m_srcZ + bx::uint32_imax(1, depth); - - deviceCtx->CopySubresourceRegion(dst.m_ptr - , blit.m_dstMip - , blit.m_dstX - , blit.m_dstY - , blit.m_dstZ - , src.m_ptr - , blit.m_srcMip - , &box - ); - } - else - { - bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) ); - BX_CHECK(!depthStencil - || (width == src.m_width && height == src.m_height) - , "When blitting depthstencil surface, source resolution must match destination." - ); - - D3D11_BOX box; - box.left = blit.m_srcX; - box.top = blit.m_srcY; - box.front = 0; - box.right = blit.m_srcX + width; - box.bottom = blit.m_srcY + height; - box.back = 1; - - const uint32_t srcZ = TextureD3D11::TextureCube == src.m_type - ? blit.m_srcZ - : 0 - ; - const uint32_t dstZ = TextureD3D11::TextureCube == dst.m_type - ? blit.m_dstZ - : 0 - ; - - deviceCtx->CopySubresourceRegion(dst.m_ptr - , dstZ*dst.m_numMips+blit.m_dstMip - , blit.m_dstX - , blit.m_dstY - , 0 - , src.m_ptr - , srcZ*src.m_numMips+blit.m_srcMip - , depthStencil ? NULL : &box - ); - } - } + submitBlit(bs, view); } if (isCompute) @@ -5594,8 +5849,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } bool programChanged = false; - bool constantsChanged = compute.m_constBegin < compute.m_constEnd; - rendererUpdateUniforms(this, _render->m_uniformBuffer, compute.m_constBegin, compute.m_constEnd); + bool constantsChanged = compute.m_uniformBegin < compute.m_uniformEnd; + rendererUpdateUniforms(this, _render->m_uniformBuffer[compute.m_uniformIdx], compute.m_uniformBegin, compute.m_uniformEnd); if (key.m_program != programIdx) { @@ -5611,7 +5866,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); constantsChanged = true; } - if (invalidHandle != programIdx) + if (kInvalidHandle != programIdx) { ProgramD3D11& program = m_program[programIdx]; @@ -5639,12 +5894,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) { - const Binding& bind = compute.m_bind[ii]; - if (invalidHandle != bind.m_idx) + const Binding& bind = renderBind.m_bind[ii]; + if (kInvalidHandle != bind.m_idx) { switch (bind.m_type) { case Binding::Image: + case Binding::Texture: { TextureD3D11& texture = m_textures[bind.m_idx]; if (Access::Read != bind.m_un.m_compute.m_access) @@ -5656,10 +5912,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { - srv[ii] = 0 == bind.m_un.m_compute.m_mip - ? texture.m_srv - : s_renderD3D11->getCachedSrv(texture.getHandle(), bind.m_un.m_compute.m_mip) - ; + srv[ii] = s_renderD3D11->getCachedSrv(texture.getHandle(), bind.m_un.m_compute.m_mip, true); sampler[ii] = s_renderD3D11->getSamplerState(texture.m_flags, NULL); } } @@ -5727,7 +5980,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW); } - programIdx = invalidHandle; + programIdx = kInvalidHandle; m_currentProgram = NULL; invalidateCompute(); @@ -5764,6 +6017,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; + currentBind.clear(); + setBlendState(newFlags); setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) ); @@ -5798,7 +6053,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); else { Rect scissorRect; - scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]); + scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); if (scissorRect.isZeroArea() ) { continue; @@ -5863,14 +6118,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } bool programChanged = false; - bool constantsChanged = draw.m_constBegin < draw.m_constEnd; - rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); + bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; + rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); if (key.m_program != programIdx) { programIdx = key.m_program; - if (invalidHandle == programIdx) + if (kInvalidHandle == programIdx) { m_currentProgram = NULL; @@ -5903,7 +6158,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); constantsChanged = true; } - if (invalidHandle != programIdx) + if (kInvalidHandle != programIdx) { ProgramD3D11& program = m_program[programIdx]; @@ -5935,16 +6190,36 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t changes = 0; for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) { - const Binding& bind = draw.m_bind[stage]; - Binding& current = currentState.m_bind[stage]; + const Binding& bind = renderBind.m_bind[stage]; + Binding& current = currentBind.m_bind[stage]; if (current.m_idx != bind.m_idx + || current.m_type != bind.m_type || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags || programChanged) { - if (invalidHandle != bind.m_idx) + if (kInvalidHandle != bind.m_idx) { - TextureD3D11& texture = m_textures[bind.m_idx]; - texture.commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + switch (bind.m_type) + { + case Binding::Texture: + { + TextureD3D11& texture = m_textures[bind.m_idx]; + texture.commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + } + break; + + case Binding::IndexBuffer: + case Binding::VertexBuffer: + { + const BufferD3D11& buffer = Binding::IndexBuffer == bind.m_type + ? m_indexBuffers[bind.m_idx] + : m_vertexBuffers[bind.m_idx] + ; + m_textureStage.m_srv[stage] = buffer.m_srv; + m_textureStage.m_sampler[stage] = NULL; + } + break; + } } else { @@ -5964,43 +6239,70 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } + bool vertexStreamChanged = hasVertexStreamChanged(currentState, draw); + if (programChanged - || currentState.m_streamMask != draw.m_streamMask - || currentState.m_stream[0].m_decl.idx != draw.m_stream[0].m_decl.idx - || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx - || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset - || currentState.m_instanceDataStride != draw.m_instanceDataStride) + || vertexStreamChanged) { currentState.m_streamMask = draw.m_streamMask; - currentState.m_stream[0].m_decl = draw.m_stream[0].m_decl; - currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; - uint16_t handle = draw.m_stream[0].m_handle.idx; - if (invalidHandle != handle) + ID3D11Buffer* buffers[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + uint32_t strides[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + uint32_t offsets[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + + uint32_t numVertices = draw.m_numVertices; + uint8_t numStreams = 0; + for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams + ) { - const VertexBufferD3D11& vb = m_vertexBuffers[handle]; + streamMask >>= ntz; + idx += ntz; + + currentState.m_stream[idx].m_decl = draw.m_stream[idx].m_decl; + currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; + currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; + uint16_t handle = draw.m_stream[idx].m_handle.idx; + const VertexBufferD3D11& vb = m_vertexBuffers[handle]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = m_vertexDecls[decl]; uint32_t stride = vertexDecl.m_stride; - uint32_t offset = 0; - deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset); + + buffers[numStreams] = vb.m_ptr; + strides[numStreams] = stride; + offsets[numStreams] = draw.m_stream[idx].m_startVertex * stride; + decls[numStreams] = &vertexDecl; + + numVertices = bx::uint32_min(UINT32_MAX == draw.m_numVertices + ? vb.m_size/stride + : draw.m_numVertices + , numVertices + ); + } + + currentState.m_numVertices = numVertices; + + if (0 < numStreams) + { + deviceCtx->IASetVertexBuffers(0, numStreams, buffers, strides, offsets); if (isValid(draw.m_instanceDataBuffer) ) { const VertexBufferD3D11& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; uint32_t instStride = draw.m_instanceDataStride; - deviceCtx->IASetVertexBuffers(1, 1, &inst.m_ptr, &instStride, &draw.m_instanceDataOffset); - setInputLayout(vertexDecl, m_program[programIdx], draw.m_instanceDataStride/16); + deviceCtx->IASetVertexBuffers(numStreams, 1, &inst.m_ptr, &instStride, &draw.m_instanceDataOffset); + setInputLayout(numStreams, decls, m_program[programIdx], draw.m_instanceDataStride/16); } else { - deviceCtx->IASetVertexBuffers(1, 1, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero); - setInputLayout(vertexDecl, m_program[programIdx], 0); + deviceCtx->IASetVertexBuffers(numStreams, 1, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero); + setInputLayout(numStreams, decls, m_program[programIdx], 0); } } else @@ -6014,7 +6316,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); currentState.m_indexBuffer = draw.m_indexBuffer; uint16_t handle = draw.m_indexBuffer.idx; - if (invalidHandle != handle) + if (kInvalidHandle != handle) { const IndexBufferD3D11& ib = m_indexBuffers[handle]; deviceCtx->IASetIndexBuffer(ib.m_ptr @@ -6030,15 +6332,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (0 != currentState.m_streamMask) { - uint32_t numVertices = draw.m_numVertices; - if (UINT32_MAX == numVertices) - { - const VertexBufferD3D11& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; - numVertices = vb.m_size/vertexDecl.m_stride; - } - + uint32_t numVertices = currentState.m_numVertices; uint32_t numIndices = 0; uint32_t numPrimsSubmitted = 0; uint32_t numInstances = 0; @@ -6100,7 +6394,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->DrawIndexedInstanced(numIndices , draw.m_numInstances , 0 - , draw.m_stream[0].m_startVertex + , 0 , 0 ); } @@ -6108,7 +6402,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { deviceCtx->DrawIndexed(numIndices , 0 - , draw.m_stream[0].m_startVertex + , 0 ); } } @@ -6124,7 +6418,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->DrawIndexedInstanced(numIndices , draw.m_numInstances , draw.m_startIndex - , draw.m_stream[0].m_startVertex + , 0 , 0 ); } @@ -6132,7 +6426,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { deviceCtx->DrawIndexed(numIndices , draw.m_startIndex - , draw.m_stream[0].m_startVertex + , 0 ); } } @@ -6147,14 +6441,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { deviceCtx->DrawInstanced(numVertices , draw.m_numInstances - , draw.m_stream[0].m_startVertex + , 0 , 0 ); } else { deviceCtx->Draw(numVertices - , draw.m_stream[0].m_startVertex + , 0 ); } } @@ -6186,7 +6480,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); invalidateCompute(); } - if (0 < _render->m_num) + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); + + if (0 < _render->m_numRenderItems) { if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) { @@ -6197,24 +6493,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); capture(); captureElapsed += bx::getHPCounter(); - BGFX_GPU_PROFILER_END(); - BGFX_PROFILER_END(); + profiler.end(); } } PIX_ENDEVENT(); - BGFX_GPU_PROFILER_END(); - int64_t now = bx::getHPCounter(); - elapsed += now; - - static int64_t last = now; - - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = last; - - int64_t frameTime = now - last; - last = now; + int64_t timeEnd = bx::getHPCounter(); + int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; @@ -6225,31 +6511,32 @@ BX_PRAGMA_DIAGNOSTIC_POP(); static double maxGpuElapsed = 0.0f; double elapsedGpuMs = 0.0; - if (m_timerQuerySupport) + if (UINT32_MAX != frameQueryIdx) { - m_gpuTimer.end(); + m_gpuTimer.end(frameQueryIdx); - do - { - double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency); - elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs; - maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; - } - while (m_gpuTimer.get() ); + const TimerQueryD3D11::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + double toGpuMs = 1000.0 / double(result.m_frequency); + elapsedGpuMs = (result.m_end - result.m_begin) * toGpuMs; + maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; - maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1); + maxGpuLatency = bx::uint32_imax(maxGpuLatency, result.m_pending-1); } const int64_t timerFreq = bx::getHPFrequency(); - perfStats.cpuTimeEnd = now; + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeEnd; perfStats.cpuTimerFreq = timerFreq; - perfStats.gpuTimeBegin = m_gpuTimer.m_begin; - perfStats.gpuTimeEnd = m_gpuTimer.m_end; - perfStats.gpuTimerFreq = m_gpuTimer.m_frequency; + const TimerQueryD3D11::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + perfStats.gpuTimeBegin = result.m_begin; + perfStats.gpuTimeEnd = result.m_end; + perfStats.gpuTimerFreq = result.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; perfStats.maxGpuLatency = maxGpuLatency; + m_nvapi.getMemoryInfo(perfStats.gpuMemoryUsed, perfStats.gpuMemoryMax); if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { @@ -6258,12 +6545,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; - static int64_t next = now; + static int64_t next = timeEnd; - if (now >= next) + if (timeEnd >= next) { - next = now + timerFreq; - double freq = double(bx::getHPFrequency() ); + next = timeEnd + timerFreq; + + double freq = double(timerFreq); double toMs = 1000.0/freq; tvm.clear(); @@ -6320,9 +6608,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); , !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' ' ); - double elapsedCpuMs = double(elapsed)*toMs; + double elapsedCpuMs = double(frameTime)*toMs; tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] %c GPU %7.4f [ms] (latency %d) " - , _render->m_num + , _render->m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs @@ -6350,7 +6638,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); - tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); +// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); @@ -6397,12 +6685,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } /* namespace d3d11 */ } // namespace bgfx -#undef BGFX_GPU_PROFILER_BIND -#undef BGFX_GPU_PROFILER_UNBIND -#undef BGFX_GPU_PROFILER_BEGIN -#undef BGFX_GPU_PROFILER_BEGIN_DYNAMIC -#undef BGFX_GPU_PROFILER_END - #else namespace bgfx { namespace d3d11 diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 852a69e11c0..699352d98e5 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -6,7 +6,8 @@ #ifndef BGFX_RENDERER_D3D11_H_HEADER_GUARD #define BGFX_RENDERER_D3D11_H_HEADER_GUARD -#define USE_D3D11_DYNAMIC_LIB BX_PLATFORM_WINDOWS +#define USE_D3D11_DYNAMIC_LIB BX_PLATFORM_WINDOWS +#define USE_D3D11_STAGING_BUFFER 0 #if !USE_D3D11_DYNAMIC_LIB # undef BGFX_CONFIG_DEBUG_PIX @@ -35,6 +36,7 @@ BX_PRAGMA_DIAGNOSTIC_POP() #include "hmd.h" #include "hmd_openvr.h" #include "debug_renderdoc.h" +#include "nvapi.h" #ifndef D3DCOLOR_ARGB # define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) ) @@ -64,6 +66,9 @@ namespace bgfx { namespace d3d11 { BufferD3D11() : m_ptr(NULL) +#if USE_D3D11_STAGING_BUFFER + , m_staging(NULL) +#endif // USE_D3D11_STAGING_BUFFER , m_srv(NULL) , m_uav(NULL) , m_flags(BGFX_BUFFER_NONE) @@ -82,11 +87,18 @@ namespace bgfx { namespace d3d11 m_dynamic = false; } +#if USE_D3D11_STAGING_BUFFER + DX_RELEASE(m_staging, 0); +#endif // USE_D3D11_STAGING_BUFFER + DX_RELEASE(m_srv, 0); DX_RELEASE(m_uav, 0); } ID3D11Buffer* m_ptr; +#if USE_D3D11_STAGING_BUFFER + ID3D11Buffer* m_staging; +#endif // USE_D3D11_STAGING_BUFFER ID3D11ShaderResourceView* m_srv; ID3D11UnorderedAccessView* m_uav; uint32_t m_size; @@ -154,7 +166,7 @@ namespace bgfx { namespace d3d11 ID3D11ComputeShader* m_computeShader; ID3D11PixelShader* m_pixelShader; ID3D11VertexShader* m_vertexShader; - IUnknown* m_ptr; + ID3D11DeviceChild* m_ptr; }; const Memory* m_code; ID3D11Buffer* m_buffer; @@ -233,6 +245,7 @@ namespace bgfx { namespace d3d11 void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]); void resolve() const; TextureHandle getHandle() const; + DXGI_FORMAT getSrvFormat() const; union { @@ -300,29 +313,44 @@ namespace bgfx { namespace d3d11 struct TimerQueryD3D11 { TimerQueryD3D11() - : m_control(BX_COUNTOF(m_frame) ) + : m_control(BX_COUNTOF(m_query) ) { } void postReset(); void preReset(); - void begin(); - void end(); - bool get(); + uint32_t begin(uint32_t _resultIdx); + void end(uint32_t _idx); + bool update(); - struct Frame + struct Query { ID3D11Query* m_disjoint; ID3D11Query* m_begin; ID3D11Query* m_end; + uint32_t m_resultIdx; + bool m_ready; + }; + + struct Result + { + void reset() + { + m_begin = 0; + m_end = 0; + m_frequency = 1; + m_pending = 0; + } + + uint64_t m_begin; + uint64_t m_end; + uint64_t m_frequency; + uint32_t m_pending; }; - uint64_t m_begin; - uint64_t m_end; - uint64_t m_elapsed; - uint64_t m_frequency; + Result m_result[BGFX_CONFIG_MAX_VIEWS+1]; - Frame m_frame[4]; + Query m_query[BGFX_CONFIG_MAX_VIEWS*4]; bx::RingBufferControl m_control; }; diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp index cf001166b4c..c38ad43a7d0 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.cpp +++ b/3rdparty/bgfx/src/renderer_d3d12.cpp @@ -10,7 +10,8 @@ namespace bgfx { namespace d3d12 { - static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][256]; + static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; + static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; struct PrimInfo { @@ -239,7 +240,7 @@ namespace bgfx { namespace d3d12 { DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA4 { DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB5A1 { DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB10A2 - { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R11G11B10F + { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG11B10F { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // UnknownDepth { DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_UNKNOWN }, // D16 { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24 @@ -260,6 +261,8 @@ namespace bgfx { namespace d3d12 { "BITANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, { "COLOR", 1, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 2, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 3, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, { "BLENDINDICES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, { "BLENDWEIGHT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, @@ -432,6 +435,46 @@ namespace bgfx { namespace d3d12 return createCommittedResource(_device, _heapProperty, &resourceDesc, NULL); } + inline bool isLost(HRESULT _hr) + { + return false + || _hr == DXGI_ERROR_DEVICE_REMOVED + || _hr == DXGI_ERROR_DEVICE_HUNG + || _hr == DXGI_ERROR_DEVICE_RESET + || _hr == DXGI_ERROR_DRIVER_INTERNAL_ERROR + || _hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE + ; + } + + static const char* getLostReason(HRESULT _hr) + { + switch (_hr) + { + // The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. + case DXGI_ERROR_DEVICE_REMOVED: return "DXGI_ERROR_DEVICE_REMOVED"; + + // The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application. + case DXGI_ERROR_DEVICE_HUNG: return "DXGI_ERROR_DEVICE_HUNG"; + + // The GPU will not respond to more commands, most likely because some other application submitted invalid commands. + // The calling application should re-create the device and continue. + case DXGI_ERROR_DEVICE_RESET: return "DXGI_ERROR_DEVICE_RESET"; + + // An internal issue prevented the driver from carrying out the specified operation. The driver's state is probably + // suspect, and the application should not continue. + case DXGI_ERROR_DRIVER_INTERNAL_ERROR: return "DXGI_ERROR_DRIVER_INTERNAL_ERROR"; + + // A resource is not available at the time of the call, but may become available later. + case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE: return "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE"; + + case S_OK: return "S_OK"; + + default: break; + } + + return "Unknown HRESULT?"; + } + BX_NO_INLINE void setDebugObjectName(ID3D12Object* _object, const char* _format, ...) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_OBJECT_NAME) ) @@ -459,6 +502,42 @@ namespace bgfx { namespace d3d12 static PFN_CREATE_EVENT_EX_A CreateEventExA; #endif // USE_D3D12_DYNAMIC_LIB + inline D3D12_CPU_DESCRIPTOR_HANDLE getCPUHandleHeapStart(ID3D12DescriptorHeap* _heap) + { +#if BX_COMPILER_MSVC + return _heap->GetCPUDescriptorHandleForHeapStart(); +#else + D3D12_CPU_DESCRIPTOR_HANDLE handle; + typedef void (WINAPI ID3D12DescriptorHeap::*PFN_GET_CPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(D3D12_CPU_DESCRIPTOR_HANDLE *); + (_heap->*(PFN_GET_CPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(&ID3D12DescriptorHeap::GetCPUDescriptorHandleForHeapStart) )(&handle); + return handle; +#endif // BX_COMPILER_MSVC + } + + inline D3D12_GPU_DESCRIPTOR_HANDLE getGPUHandleHeapStart(ID3D12DescriptorHeap* _heap) + { +#if BX_COMPILER_MSVC + return _heap->GetGPUDescriptorHandleForHeapStart(); +#else + D3D12_GPU_DESCRIPTOR_HANDLE handle; + typedef void (WINAPI ID3D12DescriptorHeap::*PFN_GET_GPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(D3D12_GPU_DESCRIPTOR_HANDLE *); + (_heap->*(PFN_GET_GPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(&ID3D12DescriptorHeap::GetGPUDescriptorHandleForHeapStart) )(&handle); + return handle; +#endif // BX_COMPILER_MSVC + } + + inline D3D12_RESOURCE_DESC getResourceDesc(ID3D12Resource* _resource) + { +#if BX_COMPILER_MSVC + return _resource->GetDesc(); +#else + typedef void (STDMETHODCALLTYPE ID3D12Resource::*PFN_GET_GET_DESC)(D3D12_RESOURCE_DESC*); + D3D12_RESOURCE_DESC desc; + (_resource->*(PFN_GET_GET_DESC)(&ID3D12Resource::GetDesc))(&desc); + return desc; +#endif // BX_COMPILER_MSVC + } + struct RendererContextD3D12 : public RendererContextI { RendererContextD3D12() @@ -467,6 +546,7 @@ namespace bgfx { namespace d3d12 , m_renderdocdll(NULL) , m_featureLevel(D3D_FEATURE_LEVEL(0) ) , m_wireframe(false) + , m_lost(false) , m_maxAnisotropy(1) , m_depthClamp(false) , m_fsChanges(0) @@ -499,32 +579,33 @@ namespace bgfx { namespace d3d12 LUID luid; m_renderdocdll = loadRenderDoc(); + setGraphicsDebuggerPresent(NULL != m_renderdocdll); - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); #if USE_D3D12_DYNAMIC_LIB m_kernel32dll = bx::dlopen("kernel32.dll"); - BX_WARN(NULL != m_kernel32dll, "Failed to load kernel32.dll."); if (NULL == m_kernel32dll) { + BX_TRACE("Init error: Failed to load kernel32.dll."); goto error; } CreateEventExA = (PFN_CREATE_EVENT_EX_A)bx::dlsym(m_kernel32dll, "CreateEventExA"); - BX_WARN(NULL != CreateEventExA, "Function CreateEventExA not found."); if (NULL == CreateEventExA) { + BX_TRACE("Init error: Function CreateEventExA not found."); goto error; } errorState = ErrorState::LoadedKernel32; m_d3d12dll = bx::dlopen("d3d12.dll"); - BX_WARN(NULL != m_d3d12dll, "Failed to load d3d12.dll."); if (NULL == m_d3d12dll) { + BX_TRACE("Init error: Failed to load d3d12.dll."); goto error; } @@ -543,22 +624,23 @@ namespace bgfx { namespace d3d12 || NULL == D3D12GetDebugInterface || NULL == D3D12SerializeRootSignature) { + BX_TRACE("Init error: Function not found."); goto error; } m_dxgidll = bx::dlopen("dxgi.dll"); - BX_WARN(NULL != m_dxgidll, "Failed to load dxgi.dll."); if (NULL == m_dxgidll) { + BX_TRACE("Init error: Failed to load dxgi.dll."); goto error; } CreateDXGIFactory1 = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgidll, "CreateDXGIFactory1"); - BX_WARN(NULL != CreateDXGIFactory1, "Function CreateDXGIFactory1 not found."); if (NULL == CreateDXGIFactory1) { + BX_TRACE("Init error: Function CreateDXGIFactory1 not found."); goto error; } #endif // USE_D3D12_DYNAMIC_LIB @@ -573,10 +655,10 @@ namespace bgfx { namespace d3d12 hr = S_OK; m_factory = NULL; #endif // BX_PLATFORM_* - BX_WARN(SUCCEEDED(hr), "Unable to create DXGI factory."); if (FAILED(hr) ) { + BX_TRACE("Init error: Unable to create DXGI factory."); goto error; } @@ -629,7 +711,7 @@ namespace bgfx { namespace d3d12 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != strstr(description, "PerfHUD") ) + && 0 != bx::strFind(description, "PerfHUD") ) { m_adapter = adapter; m_driverType = D3D_DRIVER_TYPE_REFERENCE; @@ -678,14 +760,19 @@ namespace bgfx { namespace d3d12 if (FAILED(hr) ) { - BX_TRACE("Unable to create Direct3D12 device."); + BX_TRACE("Init error: Unable to create Direct3D12 device."); goto error; } if (NULL != m_factory) { bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); - luid = m_device->GetAdapterLuid(); +// NOTICE: +// LUID STDMETHODCALLTYPE ID3D12Device::GetAdapterLuid() has a different behaviour in gcc , +// because gcc64 returns small struct in RAX, but the microsoft implemention of ID3D12Device::GetAdapterLuid() in d3d12.dll +// pass the struct LUID's address as the second parameter. + typedef void (STDMETHODCALLTYPE ID3D12Device::*ID3D12Device_GetAdapterLuid_f)(LUID *); + (m_device->*(ID3D12Device_GetAdapterLuid_f)(&ID3D12Device::GetAdapterLuid))(&luid); #if BX_PLATFORM_WINDOWS IDXGIAdapter3* adapter; #else @@ -743,7 +830,7 @@ namespace bgfx { namespace d3d12 if (FAILED(hr) ) { - BX_TRACE("Unable to query IDXGIDevice1 interface 0x%08x.", hr); + BX_TRACE("Init error: Unable to query IDXGIDevice1 interface 0x%08x.", hr); goto error; } @@ -751,7 +838,7 @@ namespace bgfx { namespace d3d12 if (FAILED(hr) ) { - BX_TRACE("DXGIDevice1::GetAdapter failed 0x%08x.", hr); + BX_TRACE("Init error: DXGIDevice1::GetAdapter failed 0x%08x.", hr); goto error; } @@ -759,7 +846,7 @@ namespace bgfx { namespace d3d12 if (FAILED(hr) ) { - BX_TRACE("IDXGIAdapter::GetParent failed 0x%08x.", hr); + BX_TRACE("Init error: IDXGIAdapter::GetParent failed 0x%08x.", hr); goto error; } } @@ -784,7 +871,7 @@ namespace bgfx { namespace d3d12 DX_RELEASE(m_adapter, 1); if (FAILED(hr) ) { - BX_TRACE("Unable to create Direct3D11 device."); + BX_TRACE("Init error: Unable to create Direct3D11 device."); goto error; } @@ -864,7 +951,7 @@ namespace bgfx { namespace d3d12 #endif // BX_PLATFORM_* if (FAILED(hr) ) { - BX_TRACE("Failed to create swap chain."); + BX_TRACE("Init error: Failed to create swap chain."); goto error; } } @@ -1014,7 +1101,7 @@ namespace bgfx { namespace d3d12 { uint16_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE; - const DXGI_FORMAT fmt = isDepth(TextureFormat::Enum(ii) ) + const DXGI_FORMAT fmt = bimg::isDepth(bimg::TextureFormat::Enum(ii) ) ? s_textureFormat[ii].m_fmtDsv : s_textureFormat[ii].m_fmt ; @@ -1154,6 +1241,13 @@ namespace bgfx { namespace d3d12 g_caps.formats[ii] = support; } + // Init reserved part of view name. + for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) + { + bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + 1, "%3d ", ii); + mbstowcs(s_viewNameW[ii], s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED); + } + postReset(); m_batch.create(4<<10); @@ -1250,29 +1344,25 @@ namespace bgfx { namespace d3d12 #endif // USE_D3D12_DYNAMIC_LIB } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { return RendererType::Direct3D12; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { return BGFX_RENDERER_DIRECT3D12_NAME; } - static bool isLost(HRESULT _hr) + bool isDeviceRemoved() override { - return DXGI_ERROR_DEVICE_REMOVED == _hr - || DXGI_ERROR_DEVICE_HUNG == _hr - || DXGI_ERROR_DEVICE_RESET == _hr - || DXGI_ERROR_DRIVER_INTERNAL_ERROR == _hr - || DXGI_ERROR_NOT_CURRENTLY_AVAILABLE == _hr - ; + return m_lost; } - void flip(HMD& /*_hmd*/) BX_OVERRIDE + void flip(HMD& /*_hmd*/) override { - if (NULL != m_swapChain) + if (NULL != m_swapChain + && !m_lost) { int64_t start = bx::getHPCounter(); @@ -1293,124 +1383,122 @@ namespace bgfx { namespace d3d12 int64_t now = bx::getHPCounter(); m_presentElapsed = now - start; - if (FAILED(hr) - && isLost(hr) ) - { - ++m_lost; - BGFX_FATAL(10 > m_lost, bgfx::Fatal::DeviceLost, "Device is lost. FAILED 0x%08x", hr); - } - else - { - m_lost = 0; - } + m_lost = isLost(hr); + BGFX_FATAL(!m_lost + , bgfx::Fatal::DeviceLost + , "Device is lost. FAILED 0x%08x %s (%s)" + , hr + , getLostReason(hr) + , DXGI_ERROR_DEVICE_REMOVED == hr ? getLostReason(m_device->GetDeviceRemovedReason() ) : "no info" + ); } } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags, false); } - void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override { VertexDecl& decl = m_vertexDecls[_handle.idx]; bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } - void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_size, NULL, _flags, false); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_indexBuffers[_handle.idx].update(m_commandList, _offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { VertexDeclHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_vertexBuffers[_handle.idx].update(m_commandList, _offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE + void createShader(ShaderHandle _handle, Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } - void destroyShader(ShaderHandle _handle) BX_OVERRIDE + void destroyShader(ShaderHandle _handle) override { m_shaders[_handle.idx].destroy(); } - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE + void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL); } - void destroyProgram(ProgramHandle _handle) BX_OVERRIDE + void destroyProgram(ProgramHandle _handle) override { m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE + void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); } - void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE + void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override { } - void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE + void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override { m_textures[_handle.idx].update(m_commandList, _side, _mip, _rect, _z, _depth, _pitch, _mem); } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { } - void readTexture(TextureHandle _handle, void* _data, uint8_t _mip ) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip ) override { const TextureD3D12& texture = m_textures[_handle.idx]; - D3D12_RESOURCE_DESC desc = texture.m_ptr->GetDesc(); + D3D12_RESOURCE_DESC desc = getResourceDesc(texture.m_ptr); D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout; uint32_t numRows; @@ -1448,7 +1536,7 @@ namespace bgfx { namespace d3d12 uint8_t* src; readback->Map(0, NULL, (void**)&src); - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; uint32_t dstPitch = srcWidth*bpp/8; @@ -1467,7 +1555,7 @@ namespace bgfx { namespace d3d12 DX_RELEASE(readback, 0); } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override { TextureD3D12& texture = m_textures[_handle.idx]; @@ -1495,35 +1583,35 @@ namespace bgfx { namespace d3d12 release(mem); } - void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override { BX_UNUSED(_handle, _ptr); } - uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + uintptr_t getInternal(TextureHandle _handle) override { BX_UNUSED(_handle); return 0; } - void destroyTexture(TextureHandle _handle) BX_OVERRIDE + void destroyTexture(TextureHandle _handle) override { m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) override { m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); } - void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle _handle) override { uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); if (UINT16_MAX != denseIdx) @@ -1538,7 +1626,7 @@ namespace bgfx { namespace d3d12 } } - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE + void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override { if (NULL != m_uniforms[_handle.idx]) { @@ -1552,14 +1640,14 @@ namespace bgfx { namespace d3d12 m_uniformReg.add(_handle, _name, data); } - void destroyUniform(UniformHandle _handle) BX_OVERRIDE + void destroyUniform(UniformHandle _handle) override { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; m_uniformReg.remove(_handle); } - void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { BX_UNUSED(_handle); @@ -1567,7 +1655,7 @@ namespace bgfx { namespace d3d12 m_cmd.finish(m_backBufferColorFence[idx]); ID3D12Resource* backBuffer = m_backBufferColor[idx]; - D3D12_RESOURCE_DESC desc = backBuffer->GetDesc(); + D3D12_RESOURCE_DESC desc = getResourceDesc(backBuffer); const uint32_t width = (uint32_t)desc.Width; const uint32_t height = (uint32_t)desc.Height; @@ -1606,17 +1694,18 @@ namespace bgfx { namespace d3d12 void* data; readback->Map(0, NULL, (void**)&data); - imageSwizzleBgra8( + bimg::imageSwizzleBgra8( data + , layout.Footprint.RowPitch , width , height - , (uint32_t)pitch , data + , layout.Footprint.RowPitch ); g_callback->screenShot(_filePath , width , height - , (uint32_t)pitch + , layout.Footprint.RowPitch , data , (uint32_t)total , false @@ -1626,27 +1715,59 @@ namespace bgfx { namespace d3d12 DX_RELEASE(readback, 0); } - void updateViewName(uint8_t /*_id*/, const char* /*_name*/) BX_OVERRIDE + void updateViewName(ViewId _id, const char* _name) override { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + mbstowcs(&s_viewNameW[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] + , _name + , BX_COUNTOF(s_viewNameW[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + ); + } + + bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] + , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + , _name + ); } - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE + void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override { bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* /*_marker*/, uint32_t /*_size*/) BX_OVERRIDE + void setMarker(const char* /*_marker*/, uint32_t /*_size*/) override { } - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override { m_occlusionQuery.invalidate(_handle); } - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE; + virtual void setName(Handle _handle, const char* _name) override + { + switch (_handle.type) + { + case Handle::Shader: +// setDebugObjectName(m_shaders[_handle.idx].m_ptr, _name); + break; + + case Handle::Texture: + setDebugObjectName(m_textures[_handle.idx].m_ptr, _name); + break; + + default: + BX_CHECK(false, "Invalid handle type?! %d", _handle.type); + break; + } + } + + void submitBlit(BlitState& _bs, uint16_t _view); - void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE + void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; + + void blitSetup(TextVideoMemBlitter& _blitter) override { const uint32_t width = getBufferWidth(); const uint32_t height = getBufferHeight(); @@ -1686,7 +1807,7 @@ namespace bgfx { namespace d3d12 m_commandList->SetGraphicsRootSignature(m_rootSignature); float proj[16]; - bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); + bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, false); PredefinedUniform& predefined = m_program[_blitter.m_program.idx].m_predefined[0]; uint8_t flags = predefined.m_type; @@ -1730,7 +1851,7 @@ namespace bgfx { namespace d3d12 m_commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); } - void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override { const uint32_t numVertices = _numIndices*4/6; if (0 < numVertices) @@ -1775,7 +1896,7 @@ namespace bgfx { namespace d3d12 for (uint32_t ii = 0, num = m_scd.BufferCount; ii < num; ++ii) { - D3D12_CPU_DESCRIPTOR_HANDLE handle = m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE handle = getCPUHandleHeapStart(m_rtvDescriptorHeap); handle.ptr += ii * rtvDescriptorSize; DX_CHECK(m_swapChain->GetBuffer(ii , IID_ID3D12Resource @@ -1815,7 +1936,7 @@ namespace bgfx { namespace d3d12 m_device->CreateDepthStencilView(m_backBufferDepthStencil , &dsvDesc - , m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart() + , getCPUHandleHeapStart(m_dsvDescriptorHeap) ); for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) @@ -1864,7 +1985,7 @@ data.NumQualityLevels = 0; } } - void updateResolution(const Resolution& _resolution) + bool updateResolution(const Resolution& _resolution) { if (!!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) ) { @@ -1946,6 +2067,8 @@ data.NumQualityLevels = 0; postReset(); } + + return false; } void setShaderUniform(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs) @@ -2024,10 +2147,10 @@ data.NumQualityLevels = 0; if (!isValid(_fbh) ) { - m_rtvHandle = m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + m_rtvHandle = getCPUHandleHeapStart(m_rtvDescriptorHeap); uint32_t rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); m_rtvHandle.ptr += m_backBufferColorIdx * rtvDescriptorSize; - m_dsvHandle = m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + m_dsvHandle = getCPUHandleHeapStart(m_dsvDescriptorHeap); m_currentColor = &m_rtvHandle; m_currentDepthStencil = &m_dsvHandle; @@ -2039,7 +2162,7 @@ data.NumQualityLevels = 0; if (0 < frameBuffer.m_num) { - D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = getCPUHandleHeapStart(m_rtvDescriptorHeap); uint32_t rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); m_rtvHandle.ptr = rtvDescriptor.ptr + (BX_COUNTOF(m_backBufferColor) + _fbh.idx * BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) * rtvDescriptorSize; m_currentColor = &m_rtvHandle; @@ -2051,7 +2174,7 @@ data.NumQualityLevels = 0; if (isValid(frameBuffer.m_depth) ) { - D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(m_dsvDescriptorHeap); uint32_t dsvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); m_dsvHandle.ptr = dsvDescriptor.ptr + (1 + _fbh.idx) * dsvDescriptorSize; m_currentDepthStencil = &m_dsvHandle; @@ -2243,7 +2366,7 @@ data.NumQualityLevels = 0; for (jj = 0; jj < num; ++jj) { curr = &_vertexElements[jj]; - if (0 == bx::strncmp(curr->SemanticName, "TEXCOORD") + if (0 == bx::strCmp(curr->SemanticName, "TEXCOORD") && curr->SemanticIndex == index) { break; @@ -2831,7 +2954,6 @@ data.NumQualityLevels = 0; #endif // BX_PLATFORM_WINDOWS int64_t m_presentElapsed; - uint16_t m_lost; uint16_t m_numWindows; FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS]; @@ -2860,6 +2982,7 @@ data.NumQualityLevels = 0; Resolution m_resolution; bool m_wireframe; + bool m_lost; #if BX_PLATFORM_WINDOWS DXGI_SWAP_CHAIN_DESC m_scd; @@ -2920,7 +3043,6 @@ data.NumQualityLevels = 0; m_size = _size; ID3D12Device* device = s_renderD3D12->m_device; - m_incrementSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); D3D12_DESCRIPTOR_HEAP_DESC desc; @@ -2951,8 +3073,8 @@ data.NumQualityLevels = 0; void ScratchBufferD3D12::reset(D3D12_GPU_DESCRIPTOR_HANDLE& _gpuHandle) { m_pos = 0; - m_cpuHandle = m_heap->GetCPUDescriptorHandleForHeapStart(); - m_gpuHandle = m_heap->GetGPUDescriptorHandleForHeapStart(); + m_cpuHandle = getCPUHandleHeapStart(m_heap); + m_gpuHandle = getGPUHandleHeapStart(m_heap); _gpuHandle = m_gpuHandle; } @@ -3108,8 +3230,8 @@ data.NumQualityLevels = 0; , (void**)&m_heap ) ); - m_cpuHandle = m_heap->GetCPUDescriptorHandleForHeapStart(); - m_gpuHandle = m_heap->GetGPUDescriptorHandleForHeapStart(); + m_cpuHandle = getCPUHandleHeapStart(m_heap); + m_gpuHandle = getGPUHandleHeapStart(m_heap); } void DescriptorAllocatorD3D12::destroy() @@ -3156,7 +3278,7 @@ data.NumQualityLevels = 0; sd.AddressU = s_textureAddress[(flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; sd.AddressV = s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; sd.AddressW = s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; - sd.MipLODBias = 0.0f; + sd.MipLODBias = float(BGFX_CONFIG_MIP_LOD_BIAS); sd.MaxAnisotropy = maxAnisotropy; sd.ComparisonFunc = 0 == cmpFunc ? D3D12_COMPARISON_FUNC_NEVER : s_cmpFunc[cmpFunc]; @@ -3673,7 +3795,7 @@ data.NumQualityLevels = 0; }; static const UavFormat s_uavFormat[] = - { // BGFX_BUFFER_COMPUTE_TYPE_UINT, BGFX_BUFFER_COMPUTE_TYPE_INT, BGFX_BUFFER_COMPUTE_TYPE_FLOAT + { // BGFX_BUFFER_COMPUTE_TYPE_INT, BGFX_BUFFER_COMPUTE_TYPE_UINT, BGFX_BUFFER_COMPUTE_TYPE_FLOAT { { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, 0 }, // ignored { { DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN }, 1 }, // BGFX_BUFFER_COMPUTE_FORMAT_8x1 { { DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN }, 2 }, // BGFX_BUFFER_COMPUTE_FORMAT_8x2 @@ -3929,7 +4051,7 @@ data.NumQualityLevels = 0; } } - uint16_t shaderSize; + uint32_t shaderSize; bx::read(&reader, shaderSize); const void* code = reader.getDataPtr(); @@ -3968,14 +4090,14 @@ data.NumQualityLevels = 0; void TextureD3D12::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) { - ImageContainer imageContainer; + bimg::ImageContainer imageContainer; - if (imageParse(imageContainer, _mem->data, _mem->size) ) + if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) { uint8_t numMips = imageContainer.m_numMips; const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) ); numMips -= startLod; - const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) ); + const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(imageContainer.m_format); const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod); const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod); const uint16_t numLayers = imageContainer.m_numLayers; @@ -3987,7 +4109,7 @@ data.NumQualityLevels = 0; m_requestedFormat = uint8_t(imageContainer.m_format); m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); const bool convert = m_textureFormat != m_requestedFormat; - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); if (imageContainer.m_cubeMap) { @@ -4009,7 +4131,7 @@ data.NumQualityLevels = 0; uint32_t kk = 0; - const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) ); + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) ); const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); uint32_t blockWidth = 1; uint32_t blockHeight = 1; @@ -4051,8 +4173,8 @@ data.NumQualityLevels = 0; height = bx::uint32_max(blockHeight, height); depth = bx::uint32_max(1, depth); - ImageMip mip; - if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) + bimg::ImageMip mip; + if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { if (convert) { @@ -4060,7 +4182,7 @@ data.NumQualityLevels = 0; const uint32_t slice = bx::strideAlign(pitch * height, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice); - imageDecodeToBgra8(temp + bimg::imageDecodeToBgra8(temp , mip.m_data , mip.m_width , mip.m_height @@ -4078,7 +4200,7 @@ data.NumQualityLevels = 0; uint32_t slice = bx::strideAlign( (mip.m_height/blockInfo.blockHeight)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice); - imageCopy(temp + bimg::imageCopy(temp , mip.m_height/blockInfo.blockHeight , (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize , mip.m_data @@ -4096,7 +4218,7 @@ data.NumQualityLevels = 0; const uint32_t slice = bx::strideAlign(pitch * mip.m_height, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice); - imageCopy(temp + bimg::imageCopy(temp , mip.m_height , mip.m_width*mip.m_bpp / 8 , mip.m_data @@ -4109,11 +4231,6 @@ data.NumQualityLevels = 0; totalSize += slice; } - if (swizzle) - { -// imageSwizzleBgra8(temp, width, height, mip.m_width*4, data); - } - srd[kk].SlicePitch = mip.m_height*srd[kk].RowPitch; ++kk; } @@ -4160,11 +4277,10 @@ data.NumQualityLevels = 0; resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; resourceDesc.Flags = D3D12_RESOURCE_FLAG_NONE; resourceDesc.DepthOrArraySize = numSides; - D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; D3D12_CLEAR_VALUE* clearValue = NULL; - if (isDepth(TextureFormat::Enum(m_textureFormat) ) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) ) ) { resourceDesc.Format = s_textureFormat[m_textureFormat].m_fmt; resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; @@ -4364,11 +4480,11 @@ data.NumQualityLevels = 0; setState(_commandList, D3D12_RESOURCE_STATE_COPY_DEST); const uint32_t subres = _mip + (_side * m_numMips); - const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t rectpitch = _rect.m_width*bpp/8; const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; - D3D12_RESOURCE_DESC desc = m_ptr->GetDesc(); + D3D12_RESOURCE_DESC desc = getResourceDesc(m_ptr); desc.Height = _rect.m_height; @@ -4458,14 +4574,14 @@ data.NumQualityLevels = 0; { ID3D12Device* device = s_renderD3D12->m_device; - D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = s_renderD3D12->m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_rtvDescriptorHeap); uint32_t rtvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); uint32_t fbhIdx = (uint32_t)(this - s_renderD3D12->m_frameBuffers); rtvDescriptor.ptr += (BX_COUNTOF(s_renderD3D12->m_backBufferColor) + fbhIdx * BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) * rtvDescriptorSize; m_width = 0; m_height = 0; - m_depth.idx = bgfx::invalidHandle; + m_depth.idx = bgfx::kInvalidHandle; m_num = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { @@ -4476,20 +4592,20 @@ data.NumQualityLevels = 0; if (0 == m_width) { - D3D12_RESOURCE_DESC desc = texture.m_ptr->GetDesc(); + D3D12_RESOURCE_DESC desc = getResourceDesc(texture.m_ptr); m_width = uint32_t(desc.Width); m_height = uint32_t(desc.Height); } - if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) { BX_CHECK(!isValid(m_depth), ""); m_depth = handle; - D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = s_renderD3D12->m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_dsvDescriptorHeap); uint32_t dsvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); dsvDescriptor.ptr += (1 + fbhIdx) * dsvDescriptorSize; - const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(texture.m_textureFormat) ); + const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(texture.m_textureFormat) ); BX_UNUSED(blockInfo); D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc; @@ -4525,7 +4641,7 @@ data.NumQualityLevels = 0; { m_numTh = 0; - m_depth.idx = bgfx::invalidHandle; + m_depth.idx = bgfx::kInvalidHandle; uint16_t denseIdx = m_denseIdx; m_denseIdx = UINT16_MAX; @@ -4545,7 +4661,7 @@ data.NumQualityLevels = 0; if (BGFX_CLEAR_COLOR & _clear.m_flags && 0 != m_num) { - D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = s_renderD3D12->m_rtvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_rtvDescriptorHeap); uint32_t rtvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); rtvDescriptor.ptr += (BX_COUNTOF(s_renderD3D12->m_backBufferColor) + fbhIdx * BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) * rtvDescriptorSize; @@ -4589,7 +4705,7 @@ data.NumQualityLevels = 0; if (isValid(m_depth) && (BGFX_CLEAR_DEPTH|BGFX_CLEAR_STENCIL) & _clear.m_flags) { - D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = s_renderD3D12->m_dsvDescriptorHeap->GetCPUDescriptorHandleForHeapStart(); + D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_dsvDescriptorHeap); uint32_t dsvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); dsvDescriptor.ptr += (1 + fbhIdx) * dsvDescriptorSize; @@ -4614,20 +4730,28 @@ data.NumQualityLevels = 0; queryHeapDesc.NodeMask = 1; queryHeapDesc.Type = D3D12_QUERY_HEAP_TYPE_TIMESTAMP; DX_CHECK(s_renderD3D12->m_device->CreateQueryHeap(&queryHeapDesc - , IID_ID3D12QueryHeap - , (void**)&m_queryHeap - ) ); + , IID_ID3D12QueryHeap + , (void**)&m_queryHeap + ) ); const uint32_t size = queryHeapDesc.Count*sizeof(uint64_t); m_readback = createCommittedResource(s_renderD3D12->m_device - , HeapProperty::ReadBack - , size - ); + , HeapProperty::ReadBack + , size + ); DX_CHECK(s_renderD3D12->m_cmd.m_commandQueue->GetTimestampFrequency(&m_frequency) ); D3D12_RANGE range = { 0, size }; - m_readback->Map(0, &range, (void**)&m_result); + m_readback->Map(0, &range, (void**)&m_queryResult); + + for (uint32_t ii = 0; ii < BX_COUNTOF(m_result); ++ii) + { + Result& result = m_result[ii]; + result.reset(); + } + + m_control.reset(); } void TimerQueryD3D12::shutdown() @@ -4639,50 +4763,86 @@ data.NumQualityLevels = 0; DX_RELEASE(m_readback, 0); } - void TimerQueryD3D12::begin(ID3D12GraphicsCommandList* _commandList) + uint32_t TimerQueryD3D12::begin(uint32_t _resultIdx) { - BX_UNUSED(_commandList); while (0 == m_control.reserve(1) ) { m_control.consume(1); } - uint32_t offset = m_control.m_current * 2 + 0; - _commandList->EndQuery(m_queryHeap + Result& result = m_result[_resultIdx]; + ++result.m_pending; + + const uint32_t idx = m_control.m_current; + Query& query = m_query[idx]; + query.m_resultIdx = _resultIdx; + query.m_ready = false; + + ID3D12GraphicsCommandList* commandList = s_renderD3D12->m_commandList; + + uint32_t offset = idx * 2 + 0; + commandList->EndQuery(m_queryHeap , D3D12_QUERY_TYPE_TIMESTAMP , offset ); + + m_control.commit(1); + + return idx; } - void TimerQueryD3D12::end(ID3D12GraphicsCommandList* _commandList) + void TimerQueryD3D12::end(uint32_t _idx) { - BX_UNUSED(_commandList); - uint32_t offset = m_control.m_current * 2; - _commandList->EndQuery(m_queryHeap + Query& query = m_query[_idx]; + query.m_ready = true; + query.m_fence = s_renderD3D12->m_cmd.m_currentFence - 1; + uint32_t offset = _idx * 2; + + ID3D12GraphicsCommandList* commandList = s_renderD3D12->m_commandList; + + commandList->EndQuery(m_queryHeap , D3D12_QUERY_TYPE_TIMESTAMP , offset + 1 ); - _commandList->ResolveQueryData(m_queryHeap + commandList->ResolveQueryData(m_queryHeap , D3D12_QUERY_TYPE_TIMESTAMP , offset , 2 , m_readback , offset * sizeof(uint64_t) ); - m_control.commit(1); + + while (update() ) + { + } } - bool TimerQueryD3D12::get() + bool TimerQueryD3D12::update() { if (0 != m_control.available() ) { - uint32_t offset = m_control.m_read * 2; - m_begin = m_result[offset+0]; - m_end = m_result[offset+1]; - m_elapsed = m_end - m_begin; + uint32_t idx = m_control.m_read; + Query& query = m_query[idx]; + + if (!query.m_ready) + { + return false; + } + + if (query.m_fence > s_renderD3D12->m_cmd.m_completedFence) + { + return false; + } m_control.consume(1); + Result& result = m_result[query.m_resultIdx]; + --result.m_pending; + + uint32_t offset = idx * 2; + result.m_begin = m_queryResult[offset+0]; + result.m_end = m_queryResult[offset+1]; + return true; } @@ -4764,7 +4924,7 @@ data.NumQualityLevels = 0; OcclusionQueryHandle& handle = m_handle[(m_control.m_read + ii) % size]; if (handle.idx == _handle.idx) { - handle.idx = bgfx::invalidHandle; + handle.idx = bgfx::kInvalidHandle; } } } @@ -4775,16 +4935,99 @@ data.NumQualityLevels = 0; uint16_t m_samplerStateIdx; }; + void RendererContextD3D12::submitBlit(BlitState& _bs, uint16_t _view) + { + while (_bs.hasItem(_view) ) + { + const BlitItem& blit = _bs.advance(); + + const TextureD3D12& src = m_textures[blit.m_src.idx]; + const TextureD3D12& dst = m_textures[blit.m_dst.idx]; + + uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; + uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; + uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; + uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; + uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; + uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; + uint32_t width = bx::uint32_min(srcWidth, dstWidth); + uint32_t height = bx::uint32_min(srcHeight, dstHeight); + uint32_t depth = bx::uint32_min(srcDepth, dstDepth); + + if (TextureD3D12::Texture3D == src.m_type) + { + D3D12_BOX box; + box.left = blit.m_srcX; + box.top = blit.m_srcY; + box.front = blit.m_srcZ; + box.right = blit.m_srcX + width; + box.bottom = blit.m_srcY + height;; + box.back = blit.m_srcZ + bx::uint32_imax(1, depth); + + D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{}} }; + D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{}} }; + m_commandList->CopyTextureRegion(&dstLocation + , blit.m_dstX + , blit.m_dstY + , blit.m_dstZ + , &srcLocation + , &box + ); + } + else + { + D3D12_BOX box; + box.left = blit.m_srcX; + box.top = blit.m_srcY; + box.front = 0; + box.right = blit.m_srcX + width; + box.bottom = blit.m_srcY + height;; + box.back = 1; + + const uint32_t srcZ = TextureD3D12::TextureCube == src.m_type + ? blit.m_srcZ + : 0 + ; + const uint32_t dstZ = TextureD3D12::TextureCube == dst.m_type + ? blit.m_dstZ + : 0 + ; + + D3D12_TEXTURE_COPY_LOCATION dstLocation; + dstLocation.pResource = dst.m_ptr; + dstLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + dstLocation.SubresourceIndex = dstZ*dst.m_numMips+blit.m_dstMip; + D3D12_TEXTURE_COPY_LOCATION srcLocation; + srcLocation.pResource = src.m_ptr; + srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + srcLocation.SubresourceIndex = srcZ*src.m_numMips+blit.m_srcMip; + + bool depthStencil = bimg::isDepth(bimg::TextureFormat::Enum(src.m_textureFormat) ); + m_commandList->CopyTextureRegion(&dstLocation + , blit.m_dstX + , blit.m_dstY + , 0 + , &srcLocation + , depthStencil ? NULL : &box + ); + } + } + } + void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter) { // PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit"); - updateResolution(_render->m_resolution); + if (m_lost + || updateResolution(_render->m_resolution) ) + { + return; + } - int64_t elapsed = -bx::getHPCounter(); + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; - m_gpuTimer.begin(m_commandList); + uint32_t frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS); if (0 < _render->m_iboffset) { @@ -4805,6 +5048,9 @@ data.NumQualityLevels = 0; currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); + RenderBind currentBind; + currentBind.clear(); + _render->m_hmdInitialized = false; const bool hmdEnabled = false; @@ -4814,8 +5060,8 @@ data.NumQualityLevels = 0; // bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); // setDebugWireframe(wireframe); - uint16_t currentSamplerStateIdx = invalidHandle; - uint16_t currentProgramIdx = invalidHandle; + uint16_t currentSamplerStateIdx = kInvalidHandle; + uint16_t currentProgramIdx = kInvalidHandle; uint32_t currentBindHash = 0; bool hasPredefined = false; bool commandListChanged = false; @@ -4824,10 +5070,7 @@ data.NumQualityLevels = 0; uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; - BlitKey blitKey; - blitKey.decode(_render->m_blitKeys[0]); - uint16_t numBlitItems = _render->m_numBlitItems; - uint16_t blitItem = 0; + BlitState bs(_render); uint32_t blendFactor = 0; @@ -4847,6 +5090,12 @@ data.NumQualityLevels = 0; uint32_t statsNumIndices = 0; uint32_t statsKeyType[2] = {}; + Profiler<TimerQueryD3D12> profiler( + _render + , m_gpuTimer + , s_viewName + ); + #if BX_PLATFORM_WINDOWS m_backBufferColorIdx = m_swapChain->GetCurrentBackBufferIndex(); #endif // BX_PLATFORM_WINDOWS @@ -4876,9 +5125,9 @@ data.NumQualityLevels = 0; // uint8_t eye = 0; // uint8_t restartState = 0; - viewState.m_rect = _render->m_rect[0]; + viewState.m_rect = _render->m_view[0].m_rect; - int32_t numItems = _render->m_num; + int32_t numItems = _render->m_numRenderItems; for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;) { const uint64_t encodedKey = _render->m_sortKeys[item]; @@ -4890,7 +5139,9 @@ data.NumQualityLevels = 0; || item == numItems ; - const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ]; + const uint32_t itemIdx = _render->m_sortValues[item]; + const RenderItem& renderItem = _render->m_renderItem[itemIdx]; + const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; ++item; if (viewChanged) @@ -4900,16 +5151,23 @@ data.NumQualityLevels = 0; view = key.m_view; currentPso = NULL; - currentSamplerStateIdx = invalidHandle; - currentProgramIdx = invalidHandle; + currentSamplerStateIdx = kInvalidHandle; + currentProgramIdx = kInvalidHandle; hasPredefined = false; - fbh = _render->m_fb[view]; + fbh = _render->m_view[view].m_fbh; setFrameBuffer(fbh); - viewState.m_rect = _render->m_rect[view]; - const Rect& rect = _render->m_rect[view]; - const Rect& scissorRect = _render->m_scissor[view]; + if (item > 1) + { + profiler.end(); + } + + profiler.begin(view); + + viewState.m_rect = _render->m_view[view].m_rect; + const Rect& rect = _render->m_view[view].m_rect; + const Rect& scissorRect = _render->m_view[view].m_scissor; viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : rect; @@ -4930,7 +5188,7 @@ data.NumQualityLevels = 0; m_commandList->RSSetScissorRects(1, &rc); restoreScissor = false; - Clear& clr = _render->m_clear[view]; + Clear& clr = _render->m_view[view].m_clear; if (BGFX_CLEAR_NONE != clr.m_flags) { Rect clearRect = rect; @@ -4940,83 +5198,7 @@ data.NumQualityLevels = 0; prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update. - const uint8_t blitView = SortKey::decodeView(encodedKey); - for (; blitItem < numBlitItems && blitKey.m_view <= blitView; blitItem++) - { - const BlitItem& blit = _render->m_blitItem[blitItem]; - blitKey.decode(_render->m_blitKeys[blitItem+1]); - - const TextureD3D12& src = m_textures[blit.m_src.idx]; - const TextureD3D12& dst = m_textures[blit.m_dst.idx]; - - uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; - uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; - uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; - uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; - uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; - uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; - uint32_t width = bx::uint32_min(srcWidth, dstWidth); - uint32_t height = bx::uint32_min(srcHeight, dstHeight); - uint32_t depth = bx::uint32_min(srcDepth, dstDepth); - - if (TextureD3D12::Texture3D == src.m_type) - { - D3D12_BOX box; - box.left = blit.m_srcX; - box.top = blit.m_srcY; - box.front = blit.m_srcZ; - box.right = blit.m_srcX + width; - box.bottom = blit.m_srcY + height;; - box.back = blit.m_srcZ + bx::uint32_imax(1, depth); - - D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{}} }; - D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{}} }; - m_commandList->CopyTextureRegion(&dstLocation - , blit.m_dstX - , blit.m_dstY - , blit.m_dstZ - , &srcLocation - , &box - ); - } - else - { - D3D12_BOX box; - box.left = blit.m_srcX; - box.top = blit.m_srcY; - box.front = 0; - box.right = blit.m_srcX + width; - box.bottom = blit.m_srcY + height;; - box.back = 1; - - const uint32_t srcZ = TextureD3D12::TextureCube == src.m_type - ? blit.m_srcZ - : 0 - ; - const uint32_t dstZ = TextureD3D12::TextureCube == dst.m_type - ? blit.m_dstZ - : 0 - ; - - D3D12_TEXTURE_COPY_LOCATION dstLocation; - dstLocation.pResource = dst.m_ptr; - dstLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; - dstLocation.SubresourceIndex = dstZ*dst.m_numMips+blit.m_dstMip; - D3D12_TEXTURE_COPY_LOCATION srcLocation; - srcLocation.pResource = src.m_ptr; - srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; - srcLocation.SubresourceIndex = srcZ*src.m_numMips+blit.m_srcMip; - - bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) ); - m_commandList->CopyTextureRegion(&dstLocation - , blit.m_dstX - , blit.m_dstY - , 0 - , &srcLocation - , depthStencil ? NULL : &box - ); - } - } + submitBlit(bs, view); } if (isCompute) @@ -5043,7 +5225,7 @@ data.NumQualityLevels = 0; currentBindHash = 0; } - uint32_t bindHash = bx::hashMurmur2A(compute.m_bind, sizeof(compute.m_bind) ); + uint32_t bindHash = bx::hash<bx::HashMurmur2A>(renderBind.m_bind, sizeof(renderBind.m_bind) ); if (currentBindHash != bindHash) { currentBindHash = bindHash; @@ -5056,12 +5238,13 @@ data.NumQualityLevels = 0; for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) { - const Binding& bind = compute.m_bind[ii]; - if (invalidHandle != bind.m_idx) + const Binding& bind = renderBind.m_bind[ii]; + if (kInvalidHandle != bind.m_idx) { switch (bind.m_type) { case Binding::Image: + case Binding::Texture: { TextureD3D12& texture = m_textures[bind.m_idx]; @@ -5132,10 +5315,10 @@ data.NumQualityLevels = 0; } bool constantsChanged = false; - if (compute.m_constBegin < compute.m_constEnd + if (compute.m_uniformBegin < compute.m_uniformEnd || currentProgramIdx != key.m_program) { - rendererUpdateUniforms(this, _render->m_uniformBuffer, compute.m_constBegin, compute.m_constEnd); + rendererUpdateUniforms(this, _render->m_uniformBuffer[compute.m_uniformIdx], compute.m_uniformBegin, compute.m_uniformEnd); currentProgramIdx = key.m_program; ProgramD3D12& program = m_program[currentProgramIdx]; @@ -5234,8 +5417,8 @@ data.NumQualityLevels = 0; currentPso = NULL; currentBindHash = 0; - currentSamplerStateIdx = invalidHandle; - currentProgramIdx = invalidHandle; + currentSamplerStateIdx = kInvalidHandle; + currentProgramIdx = kInvalidHandle; currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; @@ -5243,11 +5426,13 @@ data.NumQualityLevels = 0; currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; + currentBind.clear(); + const uint64_t pt = newFlags&BGFX_STATE_PT_MASK; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); } - rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); + rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); if (isValid(draw.m_stream[0].m_handle) ) { @@ -5271,7 +5456,7 @@ data.NumQualityLevels = 0; ); uint16_t scissor = draw.m_scissor; - uint32_t bindHash = bx::hashMurmur2A(draw.m_bind, sizeof(draw.m_bind) ); + uint32_t bindHash = bx::hash<bx::HashMurmur2A>(renderBind.m_bind, sizeof(renderBind.m_bind) ); if (currentBindHash != bindHash || 0 != changedStencil || (hasFactor && blendFactor != draw.m_rgba) @@ -5297,17 +5482,47 @@ data.NumQualityLevels = 0; srvHandle[0].ptr = 0; for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) { - const Binding& bind = draw.m_bind[stage]; - if (invalidHandle != bind.m_idx) + const Binding& bind = renderBind.m_bind[stage]; + if (kInvalidHandle != bind.m_idx) { - TextureD3D12& texture = m_textures[bind.m_idx]; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - scratchBuffer.allocSrv(srvHandle[stage], texture); - samplerFlags[stage] = (0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & bind.m_un.m_draw.m_textureFlags) - ? bind.m_un.m_draw.m_textureFlags - : texture.m_flags - ) & (BGFX_TEXTURE_SAMPLER_BITS_MASK|BGFX_TEXTURE_BORDER_COLOR_MASK) - ; + switch (bind.m_type) + { + case Binding::Texture: + { + TextureD3D12& texture = m_textures[bind.m_idx]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + scratchBuffer.allocSrv(srvHandle[stage], texture); + samplerFlags[stage] = (0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & bind.m_un.m_draw.m_textureFlags) + ? bind.m_un.m_draw.m_textureFlags + : texture.m_flags + ) & (BGFX_TEXTURE_SAMPLER_BITS_MASK | BGFX_TEXTURE_BORDER_COLOR_MASK) + ; + } + break; + + case Binding::IndexBuffer: + case Binding::VertexBuffer: + { + BufferD3D12& buffer = Binding::IndexBuffer == bind.m_type + ? m_indexBuffers[bind.m_idx] + : m_vertexBuffers[bind.m_idx] + ; + + if (Access::Read != bind.m_un.m_compute.m_access) + { + // The api functions prevent binding with Access::Write, + // but might as well allow it in here for future-proofing + buffer.setState(m_commandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); + scratchBuffer.allocUav(srvHandle[stage], buffer); + } + else + { + buffer.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + scratchBuffer.allocSrv(srvHandle[stage], buffer); + } + } + break; + } } else { @@ -5397,7 +5612,7 @@ data.NumQualityLevels = 0; { restoreScissor = true; Rect scissorRect; - scissorRect.setIntersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]); + scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); if (scissorRect.isZeroArea() ) { continue; @@ -5419,7 +5634,7 @@ data.NumQualityLevels = 0; } bool constantsChanged = false; - if (draw.m_constBegin < draw.m_constEnd + if (draw.m_uniformBegin < draw.m_uniformEnd || currentProgramIdx != key.m_program || BGFX_STATE_ALPHA_REF_MASK & changedFlags) { @@ -5471,18 +5686,27 @@ data.NumQualityLevels = 0; } m_batch.end(m_commandList); - } + kick(); - int64_t now = bx::getHPCounter(); - elapsed += now; + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); + + if (0 < _render->m_numRenderItems) + { + if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) + { +// deviceCtx->Flush(); + } - static int64_t last = now; +// captureElapsed = -bx::getHPCounter(); +// capture(); +// captureElapsed += bx::getHPCounter(); - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = last; + profiler.end(); + } + } - int64_t frameTime = now - last; - last = now; + int64_t timeEnd = bx::getHPCounter(); + int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; @@ -5498,28 +5722,44 @@ data.NumQualityLevels = 0; presentMin = bx::int64_min(presentMin, m_presentElapsed); presentMax = bx::int64_max(presentMax, m_presentElapsed); - m_gpuTimer.end(m_commandList); - - do + if (UINT32_MAX != frameQueryIdx) { + m_gpuTimer.end(frameQueryIdx); + + const TimerQueryD3D12::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency); - elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs; + elapsedGpuMs = (result.m_end - result.m_begin) * toGpuMs; maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; + + maxGpuLatency = bx::uint32_imax(maxGpuLatency, result.m_pending-1); } - while (m_gpuTimer.get() ); maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1); const int64_t timerFreq = bx::getHPFrequency(); - perfStats.cpuTimeEnd = now; + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeEnd; perfStats.cpuTimerFreq = timerFreq; - perfStats.gpuTimeBegin = m_gpuTimer.m_begin; - perfStats.gpuTimeEnd = m_gpuTimer.m_end; + const TimerQueryD3D12::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + perfStats.gpuTimeBegin = result.m_begin; + perfStats.gpuTimeEnd = result.m_end; perfStats.gpuTimerFreq = m_gpuTimer.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; perfStats.maxGpuLatency = maxGpuLatency; + perfStats.gpuMemoryMax = -INT64_MAX; + perfStats.gpuMemoryUsed = -INT64_MAX; + +#if BX_PLATFORM_WINDOWS + DXGI_QUERY_VIDEO_MEMORY_INFO vmi[2]; + DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &vmi[0]) ); + DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &vmi[1]) ); + + perfStats.gpuMemoryMax = int64_t(vmi[0].Budget); + perfStats.gpuMemoryUsed = int64_t(vmi[0].CurrentUsage); +#endif // BX_PLATFORM_WINDOWS if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { @@ -5528,12 +5768,13 @@ data.NumQualityLevels = 0; // m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; - static int64_t next = now; + static int64_t next = timeEnd; - if (now >= next) + if (timeEnd >= next) { - next = now + bx::getHPFrequency(); - double freq = double(bx::getHPFrequency() ); + next = timeEnd + timerFreq; + + double freq = double(timerFreq); double toMs = 1000.0 / freq; tvm.clear(); @@ -5570,10 +5811,6 @@ data.NumQualityLevels = 0; ); #if BX_PLATFORM_WINDOWS - DXGI_QUERY_VIDEO_MEMORY_INFO vmi[2]; - DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &vmi[0]) ); - DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &vmi[1]) ); - for (uint32_t ii = 0; ii < BX_COUNTOF(vmi); ++ii) { const DXGI_QUERY_VIDEO_MEMORY_INFO& memInfo = vmi[ii]; @@ -5625,9 +5862,9 @@ data.NumQualityLevels = 0; , !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' ' ); - double elapsedCpuMs = double(elapsed)*toMs; + double elapsedCpuMs = double(frameTime)*toMs; tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] " - , _render->m_num + , _render->m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs @@ -5661,7 +5898,7 @@ data.NumQualityLevels = 0; } tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); - tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); +// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); diff --git a/3rdparty/bgfx/src/renderer_d3d12.h b/3rdparty/bgfx/src/renderer_d3d12.h index 25de46c80bb..c658459f446 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.h +++ b/3rdparty/bgfx/src/renderer_d3d12.h @@ -306,7 +306,7 @@ namespace bgfx { namespace d3d12 , m_num(0) , m_numTh(0) { - m_depth.idx = bgfx::invalidHandle; + m_depth.idx = bgfx::kInvalidHandle; } void create(uint8_t _num, const Attachment* _attachment); @@ -449,24 +449,45 @@ namespace bgfx { namespace d3d12 struct TimerQueryD3D12 { TimerQueryD3D12() - : m_control(4) + : m_control(BX_COUNTOF(m_query) ) { } void init(); void shutdown(); - void begin(ID3D12GraphicsCommandList* _commandList); - void end(ID3D12GraphicsCommandList* _commandList); - bool get(); + uint32_t begin(uint32_t _resultIdx); + void end(uint32_t _idx); + bool update(); + + struct Query + { + uint32_t m_resultIdx; + bool m_ready; + uint64_t m_fence; + }; + + struct Result + { + void reset() + { + m_begin = 0; + m_end = 0; + m_pending = 0; + } + + uint64_t m_begin; + uint64_t m_end; + uint32_t m_pending; + }; - uint64_t m_begin; - uint64_t m_end; - uint64_t m_elapsed; uint64_t m_frequency; + Result m_result[BGFX_CONFIG_MAX_VIEWS+1]; + Query m_query[BGFX_CONFIG_MAX_VIEWS*4]; + ID3D12Resource* m_readback; ID3D12QueryHeap* m_queryHeap; - uint64_t* m_result; + uint64_t* m_queryResult; bx::RingBufferControl m_control; }; diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index 4f4267be9ad..7dd76c2cc46 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -7,6 +7,7 @@ #if BGFX_CONFIG_RENDERER_DIRECT3D9 # include "renderer_d3d9.h" +# include <bx/pixelformat.h> namespace bgfx { namespace d3d9 { @@ -237,7 +238,7 @@ namespace bgfx { namespace d3d9 { D3DFMT_A4R4G4B4 }, // RGBA4 { D3DFMT_A1R5G5B5 }, // RGB5A1 { D3DFMT_A2B10G10R10 }, // RGB10A2 - { D3DFMT_UNKNOWN }, // R11G11B10F + { D3DFMT_UNKNOWN }, // RG11B10F { D3DFMT_UNKNOWN }, // UnknownDepth { D3DFMT_D16 }, // D16 { D3DFMT_D24X8 }, // D24 @@ -275,6 +276,91 @@ namespace bgfx { namespace d3d9 static PFN_D3DPERF_BEGIN_EVENT D3DPERF_BeginEvent; static PFN_D3DPERF_END_EVENT D3DPERF_EndEvent; + static const D3DVERTEXELEMENT9 s_attrib[] = + { + { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, + { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, + { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 }, + { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0 }, + { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 }, + { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1 }, + { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 2 }, + { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 3 }, + { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0 }, + { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 0 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 4 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 5 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 6 }, + { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 7 }, + D3DDECL_END() + }; + BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1); + + static const uint8_t s_attribType[][4][2] = + { + { // Uint8 + { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, + { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, + { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, + { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, + }, + { // Uint10 + { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, + { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, + { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, + { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, + }, + { // Int16 + { D3DDECLTYPE_SHORT2, D3DDECLTYPE_SHORT2N }, + { D3DDECLTYPE_SHORT2, D3DDECLTYPE_SHORT2N }, + { D3DDECLTYPE_SHORT4, D3DDECLTYPE_SHORT4N }, + { D3DDECLTYPE_SHORT4, D3DDECLTYPE_SHORT4N }, + }, + { // Half + { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 }, + { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 }, + { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 }, + { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 }, + }, + { // Float + { D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT1 }, + { D3DDECLTYPE_FLOAT2, D3DDECLTYPE_FLOAT2 }, + { D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT3 }, + { D3DDECLTYPE_FLOAT4, D3DDECLTYPE_FLOAT4 }, + }, + }; + BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); + + static D3DVERTEXELEMENT9* fillVertexDecl(uint8_t _stream, D3DVERTEXELEMENT9* _out, const VertexDecl& _decl) + { + D3DVERTEXELEMENT9* elem = _out; + + for (uint32_t attr = 0; attr < Attrib::Count; ++attr) + { + if (UINT16_MAX != _decl.m_attributes[attr]) + { + uint8_t num; + AttribType::Enum type; + bool normalized; + bool asInt; + _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt); + + bx::memCopy(elem, &s_attrib[attr], sizeof(D3DVERTEXELEMENT9) ); + + elem->Stream = _stream; + elem->Type = s_attribType[type][num-1][normalized]; + elem->Offset = _decl.m_offset[attr]; + ++elem; + } + } + + return elem; + } + inline bool isLost(HRESULT _hr) { return false @@ -328,7 +414,7 @@ namespace bgfx { namespace d3d9 ErrorState::Enum errorState = ErrorState::Default; - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); @@ -345,7 +431,7 @@ namespace bgfx { namespace d3d9 m_params.EnableAutoDepthStencil = TRUE; m_params.AutoDepthStencilFormat = D3DFMT_D24S8; m_params.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; -#if BX_PLATFORM_WINDOWS + m_params.FullScreen_RefreshRateInHz = 0; m_params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; m_params.SwapEffect = D3DSWAPEFFECT_DISCARD; @@ -361,12 +447,14 @@ namespace bgfx { namespace d3d9 if (NULL == m_d3d9dll) { - BX_TRACE("Failed to load d3d9.dll."); + BX_TRACE("Init error: Failed to load d3d9.dll."); goto error; } errorState = ErrorState::LoadedD3D9; + m_nvapi.init(); + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker"); @@ -409,7 +497,7 @@ namespace bgfx { namespace d3d9 if (NULL == Direct3DCreate9) { - BX_TRACE("Function Direct3DCreate9 not found."); + BX_TRACE("Init error: Function Direct3DCreate9 not found."); goto error; } @@ -419,7 +507,7 @@ namespace bgfx { namespace d3d9 if (NULL == m_d3d9) { - BX_TRACE("Unable to create Direct3D."); + BX_TRACE("Init error: Unable to create Direct3D."); goto error; } @@ -463,7 +551,7 @@ namespace bgfx { namespace d3d9 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != strstr(desc.Description, "PerfHUD") ) + && 0 != bx::strFind(desc.Description, "PerfHUD") ) { m_adapter = ii; m_deviceType = D3DDEVTYPE_REF; @@ -518,7 +606,7 @@ namespace bgfx { namespace d3d9 if (NULL == m_device) { - BX_TRACE("Unable to create Direct3D9 device."); + BX_TRACE("Init error: Unable to create Direct3D9 device."); goto error; } @@ -568,6 +656,7 @@ namespace bgfx { namespace d3d9 || (D3DPTEXTURECAPS_ALPHA & m_caps.TextureCaps) != D3DPTEXTURECAPS_ALPHA || !(m_caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(2, 1) ) ) { + BX_TRACE("Init error: Min spec not satisfied."); goto error; } @@ -577,6 +666,7 @@ namespace bgfx { namespace d3d9 BX_TRACE("Max fragment shader 3.0 instr. slots: %d", m_caps.MaxPixelShader30InstructionSlots); BX_TRACE("Num simultaneous render targets: %d", m_caps.NumSimultaneousRTs); BX_TRACE("Max vertex index: %d", m_caps.MaxVertexIndex); + BX_TRACE("Max streams: %d", m_caps.MaxStreams); g_caps.supported |= ( 0 | BGFX_CAPS_TEXTURE_3D @@ -590,12 +680,14 @@ namespace bgfx { namespace d3d9 | BGFX_CAPS_TEXTURE_READ_BACK | (m_occlusionQuerySupport ? BGFX_CAPS_OCCLUSION_QUERY : 0) ); - g_caps.limits.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) ); - m_caps.NumSimultaneousRTs = uint8_t(bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); - g_caps.limits.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs); + m_caps.NumSimultaneousRTs = bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS); + m_caps.MaxStreams = bx::uint32_min(m_caps.MaxStreams, BGFX_CONFIG_MAX_VERTEX_STREAMS); + m_caps.MaxAnisotropy = bx::uint32_max(m_caps.MaxAnisotropy, 1); - m_caps.MaxAnisotropy = bx::uint32_max(m_caps.MaxAnisotropy, 1); + g_caps.limits.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) ); + g_caps.limits.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs); + g_caps.limits.maxVertexStreams = uint8_t(m_caps.MaxStreams); if (BX_ENABLED(BGFX_CONFIG_RENDERER_USE_EXTENSIONS) ) { @@ -700,7 +792,7 @@ namespace bgfx { namespace d3d9 support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter , m_deviceType , adapterFormat - , isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET + , bimg::isDepth(bimg::TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET , D3DRTYPE_TEXTURE , s_textureFormat[ii].m_fmt ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE; @@ -716,7 +808,7 @@ namespace bgfx { namespace d3d9 support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter , m_deviceType , adapterFormat - , isDepth(TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET + , bimg::isDepth(bimg::TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET , D3DRTYPE_TEXTURE , s_textureFormat[ii].m_fmt ) ) ? BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN : BGFX_CAPS_FORMAT_TEXTURE_NONE; @@ -726,37 +818,6 @@ namespace bgfx { namespace d3d9 m_fmtDepth = D3DFMT_D24S8; -#elif BX_PLATFORM_XBOX360 - m_params.PresentationInterval = D3DPRESENT_INTERVAL_ONE; - m_params.DisableAutoBackBuffer = FALSE; - m_params.DisableAutoFrontBuffer = FALSE; - m_params.FrontBufferFormat = D3DFMT_X8R8G8B8; - m_params.FrontBufferColorSpace = D3DCOLORSPACE_RGB; - - m_d3d9 = Direct3DCreate9(D3D_SDK_VERSION); - BX_TRACE("Creating D3D9 %p", m_d3d9); - - XVIDEO_MODE videoMode; - XGetVideoMode(&videoMode); - if (!videoMode.fIsWideScreen) - { - m_params.Flags |= D3DPRESENTFLAG_NO_LETTERBOX; - } - - BX_TRACE("Creating device"); - DX_CHECK(m_d3d9->CreateDevice(m_adapter - , m_deviceType - , NULL - , D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES - , &m_params - , &m_device - ) ); - - BX_TRACE("Device %p", m_device); - - m_fmtDepth = D3DFMT_D24FS8; -#endif // BX_PLATFORM_WINDOWS - { IDirect3DSwapChain9* swapChain; DX_CHECK(m_device->GetSwapChain(0, &swapChain) ); @@ -820,10 +881,9 @@ namespace bgfx { namespace d3d9 DX_RELEASE(m_d3d9, 0); } -#if BX_PLATFORM_WINDOWS case ErrorState::LoadedD3D9: + m_nvapi.shutdown(); bx::dlclose(m_d3d9dll); -#endif // BX_PLATFORM_WINDOWS case ErrorState::Default: break; @@ -856,11 +916,6 @@ namespace bgfx { namespace d3d9 m_textures[ii].destroy(); } - for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexDecls); ++ii) - { - m_vertexDecls[ii].destroy(); - } - if (NULL != m_d3d9ex) { DX_RELEASE(m_deviceEx, 1); @@ -874,19 +929,18 @@ namespace bgfx { namespace d3d9 DX_RELEASE(m_d3d9, 0); } -#if BX_PLATFORM_WINDOWS + m_nvapi.shutdown(); bx::dlclose(m_d3d9dll); -#endif // BX_PLATFORM_WINDOWS m_initialized = false; } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { return RendererType::Direct3D9; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { if (NULL != m_d3d9ex) { @@ -896,110 +950,111 @@ namespace bgfx { namespace d3d9 return BGFX_RENDERER_DIRECT3D9_NAME; } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } - void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override { - m_vertexDecls[_handle.idx].create(_decl); + VertexDecl& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + dump(decl); } - void destroyVertexDecl(VertexDeclHandle _handle) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { - m_vertexDecls[_handle.idx].destroy(); } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t /*_flags*/) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t /*_flags*/) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle); } - void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t /*_flags*/) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t /*_flags*/) override { VertexDeclHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE + void createShader(ShaderHandle _handle, Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } - void destroyShader(ShaderHandle _handle) BX_OVERRIDE + void destroyShader(ShaderHandle _handle) override { m_shaders[_handle.idx].destroy(); } - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE + void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { m_program[_handle.idx].create(m_shaders[_vsh.idx], m_shaders[_fsh.idx]); } - void destroyProgram(ProgramHandle _handle) BX_OVERRIDE + void destroyProgram(ProgramHandle _handle) override { m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE + void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); } - void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) BX_OVERRIDE + void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) override { m_updateTexture = &m_textures[_handle.idx]; m_updateTexture->updateBegin(_side, _mip); } - void updateTexture(TextureHandle /*_handle*/, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE + void updateTexture(TextureHandle /*_handle*/, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override { m_updateTexture->update(_side, _mip, _rect, _z, _depth, _pitch, _mem); } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { m_updateTexture->updateEnd(); m_updateTexture = NULL; } - void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override { TextureD3D9& texture = m_textures[_handle.idx]; @@ -1015,7 +1070,7 @@ namespace bgfx { namespace d3d9 uint32_t srcPitch = lockedRect.Pitch; uint8_t* src = (uint8_t*)lockedRect.pBits; - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; uint32_t dstPitch = srcWidth*bpp/8; @@ -1032,7 +1087,7 @@ namespace bgfx { namespace d3d9 DX_CHECK(texture.m_texture2d->UnlockRect(_mip) ); } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override { TextureD3D9& texture = m_textures[_handle.idx]; @@ -1060,7 +1115,7 @@ namespace bgfx { namespace d3d9 release(mem); } - void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override { // Resource ref. counts might be messed up outside of bgfx. // Disabling ref. count check once texture is overridden. @@ -1068,7 +1123,7 @@ namespace bgfx { namespace d3d9 m_textures[_handle.idx].overrideInternal(_ptr); } - uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + uintptr_t getInternal(TextureHandle _handle) override { // Resource ref. counts might be messed up outside of bgfx. // Disabling ref. count check once texture is overridden. @@ -1076,24 +1131,24 @@ namespace bgfx { namespace d3d9 return uintptr_t(m_textures[_handle.idx].m_ptr); } - void destroyTexture(TextureHandle _handle) BX_OVERRIDE + void destroyTexture(TextureHandle _handle) override { m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) override { m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); } - void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle _handle) override { uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); if (UINT16_MAX != denseIdx) @@ -1108,7 +1163,7 @@ namespace bgfx { namespace d3d9 } } - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE + void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override { if (NULL != m_uniforms[_handle.idx]) { @@ -1122,16 +1177,15 @@ namespace bgfx { namespace d3d9 m_uniformReg.add(_handle, _name, data); } - void destroyUniform(UniformHandle _handle) BX_OVERRIDE + void destroyUniform(UniformHandle _handle) override { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; m_uniformReg.remove(_handle); } - void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { -#if BX_PLATFORM_WINDOWS IDirect3DSwapChain9* swapChain = isValid(_handle) ? m_frameBuffers[_handle.idx].m_swapChain : m_swapChain @@ -1195,12 +1249,9 @@ namespace bgfx { namespace d3d9 DX_CHECK(surface->UnlockRect() ); DX_RELEASE(surface, 0); -#else - BX_UNUSED(_handle, _filePath); -#endif // BX_PLATFORM_WINDOWS } - void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE + void updateViewName(ViewId _id, const char* _name) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { @@ -1210,18 +1261,18 @@ namespace bgfx { namespace d3d9 ); } - bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name + bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + , _name ); } - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE + void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override { bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE + void setMarker(const char* _marker, uint32_t _size) override { #if BGFX_CONFIG_DEBUG_PIX uint32_t size = _size*sizeof(wchar_t); @@ -1232,14 +1283,21 @@ namespace bgfx { namespace d3d9 BX_UNUSED(_marker, _size); } - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override { m_occlusionQuery.invalidate(_handle); } - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE; + virtual void setName(Handle _handle, const char* _name) override + { + BX_UNUSED(_handle, _name) + } + + void submitBlit(BlitState& _bs, uint16_t _view); - void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE + void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; + + void blitSetup(TextVideoMemBlitter& _blitter) override { uint32_t width = m_params.BackBufferWidth; uint32_t height = m_params.BackBufferHeight; @@ -1271,15 +1329,15 @@ namespace bgfx { namespace d3d9 DX_CHECK(device->SetPixelShader(program.m_fsh->m_pixelShader) ); VertexBufferD3D9& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; - VertexDeclD3D9& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; - DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) ); - DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) ); + VertexDecl& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; + DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_stride) ); + setInputLayout(vertexDecl, 0); IndexBufferD3D9& ib = m_indexBuffers[_blitter.m_ib->handle.idx]; DX_CHECK(device->SetIndices(ib.m_ptr) ); float proj[16]; - bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); + bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, false); PredefinedUniform& predefined = program.m_predefined[0]; uint8_t flags = predefined.m_type; @@ -1288,7 +1346,7 @@ namespace bgfx { namespace d3d9 m_textures[_blitter.m_texture.idx].commit(0, BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER, NULL); } - void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override { const uint32_t numVertices = _numIndices*4/6; if (0 < numVertices) @@ -1359,7 +1417,6 @@ namespace bgfx { namespace d3d9 m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); m_textVideoMem.clear(); -#if BX_PLATFORM_WINDOWS D3DDEVICE_CREATION_PARAMETERS dcp; DX_CHECK(m_device->GetCreationParameters(&dcp) ); @@ -1367,7 +1424,6 @@ namespace bgfx { namespace d3d9 DX_CHECK(m_d3d9->GetAdapterDisplayMode(dcp.AdapterOrdinal, &dm) ); m_params.BackBufferFormat = dm.Format; -#endif // BX_PLATFORM_WINDOWS m_params.BackBufferWidth = _resolution.m_width; m_params.BackBufferHeight = _resolution.m_height; @@ -1458,7 +1514,12 @@ namespace bgfx { namespace d3d9 m_flushQuery->GetData(NULL, 0, D3DGETDATA_FLUSH); } - void flip(HMD& /*_hmd*/) BX_OVERRIDE + bool isDeviceRemoved() override + { + return false; + } + + void flip(HMD& /*_hmd*/) override { if (NULL != m_swapChain) { @@ -1487,7 +1548,6 @@ namespace bgfx { namespace d3d9 hr = m_frameBuffers[m_windows[ii].idx].present(); } -#if BX_PLATFORM_WINDOWS if (isLost(hr) ) { do @@ -1509,7 +1569,6 @@ namespace bgfx { namespace d3d9 { BX_TRACE("Present failed with err 0x%08x.", hr); } -#endif // BX_PLATFORM_ } } } @@ -1519,6 +1578,7 @@ namespace bgfx { namespace d3d9 m_needPresent = false; invalidateSamplerState(); + m_inputLayoutCache.invalidate(); for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) { @@ -1985,7 +2045,7 @@ namespace bgfx { namespace d3d9 } VertexBufferD3D9& vb = m_vertexBuffers[_clearQuad.m_vb->handle.idx]; - VertexDeclD3D9& vertexDecl = m_vertexDecls[_clearQuad.m_vb->decl.idx]; + VertexDecl& vertexDecl = m_vertexDecls[_clearQuad.m_vb->decl.idx]; uint32_t stride = _clearQuad.m_decl.m_stride; { @@ -2055,7 +2115,7 @@ namespace bgfx { namespace d3d9 DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, stride) ); DX_CHECK(device->SetStreamSourceFreq(0, 1) ); DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); - DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) ); + setInputLayout(vertexDecl, 0); DX_CHECK(device->SetIndices(NULL) ); DX_CHECK(device->DrawPrimitive(D3DPT_TRIANGLESTRIP , 0 @@ -2064,9 +2124,55 @@ namespace bgfx { namespace d3d9 } } -#if BX_PLATFORM_WINDOWS + void setInputLayout(uint8_t _numStreams, const VertexDecl** _vertexDecls, uint16_t _numInstanceData) + { + bx::HashMurmur2A murmur; + murmur.begin(); + murmur.add(_numInstanceData); + for (uint8_t stream = 0; stream < _numStreams; ++stream) + { + murmur.add(_vertexDecls[stream]->m_hash); + } + uint64_t layoutHash = murmur.end(); + + IDirect3DVertexDeclaration9* layout = m_inputLayoutCache.find(layoutHash); + if (NULL == layout) + { + D3DVERTEXELEMENT9 vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; + D3DVERTEXELEMENT9* elem = vertexElements; + + for (uint8_t stream = 0; stream < _numStreams; ++stream) + { + elem = fillVertexDecl(stream, elem, *_vertexDecls[stream]); + } + + const D3DVERTEXELEMENT9 inst = { _numStreams, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }; + + for (uint8_t ii = 0; ii < _numInstanceData; ++ii) + { + bx::memCopy(elem, &inst, sizeof(D3DVERTEXELEMENT9) ); + elem->UsageIndex = uint8_t(7-ii); // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc. + elem->Offset = ii*16; + ++elem; + } + + bx::memCopy(elem, &s_attrib[Attrib::Count], sizeof(D3DVERTEXELEMENT9) ); + + DX_CHECK(m_device->CreateVertexDeclaration(vertexElements, &layout) ); + + m_inputLayoutCache.add(layoutHash, layout); + } + + DX_CHECK(m_device->SetVertexDeclaration(layout) ); + } + + void setInputLayout(const VertexDecl& _vertexDecl, uint16_t _numInstanceData) + { + const VertexDecl* decls[1] = { &_vertexDecl }; + setInputLayout(BX_COUNTOF(decls), decls, _numInstanceData); + } + D3DCAPS9 m_caps; -#endif // BX_PLATFORM_WINDOWS IDirect3D9Ex* m_d3d9ex; IDirect3DDevice9Ex* m_deviceEx; @@ -2094,6 +2200,7 @@ namespace bgfx { namespace d3d9 IDirect3DVertexDeclaration9* m_instanceDataDecls[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; void* m_d3d9dll; + NvApi m_nvapi; uint32_t m_adapter; D3DDEVTYPE m_deviceType; D3DPRESENT_PARAMETERS m_params; @@ -2116,7 +2223,7 @@ namespace bgfx { namespace d3d9 ShaderD3D9 m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramD3D9 m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureD3D9 m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexDeclD3D9 m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; FrameBufferD3D9 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; UniformRegistry m_uniformReg; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; @@ -2129,6 +2236,8 @@ namespace bgfx { namespace d3d9 uint8_t m_updateTextureSide; uint8_t m_updateTextureMip; + StateCacheT<IDirect3DVertexDeclaration9> m_inputLayoutCache; + TextVideoMem m_textVideoMem; FrameBufferHandle m_fbh; @@ -2159,15 +2268,15 @@ namespace bgfx { namespace d3d9 { m_size = _size; m_flags = _flags; - m_dynamic = NULL == _data; uint32_t usage = D3DUSAGE_WRITEONLY; D3DPOOL pool = s_renderD3D9->m_pool; - if (m_dynamic) + if (NULL == _data) { usage |= D3DUSAGE_DYNAMIC; pool = D3DPOOL_DEFAULT; + m_dynamic = (uint8_t*)BX_ALLOC(g_allocator, _size); } const D3DFORMAT format = 0 == (_flags & BGFX_BUFFER_INDEX32) @@ -2191,7 +2300,7 @@ namespace bgfx { namespace d3d9 void IndexBufferD3D9::preReset() { - if (m_dynamic) + if (NULL != m_dynamic) { DX_RELEASE(m_ptr, 0); } @@ -2199,7 +2308,7 @@ namespace bgfx { namespace d3d9 void IndexBufferD3D9::postReset() { - if (m_dynamic) + if (NULL != m_dynamic) { const D3DFORMAT format = 0 == (m_flags & BGFX_BUFFER_INDEX32) ? D3DFMT_INDEX16 @@ -2213,6 +2322,8 @@ namespace bgfx { namespace d3d9 , &m_ptr , NULL ) ); + + update(0, m_size, m_dynamic); } } @@ -2220,24 +2331,24 @@ namespace bgfx { namespace d3d9 { m_size = _size; m_decl = _declHandle; - m_dynamic = NULL == _data; uint32_t usage = D3DUSAGE_WRITEONLY; D3DPOOL pool = s_renderD3D9->m_pool; - if (m_dynamic) + if (NULL == _data) { usage |= D3DUSAGE_DYNAMIC; pool = D3DPOOL_DEFAULT; + m_dynamic = (uint8_t*)BX_ALLOC(g_allocator, _size); } DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size - , usage - , 0 - , pool - , &m_ptr - , NULL - ) ); + , usage + , 0 + , pool + , &m_ptr + , NULL + ) ); if (NULL != _data) { @@ -2247,7 +2358,7 @@ namespace bgfx { namespace d3d9 void VertexBufferD3D9::preReset() { - if (m_dynamic) + if (NULL != m_dynamic) { DX_RELEASE(m_ptr, 0); } @@ -2255,127 +2366,18 @@ namespace bgfx { namespace d3d9 void VertexBufferD3D9::postReset() { - if (m_dynamic) + if (NULL != m_dynamic) { DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size - , D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC - , 0 - , D3DPOOL_DEFAULT - , &m_ptr - , NULL - ) ); - } - } - - static const D3DVERTEXELEMENT9 s_attrib[] = - { - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 4 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 5 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 6 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 7 }, - D3DDECL_END() - }; - BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1); - - static const uint8_t s_attribType[][4][2] = - { - { // Uint8 - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - }, - { // Uint10 - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - }, - { // Int16 - { D3DDECLTYPE_SHORT2, D3DDECLTYPE_SHORT2N }, - { D3DDECLTYPE_SHORT2, D3DDECLTYPE_SHORT2N }, - { D3DDECLTYPE_SHORT4, D3DDECLTYPE_SHORT4N }, - { D3DDECLTYPE_SHORT4, D3DDECLTYPE_SHORT4N }, - }, - { // Half - { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 }, - { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 }, - { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 }, - { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 }, - }, - { // Float - { D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT1 }, - { D3DDECLTYPE_FLOAT2, D3DDECLTYPE_FLOAT2 }, - { D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT3 }, - { D3DDECLTYPE_FLOAT4, D3DDECLTYPE_FLOAT4 }, - }, - }; - BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - - static D3DVERTEXELEMENT9* fillVertexDecl(D3DVERTEXELEMENT9* _out, const VertexDecl& _decl) - { - D3DVERTEXELEMENT9* elem = _out; - - for (uint32_t attr = 0; attr < Attrib::Count; ++attr) - { - if (UINT16_MAX != _decl.m_attributes[attr]) - { - uint8_t num; - AttribType::Enum type; - bool normalized; - bool asInt; - _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt); - - bx::memCopy(elem, &s_attrib[attr], sizeof(D3DVERTEXELEMENT9) ); - - elem->Type = s_attribType[type][num-1][normalized]; - elem->Offset = _decl.m_offset[attr]; - ++elem; - } - } - - return elem; - } - - static IDirect3DVertexDeclaration9* createVertexDeclaration(const VertexDecl& _decl, uint16_t _numInstanceData) - { - D3DVERTEXELEMENT9 vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; - D3DVERTEXELEMENT9* elem = fillVertexDecl(vertexElements, _decl); - - const D3DVERTEXELEMENT9 inst = { 1, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }; + , D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC + , 0 + , D3DPOOL_DEFAULT + , &m_ptr + , NULL + ) ); - for (uint8_t ii = 0; ii < _numInstanceData; ++ii) - { - bx::memCopy(elem, &inst, sizeof(D3DVERTEXELEMENT9) ); - elem->UsageIndex = uint8_t(7-ii); // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc. - elem->Offset = ii*16; - ++elem; + update(0, m_size, m_dynamic); } - - bx::memCopy(elem, &s_attrib[Attrib::Count], sizeof(D3DVERTEXELEMENT9) ); - - IDirect3DVertexDeclaration9* ptr; - DX_CHECK(s_renderD3D9->m_device->CreateVertexDeclaration(vertexElements, &ptr) ); - return ptr; - } - - void VertexDeclD3D9::create(const VertexDecl& _decl) - { - bx::memCopy(&m_decl, &_decl, sizeof(VertexDecl) ); - dump(m_decl); - m_ptr = createVertexDeclaration(_decl, 0); } void ShaderD3D9::create(const Memory* _mem) @@ -2482,7 +2484,7 @@ namespace bgfx { namespace d3d9 } } - uint16_t shaderSize; + uint32_t shaderSize; bx::read(&reader, shaderSize); const DWORD* code = (const DWORD*)reader.getDataPtr(); @@ -2504,7 +2506,7 @@ namespace bgfx { namespace d3d9 void TextureD3D9::createTexture(uint32_t _width, uint32_t _height, uint8_t _numMips) { m_type = Texture2D; - const TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat; + const bimg::TextureFormat::Enum fmt = (bimg::TextureFormat::Enum)m_textureFormat; DWORD usage = 0; D3DPOOL pool = D3DPOOL_DEFAULT; @@ -2512,7 +2514,7 @@ namespace bgfx { namespace d3d9 const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); const bool blit = 0 != (m_flags&BGFX_TEXTURE_BLIT_DST); const bool readBack = 0 != (m_flags&BGFX_TEXTURE_READ_BACK); - if (isDepth(fmt) ) + if (bimg::isDepth(fmt) ) { usage = D3DUSAGE_DEPTHSTENCIL; } @@ -2543,7 +2545,7 @@ namespace bgfx { namespace d3d9 { const Msaa& msaa = s_msaa[msaaQuality]; - if (isDepth(fmt) ) + if (bimg::isDepth(fmt) ) { DX_CHECK(device->CreateDepthStencilSurface( m_width @@ -2615,7 +2617,7 @@ namespace bgfx { namespace d3d9 , _width , _height , _numMips - , getName(fmt) + , bimg::getName(fmt) ); } @@ -2667,13 +2669,13 @@ namespace bgfx { namespace d3d9 void TextureD3D9::createCubeTexture(uint32_t _width, uint8_t _numMips) { m_type = TextureCube; - const TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat; + const bimg::TextureFormat::Enum fmt = (bimg::TextureFormat::Enum)m_textureFormat; DWORD usage = 0; const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); const bool blit = 0 != (m_flags&BGFX_TEXTURE_BLIT_DST); - if (isDepth(fmt) ) + if (bimg::isDepth(fmt) ) { usage = D3DUSAGE_DEPTHSTENCIL; } @@ -2891,14 +2893,14 @@ namespace bgfx { namespace d3d9 void TextureD3D9::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) { - ImageContainer imageContainer; + bimg::ImageContainer imageContainer; - if (imageParse(imageContainer, _mem->data, _mem->size) ) + if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) { uint8_t numMips = imageContainer.m_numMips; const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) ); numMips -= startLod; - const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) ); + const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(imageContainer.m_format) ); const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod); const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod); @@ -2911,7 +2913,7 @@ namespace bgfx { namespace d3d9 m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); const bool convert = m_textureFormat != m_requestedFormat; - uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); if (imageContainer.m_cubeMap) { @@ -2926,11 +2928,6 @@ namespace bgfx { namespace d3d9 createTexture(textureWidth, textureHeight, numMips); } - if (imageContainer.m_srgb) - { - m_flags |= BGFX_TEXTURE_SRGB; - } - BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s." , this - s_renderD3D9->m_textures , getName( (TextureFormat::Enum)m_textureFormat) @@ -2950,8 +2947,8 @@ namespace bgfx { namespace d3d9 // bytes. If actual mip size is used it causes memory corruption. // http://www.aras-p.info/texts/D3D9GPUHacks.html#3dc const bool useMipSize = true - && imageContainer.m_format != TextureFormat::BC4 - && imageContainer.m_format != TextureFormat::BC5 + && imageContainer.m_format != bimg::TextureFormat::BC4 + && imageContainer.m_format != bimg::TextureFormat::BC5 ; for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) @@ -2971,8 +2968,8 @@ namespace bgfx { namespace d3d9 mipHeight = bx::uint32_max(blockInfo.blockHeight, mipHeight); uint32_t mipSize = width*height*depth*bpp/8; - ImageMip mip; - if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) + bimg::ImageMip mip; + if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { uint32_t pitch; uint32_t slicePitch; @@ -2986,7 +2983,7 @@ namespace bgfx { namespace d3d9 uint32_t srcpitch = mipWidth*bpp/8; uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mipHeight); - imageDecodeToBgra8(temp + bimg::imageDecodeToBgra8(temp , mip.m_data , mip.m_width , mip.m_height @@ -3000,7 +2997,7 @@ namespace bgfx { namespace d3d9 } else { - imageDecodeToBgra8(bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format); + bimg::imageDecodeToBgra8(bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format); } } else @@ -3009,11 +3006,11 @@ namespace bgfx { namespace d3d9 switch (m_textureFormat) { case TextureFormat::RGB5A1: - imageConvert(bits, 16, bx::packBgr5a1, mip.m_data, bx::unpackRgb5a1, size); + bimg::imageConvert(bits, 16, bx::packBgr5a1, mip.m_data, bx::unpackRgb5a1, size); break; case TextureFormat::RGBA4: - imageConvert(bits, 16, bx::packBgra4, mip.m_data, bx::unpackRgba4, size); + bimg::imageConvert(bits, 16, bx::packBgra4, mip.m_data, bx::unpackRgba4, size); break; default: @@ -3045,7 +3042,7 @@ namespace bgfx { namespace d3d9 void TextureD3D9::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) { - const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t rectpitch = _rect.m_width*bpp/8; const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; const uint32_t dstpitch = s_renderD3D9->m_updateTexturePitch; @@ -3059,7 +3056,7 @@ namespace bgfx { namespace d3d9 if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, TextureFormat::Enum(m_requestedFormat) ); + bimg::imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; } @@ -3071,11 +3068,11 @@ namespace bgfx { namespace d3d9 switch (m_textureFormat) { case TextureFormat::RGB5A1: - imageConvert(dst, 16, bx::packBgr5a1, src, bx::unpackRgb5a1, rectpitch); + bimg::imageConvert(dst, 16, bx::packBgr5a1, src, bx::unpackRgb5a1, rectpitch); break; case TextureFormat::RGBA4: - imageConvert(dst, 16, bx::packBgra4, src, bx::unpackRgba4, rectpitch); + bimg::imageConvert(dst, 16, bx::packBgra4, src, bx::unpackRgba4, rectpitch); break; default: @@ -3211,7 +3208,7 @@ namespace bgfx { namespace d3d9 m_height = texture.m_height; } - if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) { m_dsIdx = uint8_t(ii); } @@ -3450,25 +3447,29 @@ namespace bgfx { namespace d3d9 { IDirect3DDevice9* device = s_renderD3D9->m_device; - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii) + for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) { - Frame& frame = m_frame[ii]; + Query& frame = m_query[ii]; DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMPDISJOINT, &frame.m_disjoint) ); DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &frame.m_begin) ); DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &frame.m_end) ); DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMPFREQ, &frame.m_freq) ); } - m_elapsed = 0; - m_frequency = 1; + for (uint32_t ii = 0; ii < BX_COUNTOF(m_result); ++ii) + { + Result& result = m_result[ii]; + result.reset(); + } + m_control.reset(); } void TimerQueryD3D9::preReset() { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii) + for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) { - Frame& frame = m_frame[ii]; + Query& frame = m_query[ii]; DX_RELEASE(frame.m_disjoint, 0); DX_RELEASE(frame.m_begin, 0); DX_RELEASE(frame.m_end, 0); @@ -3476,51 +3477,74 @@ namespace bgfx { namespace d3d9 } } - void TimerQueryD3D9::begin() + uint32_t TimerQueryD3D9::begin(uint32_t _resultIdx) { while (0 == m_control.reserve(1) ) { - get(); + update(); } - Frame& frame = m_frame[m_control.m_current]; - frame.m_disjoint->Issue(D3DISSUE_BEGIN); - frame.m_begin->Issue(D3DISSUE_END); + Result& result = m_result[_resultIdx]; + ++result.m_pending; + + const uint32_t idx = m_control.m_current; + Query& query = m_query[idx]; + query.m_resultIdx = _resultIdx; + query.m_ready = false; + + query.m_disjoint->Issue(D3DISSUE_BEGIN); + query.m_begin->Issue(D3DISSUE_END); + + m_control.commit(1); + + return idx; } - void TimerQueryD3D9::end() + void TimerQueryD3D9::end(uint32_t _idx) { - Frame& frame = m_frame[m_control.m_current]; - frame.m_disjoint->Issue(D3DISSUE_END); - frame.m_freq->Issue(D3DISSUE_END); - frame.m_end->Issue(D3DISSUE_END); - m_control.commit(1); + Query& query = m_query[_idx]; + query.m_ready = true; + + query.m_disjoint->Issue(D3DISSUE_END); + query.m_freq->Issue(D3DISSUE_END); + query.m_end->Issue(D3DISSUE_END); + + while (update() ) + { + } } - bool TimerQueryD3D9::get() + bool TimerQueryD3D9::update() { if (0 != m_control.available() ) { - Frame& frame = m_frame[m_control.m_read]; + Query& query = m_query[m_control.m_read]; + + if (!query.m_ready) + { + return false; + } uint64_t timeEnd; - const bool flush = BX_COUNTOF(m_frame)-1 == m_control.available(); - HRESULT hr = frame.m_end->GetData(&timeEnd, sizeof(timeEnd), flush ? D3DGETDATA_FLUSH : 0); + const bool flush = BX_COUNTOF(m_query)-1 == m_control.available(); + HRESULT hr = query.m_end->GetData(&timeEnd, sizeof(timeEnd), flush ? D3DGETDATA_FLUSH : 0); if (S_OK == hr || isLost(hr) ) { m_control.consume(1); uint64_t timeBegin; - DX_CHECK(frame.m_begin->GetData(&timeBegin, sizeof(timeBegin), 0) ); + DX_CHECK(query.m_begin->GetData(&timeBegin, sizeof(timeBegin), 0) ); uint64_t freq; - DX_CHECK(frame.m_freq->GetData(&freq, sizeof(freq), 0) ); + DX_CHECK(query.m_freq->GetData(&freq, sizeof(freq), 0) ); - m_frequency = freq; - m_begin = timeBegin; - m_end = timeEnd; - m_elapsed = timeEnd - timeBegin; + Result& result = m_result[query.m_resultIdx]; + --result.m_pending; + + result.m_frequency = freq; + result.m_begin = timeBegin; + result.m_end = timeEnd; return true; } @@ -3599,8 +3623,62 @@ namespace bgfx { namespace d3d9 Query& query = m_query[(m_control.m_read + ii) % size]; if (query.m_handle.idx == _handle.idx) { - query.m_handle.idx = bgfx::invalidHandle; + query.m_handle.idx = bgfx::kInvalidHandle; + } + } + } + + void RendererContextD3D9::submitBlit(BlitState& _bs, uint16_t _view) + { + while (_bs.hasItem(_view) ) + { + const BlitItem& blit = _bs.advance(); + + const TextureD3D9& src = m_textures[blit.m_src.idx]; + const TextureD3D9& dst = m_textures[blit.m_dst.idx]; + + uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; + uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; + uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; + uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; + uint32_t width = bx::uint32_min(srcWidth, dstWidth); + uint32_t height = bx::uint32_min(srcHeight, dstHeight); + + RECT srcRect = { LONG(blit.m_srcX), LONG(blit.m_srcY), LONG(blit.m_srcX + width), LONG(blit.m_srcY + height) }; + RECT dstRect = { LONG(blit.m_dstX), LONG(blit.m_dstY), LONG(blit.m_dstX + width), LONG(blit.m_dstY + height) }; + + IDirect3DSurface9* srcSurface = src.getSurface(uint8_t(blit.m_srcZ), blit.m_srcMip); + IDirect3DSurface9* dstSurface = dst.getSurface(uint8_t(blit.m_dstZ), blit.m_dstMip); + + // UpdateSurface (pool src: SYSTEMMEM, dst: DEFAULT) + // s/d T RTT RT + // T y y y + // RTT - - - + // RT - - - + // + // StretchRect (pool src and dst must be DEFAULT) + // s/d T RTT RT + // T - y y + // RTT - y y + // RT - y y + // + // GetRenderTargetData (dst must be SYSTEMMEM) + + bool depth = bimg::isDepth(bimg::TextureFormat::Enum(src.m_textureFormat) ); + HRESULT hr = m_device->StretchRect(srcSurface + , depth ? NULL : &srcRect + , dstSurface + , depth ? NULL : &dstRect + , D3DTEXF_NONE + ); + if (FAILED(hr) ) + { + hr = m_device->GetRenderTargetData(srcSurface, dstSurface); + BX_WARN(SUCCEEDED(hr), "StretchRect and GetRenderTargetData failed %x.", hr); } + + srcSurface->Release(); + dstSurface->Release(); } } @@ -3612,13 +3690,15 @@ namespace bgfx { namespace d3d9 updateResolution(_render->m_resolution); - int64_t elapsed = -bx::getHPCounter(); + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; + uint32_t frameQueryIdx = UINT32_MAX; + device->BeginScene(); if (m_timerQuerySupport) { - m_gpuTimer.begin(); + frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS); } if (0 < _render->m_iboffset) @@ -3640,19 +3720,19 @@ namespace bgfx { namespace d3d9 currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); + RenderBind currentBind; + currentBind.clear(); + ViewState viewState(_render, false); DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, _render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) ); - uint16_t programIdx = invalidHandle; + uint16_t programIdx = kInvalidHandle; SortKey key; uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; uint32_t blendFactor = 0; - BlitKey blitKey; - blitKey.decode(_render->m_blitKeys[0]); - uint16_t numBlitItems = _render->m_numBlitItems; - uint16_t blitItem = 0; + BlitState bs(_render); uint8_t primIndex; { @@ -3673,6 +3753,13 @@ namespace bgfx { namespace d3d9 invalidateSamplerState(); + Profiler<TimerQueryD3D9> profiler( + _render + , m_gpuTimer + , s_viewName + , m_timerQuerySupport + ); + if (m_occlusionQuerySupport) { m_occlusionQuery.resolve(_render); @@ -3680,7 +3767,7 @@ namespace bgfx { namespace d3d9 if (0 == (_render->m_debug&BGFX_DEBUG_IFH) ) { - for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item) + for (uint32_t item = 0, numItems = _render->m_numRenderItems; item < numItems; ++item) { const uint64_t encodedKey = _render->m_sortKeys[item]; const bool isCompute = key.decode(encodedKey, _render->m_viewRemap); @@ -3692,7 +3779,9 @@ namespace bgfx { namespace d3d9 continue; } - const RenderDraw& draw = _render->m_renderItem[_render->m_sortValues[item] ].draw; + const uint32_t itemIdx = _render->m_sortValues[item]; + const RenderDraw& draw = _render->m_renderItem[itemIdx].draw; + const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); if (isValid(draw.m_occlusionQuery) @@ -3719,25 +3808,26 @@ namespace bgfx { namespace d3d9 currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - PIX_ENDEVENT(); - PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[key.m_view]); - if (item > 0) - { - BGFX_PROFILER_END(); - } - BGFX_PROFILER_BEGIN_DYNAMIC(s_viewName[key.m_view]); - view = key.m_view; - programIdx = invalidHandle; + programIdx = kInvalidHandle; - if (_render->m_fb[view].idx != fbh.idx) + if (_render->m_view[view].m_fbh.idx != fbh.idx) { - fbh = _render->m_fb[view]; + fbh = _render->m_view[view].m_fbh; setFrameBuffer(fbh); } - viewState.m_rect = _render->m_rect[view]; - const Rect& scissorRect = _render->m_scissor[view]; + PIX_ENDEVENT(); + if (item > 0) + { + profiler.end(); + } + + profiler.begin(view); + PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[view]); + + viewState.m_rect = _render->m_view[view].m_rect; + const Rect& scissorRect = _render->m_view[view].m_scissor; viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; @@ -3750,12 +3840,11 @@ namespace bgfx { namespace d3d9 vp.MaxZ = 1.0f; DX_CHECK(device->SetViewport(&vp) ); - Clear& clear = _render->m_clear[view]; + Clear& clear = _render->m_view[view].m_clear; if (BGFX_CLEAR_NONE != (clear.m_flags & BGFX_CLEAR_MASK) ) { clearQuad(_clearQuad, viewState.m_rect, clear, _render->m_colorPalette); - prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update after clear quad. } DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, FALSE) ); @@ -3765,58 +3854,7 @@ namespace bgfx { namespace d3d9 DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); DX_CHECK(device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) ); - const uint8_t blitView = SortKey::decodeView(encodedKey); - for (; blitItem < numBlitItems && blitKey.m_view <= blitView; blitItem++) - { - const BlitItem& blit = _render->m_blitItem[blitItem]; - blitKey.decode(_render->m_blitKeys[blitItem+1]); - - const TextureD3D9& src = m_textures[blit.m_src.idx]; - const TextureD3D9& dst = m_textures[blit.m_dst.idx]; - - uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; - uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; - uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; - uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; - uint32_t width = bx::uint32_min(srcWidth, dstWidth); - uint32_t height = bx::uint32_min(srcHeight, dstHeight); - - RECT srcRect = { LONG(blit.m_srcX), LONG(blit.m_srcY), LONG(blit.m_srcX + width), LONG(blit.m_srcY + height) }; - RECT dstRect = { LONG(blit.m_dstX), LONG(blit.m_dstY), LONG(blit.m_dstX + width), LONG(blit.m_dstY + height) }; - - IDirect3DSurface9* srcSurface = src.getSurface(uint8_t(blit.m_srcZ), blit.m_srcMip); - IDirect3DSurface9* dstSurface = dst.getSurface(uint8_t(blit.m_dstZ), blit.m_dstMip); - - // UpdateSurface (pool src: SYSTEMMEM, dst: DEFAULT) - // s/d T RTT RT - // T y y y - // RTT - - - - // RT - - - - // - // StretchRect (pool src and dst must be DEFAULT) - // s/d T RTT RT - // T - y y - // RTT - y y - // RT - y y - // - // GetRenderTargetData (dst must be SYSTEMMEM) - - bool depth = isDepth(TextureFormat::Enum(src.m_textureFormat) ); - HRESULT hr = m_device->StretchRect(srcSurface - , depth ? NULL : &srcRect - , dstSurface - , depth ? NULL : &dstRect - , D3DTEXF_NONE - ); - if (FAILED(hr) ) - { - hr = m_device->GetRenderTargetData(srcSurface, dstSurface); - BX_WARN(SUCCEEDED(hr), "StretchRect and GetRenderTargetData failed %x.", hr); - } - - srcSurface->Release(); - dstSurface->Release(); - } + submitBlit(bs, view); } uint16_t scissor = draw.m_scissor; @@ -3840,7 +3878,7 @@ namespace bgfx { namespace d3d9 else { Rect scissorRect; - scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]); + scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); if (scissorRect.isZeroArea() ) { continue; @@ -4044,14 +4082,14 @@ namespace bgfx { namespace d3d9 } bool programChanged = false; - bool constantsChanged = draw.m_constBegin < draw.m_constEnd; - rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); + bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; + rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); if (key.m_program != programIdx) { programIdx = key.m_program; - if (invalidHandle == programIdx) + if (kInvalidHandle == programIdx) { device->SetVertexShader(NULL); device->SetPixelShader(NULL); @@ -4067,7 +4105,7 @@ namespace bgfx { namespace d3d9 constantsChanged = true; } - if (invalidHandle != programIdx) + if (kInvalidHandle != programIdx) { ProgramD3D9& program = m_program[programIdx]; @@ -4092,13 +4130,14 @@ namespace bgfx { namespace d3d9 { for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) { - const Binding& bind = draw.m_bind[stage]; - Binding& current = currentState.m_bind[stage]; + const Binding& bind = renderBind.m_bind[stage]; + Binding& current = currentBind.m_bind[stage]; + if (current.m_idx != bind.m_idx || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags || programChanged) { - if (invalidHandle != bind.m_idx) + if (kInvalidHandle != bind.m_idx) { m_textures[bind.m_idx].commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); } @@ -4112,45 +4151,75 @@ namespace bgfx { namespace d3d9 } } + bool vertexStreamChanged = hasVertexStreamChanged(currentState, draw); + if (programChanged - || currentState.m_streamMask != draw.m_streamMask - || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx - || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset - || currentState.m_instanceDataStride != draw.m_instanceDataStride) + || vertexStreamChanged) { - currentState.m_streamMask = draw.m_streamMask; - currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; + currentState.m_streamMask = draw.m_streamMask; currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; - uint16_t handle = draw.m_stream[0].m_handle.idx; - if (invalidHandle != handle) + const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + + const bool instanced = true + && isValid(draw.m_instanceDataBuffer) + && m_instancingSupport + ; + + const uint32_t freq = instanced + ? D3DSTREAMSOURCE_INDEXEDDATA|draw.m_numInstances + : 1 + ; + + uint32_t numVertices = draw.m_numVertices; + uint8_t numStreams = 0; + for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams + ) { + streamMask >>= ntz; + idx += ntz; + + currentState.m_stream[idx].m_decl = draw.m_stream[idx].m_decl; + currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; + currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; + + const uint16_t handle = draw.m_stream[idx].m_handle.idx; const VertexBufferD3D9& vb = m_vertexBuffers[handle]; + const uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const uint32_t stride = vertexDecl.m_stride; + + decls[numStreams] = &vertexDecl; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - const VertexDeclD3D9& vertexDecl = m_vertexDecls[decl]; - DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) ); + numVertices = bx::uint32_min(UINT32_MAX == draw.m_numVertices + ? vb.m_size/stride + : draw.m_numVertices + , numVertices + ); + + DX_CHECK(device->SetStreamSourceFreq(0, freq) ); + DX_CHECK(device->SetStreamSource(numStreams, vb.m_ptr, 0, stride) ); + } - if (isValid(draw.m_instanceDataBuffer) - && m_instancingSupport) + currentState.m_numVertices = numVertices; + + if (0 < numStreams) + { + if (instanced) { const VertexBufferD3D9& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; - DX_CHECK(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA|draw.m_numInstances) ); - DX_CHECK(device->SetStreamSourceFreq(1, UINT(D3DSTREAMSOURCE_INSTANCEDATA|1) ) ); - DX_CHECK(device->SetStreamSource(1, inst.m_ptr, draw.m_instanceDataOffset, draw.m_instanceDataStride) ); - - IDirect3DVertexDeclaration9* ptr = createVertexDeclaration(vertexDecl.m_decl, draw.m_instanceDataStride/16); - DX_CHECK(device->SetVertexDeclaration(ptr) ); - DX_RELEASE(ptr, 0); + DX_CHECK(device->SetStreamSourceFreq(numStreams, UINT(D3DSTREAMSOURCE_INSTANCEDATA|1) ) ); + DX_CHECK(device->SetStreamSource(numStreams, inst.m_ptr, draw.m_instanceDataOffset, draw.m_instanceDataStride) ); + setInputLayout(numStreams, decls, draw.m_instanceDataStride/16); } else { - DX_CHECK(device->SetStreamSourceFreq(0, 1) ); - DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); - DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) ); + DX_CHECK(device->SetStreamSource(numStreams, NULL, 0, 0) ); + setInputLayout(numStreams, decls, 0); } } else @@ -4165,7 +4234,7 @@ namespace bgfx { namespace d3d9 currentState.m_indexBuffer = draw.m_indexBuffer; uint16_t handle = draw.m_indexBuffer.idx; - if (invalidHandle != handle) + if (kInvalidHandle != handle) { const IndexBufferD3D9& ib = m_indexBuffers[handle]; DX_CHECK(device->SetIndices(ib.m_ptr) ); @@ -4178,15 +4247,7 @@ namespace bgfx { namespace d3d9 if (0 != currentState.m_streamMask) { - uint32_t numVertices = draw.m_numVertices; - if (UINT32_MAX == numVertices) - { - const VertexBufferD3D9& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - const VertexDeclD3D9& vertexDecl = m_vertexDecls[decl]; - numVertices = vb.m_size/vertexDecl.m_decl.m_stride; - } - + uint32_t numVertices = draw.m_numVertices; uint32_t numIndices = 0; uint32_t numPrimsSubmitted = 0; uint32_t numInstances = 0; @@ -4256,7 +4317,9 @@ namespace bgfx { namespace d3d9 } } - if (0 < _render->m_num) + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); + + if (0 < _render->m_numRenderItems) { if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) { @@ -4267,22 +4330,14 @@ namespace bgfx { namespace d3d9 capture(); captureElapsed += bx::getHPCounter(); - BGFX_PROFILER_END(); + profiler.end(); } } PIX_ENDEVENT(); - int64_t now = bx::getHPCounter(); - elapsed += now; - - static int64_t last = now; - - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = last; - - int64_t frameTime = now - last; - last = now; + int64_t timeEnd = bx::getHPCounter(); + int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; @@ -4293,31 +4348,32 @@ namespace bgfx { namespace d3d9 static double maxGpuElapsed = 0.0f; double elapsedGpuMs = 0.0; - if (m_timerQuerySupport) + if (UINT32_MAX != frameQueryIdx) { - m_gpuTimer.end(); + m_gpuTimer.end(frameQueryIdx); - do - { - double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency); - elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs; - maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; - } - while (m_gpuTimer.get() ); + const TimerQueryD3D9::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + double toGpuMs = 1000.0 / double(result.m_frequency); + elapsedGpuMs = (result.m_end - result.m_begin) * toGpuMs; + maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; - maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1); + maxGpuLatency = bx::uint32_imax(maxGpuLatency, result.m_pending-1); } const int64_t timerFreq = bx::getHPFrequency(); - perfStats.cpuTimeEnd = now; + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeEnd; perfStats.cpuTimerFreq = timerFreq; - perfStats.gpuTimeBegin = m_gpuTimer.m_begin; - perfStats.gpuTimeEnd = m_gpuTimer.m_end; - perfStats.gpuTimerFreq = m_gpuTimer.m_frequency; + const TimerQueryD3D9::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + perfStats.gpuTimeBegin = result.m_begin; + perfStats.gpuTimeEnd = result.m_end; + perfStats.gpuTimerFreq = result.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; perfStats.maxGpuLatency = maxGpuLatency; + m_nvapi.getMemoryInfo(perfStats.gpuMemoryUsed, perfStats.gpuMemoryMax); if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { @@ -4326,11 +4382,11 @@ namespace bgfx { namespace d3d9 m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; - static int64_t next = now; + static int64_t next = timeEnd; - if (now >= next) + if (timeEnd >= next) { - next = now + timerFreq; + next = timeEnd + timerFreq; double freq = double(timerFreq); double toMs = 1000.0/freq; @@ -4364,9 +4420,9 @@ namespace bgfx { namespace d3d9 , !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' ' ); - double elapsedCpuMs = double(elapsed)*toMs; + double elapsedCpuMs = double(frameTime)*toMs; tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] %c GPU %7.4f [ms] (latency %d)" - , _render->m_num + , _render->m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs @@ -4388,11 +4444,21 @@ namespace bgfx { namespace d3d9 } tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); - tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); +// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); pos++; + tvm.printf(10, pos++, 0x8e, " Occlusion queries: %3d ", m_occlusionQuery.m_control.available() ); + + pos++; + tvm.printf(10, pos++, 0x8e, " State cache: "); + tvm.printf(10, pos++, 0x8e, " Input "); + tvm.printf(10, pos++, 0x8e, " %6d " + , m_inputLayoutCache.getCount() + ); + pos++; + double captureMs = double(captureElapsed)*toMs; tvm.printf(10, pos++, 0x8e, " Capture: %7.4f [ms]", captureMs); diff --git a/3rdparty/bgfx/src/renderer_d3d9.h b/3rdparty/bgfx/src/renderer_d3d9.h index 2aa9b64dcb9..46945e8014f 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.h +++ b/3rdparty/bgfx/src/renderer_d3d9.h @@ -11,21 +11,6 @@ #if BX_PLATFORM_WINDOWS # include <sal.h> # include <d3d9.h> - -#elif BX_PLATFORM_XBOX360 -# include <xgraphics.h> -# define D3DUSAGE_DYNAMIC 0 // not supported on X360 -# define D3DLOCK_DISCARD 0 // not supported on X360 -# define D3DERR_DEVICEHUNG D3DERR_DEVICELOST // not supported on X360 -# define D3DERR_DEVICEREMOVED D3DERR_DEVICELOST // not supported on X360 -# define D3DMULTISAMPLE_8_SAMPLES D3DMULTISAMPLE_4_SAMPLES -# define D3DMULTISAMPLE_16_SAMPLES D3DMULTISAMPLE_4_SAMPLES - -# define D3DFMT_DF24 D3DFMT_D24FS8 - -# define _PIX_SETMARKER(_col, _name) BX_NOOP() -# define _PIX_BEGINEVENT(_col, _name) BX_NOOP() -# define _PIX_ENDEVENT() BX_NOOP #endif // BX_PLATFORM_ #ifndef D3DSTREAMSOURCE_INDEXEDDATA @@ -38,6 +23,7 @@ #include "renderer.h" #include "renderer_d3d.h" +#include "nvapi.h" namespace bgfx { namespace d3d9 { @@ -128,15 +114,21 @@ namespace bgfx { namespace d3d9 { IndexBufferD3D9() : m_ptr(NULL) + , m_dynamic(NULL) , m_size(0) , m_flags(BGFX_BUFFER_NONE) - , m_dynamic(false) { } void create(uint32_t _size, void* _data, uint16_t _flags); void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false) { + if (NULL != m_dynamic + && _data != m_dynamic) + { + bx::memCopy(&m_dynamic[_offset], _data, _size); + } + void* buffer; DX_CHECK(m_ptr->Lock(_offset , _size @@ -154,7 +146,12 @@ namespace bgfx { namespace d3d9 if (NULL != m_ptr) { DX_RELEASE(m_ptr, 0); - m_dynamic = false; + + if (NULL != m_dynamic) + { + BX_FREE(g_allocator, m_dynamic); + m_dynamic = NULL; + } } } @@ -162,22 +159,29 @@ namespace bgfx { namespace d3d9 void postReset(); IDirect3DIndexBuffer9* m_ptr; + uint8_t* m_dynamic; uint32_t m_size; uint16_t m_flags; - bool m_dynamic; }; struct VertexBufferD3D9 { VertexBufferD3D9() : m_ptr(NULL) - , m_dynamic(false) + , m_dynamic(NULL) + , m_size(0) { } void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle); void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false) { + if (NULL != m_dynamic + && _data != m_dynamic) + { + bx::memCopy(&m_dynamic[_offset], _data, _size); + } + void* buffer; DX_CHECK(m_ptr->Lock(_offset , _size @@ -195,7 +199,12 @@ namespace bgfx { namespace d3d9 if (NULL != m_ptr) { DX_RELEASE(m_ptr, 0); - m_dynamic = false; + + if (NULL != m_dynamic) + { + BX_FREE(g_allocator, m_dynamic); + m_dynamic = NULL; + } } } @@ -203,27 +212,9 @@ namespace bgfx { namespace d3d9 void postReset(); IDirect3DVertexBuffer9* m_ptr; + uint8_t* m_dynamic; uint32_t m_size; VertexDeclHandle m_decl; - bool m_dynamic; - }; - - struct VertexDeclD3D9 - { - VertexDeclD3D9() - : m_ptr(NULL) - { - } - - void create(const VertexDecl& _decl); - - void destroy() - { - DX_RELEASE(m_ptr, 0); - } - - IDirect3DVertexDeclaration9* m_ptr; - VertexDecl m_decl; }; struct ShaderD3D9 @@ -429,30 +420,45 @@ namespace bgfx { namespace d3d9 struct TimerQueryD3D9 { TimerQueryD3D9() - : m_control(BX_COUNTOF(m_frame) ) + : m_control(BX_COUNTOF(m_query) ) { } void postReset(); void preReset(); - void begin(); - void end(); - bool get(); + uint32_t begin(uint32_t _resultIdx); + void end(uint32_t _idx); + bool update(); - struct Frame + struct Query { IDirect3DQuery9* m_disjoint; IDirect3DQuery9* m_begin; IDirect3DQuery9* m_end; IDirect3DQuery9* m_freq; + uint32_t m_resultIdx; + bool m_ready; + }; + + struct Result + { + void reset() + { + m_begin = 0; + m_end = 0; + m_frequency = 1; + m_pending = 0; + } + + uint64_t m_begin; + uint64_t m_end; + uint64_t m_frequency; + uint32_t m_pending; }; - uint64_t m_begin; - uint64_t m_end; - uint64_t m_elapsed; - uint64_t m_frequency; + Result m_result[BGFX_CONFIG_MAX_VIEWS+1]; - Frame m_frame[4]; + Query m_query[BGFX_CONFIG_MAX_VIEWS*4]; bx::RingBufferControl m_control; }; diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index 8f4903a2cb1..9d7e0d3d701 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -11,20 +11,6 @@ # include <bx/uint32_t.h> # include "hmd_ovr.h" -#if BGFX_CONFIG_PROFILER_REMOTERY -# define BGFX_GPU_PROFILER_BIND() rmt_BindOpenGL() -# define BGFX_GPU_PROFILER_UNBIND() rmt_UnbindOpenGL() -# define BGFX_GPU_PROFILER_BEGIN(_group, _name, _color) rmt_BeginOpenGLSample(_group##_##_name) -# define BGFX_GPU_PROFILER_BEGIN_DYNAMIC(_namestr) rmt_BeginOpenGLSampleDynamic(_namestr) -# define BGFX_GPU_PROFILER_END() rmt_EndOpenGLSample() -#else -# define BGFX_GPU_PROFILER_BIND() BX_NOOP() -# define BGFX_GPU_PROFILER_UNBIND() BX_NOOP() -# define BGFX_GPU_PROFILER_BEGIN(_group, _name, _color) BX_NOOP() -# define BGFX_GPU_PROFILER_BEGIN_DYNAMIC(_namestr) BX_NOOP() -# define BGFX_GPU_PROFILER_END() BX_NOOP() -#endif // BGFX_CONFIG_PROFILER_REMOTERY - namespace bgfx { namespace gl { static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -63,6 +49,8 @@ namespace bgfx { namespace gl "a_bitangent", "a_color0", "a_color1", + "a_color2", + "a_color3", "a_indices", "a_weight", "a_texcoord0", @@ -269,7 +257,7 @@ namespace bgfx { namespace gl { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, false }, // RGBA4 { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false }, // RGB5A1 { GL_RGB10_A2, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false }, // RGB10A2 - { GL_R11F_G11F_B10F, GL_ZERO, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, false }, // R11G11B10F + { GL_R11F_G11F_B10F, GL_ZERO, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, false }, // RG11B10F { GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO, false }, // UnknownDepth { GL_DEPTH_COMPONENT16, GL_ZERO, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, false }, // D16 { GL_DEPTH_COMPONENT24, GL_ZERO, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, false }, // D24 @@ -352,7 +340,7 @@ namespace bgfx { namespace gl GL_RGBA4, // RGBA4 GL_RGB5_A1, // RGB5A1 GL_RGB10_A2, // RGB10A2 - GL_R11F_G11F_B10F, // R11G11B10F + GL_R11F_G11F_B10F, // RG11B10F GL_ZERO, // UnknownDepth GL_DEPTH_COMPONENT16, // D16 GL_DEPTH_COMPONENT24, // D24 @@ -433,7 +421,7 @@ namespace bgfx { namespace gl GL_RGBA4, // RGBA4 GL_RGB5_A1, // RGB5A1 GL_RGB10_A2, // RGB10A2 - GL_R11F_G11F_B10F, // R11G11B10F + GL_R11F_G11F_B10F, // RG11B10F GL_ZERO, // UnknownDepth GL_ZERO, // D16 GL_ZERO, // D24 @@ -896,15 +884,6 @@ namespace bgfx { namespace gl NULL }; - static const char* s_OES_texture_3D[] = - { - "texture3D", - "texture3DProj", - "texture3DLod", - "texture3DProjLod", - NULL - }; - static const char* s_uisamplers[] = { "isampler2D", @@ -918,11 +897,23 @@ namespace bgfx { namespace gl static const char* s_texelFetch[] = { + "texture", + "textureLod", + "textureGrad", + "textureProj", + "textureProjLod", "texelFetch", "texelFetchOffset", NULL }; + static const char* s_texture3D[] = + { + "sampler3D", + "sampler3DArray", + NULL + }; + static const char* s_textureArray[] = { "sampler2DArray", @@ -940,6 +931,13 @@ namespace bgfx { namespace gl NULL }; + static const char* s_EXT_gpu_shader4[] = + { + "gl_VertexID", + "gl_InstanceID", + NULL + }; + static const char* s_ARB_gpu_shader5[] = { "bitfieldReverse", @@ -986,7 +984,7 @@ namespace bgfx { namespace gl // // If <length> is 0 then <marker> is assumed to be null-terminated. - uint32_t size = (0 == _length ? (uint32_t)bx::strnlen(_marker) : _length) + 1; + uint32_t size = (0 == _length ? (uint32_t)bx::strLen(_marker) : _length) + 1; size *= sizeof(wchar_t); wchar_t* name = (wchar_t*)alloca(size); mbstowcs(name, _marker, size-2); @@ -1045,7 +1043,7 @@ namespace bgfx { namespace gl glGetError(); // ignore error if glGetString returns NULL. if (NULL != str) { - return bx::hashMurmur2A(str, (uint32_t)bx::strnlen(str) ); + return bx::hash<bx::HashMurmur2A>(str, (uint32_t)bx::strLen(str) ); } return 0; @@ -1057,21 +1055,21 @@ namespace bgfx { namespace gl { char name[1024]; const char* pos = _extensions; - const char* end = _extensions + bx::strnlen(_extensions); + const char* end = _extensions + bx::strLen(_extensions); while (pos < end) { uint32_t len; - const char* space = bx::strnchr(pos, ' '); + const char* space = bx::strFind(pos, ' '); if (NULL != space) { len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) ); } else { - len = bx::uint32_min(sizeof(name), (uint32_t)bx::strnlen(pos) ); + len = bx::uint32_min(sizeof(name), (uint32_t)bx::strLen(pos) ); } - bx::strlncpy(name, BX_COUNTOF(name), pos, len); + bx::strCopy(name, BX_COUNTOF(name), pos, len); name[len] = '\0'; BX_TRACE("\t%s", name); @@ -1145,7 +1143,252 @@ namespace bgfx { namespace gl for (GLenum err = glGetError(); err != 0; err = glGetError() ); } - GLenum initTestTexture(TextureFormat::Enum _format, bool _srgb, bool _mipmaps) + static void texSubImage( + GLenum _target + , GLint _level + , GLint _xoffset + , GLint _yoffset + , GLint _zoffset + , GLsizei _width + , GLsizei _height + , GLsizei _depth + , GLenum _format + , GLenum _type + , const GLvoid* _data + ) + { + if (NULL == _data) + { + return; + } + + if (_target == GL_TEXTURE_3D + || _target == GL_TEXTURE_2D_ARRAY + || _target == GL_TEXTURE_CUBE_MAP_ARRAY) + { + glTexSubImage3D( + _target + , _level + , _xoffset + , _yoffset + , _zoffset + , _width + , _height + , _depth + , _format + , _type + , _data + ); + } + else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) + { + } + else + { + BX_UNUSED(_zoffset, _depth); + glTexSubImage2D( + _target + , _level + , _xoffset + , _yoffset + , _width + , _height + , _format + , _type + , _data + ); + } + } + + static void texImage( + GLenum _target + , uint32_t _msaaQuality + , GLint _level + , GLint _internalFormat + , GLsizei _width + , GLsizei _height + , GLsizei _depth + , GLint _border + , GLenum _format + , GLenum _type + , const GLvoid* _data + ) + { + if (_target == GL_TEXTURE_3D) + { + glTexImage3D( + _target + , _level + , _internalFormat + , _width + , _height + , _depth + , _border + , _format + , _type + , _data + ); + } + else if (_target == GL_TEXTURE_2D_ARRAY + || _target == GL_TEXTURE_CUBE_MAP_ARRAY) + { + texSubImage( + _target + , _level + , 0 + , 0 + , _depth + , _width + , _height + , 1 + , _format + , _type + , _data + ); + } + else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) + { + } + else if (_target == GL_TEXTURE_2D_MULTISAMPLE) + { + glTexImage2DMultisample( + _target + , _msaaQuality + , _internalFormat + , _width + , _height + , false + ); + } + else + { + glTexImage2D( + _target + , _level + , _internalFormat + , _width + , _height + , _border + , _format + , _type + , _data + ); + } + + BX_UNUSED(_msaaQuality, _depth, _border, _data); + } + + static void compressedTexSubImage( + GLenum _target + , GLint _level + , GLint _xoffset + , GLint _yoffset + , GLint _zoffset + , GLsizei _width + , GLsizei _height + , GLsizei _depth + , GLenum _format + , GLsizei _imageSize + , const GLvoid* _data + ) + { + if (_target == GL_TEXTURE_3D + || _target == GL_TEXTURE_2D_ARRAY) + { + glCompressedTexSubImage3D( + _target + , _level + , _xoffset + , _yoffset + , _zoffset + , _width + , _height + , _depth + , _format + , _imageSize + , _data + ); + } + else + { + BX_UNUSED(_zoffset, _depth); + glCompressedTexSubImage2D( + _target + , _level + , _xoffset + , _yoffset + , _width + , _height + , _format + , _imageSize + , _data + ); + } + } + + static void compressedTexImage( + GLenum _target + , GLint _level + , GLenum _internalformat + , GLsizei _width + , GLsizei _height + , GLsizei _depth + , GLint _border + , GLsizei _imageSize + , const GLvoid* _data + ) + { + if (_target == GL_TEXTURE_3D) + { + glCompressedTexImage3D( + _target + , _level + , _internalformat + , _width + , _height + , _depth + , _border + , _imageSize + , _data + ); + } + else if (_target == GL_TEXTURE_2D_ARRAY + || _target == GL_TEXTURE_CUBE_MAP_ARRAY) + { + compressedTexSubImage( + _target + , _level + , 0 + , 0 + , _depth + , _width + , _height + , 1 + , _internalformat + , _imageSize + , _data + ); + } + else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) + { + } + else + { + BX_UNUSED(_depth); + glCompressedTexImage2D( + _target + , _level + , _internalformat + , _width + , _height + , _border + , _imageSize + , _data + ); + } + } + + GLenum initTestTexture(TextureFormat::Enum _format, bool _srgb, bool _mipmaps, bool _array, GLsizei _dim) { const TextureFormatInfo& tfi = s_textureFormat[_format]; GLenum internalFmt = _srgb @@ -1153,13 +1396,15 @@ namespace bgfx { namespace gl : tfi.m_internalFmt ; - GLsizei size = (16*16*getBitsPerPixel(_format) )/8; + GLsizei bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(_format) ); + GLsizei size = (_dim*_dim*bpp)/8; void* data = NULL; - if (isDepth(_format) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(_format) ) ) { _srgb = false; _mipmaps = false; + _array = false; } else { @@ -1169,35 +1414,29 @@ namespace bgfx { namespace gl flushGlError(); GLenum err = 0; - if (isCompressed(_format) ) + const GLenum target = _array + ? GL_TEXTURE_2D_ARRAY + : GL_TEXTURE_2D + ; + + if (bimg::isCompressed(bimg::TextureFormat::Enum(_format) ) ) { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, internalFmt, 16, 16, 0, size, data); - err |= glGetError(); - if (_mipmaps) + for (uint32_t ii = 0, dim = _dim; ii < (_mipmaps ? 5u : 1u) && 0 == err; ++ii, dim >>= 1) { - glCompressedTexImage2D(GL_TEXTURE_2D, 1, internalFmt, 8, 8, 0, size, data); - err |= glGetError(); - glCompressedTexImage2D(GL_TEXTURE_2D, 2, internalFmt, 4, 4, 0, size, data); - err |= glGetError(); - glCompressedTexImage2D(GL_TEXTURE_2D, 3, internalFmt, 2, 2, 0, size, data); - err |= glGetError(); - glCompressedTexImage2D(GL_TEXTURE_2D, 4, internalFmt, 1, 1, 0, size, data); + dim = bx::uint32_max(1, dim); + uint32_t block = bx::uint32_max(4, dim); + size = (block*block*bpp)/8; + compressedTexImage(target, ii, internalFmt, dim, dim, 0, 0, size, data); err |= glGetError(); } } else { - glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, 16, 16, 0, tfi.m_fmt, tfi.m_type, data); - err |= glGetError(); - if (_mipmaps) + for (uint32_t ii = 0, dim = _dim; ii < (_mipmaps ? 5u : 1u) && 0 == err; ++ii, dim >>= 1) { - glTexImage2D(GL_TEXTURE_2D, 1, internalFmt, 8, 8, 0, tfi.m_fmt, tfi.m_type, data); - err |= glGetError(); - glTexImage2D(GL_TEXTURE_2D, 2, internalFmt, 4, 4, 0, tfi.m_fmt, tfi.m_type, data); - err |= glGetError(); - glTexImage2D(GL_TEXTURE_2D, 3, internalFmt, 2, 2, 0, tfi.m_fmt, tfi.m_type, data); - err |= glGetError(); - glTexImage2D(GL_TEXTURE_2D, 4, internalFmt, 1, 1, 0, tfi.m_fmt, tfi.m_type, data); + dim = bx::uint32_max(1, dim); + size = (dim*dim*bpp)/8; + texImage(target, 0, ii, internalFmt, dim, dim, 0, 0, tfi.m_fmt, tfi.m_type, data); err |= glGetError(); } } @@ -1205,7 +1444,7 @@ namespace bgfx { namespace gl return err; } - static bool isTextureFormatValid(TextureFormat::Enum _format, bool _srgb = false, bool _mipAutogen = false) + static bool isTextureFormatValid(TextureFormat::Enum _format, bool _srgb = false, bool _mipAutogen = false, bool _array = false, GLsizei _dim = 16) { const TextureFormatInfo& tfi = s_textureFormat[_format]; GLenum internalFmt = _srgb @@ -1217,18 +1456,46 @@ namespace bgfx { namespace gl return false; } + const GLenum target = _array + ? GL_TEXTURE_2D_ARRAY + : GL_TEXTURE_2D + ; + GLuint id; GL_CHECK(glGenTextures(1, &id) ); - GL_CHECK(glBindTexture(GL_TEXTURE_2D, id) ); + GL_CHECK(glBindTexture(target, id) ); - GLenum err = initTestTexture(_format, _srgb, _mipAutogen); - BX_WARN(0 == err, "TextureFormat::%s is not supported (%x: %s).", getName(_format), err, glEnumName(err) ); + GLenum err = 0; + if (_array) + { + glTexStorage3D(target + , 1 + GLsizei(bx::flog2(float(_dim) ) ) + , internalFmt + , _dim + , _dim + , _dim + ); + err = glGetError(); + } - if (0 == err - && _mipAutogen) + if (0 == err) { - glGenerateMipmap(GL_TEXTURE_2D); - err = glGetError(); + err = initTestTexture(_format, _srgb, _mipAutogen, _array, _dim); + BX_WARN(0 == err, "TextureFormat::%s %s%s%sis not supported (%x: %s)." + , getName(_format) + , _srgb ? "+sRGB " : "" + , _mipAutogen ? "+mipAutoGen " : "" + , _array ? "+array " : "" + , err + , glEnumName(err) + ); + + if (0 == err + && _mipAutogen) + { + glGenerateMipmap(target); + err = glGetError(); + } } GL_CHECK(glDeleteTextures(1, &id) ); @@ -1236,7 +1503,7 @@ namespace bgfx { namespace gl return 0 == err; } - static bool isImageFormatValid(TextureFormat::Enum _format) + static bool isImageFormatValid(TextureFormat::Enum _format, GLsizei _dim = 16) { if (GL_ZERO == s_imageFormat[_format]) { @@ -1250,7 +1517,7 @@ namespace bgfx { namespace gl flushGlError(); GLenum err = 0; - glTexStorage2D(GL_TEXTURE_2D, 1, s_imageFormat[_format], 16, 16); + glTexStorage2D(GL_TEXTURE_2D, 1, s_imageFormat[_format], _dim, _dim); err |= glGetError(); if (0 == err) { @@ -1270,7 +1537,12 @@ namespace bgfx { namespace gl return 0 == err; } - static bool isFramebufferFormatValid(TextureFormat::Enum _format, bool _srgb = false) + static bool isFramebufferFormatValid( + TextureFormat::Enum _format + , bool _srgb = false + , bool _writeOnly = false + , GLsizei _dim = 16 + ) { const TextureFormatInfo& tfi = s_textureFormat[_format]; GLenum internalFmt = _srgb @@ -1283,6 +1555,24 @@ namespace bgfx { namespace gl return false; } + if (_writeOnly) + { + GLuint rbo; + glGenRenderbuffers(1, &rbo); + glBindRenderbuffer(GL_RENDERBUFFER, rbo); + + glRenderbufferStorage(GL_RENDERBUFFER + , s_rboFormat[_format] + , _dim + , _dim + ); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + glDeleteRenderbuffers(1, &rbo); + + GLenum err = glGetError(); + return 0 == err; + } + GLuint fbo; GL_CHECK(glGenFramebuffers(1, &fbo) ); GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, fbo) ); @@ -1291,12 +1581,12 @@ namespace bgfx { namespace gl GL_CHECK(glGenTextures(1, &id) ); GL_CHECK(glBindTexture(GL_TEXTURE_2D, id) ); - GLenum err = initTestTexture(_format, _srgb, false); + GLenum err = initTestTexture(_format, _srgb, false, false, _dim); GLenum attachment; - if (isDepth(_format) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(_format) ) ) { - const ImageBlockInfo& info = getBlockInfo(_format); + const bimg::ImageBlockInfo& info = bimg::getBlockInfo(bimg::TextureFormat::Enum(_format) ); if (0 == info.depthBits) { attachment = GL_STENCIL_ATTACHMENT; @@ -1355,12 +1645,12 @@ namespace bgfx { namespace gl && extension.m_initialize) { const char* ext = _name; - if (0 == bx::strncmp(ext, "GL_", 3) ) // skip GL_ + if (0 == bx::strCmp(ext, "GL_", 3) ) // skip GL_ { ext += 3; } - if (0 == bx::strncmp(ext, extension.m_name) ) + if (0 == bx::strCmp(ext, extension.m_name) ) { extension.m_supported = true; supported = true; @@ -1379,11 +1669,11 @@ namespace bgfx { namespace gl public: VRImplOVRGL(); - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) BX_OVERRIDE; - virtual void destroySwapChain() BX_OVERRIDE; - virtual void destroyMirror() BX_OVERRIDE; - virtual void makeRenderTargetActive(const VRDesc& _desc) BX_OVERRIDE; - virtual bool submitSwapChain(const VRDesc& _desc) BX_OVERRIDE; + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override; + virtual void destroySwapChain() override; + virtual void destroyMirror() override; + virtual void makeRenderTargetActive(const VRDesc& _desc) override; + virtual bool submitSwapChain(const VRDesc& _desc) override; private: GLuint m_eyeTarget[4]; @@ -1412,6 +1702,16 @@ namespace bgfx { namespace gl { "Intel", BGFX_PCI_ID_INTEL }, }; + struct Workaround + { + void reset() + { + m_detachShader = true; + } + + bool m_detachShader; + }; + struct RendererContextGL : public RendererContextI { RendererContextGL() @@ -1450,11 +1750,21 @@ namespace bgfx { namespace gl { } - void init() + bool init() { + struct ErrorState + { + enum Enum + { + Default, + }; + }; + + ErrorState::Enum errorState = ErrorState::Default; + m_renderdocdll = loadRenderDoc(); - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); @@ -1475,13 +1785,15 @@ namespace bgfx { namespace gl for (uint32_t ii = 0; ii < BX_COUNTOF(s_vendorIds); ++ii) { const VendorId& vendorId = s_vendorIds[ii]; - if (0 == bx::strncmp(vendorId.name, m_vendor, bx::strnlen(vendorId.name) ) ) + if (0 == bx::strCmp(vendorId.name, m_vendor, bx::strLen(vendorId.name) ) ) { g_caps.vendorId = vendorId.id; break; } } + m_workaround.reset(); + GLint numCmpFormats = 0; GL_CHECK(glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCmpFormats) ); BX_TRACE("GL_NUM_COMPRESSED_TEXTURE_FORMATS %d", numCmpFormats); @@ -1549,14 +1861,21 @@ namespace bgfx { namespace gl ; if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) - && 0 == bx::strncmp(m_vendor, "Imagination Technologies") - && NULL != bx::strnstr(m_version, "(SDK 3.5@3510720)") ) + && 0 == bx::strCmp(m_vendor, "Imagination Technologies") + && NULL != bx::strFind(m_version, "(SDK 3.5@3510720)") ) { // Skip initializing extensions that are broken in emulator. s_extension[Extension::ARB_program_interface_query ].m_initialize = s_extension[Extension::ARB_shader_storage_buffer_object].m_initialize = false; } + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) + && 0 == bx::strCmp(m_vendor, "Imagination Technologies") + && NULL != bx::strFind(m_version, "1.8@905891") ) + { + m_workaround.m_detachShader = false; + } + if (BX_ENABLED(BGFX_CONFIG_RENDERER_USE_EXTENSIONS) ) { const char* extensions = (const char*)glGetString(GL_EXTENSIONS); @@ -1565,22 +1884,22 @@ namespace bgfx { namespace gl { char name[1024]; const char* pos = extensions; - const char* end = extensions + bx::strnlen(extensions); + const char* end = extensions + bx::strLen(extensions); uint32_t index = 0; while (pos < end) { uint32_t len; - const char* space = bx::strnchr(pos, ' '); + const char* space = bx::strFind(pos, ' '); if (NULL != space) { len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) ); } else { - len = bx::uint32_min(sizeof(name), (uint32_t)bx::strnlen(pos) ); + len = bx::uint32_min(sizeof(name), (uint32_t)bx::strLen(pos) ); } - bx::strlncpy(name, BX_COUNTOF(name), pos, len); + bx::strCopy(name, BX_COUNTOF(name), pos, len); name[len] = '\0'; updateExtension(name); @@ -1612,624 +1931,642 @@ namespace bgfx { namespace gl } } - // Allow all texture filters. - bx::memSet(s_textureFilter, true, BX_COUNTOF(s_textureFilter) ); - - bool bc123Supported = 0 - || s_extension[Extension::EXT_texture_compression_s3tc ].m_supported - || s_extension[Extension::MOZ_WEBGL_compressed_texture_s3tc ].m_supported - || s_extension[Extension::WEBGL_compressed_texture_s3tc ].m_supported - || s_extension[Extension::WEBKIT_WEBGL_compressed_texture_s3tc].m_supported - ; - s_textureFormat[TextureFormat::BC1].m_supported |= bc123Supported - || s_extension[Extension::ANGLE_texture_compression_dxt1].m_supported - || s_extension[Extension::EXT_texture_compression_dxt1 ].m_supported - ; + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) + && !s_extension[Extension::ARB_framebuffer_object].m_supported) + { + BX_TRACE("Init error: ARB_framebuffer_object not supported."); + goto error; + } - if (!s_textureFormat[TextureFormat::BC1].m_supported - && ( s_textureFormat[TextureFormat::BC2].m_supported || s_textureFormat[TextureFormat::BC3].m_supported) ) { - // If RGBA_S3TC_DXT1 is not supported, maybe RGB_S3TC_DXT1 is? - for (GLint ii = 0; ii < numCmpFormats; ++ii) + // Allow all texture filters. + bx::memSet(s_textureFilter, true, BX_COUNTOF(s_textureFilter) ); + + bool bc123Supported = 0 + || s_extension[Extension::EXT_texture_compression_s3tc ].m_supported + || s_extension[Extension::MOZ_WEBGL_compressed_texture_s3tc ].m_supported + || s_extension[Extension::WEBGL_compressed_texture_s3tc ].m_supported + || s_extension[Extension::WEBKIT_WEBGL_compressed_texture_s3tc].m_supported + ; + s_textureFormat[TextureFormat::BC1].m_supported |= bc123Supported + || s_extension[Extension::ANGLE_texture_compression_dxt1].m_supported + || s_extension[Extension::EXT_texture_compression_dxt1 ].m_supported + ; + + if (!s_textureFormat[TextureFormat::BC1].m_supported + && ( s_textureFormat[TextureFormat::BC2].m_supported || s_textureFormat[TextureFormat::BC3].m_supported) ) { - if (GL_COMPRESSED_RGB_S3TC_DXT1_EXT == cmpFormat[ii]) + // If RGBA_S3TC_DXT1 is not supported, maybe RGB_S3TC_DXT1 is? + for (GLint ii = 0; ii < numCmpFormats; ++ii) { - setTextureFormat(TextureFormat::BC1, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT); - s_textureFormat[TextureFormat::BC1].m_supported = true; - break; + if (GL_COMPRESSED_RGB_S3TC_DXT1_EXT == cmpFormat[ii]) + { + setTextureFormat(TextureFormat::BC1, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT); + s_textureFormat[TextureFormat::BC1].m_supported = true; + break; + } } } - } - - s_textureFormat[TextureFormat::BC2].m_supported |= bc123Supported - || s_extension[Extension::ANGLE_texture_compression_dxt3 ].m_supported - || s_extension[Extension::CHROMIUM_texture_compression_dxt3].m_supported - ; - s_textureFormat[TextureFormat::BC3].m_supported |= bc123Supported - || s_extension[Extension::ANGLE_texture_compression_dxt5 ].m_supported - || s_extension[Extension::CHROMIUM_texture_compression_dxt5].m_supported - ; + s_textureFormat[TextureFormat::BC2].m_supported |= bc123Supported + || s_extension[Extension::ANGLE_texture_compression_dxt3 ].m_supported + || s_extension[Extension::CHROMIUM_texture_compression_dxt3].m_supported + ; - if (s_extension[Extension::EXT_texture_compression_latc].m_supported) - { - setTextureFormat(TextureFormat::BC4, GL_COMPRESSED_LUMINANCE_LATC1_EXT, GL_COMPRESSED_LUMINANCE_LATC1_EXT); - setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT); - } + s_textureFormat[TextureFormat::BC3].m_supported |= bc123Supported + || s_extension[Extension::ANGLE_texture_compression_dxt5 ].m_supported + || s_extension[Extension::CHROMIUM_texture_compression_dxt5].m_supported + ; - if (s_extension[Extension::ARB_texture_compression_rgtc].m_supported - || s_extension[Extension::EXT_texture_compression_rgtc].m_supported) - { - setTextureFormat(TextureFormat::BC4, GL_COMPRESSED_RED_RGTC1, GL_COMPRESSED_RED_RGTC1); - setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2); - } + if (s_extension[Extension::EXT_texture_compression_latc].m_supported) + { + setTextureFormat(TextureFormat::BC4, GL_COMPRESSED_LUMINANCE_LATC1_EXT, GL_COMPRESSED_LUMINANCE_LATC1_EXT); + setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT); + } - bool etc1Supported = 0 - || s_extension[Extension::OES_compressed_ETC1_RGB8_texture].m_supported - || s_extension[Extension::WEBGL_compressed_texture_etc1 ].m_supported - ; - s_textureFormat[TextureFormat::ETC1].m_supported |= etc1Supported; + if (s_extension[Extension::ARB_texture_compression_rgtc].m_supported + || s_extension[Extension::EXT_texture_compression_rgtc].m_supported) + { + setTextureFormat(TextureFormat::BC4, GL_COMPRESSED_RED_RGTC1, GL_COMPRESSED_RED_RGTC1); + setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2); + } - bool etc2Supported = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_ES3_compatibility].m_supported - ; - s_textureFormat[TextureFormat::ETC2 ].m_supported |= etc2Supported; - s_textureFormat[TextureFormat::ETC2A ].m_supported |= etc2Supported; - s_textureFormat[TextureFormat::ETC2A1].m_supported |= etc2Supported; + bool etc1Supported = 0 + || s_extension[Extension::OES_compressed_ETC1_RGB8_texture].m_supported + || s_extension[Extension::WEBGL_compressed_texture_etc1 ].m_supported + ; + s_textureFormat[TextureFormat::ETC1].m_supported |= etc1Supported; - if (!s_textureFormat[TextureFormat::ETC1].m_supported - && s_textureFormat[TextureFormat::ETC2].m_supported) - { - // When ETC2 is supported override ETC1 texture format settings. - s_textureFormat[TextureFormat::ETC1].m_internalFmt = GL_COMPRESSED_RGB8_ETC2; - s_textureFormat[TextureFormat::ETC1].m_fmt = GL_COMPRESSED_RGB8_ETC2; - s_textureFormat[TextureFormat::ETC1].m_supported = true; - } + bool etc2Supported = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_ES3_compatibility].m_supported + ; + s_textureFormat[TextureFormat::ETC2 ].m_supported |= etc2Supported; + s_textureFormat[TextureFormat::ETC2A ].m_supported |= etc2Supported; + s_textureFormat[TextureFormat::ETC2A1].m_supported |= etc2Supported; - bool ptc1Supported = 0 - || s_extension[Extension::IMG_texture_compression_pvrtc ].m_supported - || s_extension[Extension::WEBGL_compressed_texture_pvrtc].m_supported - ; - s_textureFormat[TextureFormat::PTC12 ].m_supported |= ptc1Supported; - s_textureFormat[TextureFormat::PTC14 ].m_supported |= ptc1Supported; - s_textureFormat[TextureFormat::PTC12A].m_supported |= ptc1Supported; - s_textureFormat[TextureFormat::PTC14A].m_supported |= ptc1Supported; + if (!s_textureFormat[TextureFormat::ETC1].m_supported + && s_textureFormat[TextureFormat::ETC2].m_supported) + { + // When ETC2 is supported override ETC1 texture format settings. + s_textureFormat[TextureFormat::ETC1].m_internalFmt = GL_COMPRESSED_RGB8_ETC2; + s_textureFormat[TextureFormat::ETC1].m_fmt = GL_COMPRESSED_RGB8_ETC2; + s_textureFormat[TextureFormat::ETC1].m_supported = true; + } - bool ptc2Supported = s_extension[Extension::IMG_texture_compression_pvrtc2].m_supported; - s_textureFormat[TextureFormat::PTC22].m_supported |= ptc2Supported; - s_textureFormat[TextureFormat::PTC24].m_supported |= ptc2Supported; + bool ptc1Supported = 0 + || s_extension[Extension::IMG_texture_compression_pvrtc ].m_supported + || s_extension[Extension::WEBGL_compressed_texture_pvrtc].m_supported + ; + s_textureFormat[TextureFormat::PTC12 ].m_supported |= ptc1Supported; + s_textureFormat[TextureFormat::PTC14 ].m_supported |= ptc1Supported; + s_textureFormat[TextureFormat::PTC12A].m_supported |= ptc1Supported; + s_textureFormat[TextureFormat::PTC14A].m_supported |= ptc1Supported; - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) - { - setTextureFormat(TextureFormat::D32, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT); + bool ptc2Supported = s_extension[Extension::IMG_texture_compression_pvrtc2].m_supported; + s_textureFormat[TextureFormat::PTC22].m_supported |= ptc2Supported; + s_textureFormat[TextureFormat::PTC24].m_supported |= ptc2Supported; - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) ) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) { - setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT); - setTextureFormat(TextureFormat::RGBA32F, GL_RGBA, GL_RGBA, GL_FLOAT); - // internalFormat and format must match: - // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml - setTextureFormat(TextureFormat::RGBA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); - setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV); - setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV); - setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV); + setTextureFormat(TextureFormat::D32, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT); - if (s_extension[Extension::OES_texture_half_float].m_supported - || s_extension[Extension::OES_texture_float ].m_supported) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) ) { - // https://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt - // When half/float is available via extensions texture will be marked as - // incomplete if it uses anything other than nearest filter. - const bool linear16F = s_extension[Extension::OES_texture_half_float_linear].m_supported; - const bool linear32F = s_extension[Extension::OES_texture_float_linear ].m_supported; - - s_textureFilter[TextureFormat::R16F] = linear16F; - s_textureFilter[TextureFormat::RG16F] = linear16F; - s_textureFilter[TextureFormat::RGBA16F] = linear16F; - s_textureFilter[TextureFormat::R32F] = linear32F; - s_textureFilter[TextureFormat::RG32F] = linear32F; - s_textureFilter[TextureFormat::RGBA32F] = linear32F; - } + setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT); + setTextureFormat(TextureFormat::RGBA32F, GL_RGBA, GL_RGBA, GL_FLOAT); + // internalFormat and format must match: + // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml + setTextureFormat(TextureFormat::RGBA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); + setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV); + setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV); + setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV); + + if (s_extension[Extension::OES_texture_half_float].m_supported + || s_extension[Extension::OES_texture_float ].m_supported) + { + // https://www.khronos.org/registry/gles/extensions/OES/OES_texture_float.txt + // When half/float is available via extensions texture will be marked as + // incomplete if it uses anything other than nearest filter. + const bool linear16F = s_extension[Extension::OES_texture_half_float_linear].m_supported; + const bool linear32F = s_extension[Extension::OES_texture_float_linear ].m_supported; + + s_textureFilter[TextureFormat::R16F] = linear16F; + s_textureFilter[TextureFormat::RG16F] = linear16F; + s_textureFilter[TextureFormat::RGBA16F] = linear16F; + s_textureFilter[TextureFormat::R32F] = linear32F; + s_textureFilter[TextureFormat::RG32F] = linear32F; + s_textureFilter[TextureFormat::RGBA32F] = linear32F; + } - if (BX_ENABLED(BX_PLATFORM_IOS) || BX_ENABLED(BX_PLATFORM_EMSCRIPTEN)) - { - setTextureFormat(TextureFormat::D16, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT); - setTextureFormat(TextureFormat::D24S8, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8); + if (BX_ENABLED(BX_PLATFORM_IOS) || BX_ENABLED(BX_PLATFORM_EMSCRIPTEN)) + { + setTextureFormat(TextureFormat::D16, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT); + setTextureFormat(TextureFormat::D24S8, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8); + } } } - } - - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) - || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) - { - setTextureFormat(TextureFormat::R8I, GL_R8I, GL_RED_INTEGER, GL_BYTE); - setTextureFormat(TextureFormat::R8U, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE); - setTextureFormat(TextureFormat::R16I, GL_R16I, GL_RED_INTEGER, GL_SHORT); - setTextureFormat(TextureFormat::R16U, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT); -// setTextureFormat(TextureFormat::RG16, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT); -// setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT); - setTextureFormat(TextureFormat::R32U, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT); - setTextureFormat(TextureFormat::RG32U, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT); - setTextureFormat(TextureFormat::RGBA32U, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT); - } - if (s_extension[Extension::EXT_texture_format_BGRA8888 ].m_supported - || s_extension[Extension::EXT_bgra ].m_supported - || s_extension[Extension::IMG_texture_format_BGRA8888 ].m_supported - || s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported) - { - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) + || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) { - m_readPixelsFmt = GL_BGRA; + setTextureFormat(TextureFormat::R8I, GL_R8I, GL_RED_INTEGER, GL_BYTE); + setTextureFormat(TextureFormat::R8U, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE); + setTextureFormat(TextureFormat::R16I, GL_R16I, GL_RED_INTEGER, GL_SHORT); + setTextureFormat(TextureFormat::R16U, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT); + // setTextureFormat(TextureFormat::RG16, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT); + // setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT); + setTextureFormat(TextureFormat::R32U, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT); + setTextureFormat(TextureFormat::RG32U, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT); + setTextureFormat(TextureFormat::RGBA32U, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT); } - // Mixing GLES and GL extensions here. OpenGL EXT_bgra and - // APPLE_texture_format_BGRA8888 wants - // format to be BGRA but internal format to stay RGBA, but - // EXT_texture_format_BGRA8888 wants both format and internal - // format to be BGRA. - // - // Reference: - // https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt - // https://www.opengl.org/registry/specs/EXT/bgra.txt - // https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_format_BGRA8888.txt - if (!s_extension[Extension::EXT_bgra ].m_supported - && !s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported) + if (s_extension[Extension::EXT_texture_format_BGRA8888 ].m_supported + || s_extension[Extension::EXT_bgra ].m_supported + || s_extension[Extension::IMG_texture_format_BGRA8888 ].m_supported + || s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported) { - s_textureFormat[TextureFormat::BGRA8].m_internalFmt = GL_BGRA; + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) + { + m_readPixelsFmt = GL_BGRA; + } + + // Mixing GLES and GL extensions here. OpenGL EXT_bgra and + // APPLE_texture_format_BGRA8888 wants + // format to be BGRA but internal format to stay RGBA, but + // EXT_texture_format_BGRA8888 wants both format and internal + // format to be BGRA. + // + // Reference: + // https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt + // https://www.opengl.org/registry/specs/EXT/bgra.txt + // https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_format_BGRA8888.txt + if (!s_extension[Extension::EXT_bgra ].m_supported + && !s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported) + { + s_textureFormat[TextureFormat::BGRA8].m_internalFmt = GL_BGRA; + } + + if (!isTextureFormatValid(TextureFormat::BGRA8) ) + { + // Revert back to RGBA if texture can't be created. + setTextureFormat(TextureFormat::BGRA8, GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE); + } } - if (!isTextureFormatValid(TextureFormat::BGRA8) ) + if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) + || !isTextureFormatValid(TextureFormat::R8) ) { - // Revert back to RGBA if texture can't be created. - setTextureFormat(TextureFormat::BGRA8, GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE); + // GL core has to use GL_R8 Issue#208, GLES2 has to use GL_LUMINANCE issue#226 + s_textureFormat[TextureFormat::R8].m_internalFmt = GL_LUMINANCE; + s_textureFormat[TextureFormat::R8].m_fmt = GL_LUMINANCE; } - } - if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) - || !isTextureFormatValid(TextureFormat::R8) ) - { - // GL core has to use GL_R8 Issue#208, GLES2 has to use GL_LUMINANCE issue#226 - s_textureFormat[TextureFormat::R8].m_internalFmt = GL_LUMINANCE; - s_textureFormat[TextureFormat::R8].m_fmt = GL_LUMINANCE; - } - - for (uint32_t ii = BX_ENABLED(BX_PLATFORM_IOS) ? TextureFormat::Unknown : 0 // skip test on iOS! - ; ii < TextureFormat::Count - ; ++ii - ) - { - if (TextureFormat::Unknown != ii - && TextureFormat::UnknownDepth != ii) + for (uint32_t ii = BX_ENABLED(BX_PLATFORM_IOS) ? TextureFormat::Unknown : 0 // skip test on iOS! + ; ii < TextureFormat::Count + ; ++ii + ) { - s_textureFormat[ii].m_supported = isTextureFormatValid(TextureFormat::Enum(ii) ); + if (TextureFormat::Unknown != ii + && TextureFormat::UnknownDepth != ii) + { + s_textureFormat[ii].m_supported = isTextureFormatValid(TextureFormat::Enum(ii) ); + } } - } - if (BX_ENABLED(0) ) - { - // Disable all compressed texture formats. For testing only. - for (uint32_t ii = 0; ii < TextureFormat::Unknown; ++ii) + if (BX_ENABLED(0) ) { - s_textureFormat[ii].m_supported = false; + // Disable all compressed texture formats. For testing only. + for (uint32_t ii = 0; ii < TextureFormat::Unknown; ++ii) + { + s_textureFormat[ii].m_supported = false; + } } - } - - const bool computeSupport = false - || !!(BGFX_CONFIG_RENDERER_OPENGLES >= 31) - || s_extension[Extension::ARB_compute_shader].m_supported - ; - for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) - { - uint16_t supported = BGFX_CAPS_FORMAT_TEXTURE_NONE; - supported |= s_textureFormat[ii].m_supported - ? BGFX_CAPS_FORMAT_TEXTURE_2D - | BGFX_CAPS_FORMAT_TEXTURE_3D - | BGFX_CAPS_FORMAT_TEXTURE_CUBE - : BGFX_CAPS_FORMAT_TEXTURE_NONE - ; - - supported |= isTextureFormatValid(TextureFormat::Enum(ii), true) - ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB - | BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB - | BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB - : BGFX_CAPS_FORMAT_TEXTURE_NONE + const bool computeSupport = false + || !!(BGFX_CONFIG_RENDERER_OPENGLES >= 31) + || s_extension[Extension::ARB_compute_shader].m_supported ; - supported |= isTextureFormatValid(TextureFormat::Enum(ii), false, true) - ? BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN - : BGFX_CAPS_FORMAT_TEXTURE_NONE - ; + for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) + { + uint16_t supported = BGFX_CAPS_FORMAT_TEXTURE_NONE; + supported |= s_textureFormat[ii].m_supported + ? BGFX_CAPS_FORMAT_TEXTURE_2D + | BGFX_CAPS_FORMAT_TEXTURE_3D + | BGFX_CAPS_FORMAT_TEXTURE_CUBE + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; - supported |= computeSupport - && isImageFormatValid(TextureFormat::Enum(ii) ) - ? BGFX_CAPS_FORMAT_TEXTURE_IMAGE - : BGFX_CAPS_FORMAT_TEXTURE_NONE - ; + supported |= isTextureFormatValid(TextureFormat::Enum(ii), true) + ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB + | BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB + | BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; - supported |= isFramebufferFormatValid(TextureFormat::Enum(ii) ) - ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER - : BGFX_CAPS_FORMAT_TEXTURE_NONE - ; + supported |= isTextureFormatValid(TextureFormat::Enum(ii), false, true) + ? BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; - if (NULL != glGetInternalformativ) - { - GLint maxSamples; - glGetInternalformativ(GL_RENDERBUFFER - , s_textureFormat[ii].m_internalFmt - , GL_SAMPLES - , 1 - , &maxSamples - ); - GLenum err = glGetError(); - supported |= 0 == err && maxSamples > 0 - ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA + supported |= computeSupport + && isImageFormatValid(TextureFormat::Enum(ii) ) + ? BGFX_CAPS_FORMAT_TEXTURE_IMAGE : BGFX_CAPS_FORMAT_TEXTURE_NONE ; - glGetInternalformativ(GL_TEXTURE_2D_MULTISAMPLE - , s_textureFormat[ii].m_internalFmt - , GL_SAMPLES - , 1 - , &maxSamples - ); - err = glGetError(); - supported |= 0 == err && maxSamples > 0 - ? BGFX_CAPS_FORMAT_TEXTURE_MSAA + supported |= isFramebufferFormatValid(TextureFormat::Enum(ii) ) + ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE ; - } - g_caps.formats[ii] = supported; - } + supported |= isFramebufferFormatValid(TextureFormat::Enum(ii), false, true) + ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; - g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::OES_texture_3D].m_supported - ? BGFX_CAPS_TEXTURE_3D - : 0 - ; - g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::EXT_shadow_samplers].m_supported - ? BGFX_CAPS_TEXTURE_COMPARE_ALL - : 0 - ; - g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::OES_vertex_half_float].m_supported - ? BGFX_CAPS_VERTEX_ATTRIB_HALF - : 0 - ; - g_caps.supported |= false - || s_extension[Extension::ARB_vertex_type_2_10_10_10_rev].m_supported - || s_extension[Extension::OES_vertex_type_10_10_10_2].m_supported - ? BGFX_CAPS_VERTEX_ATTRIB_UINT10 - : 0 - ; - g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::EXT_frag_depth].m_supported - ? BGFX_CAPS_FRAGMENT_DEPTH - : 0 - ; - g_caps.supported |= s_extension[Extension::ARB_draw_buffers_blend].m_supported - ? BGFX_CAPS_BLEND_INDEPENDENT - : 0 - ; - g_caps.supported |= s_extension[Extension::INTEL_fragment_shader_ordering].m_supported - ? BGFX_CAPS_FRAGMENT_ORDERING - : 0 - ; - g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::OES_element_index_uint].m_supported - ? BGFX_CAPS_INDEX32 - : 0 - ; + if (NULL != glGetInternalformativ) + { + GLint maxSamples; + glGetInternalformativ(GL_RENDERBUFFER + , s_textureFormat[ii].m_internalFmt + , GL_SAMPLES + , 1 + , &maxSamples + ); + GLenum err = glGetError(); + supported |= 0 == err && maxSamples > 0 + ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; - const bool drawIndirectSupported = false - || s_extension[Extension::AMD_multi_draw_indirect].m_supported - || s_extension[Extension::ARB_draw_indirect ].m_supported - || s_extension[Extension::ARB_multi_draw_indirect].m_supported - || s_extension[Extension::EXT_multi_draw_indirect].m_supported - ; + glGetInternalformativ(GL_TEXTURE_2D_MULTISAMPLE + , s_textureFormat[ii].m_internalFmt + , GL_SAMPLES + , 1 + , &maxSamples + ); + err = glGetError(); + supported |= 0 == err && maxSamples > 0 + ? BGFX_CAPS_FORMAT_TEXTURE_MSAA + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; + } - if (drawIndirectSupported) - { - if (NULL == glMultiDrawArraysIndirect - || NULL == glMultiDrawElementsIndirect) - { - glMultiDrawArraysIndirect = stubMultiDrawArraysIndirect; - glMultiDrawElementsIndirect = stubMultiDrawElementsIndirect; + g_caps.formats[ii] = supported; } - } - g_caps.supported |= drawIndirectSupported - ? BGFX_CAPS_DRAW_INDIRECT - : 0 - ; + g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::OES_texture_3D].m_supported + ? BGFX_CAPS_TEXTURE_3D + : 0 + ; + g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::EXT_shadow_samplers].m_supported + ? BGFX_CAPS_TEXTURE_COMPARE_ALL + : 0 + ; + g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::OES_vertex_half_float].m_supported + ? BGFX_CAPS_VERTEX_ATTRIB_HALF + : 0 + ; + g_caps.supported |= false + || s_extension[Extension::ARB_vertex_type_2_10_10_10_rev].m_supported + || s_extension[Extension::OES_vertex_type_10_10_10_2].m_supported + ? BGFX_CAPS_VERTEX_ATTRIB_UINT10 + : 0 + ; + g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::EXT_frag_depth].m_supported + ? BGFX_CAPS_FRAGMENT_DEPTH + : 0 + ; + g_caps.supported |= s_extension[Extension::ARB_draw_buffers_blend].m_supported + ? BGFX_CAPS_BLEND_INDEPENDENT + : 0 + ; + g_caps.supported |= s_extension[Extension::INTEL_fragment_shader_ordering].m_supported + ? BGFX_CAPS_FRAGMENT_ORDERING + : 0 + ; + g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::OES_element_index_uint].m_supported + ? BGFX_CAPS_INDEX32 + : 0 + ; - if (NULL == glPolygonMode) - { - glPolygonMode = stubPolygonMode; - } + const bool drawIndirectSupported = false + || s_extension[Extension::AMD_multi_draw_indirect].m_supported + || s_extension[Extension::ARB_draw_indirect ].m_supported + || s_extension[Extension::ARB_multi_draw_indirect].m_supported + || s_extension[Extension::EXT_multi_draw_indirect].m_supported + ; - if (s_extension[Extension::ARB_copy_image].m_supported - || s_extension[Extension::EXT_copy_image].m_supported - || s_extension[Extension:: NV_copy_image].m_supported - || s_extension[Extension::OES_copy_image].m_supported) - { - m_blitSupported = NULL != glCopyImageSubData; - g_caps.supported |= m_blitSupported - ? BGFX_CAPS_TEXTURE_BLIT + if (drawIndirectSupported) + { + if (NULL == glMultiDrawArraysIndirect + || NULL == glMultiDrawElementsIndirect) + { + glMultiDrawArraysIndirect = stubMultiDrawArraysIndirect; + glMultiDrawElementsIndirect = stubMultiDrawElementsIndirect; + } + } + + g_caps.supported |= drawIndirectSupported + ? BGFX_CAPS_DRAW_INDIRECT : 0 ; - } - g_caps.supported |= m_readBackSupported - ? BGFX_CAPS_TEXTURE_READ_BACK - : 0 - ; + if (NULL == glPolygonMode) + { + glPolygonMode = stubPolygonMode; + } - g_caps.supported |= false - || s_extension[Extension::EXT_texture_array].m_supported - || s_extension[Extension::EXT_gpu_shader4].m_supported - || !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - ? BGFX_CAPS_TEXTURE_2D_ARRAY - : 0 - ; + if (s_extension[Extension::ARB_copy_image].m_supported + || s_extension[Extension::EXT_copy_image].m_supported + || s_extension[Extension:: NV_copy_image].m_supported + || s_extension[Extension::OES_copy_image].m_supported) + { + m_blitSupported = NULL != glCopyImageSubData; + g_caps.supported |= m_blitSupported + ? BGFX_CAPS_TEXTURE_BLIT + : 0 + ; + } - g_caps.supported |= false - || s_extension[Extension::ARB_texture_cube_map_array].m_supported - || s_extension[Extension::EXT_texture_cube_map_array].m_supported - ? BGFX_CAPS_TEXTURE_CUBE_ARRAY - : 0 - ; + g_caps.supported |= m_readBackSupported + ? BGFX_CAPS_TEXTURE_READ_BACK + : 0 + ; - g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) ); + g_caps.supported |= false + || s_extension[Extension::EXT_texture_array].m_supported + || s_extension[Extension::EXT_gpu_shader4].m_supported + || !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + ? BGFX_CAPS_TEXTURE_2D_ARRAY + : 0 + ; - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) - || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::EXT_draw_buffers ].m_supported - || s_extension[Extension::WEBGL_draw_buffers].m_supported) - { - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS) - , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) - ); - } + g_caps.supported |= false + || s_extension[Extension::ARB_texture_cube_map_array].m_supported + || s_extension[Extension::EXT_texture_cube_map_array].m_supported + ? BGFX_CAPS_TEXTURE_CUBE_ARRAY + : 0 + ; -// if (s_extension[Extension::ARB_clip_control].m_supported) -// { -// GL_CHECK(glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) ); -// g_caps.originBottomLeft = true; -// } -// else - { - g_caps.homogeneousDepth = true; - g_caps.originBottomLeft = true; - } + g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) ); - m_vaoSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_vertex_array_object].m_supported - || s_extension[Extension::OES_vertex_array_object].m_supported - ; + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) + || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::EXT_draw_buffers ].m_supported + || s_extension[Extension::WEBGL_draw_buffers].m_supported) + { + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS) + , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) + ); + } - if (BX_ENABLED(BX_PLATFORM_NACL) ) - { - m_vaoSupport &= true - && NULL != glGenVertexArrays - && NULL != glDeleteVertexArrays - && NULL != glBindVertexArray + // if (s_extension[Extension::ARB_clip_control].m_supported) + // { + // GL_CHECK(glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) ); + // g_caps.originBottomLeft = true; + // } + // else + { + g_caps.homogeneousDepth = true; + g_caps.originBottomLeft = true; + } + + m_vaoSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_vertex_array_object].m_supported + || s_extension[Extension::OES_vertex_array_object].m_supported ; - } - if (m_vaoSupport) - { - GL_CHECK(glGenVertexArrays(1, &m_vao) ); - } + if (m_vaoSupport) + { + GL_CHECK(glGenVertexArrays(1, &m_vao) ); + } - m_samplerObjectSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_sampler_objects].m_supported - ; + m_samplerObjectSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_sampler_objects].m_supported + ; - m_shadowSamplersSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::EXT_shadow_samplers].m_supported - ; + m_shadowSamplersSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::EXT_shadow_samplers].m_supported + ; - m_programBinarySupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_get_program_binary].m_supported - || s_extension[Extension::OES_get_program_binary].m_supported - || s_extension[Extension::IMG_shader_binary ].m_supported - ; + m_programBinarySupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_get_program_binary].m_supported + || s_extension[Extension::OES_get_program_binary].m_supported + || s_extension[Extension::IMG_shader_binary ].m_supported + ; - m_textureSwizzleSupport = false - || s_extension[Extension::ARB_texture_swizzle].m_supported - || s_extension[Extension::EXT_texture_swizzle].m_supported - ; + m_textureSwizzleSupport = false + || s_extension[Extension::ARB_texture_swizzle].m_supported + || s_extension[Extension::EXT_texture_swizzle].m_supported + ; - m_depthTextureSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ANGLE_depth_texture ].m_supported - || s_extension[Extension::CHROMIUM_depth_texture ].m_supported - || s_extension[Extension::GOOGLE_depth_texture ].m_supported - || s_extension[Extension::OES_depth_texture ].m_supported - || s_extension[Extension::MOZ_WEBGL_depth_texture ].m_supported - || s_extension[Extension::WEBGL_depth_texture ].m_supported - || s_extension[Extension::WEBKIT_WEBGL_depth_texture].m_supported - ; + m_depthTextureSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ANGLE_depth_texture ].m_supported + || s_extension[Extension::CHROMIUM_depth_texture ].m_supported + || s_extension[Extension::GOOGLE_depth_texture ].m_supported + || s_extension[Extension::OES_depth_texture ].m_supported + || s_extension[Extension::MOZ_WEBGL_depth_texture ].m_supported + || s_extension[Extension::WEBGL_depth_texture ].m_supported + || s_extension[Extension::WEBKIT_WEBGL_depth_texture].m_supported + ; - m_timerQuerySupport = false - || s_extension[Extension::ANGLE_timer_query ].m_supported - || s_extension[Extension::ARB_timer_query ].m_supported - || s_extension[Extension::EXT_disjoint_timer_query].m_supported - || s_extension[Extension::EXT_timer_query ].m_supported - ; + m_timerQuerySupport = false + || s_extension[Extension::ANGLE_timer_query ].m_supported + || s_extension[Extension::ARB_timer_query ].m_supported + || s_extension[Extension::EXT_disjoint_timer_query].m_supported + || s_extension[Extension::EXT_timer_query ].m_supported + ; - m_timerQuerySupport &= true - && NULL != glQueryCounter - && NULL != glGetQueryObjectiv - && NULL != glGetQueryObjectui64v - ; + m_timerQuerySupport &= true + && NULL != glQueryCounter + && NULL != glGetQueryObjectiv + && NULL != glGetQueryObjectui64v + ; - m_occlusionQuerySupport = false - || s_extension[Extension::ARB_occlusion_query ].m_supported - || s_extension[Extension::ARB_occlusion_query2 ].m_supported - || s_extension[Extension::EXT_occlusion_query_boolean].m_supported - || s_extension[Extension::NV_occlusion_query ].m_supported - ; + m_occlusionQuerySupport = false + || s_extension[Extension::ARB_occlusion_query ].m_supported + || s_extension[Extension::ARB_occlusion_query2 ].m_supported + || s_extension[Extension::EXT_occlusion_query_boolean].m_supported + || s_extension[Extension::NV_occlusion_query ].m_supported + ; - m_occlusionQuerySupport &= true - && NULL != glGenQueries - && NULL != glDeleteQueries - && NULL != glBeginQuery - && NULL != glEndQuery - ; + m_occlusionQuerySupport &= true + && NULL != glGenQueries + && NULL != glDeleteQueries + && NULL != glBeginQuery + && NULL != glEndQuery + ; - m_atocSupport = s_extension[Extension::ARB_multisample].m_supported; - m_conservativeRasterSupport = s_extension[Extension::NV_conservative_raster].m_supported; + m_atocSupport = s_extension[Extension::ARB_multisample].m_supported; + m_conservativeRasterSupport = s_extension[Extension::NV_conservative_raster].m_supported; - g_caps.supported |= 0 - | (m_atocSupport ? BGFX_CAPS_ALPHA_TO_COVERAGE : 0) - | (m_conservativeRasterSupport ? BGFX_CAPS_CONSERVATIVE_RASTER : 0) - | (m_occlusionQuerySupport ? BGFX_CAPS_OCCLUSION_QUERY : 0) - | (m_depthTextureSupport ? BGFX_CAPS_TEXTURE_COMPARE_LEQUAL : 0) - | (computeSupport ? BGFX_CAPS_COMPUTE : 0) - ; + g_caps.supported |= 0 + | (m_atocSupport ? BGFX_CAPS_ALPHA_TO_COVERAGE : 0) + | (m_conservativeRasterSupport ? BGFX_CAPS_CONSERVATIVE_RASTER : 0) + | (m_occlusionQuerySupport ? BGFX_CAPS_OCCLUSION_QUERY : 0) + | (m_depthTextureSupport ? BGFX_CAPS_TEXTURE_COMPARE_LEQUAL : 0) + | (computeSupport ? BGFX_CAPS_COMPUTE : 0) + ; - g_caps.supported |= m_glctx.getCaps(); + g_caps.supported |= m_glctx.getCaps(); - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) - { - m_srgbWriteControlSupport = s_extension[Extension::EXT_sRGB_write_control].m_supported; + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) + { + m_srgbWriteControlSupport = s_extension[Extension::EXT_sRGB_write_control].m_supported; - m_borderColorSupport = s_extension[Extension::NV_texture_border_clamp].m_supported; - s_textureAddress[BGFX_TEXTURE_U_BORDER>>BGFX_TEXTURE_U_SHIFT] = s_extension[Extension::NV_texture_border_clamp].m_supported - ? GL_CLAMP_TO_BORDER - : GL_CLAMP_TO_EDGE - ; - } + m_borderColorSupport = s_extension[Extension::NV_texture_border_clamp].m_supported; + s_textureAddress[BGFX_TEXTURE_U_BORDER>>BGFX_TEXTURE_U_SHIFT] = s_extension[Extension::NV_texture_border_clamp].m_supported + ? GL_CLAMP_TO_BORDER + : GL_CLAMP_TO_EDGE + ; + } - if (s_extension[Extension::EXT_texture_filter_anisotropic].m_supported) - { - GL_CHECK(glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_maxAnisotropyDefault) ); - } + if (s_extension[Extension::EXT_texture_filter_anisotropic].m_supported) + { + GL_CHECK(glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_maxAnisotropyDefault) ); + } - if (s_extension[Extension::ARB_texture_multisample].m_supported - || s_extension[Extension::ANGLE_framebuffer_multisample].m_supported) - { - GL_CHECK(glGetIntegerv(GL_MAX_SAMPLES, &m_maxMsaa) ); - } + if (s_extension[Extension::ARB_texture_multisample].m_supported + || s_extension[Extension::ANGLE_framebuffer_multisample].m_supported) + { + GL_CHECK(glGetIntegerv(GL_MAX_SAMPLES, &m_maxMsaa) ); + } - if (s_extension[Extension::OES_read_format].m_supported - && (s_extension[Extension::IMG_read_format].m_supported || s_extension[Extension::EXT_read_format_bgra].m_supported) ) - { - m_readPixelsFmt = GL_BGRA; - } - else - { - m_readPixelsFmt = GL_RGBA; - } + if (s_extension[Extension::OES_read_format].m_supported + && (s_extension[Extension::IMG_read_format].m_supported || s_extension[Extension::EXT_read_format_bgra].m_supported) ) + { + m_readPixelsFmt = GL_BGRA; + } + else + { + m_readPixelsFmt = GL_RGBA; + } - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) - { - g_caps.supported |= BGFX_CAPS_INSTANCING; - } - else - { - if (s_extension[Extension::ANGLE_instanced_arrays].m_supported - || s_extension[Extension::ARB_instanced_arrays].m_supported - || s_extension[Extension::EXT_instanced_arrays].m_supported) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) + { + g_caps.supported |= BGFX_CAPS_INSTANCING; + } + else { - if (NULL != glVertexAttribDivisor - && NULL != glDrawArraysInstanced - && NULL != glDrawElementsInstanced) + if (s_extension[Extension::ANGLE_instanced_arrays].m_supported + || s_extension[Extension::ARB_instanced_arrays].m_supported + || s_extension[Extension::EXT_instanced_arrays].m_supported) { - g_caps.supported |= BGFX_CAPS_INSTANCING; + if (NULL != glVertexAttribDivisor + && NULL != glDrawArraysInstanced + && NULL != glDrawElementsInstanced) + { + g_caps.supported |= BGFX_CAPS_INSTANCING; + } } - } - if (0 == (g_caps.supported & BGFX_CAPS_INSTANCING) ) - { - glVertexAttribDivisor = stubVertexAttribDivisor; - glDrawArraysInstanced = stubDrawArraysInstanced; - glDrawElementsInstanced = stubDrawElementsInstanced; + if (0 == (g_caps.supported & BGFX_CAPS_INSTANCING) ) + { + glVertexAttribDivisor = stubVertexAttribDivisor; + glDrawArraysInstanced = stubDrawArraysInstanced; + glDrawElementsInstanced = stubDrawElementsInstanced; + } } - } - if (s_extension[Extension::ARB_debug_output].m_supported - || s_extension[Extension::KHR_debug].m_supported) - { - if (NULL != glDebugMessageControl - && NULL != glDebugMessageInsert - && NULL != glDebugMessageCallback - && NULL != glGetDebugMessageLog) + if (s_extension[Extension::ARB_debug_output].m_supported + || s_extension[Extension::KHR_debug].m_supported) { - GL_CHECK(glDebugMessageCallback(debugProcCb, NULL) ); - GL_CHECK(glDebugMessageControl(GL_DONT_CARE + if (NULL != glDebugMessageControl + && NULL != glDebugMessageInsert + && NULL != glDebugMessageCallback + && NULL != glGetDebugMessageLog) + { + GL_CHECK(glDebugMessageCallback(debugProcCb, NULL) ); + GL_CHECK(glDebugMessageControl(GL_DONT_CARE , GL_DONT_CARE , GL_DEBUG_SEVERITY_MEDIUM , 0 , NULL , GL_TRUE ) ); + } } - } - if (s_extension[Extension::ARB_seamless_cube_map].m_supported) - { - GL_CHECK(glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) ); - } + if (s_extension[Extension::ARB_seamless_cube_map].m_supported) + { + GL_CHECK(glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) ); + } - if (NULL == glFrameTerminatorGREMEDY - || !s_extension[Extension::GREMEDY_frame_terminator].m_supported) - { - glFrameTerminatorGREMEDY = stubFrameTerminatorGREMEDY; - } + if (NULL == glFrameTerminatorGREMEDY + || !s_extension[Extension::GREMEDY_frame_terminator].m_supported) + { + glFrameTerminatorGREMEDY = stubFrameTerminatorGREMEDY; + } - if (NULL == glInsertEventMarker - || !s_extension[Extension::EXT_debug_marker].m_supported) - { - glInsertEventMarker = (NULL != glStringMarkerGREMEDY && s_extension[Extension::GREMEDY_string_marker].m_supported) - ? stubInsertEventMarkerGREMEDY - : stubInsertEventMarker - ; - } + if (NULL == glInsertEventMarker + || !s_extension[Extension::EXT_debug_marker].m_supported) + { + glInsertEventMarker = (NULL != glStringMarkerGREMEDY && s_extension[Extension::GREMEDY_string_marker].m_supported) + ? stubInsertEventMarkerGREMEDY + : stubInsertEventMarker + ; + } - setGraphicsDebuggerPresent(s_extension[Extension::EXT_debug_tool].m_supported); + setGraphicsDebuggerPresent(s_extension[Extension::EXT_debug_tool].m_supported); - if (NULL == glObjectLabel) - { - glObjectLabel = stubObjectLabel; - } + if (NULL == glObjectLabel) + { + glObjectLabel = stubObjectLabel; + } - if (NULL == glInvalidateFramebuffer) - { - glInvalidateFramebuffer = stubInvalidateFramebuffer; - } + if (NULL == glInvalidateFramebuffer) + { + glInvalidateFramebuffer = stubInvalidateFramebuffer; + } - if (m_timerQuerySupport) - { - m_gpuTimer.create(); - } + if (m_timerQuerySupport) + { + m_gpuTimer.create(); + } - if (m_occlusionQuerySupport) - { - m_occlusionQuery.create(); + if (m_occlusionQuerySupport) + { + m_occlusionQuery.create(); + } + + // Init reserved part of view name. + for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) + { + bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED+1, "%3d ", ii); + } + + ovrPostReset(); + + m_needPresent = false; } - // Init reserved part of view name. - for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) + return true; + + error: + switch (errorState) { - bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED+1, "%3d ", ii); + case ErrorState::Default: + break; } - ovrPostReset(); + ovrPreReset(); + m_ovr.shutdown(); - m_needPresent = false; + m_glctx.destroy(); - BGFX_GPU_PROFILER_BIND(); + unloadRenderDoc(m_renderdocdll); + return false; } void shutdown() { - BGFX_GPU_PROFILER_UNBIND(); - ovrPreReset(); m_ovr.shutdown(); @@ -2262,7 +2599,7 @@ namespace bgfx { namespace gl unloadRenderDoc(m_renderdocdll); } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) { @@ -2272,12 +2609,17 @@ namespace bgfx { namespace gl return RendererType::OpenGLES; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { return BGFX_RENDERER_OPENGL_NAME; } - void flip(HMD& _hmd) + bool isDeviceRemoved() override + { + return false; + } + + void flip(HMD& _hmd) override { if (m_flip) { @@ -2307,113 +2649,113 @@ namespace bgfx { namespace gl } } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } - void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override { VertexDecl& decl = m_vertexDecls[_handle.idx]; bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } - void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { VertexDeclHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE + void createShader(ShaderHandle _handle, Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } - void destroyShader(ShaderHandle _handle) BX_OVERRIDE + void destroyShader(ShaderHandle _handle) override { m_shaders[_handle.idx].destroy(); } - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE + void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { ShaderGL dummyFragmentShader; m_program[_handle.idx].create(m_shaders[_vsh.idx], isValid(_fsh) ? m_shaders[_fsh.idx] : dummyFragmentShader); } - void destroyProgram(ProgramHandle _handle) BX_OVERRIDE + void destroyProgram(ProgramHandle _handle) override { m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE + void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); } - void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE + void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override { } - void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE + void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override { m_textures[_handle.idx].update(_side, _mip, _rect, _z, _depth, _pitch, _mem); } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { } - void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override { if (m_readBackSupported) { const TextureGL& texture = m_textures[_handle.idx]; - const bool compressed = isCompressed(TextureFormat::Enum(texture.m_textureFormat) ); + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(texture.m_textureFormat) ); GL_CHECK(glBindTexture(texture.m_target, texture.m_id) ); @@ -2436,9 +2778,54 @@ namespace bgfx { namespace gl GL_CHECK(glBindTexture(texture.m_target, 0) ); } + else + { + const TextureGL& texture = m_textures[_handle.idx]; + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(texture.m_textureFormat) ); + + if(!compressed) + { + Attachment attachment[1]; + attachment[0].handle = _handle; + attachment[0].mip = 0; + attachment[0].layer = 0; + + FrameBufferGL frameBuffer; + frameBuffer.create(1, attachment); + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer.m_fbo[0]) ); + GL_CHECK(glFramebufferTexture2D( + GL_FRAMEBUFFER + , GL_COLOR_ATTACHMENT0 + , GL_TEXTURE_2D + , texture.m_id + , attachment[0].mip + ) ); + + if (!BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) + && !BX_ENABLED(BX_PLATFORM_IOS)) + { + GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0) ); + } + + if (GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER) ) + { + GL_CHECK(glReadPixels( + 0 + , 0 + , texture.m_width + , texture.m_height + , m_readPixelsFmt + , GL_UNSIGNED_BYTE + , _data + ) ); + } + + frameBuffer.destroy(); + } + } } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override { TextureGL& texture = m_textures[_handle.idx]; @@ -2466,34 +2853,34 @@ namespace bgfx { namespace gl release(mem); } - void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override { m_textures[_handle.idx].overrideInternal(_ptr); } - uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + uintptr_t getInternal(TextureHandle _handle) override { return uintptr_t(m_textures[_handle.idx].m_id); } - void destroyTexture(TextureHandle _handle) BX_OVERRIDE + void destroyTexture(TextureHandle _handle) override { m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) override { m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); } - void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle _handle) override { uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); if (UINT16_MAX != denseIdx) @@ -2508,7 +2895,7 @@ namespace bgfx { namespace gl } } - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE + void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override { if (NULL != m_uniforms[_handle.idx]) { @@ -2522,14 +2909,14 @@ namespace bgfx { namespace gl m_uniformReg.add(_handle, _name, m_uniforms[_handle.idx]); } - void destroyUniform(UniformHandle _handle) BX_OVERRIDE + void destroyUniform(UniformHandle _handle) override { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; m_uniformReg.remove(_handle); } - void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { SwapChainGL* swapChain = NULL; uint32_t width = m_resolution.m_width; @@ -2558,7 +2945,7 @@ namespace bgfx { namespace gl if (GL_RGBA == m_readPixelsFmt) { - imageSwizzleBgra8(data, width, height, width*4, data); + bimg::imageSwizzleBgra8(data, width*4, width, height, data, width*4); } g_callback->screenShot(_filePath @@ -2572,32 +2959,52 @@ namespace bgfx { namespace gl BX_FREE(g_allocator, data); } - void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE + void updateViewName(ViewId _id, const char* _name) override { - bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name + bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + , _name ); } - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE + void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override { bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE + void setMarker(const char* _marker, uint32_t _size) override { GL_CHECK(glInsertEventMarker(_size, _marker) ); } - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override { m_occlusionQuery.invalidate(_handle); } - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE; + virtual void setName(Handle _handle, const char* _name) override + { + switch (_handle.type) + { + case Handle::Shader: + GL_CHECK(glObjectLabel(GL_SHADER, m_shaders[_handle.idx].m_id, -1, _name) ); + break; + + case Handle::Texture: + GL_CHECK(glObjectLabel(GL_TEXTURE, m_textures[_handle.idx].m_id, -1, _name) ); + break; - void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE + default: + BX_CHECK(false, "Invalid handle type?! %d", _handle.type); + break; + } + } + + void submitBlit(BlitState& _bs, uint16_t _view); + + void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; + + void blitSetup(TextVideoMemBlitter& _blitter) override { if (0 != m_vao) { @@ -2623,7 +3030,7 @@ namespace bgfx { namespace gl GL_CHECK(glUniform1i(program.m_sampler[0], 0) ); float proj[16]; - bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); + bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, true); GL_CHECK(glUniformMatrix4fv(program.m_predefined[0].m_loc , 1 @@ -2647,7 +3054,7 @@ namespace bgfx { namespace gl } } - void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override { const uint32_t numVertices = _numIndices*4/6; if (0 < numVertices) @@ -2955,11 +3362,6 @@ namespace bgfx { namespace gl void invalidateCache() { - if (m_vaoSupport) - { - m_vaoStateCache.invalidate(); - } - if ( (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) && m_samplerObjectSupport) { @@ -3034,13 +3436,15 @@ namespace bgfx { namespace gl GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, magFilter) ); GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, minFilter) ); - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) - || m_borderColorSupport) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) { - if (hasBorderColor) - { - GL_CHECK(glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, _rgba) ); - } + GL_CHECK(glSamplerParameterf(sampler, GL_TEXTURE_LOD_BIAS, float(BGFX_CONFIG_MIP_LOD_BIAS) ) ); + } + + if (m_borderColorSupport + && hasBorderColor) + { + GL_CHECK(glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, _rgba) ); } if (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) @@ -3127,7 +3531,14 @@ namespace bgfx { namespace gl if (GL_RGBA == m_readPixelsFmt) { - imageSwizzleBgra8(m_capture, m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture); + bimg::imageSwizzleBgra8( + m_capture + , m_resolution.m_width*4 + , m_resolution.m_width + , m_resolution.m_height + , m_capture + , m_resolution.m_width*4 + ); } g_callback->captureFrame(m_capture, m_captureSize); @@ -3474,7 +3885,6 @@ namespace bgfx { namespace gl TimerQueryGL m_gpuTimer; OcclusionQueryGL m_occlusionQuery; - VaoStateCache m_vaoStateCache; SamplerStateCache m_samplerStateCache; TextVideoMem m_textVideoMem; @@ -3520,6 +3930,8 @@ namespace bgfx { namespace gl const char* m_version; const char* m_glslVersion; + Workaround m_workaround; + GLuint m_currentFbo; VR m_ovr; @@ -3533,7 +3945,11 @@ namespace bgfx { namespace gl RendererContextI* rendererCreate() { s_renderGL = BX_NEW(g_allocator, RendererContextGL); - s_renderGL->init(); + if (!s_renderGL->init() ) + { + BX_DELETE(g_allocator, s_renderGL); + s_renderGL = NULL; + } return s_renderGL; } @@ -4018,7 +4434,8 @@ namespace bgfx { namespace gl init(); - if (!cached) + if (!cached + && s_renderGL->m_workaround.m_detachShader) { // Must be after init, otherwise init might fail to lookup shader // info (NVIDIA Tegra 3 OpenGL ES 2.0 14.01003). @@ -4046,8 +4463,6 @@ namespace bgfx { namespace gl GL_CHECK(glDeleteProgram(m_id) ); m_id = 0; } - - m_vcref.invalidate(s_renderGL->m_vaoStateCache); } void ProgramGL::init() @@ -4172,13 +4587,13 @@ namespace bgfx { namespace gl num = bx::uint32_max(num, 1); int offset = 0; - char* array = const_cast<char*>(bx::strnchr(name, '[') ); + char* array = const_cast<char*>(bx::strFind(name, '[') ); if (NULL != array) { BX_TRACE("--- %s", name); *array = '\0'; array++; - char* end = const_cast<char*>(bx::strnchr(array, ']') ); + char* end = const_cast<char*>(bx::strFind(array, ']') ); if (NULL != end) { // Some devices (Amazon Fire) might not return terminating brace. *end = '\0'; @@ -4384,21 +4799,21 @@ namespace bgfx { namespace gl && !normalized) { GL_CHECK(glVertexAttribIPointer(loc - , num - , s_attribType[type] - , _vertexDecl.m_stride - , (void*)(uintptr_t)baseVertex) - ); + , num + , s_attribType[type] + , _vertexDecl.m_stride + , (void*)(uintptr_t)baseVertex) + ); } else { GL_CHECK(glVertexAttribPointer(loc - , num - , s_attribType[type] - , normalized - , _vertexDecl.m_stride - , (void*)(uintptr_t)baseVertex) - ); + , num + , s_attribType[type] + , normalized + , _vertexDecl.m_stride + , (void*)(uintptr_t)baseVertex) + ); } m_unboundUsedAttrib[ii] = Attrib::Count; @@ -4424,248 +4839,12 @@ namespace bgfx { namespace gl { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) ); GL_CHECK(glDeleteBuffers(1, &m_id) ); - - m_vcref.invalidate(s_renderGL->m_vaoStateCache); } void VertexBufferGL::destroy() { GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) ); GL_CHECK(glDeleteBuffers(1, &m_id) ); - - m_vcref.invalidate(s_renderGL->m_vaoStateCache); - } - - static void texSubImage( - GLenum _target - , GLint _level - , GLint _xoffset - , GLint _yoffset - , GLint _zoffset - , GLsizei _width - , GLsizei _height - , GLsizei _depth - , GLenum _format - , GLenum _type - , const GLvoid* _data - ) - { - if (NULL == _data) - { - return; - } - - if (_target == GL_TEXTURE_3D - || _target == GL_TEXTURE_2D_ARRAY - || _target == GL_TEXTURE_CUBE_MAP_ARRAY) - { - GL_CHECK(glTexSubImage3D( - _target - , _level - , _xoffset - , _yoffset - , _zoffset - , _width - , _height - , _depth - , _format - , _type - , _data - ) ); - } - else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) - { - } - else - { - BX_UNUSED(_zoffset, _depth); - GL_CHECK(glTexSubImage2D( - _target - , _level - , _xoffset - , _yoffset - , _width - , _height - , _format - , _type - , _data - ) ); - } - } - - static void texImage( - GLenum _target - , uint32_t _msaaQuality - , GLint _level - , GLint _internalFormat - , GLsizei _width - , GLsizei _height - , GLsizei _depth - , GLint _border - , GLenum _format - , GLenum _type - , const GLvoid* _data - ) - { - if (_target == GL_TEXTURE_3D) - { - GL_CHECK(glTexImage3D( - _target - , _level - , _internalFormat - , _width - , _height - , _depth - , _border - , _format - , _type - , _data - ) ); - } - else if (_target == GL_TEXTURE_2D_ARRAY - || _target == GL_TEXTURE_CUBE_MAP_ARRAY) - { - texSubImage( - _target - , _level - , 0 - , 0 - , _depth - , _width - , _height - , 1 - , _format - , _type - , _data - ); - } - else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) - { - } - else if (_target == GL_TEXTURE_2D_MULTISAMPLE) - { - GL_CHECK(glTexImage2DMultisample( - _target - , _msaaQuality - , _internalFormat - , _width - , _height - , false - ) ); - } - else - { - GL_CHECK(glTexImage2D( - _target - , _level - , _internalFormat - , _width - , _height - , _border - , _format - , _type - , _data - ) ); - } - - BX_UNUSED(_msaaQuality, _depth, _border, _data); - } - - static void compressedTexSubImage( - GLenum _target - , GLint _level - , GLint _xoffset - , GLint _yoffset - , GLint _zoffset - , GLsizei _width - , GLsizei _height - , GLsizei _depth - , GLenum _format - , GLsizei _imageSize - , const GLvoid* _data - ) - { - if (_target == GL_TEXTURE_3D) - { - GL_CHECK(glCompressedTexSubImage3D( - _target - , _level - , _xoffset - , _yoffset - , _zoffset - , _width - , _height - , _depth - , _format - , _imageSize - , _data - ) ); - } - else - { - BX_UNUSED(_zoffset, _depth); - GL_CHECK(glCompressedTexSubImage2D( - _target - , _level - , _xoffset - , _yoffset - , _width - , _height - , _format - , _imageSize - , _data - ) ); - } - } - - static void compressedTexImage( - GLenum _target - , GLint _level - , GLenum _internalformat - , GLsizei _width - , GLsizei _height - , GLsizei _depth - , GLint _border - , GLsizei _imageSize - , const GLvoid* _data - ) - { - if (_target == GL_TEXTURE_3D) - { - GL_CHECK(glCompressedTexImage3D( - _target - , _level - , _internalformat - , _width - , _height - , _depth - , _border - , _imageSize - , _data - ) ); - } - else if (_target == GL_TEXTURE_2D_ARRAY - || _target == GL_TEXTURE_CUBE_MAP_ARRAY) - { - compressedTexSubImage(_target, _level, 0, 0, _depth, _width, _height, 1, _internalformat, _imageSize, _data); - } - else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) - { - } - else - { - BX_UNUSED(_depth); - GL_CHECK(glCompressedTexImage2D( - _target - , _level - , _internalformat - , _width - , _height - , _border - , _imageSize - , _data - ) ); - } } bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint32_t _flags) @@ -4680,6 +4859,7 @@ namespace bgfx { namespace gl const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE ); + const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB); const bool textureArray = false || _target == GL_TEXTURE_2D_ARRAY || _target == GL_TEXTURE_CUBE_MAP_ARRAY @@ -4714,11 +4894,16 @@ namespace bgfx { namespace gl m_type = tfiRgba8.m_type; } + const GLenum internalFmt = srgb + ? s_textureFormat[m_textureFormat].m_internalFmtSrgb + : s_textureFormat[m_textureFormat].m_internalFmt + ; + if (textureArray) { GL_CHECK(glTexStorage3D(_target , _numMips - , s_textureFormat[m_textureFormat].m_internalFmt + , internalFmt , m_width , m_height , _depth @@ -4730,21 +4915,21 @@ namespace bgfx { namespace gl if (_target == GL_TEXTURE_3D) { GL_CHECK(glTexStorage3D(_target - , _numMips - , s_textureFormat[m_textureFormat].m_internalFmt - , m_width - , m_height - , _depth - ) ); + , _numMips + , internalFmt + , m_width + , m_height + , _depth + ) ); } else { GL_CHECK(glTexStorage2D(_target - , _numMips - , s_textureFormat[m_textureFormat].m_internalFmt - , m_width - , m_height - ) ); + , _numMips + , internalFmt + , m_width + , m_height + ) ); } } @@ -4810,9 +4995,9 @@ namespace bgfx { namespace gl void TextureGL::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) { - ImageContainer imageContainer; + bimg::ImageContainer imageContainer; - if (imageParse(imageContainer, _mem->data, _mem->size) ) + if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) { uint8_t numMips = imageContainer.m_numMips; const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) ); @@ -4822,7 +5007,7 @@ namespace bgfx { namespace gl uint32_t textureHeight; uint32_t textureDepth; { - const ImageBlockInfo& ibi = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) ); + const bimg::ImageBlockInfo& ibi = bimg::getBlockInfo(bimg::TextureFormat::Enum(imageContainer.m_format) ); textureWidth = bx::uint32_max(ibi.blockWidth, imageContainer.m_width >>startLod); textureHeight = bx::uint32_max(ibi.blockHeight, imageContainer.m_height>>startLod); textureDepth = 1 < imageContainer.m_depth @@ -4856,9 +5041,9 @@ namespace bgfx { namespace gl { switch (target) { - case GL_TEXTURE_CUBE_MAP: target = GL_TEXTURE_CUBE_MAP_ARRAY; - case GL_TEXTURE_2D_MULTISAMPLE: target = GL_TEXTURE_2D_MULTISAMPLE_ARRAY; - default: target = GL_TEXTURE_2D_ARRAY; + case GL_TEXTURE_CUBE_MAP: target = GL_TEXTURE_CUBE_MAP_ARRAY; break; + case GL_TEXTURE_2D_MULTISAMPLE: target = GL_TEXTURE_2D_MULTISAMPLE_ARRAY; break; + default: target = GL_TEXTURE_2D_ARRAY; break; } } @@ -4888,16 +5073,17 @@ namespace bgfx { namespace gl && !s_textureFormat[m_requestedFormat].m_supported && !s_renderGL->m_textureSwizzleSupport ; - const bool compressed = isCompressed(TextureFormat::Enum(m_requestedFormat) ); + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_requestedFormat) ); const bool convert = false || m_textureFormat != m_requestedFormat || swizzle ; - BX_TRACE("Texture%-4s %3d: %s (requested: %s), layers %d, %dx%dx%d%s." + BX_TRACE("Texture%-4s %3d: %s %s(requested: %s), layers %d, %dx%dx%d%s." , imageContainer.m_cubeMap ? "Cube" : (1 < imageContainer.m_depth ? "3D" : "2D") , this - s_renderGL->m_textures , getName( (TextureFormat::Enum)m_textureFormat) + , srgb ? "+sRGB " : "" , getName( (TextureFormat::Enum)m_requestedFormat) , numLayers , textureWidth @@ -4907,12 +5093,12 @@ namespace bgfx { namespace gl ); BX_WARN(!convert, "Texture %s%s%s from %s to %s." - , swizzle ? "swizzle" : "" - , swizzle&&convert ? " and " : "" - , convert ? "convert" : "" - , getName( (TextureFormat::Enum)m_requestedFormat) - , getName( (TextureFormat::Enum)m_textureFormat) - ); + , swizzle ? "swizzle" : "" + , swizzle&&convert ? " and " : "" + , convert ? "convert" : "" + , getName( (TextureFormat::Enum)m_requestedFormat) + , getName( (TextureFormat::Enum)m_textureFormat) + ); uint8_t* temp = NULL; if (convert) @@ -4941,13 +5127,13 @@ namespace bgfx { namespace gl : side ; - ImageMip mip; - if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) + bimg::ImageMip mip; + if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { if (compressed && !convert) { - compressedTexImage(imageTarget + GL_CHECK(compressedTexImage(imageTarget , lod , internalFmt , width @@ -4956,7 +5142,7 @@ namespace bgfx { namespace gl , 0 , mip.m_size , mip.m_data - ); + ) ); } else { @@ -4965,16 +5151,16 @@ namespace bgfx { namespace gl if (convert) { imageDecodeToRgba8(temp - , mip.m_data - , mip.m_width - , mip.m_height - , mip.m_width*4 - , mip.m_format - ); + , mip.m_data + , mip.m_width + , mip.m_height + , mip.m_width*4 + , mip.m_format + ); data = temp; } - texImage(imageTarget + GL_CHECK(texImage(imageTarget , msaaQuality , lod , internalFmt @@ -4985,7 +5171,7 @@ namespace bgfx { namespace gl , m_fmt , m_type , data - ); + ) ); } } else if (!computeWrite) @@ -4994,10 +5180,10 @@ namespace bgfx { namespace gl { uint32_t size = bx::uint32_max(1, (width + 3)>>2) * bx::uint32_max(1, (height + 3)>>2) - * 4*4*getBitsPerPixel(TextureFormat::Enum(m_textureFormat) )/8 + * 4*4* bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) )/8 ; - compressedTexImage(imageTarget + GL_CHECK(compressedTexImage(imageTarget , lod , internalFmt , width @@ -5006,11 +5192,11 @@ namespace bgfx { namespace gl , 0 , size , NULL - ); + ) ); } else { - texImage(imageTarget + GL_CHECK(texImage(imageTarget , msaaQuality , lod , internalFmt @@ -5021,7 +5207,7 @@ namespace bgfx { namespace gl , m_fmt , m_type , NULL - ); + ) ); } } @@ -5066,7 +5252,7 @@ namespace bgfx { namespace gl void TextureGL::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) { - const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t rectpitch = _rect.m_width*bpp/8; uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; @@ -5084,7 +5270,7 @@ namespace bgfx { namespace gl && !s_renderGL->m_textureSwizzleSupport ; const bool unpackRowLength = BX_IGNORE_C4127(!!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported); - const bool compressed = isCompressed(TextureFormat::Enum(m_requestedFormat) ); + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_requestedFormat) ); const bool convert = false || (compressed && m_textureFormat != m_requestedFormat) || swizzle @@ -5110,7 +5296,7 @@ namespace bgfx { namespace gl if (!unpackRowLength) { - imageCopy(temp, width, height, bpp, srcpitch, data); + bimg::imageCopy(temp, width, height, bpp, srcpitch, data); data = temp; } @@ -5133,7 +5319,7 @@ namespace bgfx { namespace gl if (convert) { - imageDecodeToRgba8(temp, data, width, height, srcpitch, TextureFormat::Enum(m_requestedFormat) ); + bimg::imageDecodeToRgba8(temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; srcpitch = rectpitch; } @@ -5141,7 +5327,7 @@ namespace bgfx { namespace gl if (!unpackRowLength && !convert) { - imageCopy(temp, width, height, bpp, srcpitch, data); + bimg::imageCopy(temp, width, height, bpp, srcpitch, data); data = temp; } @@ -5233,13 +5419,15 @@ namespace bgfx { namespace gl GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilter) ); GL_CHECK(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter) ); - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) - || s_renderGL->m_borderColorSupport) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) { - if (hasBorderColor) - { - GL_CHECK(glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, _rgba) ); - } + GL_CHECK(glTexParameterf(target, GL_TEXTURE_LOD_BIAS, float(BGFX_CONFIG_MIP_LOD_BIAS) ) ); + } + + if (s_renderGL->m_borderColorSupport + && hasBorderColor) + { + GL_CHECK(glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, _rgba) ); } if (0 != (flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) @@ -5318,7 +5506,7 @@ namespace bgfx { namespace gl void writeString(bx::WriterI* _writer, const char* _str) { - bx::write(_writer, _str, (int32_t)bx::strnlen(_str) ); + bx::write(_writer, _str, (int32_t)bx::strLen(_str) ); } void writeStringf(bx::WriterI* _writer, const char* _format, ...) @@ -5335,15 +5523,15 @@ namespace bgfx { namespace gl void strins(char* _str, const char* _insert) { - size_t len = bx::strnlen(_insert); - bx::memMove(&_str[len], _str, bx::strnlen(_str)+1); + size_t len = bx::strLen(_insert); + bx::memMove(&_str[len], _str, bx::strLen(_str)+1); bx::memCopy(_str, _insert, len); } void ShaderGL::create(Memory* _mem) { bx::MemoryReader reader(_mem->data, _mem->size); - m_hash = bx::hashMurmur2A(_mem->data, _mem->size); + m_hash = bx::hash<bx::HashMurmur2A>(_mem->data, _mem->size); uint32_t magic; bx::read(&reader, magic); @@ -5404,9 +5592,10 @@ namespace bgfx { namespace gl if (0 != m_id) { - if (GL_COMPUTE_SHADER != m_type) + if (GL_COMPUTE_SHADER != m_type + && 0 != bx::strCmp(code, "#version 430", 12) ) { - int32_t codeLen = (int32_t)bx::strnlen(code); + int32_t codeLen = (int32_t)bx::strLen(code); int32_t tempLen = codeLen + (4<<10); char* temp = (char*)alloca(tempLen); bx::StaticMemoryBlockWriter writer(temp, tempLen); @@ -5432,7 +5621,7 @@ namespace bgfx { namespace gl bool usesShadowSamplers = !!bx::findIdentifierMatch(code, s_EXT_shadow_samplers); bool usesTexture3D = s_extension[Extension::OES_texture_3D].m_supported - && bx::findIdentifierMatch(code, s_OES_texture_3D) + && bx::findIdentifierMatch(code, s_texture3D) ; bool usesTextureLod = !!bx::findIdentifierMatch(code, s_EXT_shader_texture_lod); @@ -5506,7 +5695,8 @@ namespace bgfx { namespace gl if (usesTextureLod) { BX_WARN(s_extension[Extension::ARB_shader_texture_lod].m_supported - , "ARB_shader_texture_lod is used but not supported by GLES2 driver." + || s_extension[Extension::EXT_shader_texture_lod].m_supported + , "(ARB|EXT)_shader_texture_lod is used but not supported by GLES2 driver." ); if (s_extension[Extension::ARB_shader_texture_lod].m_supported) @@ -5523,11 +5713,23 @@ namespace bgfx { namespace gl } else { - writeString(&writer - , "#define texture2DLod(_sampler, _coord, _level) texture2D(_sampler, _coord)\n" - "#define texture2DProjLod(_sampler, _coord, _level) texture2DProj(_sampler, _coord)\n" - "#define textureCubeLod(_sampler, _coord, _level) textureCube(_sampler, _coord)\n" + if(s_extension[Extension::EXT_shader_texture_lod].m_supported) + { + writeString(&writer + , "#extension GL_EXT_shader_texture_lod : enable\n" + "#define texture2DLod texture2DLodEXT\n" + "#define texture2DProjLod texture2DProjLodEXT\n" + "#define textureCubeLod textureCubeLodEXT\n" ); + } + else + { + writeString(&writer + , "#define texture2DLod(_sampler, _coord, _level) texture2D(_sampler, _coord)\n" + "#define texture2DProjLod(_sampler, _coord, _level) texture2DProj(_sampler, _coord)\n" + "#define textureCubeLod(_sampler, _coord, _level) textureCube(_sampler, _coord)\n" + ); + } } } @@ -5552,10 +5754,10 @@ namespace bgfx { namespace gl if (insertFragDepth) { - const char* entry = bx::strnstr(temp, "void main ()"); + const char* entry = bx::strFind(temp, "void main ()"); if (NULL != entry) { - char* brace = const_cast<char*>(bx::strnstr(entry, "{") ); + char* brace = const_cast<char*>(bx::strFind(entry, "{") ); if (NULL != brace) { const char* end = bx::strmb(brace, '{', '}'); @@ -5582,15 +5784,17 @@ namespace bgfx { namespace gl && s_extension[Extension::ARB_shader_texture_lod].m_supported && bx::findIdentifierMatch(code, s_ARB_shader_texture_lod) ; + const bool usesGpuShader4 = !!bx::findIdentifierMatch(code, s_EXT_gpu_shader4); const bool usesGpuShader5 = !!bx::findIdentifierMatch(code, s_ARB_gpu_shader5); const bool usesIUsamplers = !!bx::findIdentifierMatch(code, s_uisamplers); const bool usesTexelFetch = !!bx::findIdentifierMatch(code, s_texelFetch); const bool usesTextureArray = !!bx::findIdentifierMatch(code, s_textureArray); + const bool usesTexture3D = !!bx::findIdentifierMatch(code, s_texture3D); const bool usesTextureMS = !!bx::findIdentifierMatch(code, s_ARB_texture_multisample); const bool usesPacking = !!bx::findIdentifierMatch(code, s_ARB_shading_language_packing); - uint32_t version = - usesIUsamplers || usesTexelFetch || usesGpuShader5 ? 130 + uint32_t version = BX_ENABLED(BX_PLATFORM_OSX) ? 120 + : usesTextureArray || usesTexture3D || usesIUsamplers|| usesTexelFetch || usesGpuShader5 ? 130 : usesTextureLod ? 120 : 120 ; @@ -5613,6 +5817,11 @@ namespace bgfx { namespace gl } } + if (usesGpuShader4) + { + writeString(&writer, "#extension GL_EXT_gpu_shader4 : enable\n"); + } + if (usesGpuShader5) { writeString(&writer, "#extension GL_ARB_gpu_shader5 : enable\n"); @@ -5631,6 +5840,29 @@ namespace bgfx { namespace gl if (usesTextureArray) { writeString(&writer, "#extension GL_EXT_texture_array : enable\n"); + + if (BX_ENABLED(BX_PLATFORM_OSX) ) + { + writeString(&writer, "#define texture2DArrayLodEXT texture2DArray\n"); + } + else + { + writeString(&writer, "#define texture2DArrayLodEXT texture2DArrayLod\n"); + } + } + + if (usesTexture3D) + { + writeString(&writer, "#define texture3DEXT texture3D\n"); + + if (BX_ENABLED(BX_PLATFORM_OSX) ) + { + writeString(&writer, "#define texture3DLodEXT texture3D\n"); + } + else + { + writeString(&writer, "#define texture3DLodEXT texture3DLod\n"); + } } if (130 <= version) @@ -5653,7 +5885,7 @@ namespace bgfx { namespace gl { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); - fragData = bx::uint32_max(fragData, NULL == bx::strnstr(code, tmpFragData) ? 0 : ii+1); + fragData = bx::uint32_max(fragData, NULL == bx::strFind(code, tmpFragData) ? 0 : ii+1); } BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!"); @@ -5746,7 +5978,7 @@ namespace bgfx { namespace gl { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); - fragData = bx::uint32_max(fragData, NULL == bx::strnstr(code, tmpFragData) ? 0 : ii+1); + fragData = bx::uint32_max(fragData, NULL == bx::strFind(code, tmpFragData) ? 0 : ii+1); } BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!"); @@ -5801,6 +6033,26 @@ namespace bgfx { namespace gl code = temp; } + else if (GL_COMPUTE_SHADER == m_type) + { + int32_t codeLen = (int32_t)bx::strLen(code); + int32_t tempLen = codeLen + (4<<10); + char* temp = (char*)alloca(tempLen); + bx::StaticMemoryBlockWriter writer(temp, tempLen); + + writeString(&writer, "#version 430\n"); + writeString(&writer, "#define texture2DLod textureLod\n"); + writeString(&writer, "#define texture3DLod textureLod\n"); + writeString(&writer, "#define textureCubeLod textureLod\n"); + writeString(&writer, "#define texture2DGrad textureGrad\n"); + writeString(&writer, "#define texture3DGrad textureGrad\n"); + writeString(&writer, "#define textureCubeGrad textureGrad\n"); + + bx::write(&writer, code+bx::strLen("#version 430"), codeLen); + bx::write(&writer, '\0'); + + code = temp; + } GL_CHECK(glShaderSource(m_id, 1, (const GLchar**)&code, NULL) ); GL_CHECK(glCompileShader(m_id) ); @@ -5810,7 +6062,24 @@ namespace bgfx { namespace gl if (0 == compiled) { - BX_TRACE("\n####\n%s\n####", code); + LineReader lineReader(code); + bx::Error err; + for (int32_t line = 1; err.isOk(); ++line) + { + char str[4096]; + int32_t len = bx::read(&lineReader, str, BX_COUNTOF(str)-1, &err); + + if (err.isOk() ) + { + str[len] = '\0'; + const char* eol = bx::streol(str); + if (eol != str) + { + *const_cast<char*>(eol) = '\0'; + } + BX_TRACE("%3d %s", line, str); + } + } GLsizei len; char log[1024]; @@ -5883,10 +6152,10 @@ namespace bgfx { namespace gl } GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx; - TextureFormat::Enum format = (TextureFormat::Enum)texture.m_textureFormat; - if (isDepth(format) ) + bimg::TextureFormat::Enum format = bimg::TextureFormat::Enum(texture.m_textureFormat); + if (bimg::isDepth(format) ) { - const ImageBlockInfo& info = getBlockInfo(format); + const bimg::ImageBlockInfo& info = bimg::getBlockInfo(format); if (0 < info.stencilBits) { attachment = GL_DEPTH_STENCIL_ATTACHMENT; @@ -5973,7 +6242,7 @@ namespace bgfx { namespace gl if (0 != texture.m_id) { GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx; - if (!isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) + if (!bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) { ++colorIdx; @@ -6181,15 +6450,54 @@ namespace bgfx { namespace gl Query& query = m_query[(m_control.m_read + ii) % size]; if (query.m_handle.idx == _handle.idx) { - query.m_handle.idx = bgfx::invalidHandle; + query.m_handle.idx = bgfx::kInvalidHandle; } } } - void RendererContextGL::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) + void RendererContextGL::submitBlit(BlitState& _bs, uint16_t _view) { - BGFX_GPU_PROFILER_BEGIN_DYNAMIC("rendererSubmit"); + if (m_blitSupported) + { + while (_bs.hasItem(_view) ) + { + const BlitItem& bi = _bs.advance(); + + const TextureGL& src = m_textures[bi.m_src.idx]; + const TextureGL& dst = m_textures[bi.m_dst.idx]; + + uint32_t srcWidth = bx::uint32_min(src.m_width, bi.m_srcX + bi.m_width) - bi.m_srcX; + uint32_t srcHeight = bx::uint32_min(src.m_height, bi.m_srcY + bi.m_height) - bi.m_srcY; + uint32_t srcDepth = bx::uint32_min(src.m_depth, bi.m_srcZ + bi.m_depth) - bi.m_srcZ; + uint32_t dstWidth = bx::uint32_min(dst.m_width, bi.m_dstX + bi.m_width) - bi.m_dstX; + uint32_t dstHeight = bx::uint32_min(dst.m_height, bi.m_dstY + bi.m_height) - bi.m_dstY; + uint32_t dstDepth = bx::uint32_min(dst.m_depth, bi.m_dstZ + bi.m_depth) - bi.m_dstZ; + uint32_t width = bx::uint32_min(srcWidth, dstWidth); + uint32_t height = bx::uint32_min(srcHeight, dstHeight); + uint32_t depth = bx::uint32_min(srcDepth, dstDepth); + + GL_CHECK(glCopyImageSubData(src.m_id + , src.m_target + , bi.m_srcMip + , bi.m_srcX + , bi.m_srcY + , bi.m_srcZ + , dst.m_id + , dst.m_target + , bi.m_dstMip + , bi.m_dstX + , bi.m_dstY + , bi.m_dstZ + , width + , height + , bx::uint32_imax(depth, 1) + ) ); + } + } + } + void RendererContextGL::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) + { if (_render->m_capture) { renderDocTriggerCapture(); @@ -6202,7 +6510,6 @@ namespace bgfx { namespace gl GL_CHECK(glBindVertexArray(0) ); GL_CHECK(glDeleteVertexArrays(1, &m_vao) ); m_vao = 0; - m_vaoStateCache.invalidate(); } m_glctx.makeCurrent(NULL); @@ -6217,12 +6524,15 @@ namespace bgfx { namespace gl updateResolution(_render->m_resolution); - int64_t elapsed = -bx::getHPCounter(); + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; - if (m_timerQuerySupport) + uint32_t frameQueryIdx = UINT32_MAX; + + if (m_timerQuerySupport + && !BX_ENABLED(BX_PLATFORM_OSX) ) { - m_gpuTimer.begin(); + frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS); } if (0 < _render->m_iboffset) @@ -6244,21 +6554,21 @@ namespace bgfx { namespace gl currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); + RenderBind currentBind; + currentBind.clear(); + _render->m_hmdInitialized = m_ovr.isInitialized(); const bool hmdEnabled = m_ovr.isEnabled(); static ViewState viewState; viewState.reset(_render, hmdEnabled); - uint16_t programIdx = invalidHandle; + uint16_t programIdx = kInvalidHandle; SortKey key; uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; - BlitKey blitKey; - blitKey.decode(_render->m_blitKeys[0]); - uint16_t numBlitItems = _render->m_numBlitItems; - uint16_t blitItem = 0; + BlitState bs(_render); int32_t resolutionHeight = hmdEnabled ? _render->m_hmd.height @@ -6279,7 +6589,6 @@ namespace bgfx { namespace gl : GL_FILL ) ); - GLuint currentVao = 0; bool wasCompute = false; bool viewHasScissor = false; Rect viewScissorRect; @@ -6287,9 +6596,10 @@ namespace bgfx { namespace gl uint16_t discardFlags = BGFX_CLEAR_NONE; const bool blendIndependentSupported = s_extension[Extension::ARB_draw_buffers_blend].m_supported; - const bool computeSupported = (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && s_extension[Extension::ARB_compute_shader].m_supported) - || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) - ; + const bool computeSupported = false + || (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && s_extension[Extension::ARB_compute_shader].m_supported) + || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) + ; uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {}; @@ -6297,6 +6607,13 @@ namespace bgfx { namespace gl uint32_t statsNumIndices = 0; uint32_t statsKeyType[2] = {}; + Profiler<TimerQueryGL> profiler( + _render + , m_gpuTimer + , s_viewName + , m_timerQuerySupport && !BX_ENABLED(BX_PLATFORM_OSX) + ); + if (m_occlusionQuerySupport) { m_occlusionQuery.resolve(_render); @@ -6310,9 +6627,9 @@ namespace bgfx { namespace gl bool viewRestart = false; uint8_t restartState = 0; - viewState.m_rect = _render->m_rect[0]; + viewState.m_rect = _render->m_view[0].m_rect; - int32_t numItems = _render->m_num; + int32_t numItems = _render->m_numRenderItems; for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;) { const uint64_t encodedKey = _render->m_sortKeys[item]; @@ -6324,7 +6641,9 @@ namespace bgfx { namespace gl || item == numItems ; - const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ]; + const uint32_t itemIdx = _render->m_sortValues[item]; + const RenderItem& renderItem = _render->m_renderItem[itemIdx]; + const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; ++item; if (viewChanged) @@ -6339,11 +6658,11 @@ namespace bgfx { namespace gl } view = key.m_view; - programIdx = invalidHandle; + programIdx = kInvalidHandle; - if (_render->m_fb[view].idx != fbh.idx) + if (_render->m_view[view].m_fbh.idx != fbh.idx) { - fbh = _render->m_fb[view]; + fbh = _render->m_view[view].m_fbh; resolutionHeight = hmdEnabled ? _render->m_hmd.height : _render->m_resolution.m_height @@ -6351,7 +6670,7 @@ namespace bgfx { namespace gl resolutionHeight = setFrameBuffer(fbh, resolutionHeight, discardFlags); } - viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_viewFlags[view] & BGFX_VIEW_STEREO) ) ); + viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_view[view].m_flags & BGFX_VIEW_STEREO) ) ); viewRestart &= hmdEnabled; if (viewRestart) { @@ -6371,13 +6690,12 @@ namespace bgfx { namespace gl if (item > 1) { - BGFX_GPU_PROFILER_END(); - BGFX_PROFILER_END(); + profiler.end(); } - BGFX_PROFILER_BEGIN_DYNAMIC(s_viewName[view]); - BGFX_GPU_PROFILER_BEGIN_DYNAMIC(s_viewName[view]); - viewState.m_rect = _render->m_rect[view]; + profiler.begin(view); + + viewState.m_rect = _render->m_view[view].m_rect; if (viewRestart) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) @@ -6409,7 +6727,7 @@ namespace bgfx { namespace gl } } - const Rect& scissorRect = _render->m_scissor[view]; + const Rect& scissorRect = _render->m_view[view].m_scissor; viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; @@ -6419,13 +6737,12 @@ namespace bgfx { namespace gl , viewState.m_rect.m_height ) ); - Clear& clear = _render->m_clear[view]; + Clear& clear = _render->m_view[view].m_clear; discardFlags = clear.m_flags & BGFX_CLEAR_DISCARD_MASK; if (BGFX_CLEAR_NONE != (clear.m_flags & BGFX_CLEAR_MASK) ) { clearQuad(_clearQuad, viewState.m_rect, clear, resolutionHeight, _render->m_colorPalette); - currentVao = UINT32_MAX; // clearQuad will mess with VAO, invalidate it. } GL_CHECK(glDisable(GL_STENCIL_TEST) ); @@ -6434,45 +6751,7 @@ namespace bgfx { namespace gl GL_CHECK(glEnable(GL_CULL_FACE) ); GL_CHECK(glDisable(GL_BLEND) ); - if (m_blitSupported) - { - const uint8_t blitView = SortKey::decodeView(encodedKey); - for (; blitItem < numBlitItems && blitKey.m_view <= blitView; blitItem++) - { - const BlitItem& bi = _render->m_blitItem[blitItem]; - blitKey.decode(_render->m_blitKeys[blitItem + 1]); - - const TextureGL& src = m_textures[bi.m_src.idx]; - const TextureGL& dst = m_textures[bi.m_dst.idx]; - - uint32_t srcWidth = bx::uint32_min(src.m_width, bi.m_srcX + bi.m_width) - bi.m_srcX; - uint32_t srcHeight = bx::uint32_min(src.m_height, bi.m_srcY + bi.m_height) - bi.m_srcY; - uint32_t srcDepth = bx::uint32_min(src.m_depth, bi.m_srcZ + bi.m_depth) - bi.m_srcZ; - uint32_t dstWidth = bx::uint32_min(dst.m_width, bi.m_dstX + bi.m_width) - bi.m_dstX; - uint32_t dstHeight = bx::uint32_min(dst.m_height, bi.m_dstY + bi.m_height) - bi.m_dstY; - uint32_t dstDepth = bx::uint32_min(dst.m_depth, bi.m_dstZ + bi.m_depth) - bi.m_dstZ; - uint32_t width = bx::uint32_min(srcWidth, dstWidth); - uint32_t height = bx::uint32_min(srcHeight, dstHeight); - uint32_t depth = bx::uint32_min(srcDepth, dstDepth); - - GL_CHECK(glCopyImageSubData(src.m_id - , src.m_target - , bi.m_srcMip - , bi.m_srcX - , bi.m_srcY - , bi.m_srcZ - , dst.m_id - , dst.m_target - , bi.m_dstMip - , bi.m_dstX - , bi.m_dstY - , bi.m_dstZ - , width - , height - , bx::uint32_imax(depth, 1) - ) ); - } - } + submitBlit(bs, view); } if (isCompute) @@ -6499,18 +6778,25 @@ namespace bgfx { namespace gl GLbitfield barrier = 0; for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) { - const Binding& bind = compute.m_bind[ii]; - if (invalidHandle != bind.m_idx) + const Binding& bind = renderBind.m_bind[ii]; + if (kInvalidHandle != bind.m_idx) { switch (bind.m_type) { + case Binding::Texture: + { + TextureGL& texture = m_textures[bind.m_idx]; + texture.commit(ii, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + } + break; + case Binding::Image: { const TextureGL& texture = m_textures[bind.m_idx]; GL_CHECK(glBindImageTexture(ii , texture.m_id , bind.m_un.m_compute.m_mip - , texture.isCubeMap()?GL_TRUE:GL_FALSE + , texture.isCubeMap() ? GL_TRUE : GL_FALSE , 0 , s_access[bind.m_un.m_compute.m_access] , s_imageFormat[bind.m_un.m_compute.m_format]) @@ -6540,8 +6826,8 @@ namespace bgfx { namespace gl if (0 != barrier) { - bool constantsChanged = compute.m_constBegin < compute.m_constEnd; - rendererUpdateUniforms(this, _render->m_uniformBuffer, compute.m_constBegin, compute.m_constEnd); + bool constantsChanged = compute.m_uniformBegin < compute.m_uniformEnd; + rendererUpdateUniforms(this, _render->m_uniformBuffer[compute.m_uniformIdx], compute.m_uniformBegin, compute.m_uniformEnd); if (constantsChanged && NULL != program.m_constantBuffer) @@ -6576,7 +6862,7 @@ namespace bgfx { namespace gl { if (isValid(currentState.m_indirectBuffer) ) { - currentState.m_indirectBuffer.idx = invalidHandle; + currentState.m_indirectBuffer.idx = kInvalidHandle; GL_CHECK(glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0) ); } @@ -6616,11 +6902,9 @@ namespace bgfx { namespace gl const uint64_t newFlags = draw.m_stateFlags; uint64_t changedFlags = currentState.m_stateFlags ^ draw.m_stateFlags; - currentState.m_stateFlags = newFlags; const uint64_t newStencil = draw.m_stencil; uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil; - currentState.m_stencil = newStencil; if (resetState) { @@ -6628,8 +6912,8 @@ namespace bgfx { namespace gl currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); - currentState.m_stateFlags = newFlags; - currentState.m_stencil = newStencil; + + currentBind.clear(); } uint16_t scissor = draw.m_scissor; @@ -6656,7 +6940,7 @@ namespace bgfx { namespace gl else { Rect scissorRect; - scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]); + scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); if (scissorRect.isZeroArea() ) { continue; @@ -6671,6 +6955,9 @@ namespace bgfx { namespace gl } } + currentState.m_stateFlags = newFlags; + currentState.m_stencil = newStencil; + if (0 != changedStencil) { if (0 != newStencil) @@ -6952,17 +7239,17 @@ namespace bgfx { namespace gl } bool programChanged = false; - bool constantsChanged = draw.m_constBegin < draw.m_constEnd; + bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; bool bindAttribs = false; - rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); + rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); if (key.m_program != programIdx) { programIdx = key.m_program; - GLuint id = invalidHandle == programIdx ? 0 : m_program[programIdx].m_id; + GLuint id = kInvalidHandle == programIdx ? 0 : m_program[programIdx].m_id; // Skip rendering if program index is valid, but program is invalid. - programIdx = 0 == id ? invalidHandle : programIdx; + programIdx = 0 == id ? kInvalidHandle : programIdx; GL_CHECK(glUseProgram(id) ); programChanged = @@ -6970,7 +7257,7 @@ namespace bgfx { namespace gl bindAttribs = true; } - if (invalidHandle != programIdx) + if (kInvalidHandle != programIdx) { ProgramGL& program = m_program[programIdx]; @@ -6985,16 +7272,38 @@ namespace bgfx { namespace gl { for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) { - const Binding& bind = draw.m_bind[stage]; - Binding& current = currentState.m_bind[stage]; + const Binding& bind = renderBind.m_bind[stage]; + Binding& current = currentBind.m_bind[stage]; if (current.m_idx != bind.m_idx + || current.m_type != bind.m_type || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags || programChanged) { - if (invalidHandle != bind.m_idx) + if (kInvalidHandle != bind.m_idx) { - TextureGL& texture = m_textures[bind.m_idx]; - texture.commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + switch (bind.m_type) + { + case Binding::Texture: + { + TextureGL& texture = m_textures[bind.m_idx]; + texture.commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + } + break; + + case Binding::IndexBuffer: + { + const IndexBufferGL& buffer = m_indexBuffers[bind.m_idx]; + GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, stage, buffer.m_id) ); + } + break; + + case Binding::VertexBuffer: + { + const VertexBufferGL& buffer = m_vertexBuffers[bind.m_idx]; + GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, stage, buffer.m_id) ); + } + break; + } } } @@ -7002,153 +7311,7 @@ namespace bgfx { namespace gl } } - if (0 != defaultVao - && 0 == draw.m_stream[0].m_startVertex - && 0 == draw.m_instanceDataOffset) - { - bool diffStartVertex = false; - bool diffStreamHandles = false; - for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) - ) - { - streamMask >>= ntz; - idx += ntz; - - if (currentState.m_stream[idx].m_handle.idx != draw.m_stream[idx].m_handle.idx) - { - diffStreamHandles = true; - break; - } - - if (currentState.m_stream[idx].m_startVertex != draw.m_stream[idx].m_startVertex) - { - diffStartVertex = true; - break; - } - } - - if (programChanged - || currentState.m_streamMask != draw.m_streamMask - || currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset - || currentState.m_instanceDataStride != draw.m_instanceDataStride - || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || diffStartVertex - || diffStreamHandles) - { - bx::HashMurmur2A murmur; - murmur.begin(); - - for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) - ) - { - streamMask >>= ntz; - idx += ntz; - - const Stream& stream = draw.m_stream[idx]; - murmur.add(stream.m_handle.idx); - - if (isValid(stream.m_handle) ) - { - const VertexBufferGL& vb = m_vertexBuffers[stream.m_handle.idx]; - uint16_t decl = !isValid(vb.m_decl) ? stream.m_decl.idx : vb.m_decl.idx; - murmur.add(decl); - } - - currentState.m_stream[idx].m_handle = stream.m_handle; - currentState.m_stream[idx].m_startVertex = stream.m_startVertex; - } - currentState.m_streamMask = draw.m_streamMask; - - murmur.add(draw.m_indexBuffer.idx); - murmur.add(draw.m_instanceDataBuffer.idx); - murmur.add(draw.m_instanceDataOffset); - murmur.add(draw.m_instanceDataStride); - murmur.add(programIdx); - uint32_t hash = murmur.end(); - - currentState.m_indexBuffer = draw.m_indexBuffer; - currentState.m_instanceDataOffset = draw.m_instanceDataOffset; - currentState.m_instanceDataStride = draw.m_instanceDataStride; - - GLuint id = m_vaoStateCache.find(hash); - if (UINT32_MAX != id) - { - currentVao = id; - GL_CHECK(glBindVertexArray(id) ); - } - else - { - id = m_vaoStateCache.add(hash); - currentVao = id; - GL_CHECK(glBindVertexArray(id) ); - - program.add(hash); - - program.bindAttributesBegin(); - for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) - ) - { - streamMask >>= ntz; - idx += ntz; - - const Stream& stream = draw.m_stream[idx]; - - if (isValid(stream.m_handle) ) - { - VertexBufferGL& vb = m_vertexBuffers[stream.m_handle.idx]; - vb.add(hash); - - uint16_t decl = !isValid(vb.m_decl) ? stream.m_decl.idx : vb.m_decl.idx; - GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); - program.bindAttributes(m_vertexDecls[decl], stream.m_startVertex); - } - - if (isValid(draw.m_instanceDataBuffer) ) - { - VertexBufferGL& instanceVb = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; - instanceVb.add(hash); - GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, instanceVb.m_id) ); - program.bindInstanceData(draw.m_instanceDataStride, draw.m_instanceDataOffset); - } - } - program.bindAttributesEnd(); - - if (isValid(draw.m_indexBuffer) ) - { - IndexBufferGL& ib = m_indexBuffers[draw.m_indexBuffer.idx]; - ib.add(hash); - GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) ); - } - else - { - GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) ); - } - } - } - } - else { - if (0 != defaultVao - && 0 != currentVao) - { - GL_CHECK(glBindVertexArray(defaultVao) ); - currentState.m_streamMask = 0; - for (size_t ii = 0; ii < BGFX_CONFIG_MAX_VERTEX_STREAMS; ++ii) - { - currentState.m_stream[ii].m_handle.idx = invalidHandle; - } - currentState.m_indexBuffer.idx = invalidHandle; - bindAttribs = true; - currentVao = 0; - } - bool diffStreamHandles = false; for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) ; 0 != streamMask @@ -7196,7 +7359,7 @@ namespace bgfx { namespace gl currentState.m_indexBuffer = draw.m_indexBuffer; uint16_t handle = draw.m_indexBuffer.idx; - if (invalidHandle != handle) + if (kInvalidHandle != handle) { IndexBufferGL& ib = m_indexBuffers[handle]; GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) ); @@ -7335,7 +7498,7 @@ namespace bgfx { namespace gl { if (isValid(currentState.m_indirectBuffer) ) { - currentState.m_indirectBuffer.idx = invalidHandle; + currentState.m_indirectBuffer.idx = kInvalidHandle; GL_CHECK(glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0) ); } @@ -7405,6 +7568,8 @@ namespace bgfx { namespace gl } } + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); + blitMsaaFbo(); if (m_vaoSupport) @@ -7412,7 +7577,7 @@ namespace bgfx { namespace gl GL_CHECK(glBindVertexArray(m_vao) ); } - if (0 < _render->m_num) + if (0 < _render->m_numRenderItems) { if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) { @@ -7423,24 +7588,13 @@ namespace bgfx { namespace gl capture(); captureElapsed += bx::getHPCounter(); - BGFX_GPU_PROFILER_END(); - BGFX_PROFILER_END(); + profiler.end(); } } - BGFX_GPU_PROFILER_END(); - m_glctx.makeCurrent(NULL); - int64_t now = bx::getHPCounter(); - elapsed += now; - - static int64_t last = now; - - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = last; - - int64_t frameTime = now - last; - last = now; + int64_t timeEnd = bx::getHPCounter(); + int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; @@ -7450,43 +7604,45 @@ namespace bgfx { namespace gl static uint32_t maxGpuLatency = 0; static double maxGpuElapsed = 0.0f; double elapsedGpuMs = 0.0; - uint64_t elapsedGl = 0; - if (m_timerQuerySupport) + if (UINT32_MAX != frameQueryIdx) { - m_gpuTimer.end(); - do - { - elapsedGl = m_gpuTimer.m_elapsed; - elapsedGpuMs = double(elapsedGl)/1e6; - maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; - } - while (m_gpuTimer.get() ); + m_gpuTimer.end(frameQueryIdx); - maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1); + const TimerQueryGL::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + double toGpuMs = 1000.0 / 1e9; + elapsedGpuMs = (result.m_end - result.m_begin) * toGpuMs; + maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; + + maxGpuLatency = bx::uint32_imax(maxGpuLatency, result.m_pending-1); } const int64_t timerFreq = bx::getHPFrequency(); - perfStats.cpuTimeEnd = now; + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeEnd; perfStats.cpuTimerFreq = timerFreq; - perfStats.gpuTimeBegin = m_gpuTimer.m_begin; - perfStats.gpuTimeEnd = m_gpuTimer.m_end; + const TimerQueryGL::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; + perfStats.gpuTimeBegin = result.m_begin; + perfStats.gpuTimeEnd = result.m_end; perfStats.gpuTimerFreq = 1000000000; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; perfStats.maxGpuLatency = maxGpuLatency; + perfStats.gpuMemoryMax = -INT64_MAX; + perfStats.gpuMemoryUsed = -INT64_MAX; if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; - static int64_t next = now; + static int64_t next = timeEnd; - if (now >= next) + if (timeEnd >= next) { - next = now + timerFreq; + next = timeEnd + timerFreq; double freq = double(timerFreq); double toMs = 1000.0/freq; @@ -7524,9 +7680,9 @@ namespace bgfx { namespace gl , !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' ' ); - double elapsedCpuMs = double(elapsed)*toMs; + double elapsedCpuMs = double(frameTime)*toMs; tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] %c GPU %7.4f [ms] (latency %d) " - , _render->m_num + , _render->m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs @@ -7553,15 +7709,14 @@ namespace bgfx { namespace gl } tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); - tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); +// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); pos++; tvm.printf(10, pos++, 0x8e, " State cache: "); - tvm.printf(10, pos++, 0x8e, " VAO | Sampler "); - tvm.printf(10, pos++, 0x8e, " %6d | %6d " - , m_vaoStateCache.getCount() + tvm.printf(10, pos++, 0x8e, " Sampler "); + tvm.printf(10, pos++, 0x8e, " %6d " , m_samplerStateCache.getCount() ); @@ -7661,12 +7816,6 @@ namespace bgfx { namespace gl } } } // namespace bgfx -#undef BGFX_GPU_PROFILER_BIND -#undef BGFX_GPU_PROFILER_UNBIND -#undef BGFX_GPU_PROFILER_BEGIN -#undef BGFX_GPU_PROFILER_BEGIN_DYNAMIC -#undef BGFX_GPU_PROFILER_END - #else namespace bgfx { namespace gl diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h index 4d9778a0c4d..0e890a245ba 100644 --- a/3rdparty/bgfx/src/renderer_gl.h +++ b/3rdparty/bgfx/src/renderer_gl.h @@ -7,26 +7,27 @@ #define BGFX_RENDERER_GL_H_HEADER_GUARD #define BGFX_USE_EGL (BGFX_CONFIG_RENDERER_OPENGLES && (0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_EMSCRIPTEN \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_STEAMLINK \ - || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_EMSCRIPTEN \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_NX \ + || BX_PLATFORM_QNX \ + || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ + || BX_PLATFORM_WINDOWS \ ) ) #define BGFX_USE_WGL (BGFX_CONFIG_RENDERER_OPENGL && BX_PLATFORM_WINDOWS) #define BGFX_USE_GLX (BGFX_CONFIG_RENDERER_OPENGL && (0 \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_BSD \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_LINUX \ ) ) #define BGFX_USE_GL_DYNAMIC_LIB (0 \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_OSX \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_OSX \ || BX_PLATFORM_WINDOWS \ ) @@ -82,11 +83,17 @@ typedef uint64_t GLuint64; # define GL_HALF_FLOAT GL_HALF_FLOAT_OES # define GL_RGBA8 GL_RGBA8_OES # define GL_UNSIGNED_INT_2_10_10_10_REV GL_UNSIGNED_INT_2_10_10_10_REV_EXT -# define GL_TEXTURE_3D GL_TEXTURE_3D_OES +# ifndef GL_TEXTURE_3D +# define GL_TEXTURE_3D GL_TEXTURE_3D_OES +# endif // GL_TEXTURE_3D # define GL_SAMPLER_3D GL_SAMPLER_3D_OES # define GL_TEXTURE_WRAP_R GL_TEXTURE_WRAP_R_OES -# define GL_MIN GL_MIN_EXT -# define GL_MAX GL_MAX_EXT +# ifndef GL_MIN +# define GL_MIN GL_MIN_EXT +# endif // GL_MIN +# ifndef GL_MAX +# define GL_MAX GL_MAX_EXT +# endif // GL_MAX # define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES # define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES # define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES @@ -840,6 +847,14 @@ typedef uint64_t GLuint64; # define GL_UPPER_LEFT 0x8CA2 #endif // GL_UPPER_LEFT +#ifndef GL_SHADER +# define GL_SHADER 0x82E1 +#endif // GL_SHADER + +#ifndef GL_TEXTURE +# define GL_TEXTURE 0x1702 +#endif // GL_TEXTURE + // _KHR or _ARB... #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 @@ -935,9 +950,11 @@ typedef uint64_t GLuint64; # define GL_LINE_SMOOTH 0x0B20 #endif // GL_LINE_SMOOTH -#if BX_PLATFORM_NACL -# include "glcontext_ppapi.h" -#elif BX_PLATFORM_WINDOWS +#ifndef GL_TEXTURE_LOD_BIAS +# define GL_TEXTURE_LOD_BIAS 0x8501 +#endif // GL_TEXTURE_LOD_BIAS + +#if BX_PLATFORM_WINDOWS # include <windows.h> #elif BX_PLATFORM_LINUX || BX_PLATFORM_BSD # include "glcontext_glx.h" @@ -997,87 +1014,6 @@ namespace bgfx { namespace gl #define GL_IMPORT(_optional, _proto, _func, _import) extern _proto _func #include "glimports.h" - class VaoStateCache - { - public: - GLuint add(uint32_t _hash) - { - invalidate(_hash); - - GLuint arrayId; - GL_CHECK(glGenVertexArrays(1, &arrayId) ); - - m_hashMap.insert(stl::make_pair(_hash, arrayId) ); - - return arrayId; - } - - GLuint find(uint32_t _hash) - { - HashMap::iterator it = m_hashMap.find(_hash); - if (it != m_hashMap.end() ) - { - return it->second; - } - - return UINT32_MAX; - } - - void invalidate(uint32_t _hash) - { - GL_CHECK(glBindVertexArray(0) ); - - HashMap::iterator it = m_hashMap.find(_hash); - if (it != m_hashMap.end() ) - { - GL_CHECK(glDeleteVertexArrays(1, &it->second) ); - m_hashMap.erase(it); - } - } - - void invalidate() - { - GL_CHECK(glBindVertexArray(0) ); - - for (HashMap::iterator it = m_hashMap.begin(), itEnd = m_hashMap.end(); it != itEnd; ++it) - { - GL_CHECK(glDeleteVertexArrays(1, &it->second) ); - } - m_hashMap.clear(); - } - - uint32_t getCount() const - { - return uint32_t(m_hashMap.size() ); - } - - private: - typedef stl::unordered_map<uint32_t, GLuint> HashMap; - HashMap m_hashMap; - }; - - class VaoCacheRef - { - public: - void add(uint32_t _hash) - { - m_vaoSet.insert(_hash); - } - - void invalidate(VaoStateCache& _vaoCache) - { - for (VaoSet::iterator it = m_vaoSet.begin(), itEnd = m_vaoSet.end(); it != itEnd; ++it) - { - _vaoCache.invalidate(*it); - } - - m_vaoSet.clear(); - } - - typedef stl::unordered_set<uint32_t> VaoSet; - VaoSet m_vaoSet; - }; - class SamplerStateCache { public: @@ -1173,14 +1109,8 @@ namespace bgfx { namespace gl void destroy(); - void add(uint32_t _hash) - { - m_vcref.add(_hash); - } - GLuint m_id; uint32_t m_size; - VaoCacheRef m_vcref; uint16_t m_flags; }; @@ -1227,16 +1157,10 @@ namespace bgfx { namespace gl void destroy(); - void add(uint32_t _hash) - { - m_vcref.add(_hash); - } - GLuint m_id; GLenum m_target; uint32_t m_size; VertexDeclHandle m_decl; - VaoCacheRef m_vcref; }; struct TextureGL @@ -1365,11 +1289,6 @@ namespace bgfx { namespace gl } } - void add(uint32_t _hash) - { - m_vcref.add(_hash); - } - GLuint m_id; uint8_t m_unboundUsedAttrib[Attrib::Count]; // For tracking unbound used attributes between begin()/end(). @@ -1384,94 +1303,114 @@ namespace bgfx { namespace gl UniformBuffer* m_constantBuffer; PredefinedUniform m_predefined[PredefinedUniform::Count]; uint8_t m_numPredefined; - VaoCacheRef m_vcref; }; struct TimerQueryGL { TimerQueryGL() - : m_control(BX_COUNTOF(m_frame) ) + : m_control(BX_COUNTOF(m_query) ) { } void create() { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii) + for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) + { + Query& query = m_query[ii]; + query.m_ready = false; + GL_CHECK(glGenQueries(1, &query.m_begin) ); + GL_CHECK(glGenQueries(1, &query.m_end) ); + } + + for (uint32_t ii = 0; ii < BX_COUNTOF(m_result); ++ii) { - Frame& frame = m_frame[ii]; - GL_CHECK(glGenQueries(1, &frame.m_begin) ); - GL_CHECK(glGenQueries(1, &frame.m_elapsed) ); + Result& result = m_result[ii]; + result.reset(); } } void destroy() { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frame); ++ii) + for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) { - Frame& frame = m_frame[ii]; - GL_CHECK(glDeleteQueries(1, &frame.m_begin) ); - GL_CHECK(glDeleteQueries(1, &frame.m_elapsed) ); + Query& query = m_query[ii]; + GL_CHECK(glDeleteQueries(1, &query.m_begin) ); + GL_CHECK(glDeleteQueries(1, &query.m_end) ); } } - void begin() + uint32_t begin(uint32_t _resultIdx) { while (0 == m_control.reserve(1) ) { - get(); + update(); } - Frame& frame = m_frame[m_control.m_current]; - if (!BX_ENABLED(BX_PLATFORM_OSX) ) - { - GL_CHECK(glQueryCounter(frame.m_begin - , GL_TIMESTAMP - ) ); - } + Result& result = m_result[_resultIdx]; + ++result.m_pending; - GL_CHECK(glBeginQuery(GL_TIME_ELAPSED - , frame.m_elapsed - ) ); + const uint32_t idx = m_control.m_current; + Query& query = m_query[idx]; + query.m_resultIdx = _resultIdx; + query.m_ready = false; + + GL_CHECK(glQueryCounter(query.m_begin + , GL_TIMESTAMP + ) ); + + m_control.commit(1); + + return idx; } - void end() + void end(uint32_t _idx) { - GL_CHECK(glEndQuery(GL_TIME_ELAPSED) ); - m_control.commit(1); + Query& query = m_query[_idx]; + query.m_ready = true; + + GL_CHECK(glQueryCounter(query.m_end + , GL_TIMESTAMP + ) ); + + while (update() ) + { + } } - bool get() + bool update() { if (0 != m_control.available() ) { - Frame& frame = m_frame[m_control.m_read]; + Query& query = m_query[m_control.m_read]; + + if (!query.m_ready) + { + return false; + } GLint available; - GL_CHECK(glGetQueryObjectiv(frame.m_elapsed - , GL_QUERY_RESULT_AVAILABLE - , &available - ) ); + GL_CHECK(glGetQueryObjectiv(query.m_end + , GL_QUERY_RESULT_AVAILABLE + , &available + ) ); if (available) { - if (!BX_ENABLED(BX_PLATFORM_OSX) ) - { - GL_CHECK(glGetQueryObjectui64v(frame.m_begin - , GL_QUERY_RESULT - , &m_begin - ) ); - } - else - { - m_begin = 0; - } - - GL_CHECK(glGetQueryObjectui64v(frame.m_elapsed - , GL_QUERY_RESULT - , &m_elapsed - ) ); - m_end = m_begin + m_elapsed; m_control.consume(1); + + Result& result = m_result[query.m_resultIdx]; + --result.m_pending; + + GL_CHECK(glGetQueryObjectui64v(query.m_begin + , GL_QUERY_RESULT + , &result.m_begin + ) ); + + GL_CHECK(glGetQueryObjectui64v(query.m_end + , GL_QUERY_RESULT + , &result.m_end + ) ); + return true; } } @@ -1479,17 +1418,31 @@ namespace bgfx { namespace gl return false; } - uint64_t m_begin; - uint64_t m_end; - uint64_t m_elapsed; + struct Result + { + void reset() + { + m_begin = 0; + m_end = 0; + m_pending = 0; + } + + uint64_t m_begin; + uint64_t m_end; + uint32_t m_pending; + }; - struct Frame + struct Query { - GLuint m_begin; - GLuint m_elapsed; + GLuint m_begin; + GLuint m_end; + uint32_t m_resultIdx; + bool m_ready; }; - Frame m_frame[4]; + Result m_result[BGFX_CONFIG_MAX_VIEWS+1]; + + Query m_query[BGFX_CONFIG_MAX_VIEWS*4]; bx::RingBufferControl m_control; }; @@ -1517,6 +1470,45 @@ namespace bgfx { namespace gl bx::RingBufferControl m_control; }; + class LineReader : public bx::ReaderI + { + public: + LineReader(const void* _str) + : m_str( (const char*)_str) + , m_pos(0) + , m_size(bx::strLen( (const char*)_str) ) + { + } + + virtual int32_t read(void* _data, int32_t _size, bx::Error* _err) override + { + if (m_str[m_pos] == '\0' + || m_pos == m_size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "LineReader: EOF."); + return 0; + } + + uint32_t pos = m_pos; + const char* str = &m_str[pos]; + const char* nl = bx::strnl(str); + pos += (uint32_t)(nl - str); + + const char* eol = &m_str[pos]; + + uint32_t size = bx::uint32_min(uint32_t(eol - str), _size); + + bx::memCopy(_data, str, size); + m_pos += size; + + return size; + } + + const char* m_str; + uint32_t m_pos; + uint32_t m_size; + }; + } /* namespace gl */ } // namespace bgfx #endif // BGFX_RENDERER_GL_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h index 86893f70e4c..805fa1eaff7 100644 --- a/3rdparty/bgfx/src/renderer_mtl.h +++ b/3rdparty/bgfx/src/renderer_mtl.h @@ -224,14 +224,8 @@ namespace bgfx { namespace mtl id<MTLLibrary> newLibraryWithSource(const char* _source) { - MTLCompileOptions* options = [MTLCompileOptions new]; - //NOTE: turned of as 'When using the fast variants, math functions execute more quickly, - // but operate over a **LIMITED RANGE** and their behavior when handling NaN values is not defined.' - if (BX_ENABLED(BX_PLATFORM_IOS)) - options.fastMathEnabled = NO; - NSError* error; - id<MTLLibrary> lib = [m_obj newLibraryWithSource:@(_source) options:options error:&error]; + id<MTLLibrary> lib = [m_obj newLibraryWithSource:@(_source) options:nil error:&error]; BX_WARN(NULL == error , "Shader compilation failed: %s" , [error.localizedDescription cStringUsingEncoding:NSASCIIStringEncoding] @@ -332,6 +326,14 @@ namespace bgfx { namespace mtl MTL_CLASS(Function) NSArray* vertexAttributes() { return m_obj.vertexAttributes; } + + void setLabel(const char* _label) + { + if ([m_obj respondsToSelector:@selector(setLabel:)]) + { + [m_obj setLabel:@(_label)]; + } + } MTL_CLASS_END MTL_CLASS(Library) @@ -504,6 +506,11 @@ namespace bgfx { namespace mtl { return m_obj.textureType; } + + void setLabel(const char* _label) + { + [m_obj setLabel:@(_label)]; + } MTL_CLASS_END typedef id<MTLComputePipelineState> ComputePipelineState; @@ -732,8 +739,7 @@ namespace bgfx { namespace mtl , m_vshConstantBufferAlignmentMask(0) , m_fshConstantBufferSize(0) , m_fshConstantBufferAlignmentMask(0) - , m_usedVertexSamplerStages(0) - , m_usedFragmentSamplerStages(0) + , m_samplerCount(0) , m_numPredefined(0) , m_processedUniforms(false) { @@ -759,8 +765,16 @@ namespace bgfx { namespace mtl uint32_t m_vshConstantBufferAlignmentMask; uint32_t m_fshConstantBufferSize; uint32_t m_fshConstantBufferAlignmentMask; - uint32_t m_usedVertexSamplerStages; - uint32_t m_usedFragmentSamplerStages; + + struct SamplerInfo + { + uint32_t m_index; + bgfx::UniformHandle m_uniform; + bool m_fragment; + }; + SamplerInfo m_samplers[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; + uint32_t m_samplerCount; + PredefinedUniform m_predefined[PredefinedUniform::Count*2]; uint8_t m_numPredefined; bool m_processedUniforms; @@ -818,7 +832,7 @@ namespace bgfx { namespace mtl , m_pixelFormatHash(0) , m_num(0) { - m_depthHandle.idx = invalidHandle; + m_depthHandle.idx = kInvalidHandle; } void create(uint8_t _num, const Attachment* _attachment); diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index fbfcdf287f7..1b1251dbad9 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -21,33 +21,24 @@ /* // known metal shader generation issues: 03-raymarch: OSX10.11.3 nothing is visible ( depth/color swap in fragment output struct fixed this ) - 14-shadowvolumes: in texture as stencil mode - columns/bunny are dark. in fs_shadowvolume_color_lighting SAMPLER2D(s_texStencil, 1) is - converted to "texture2d<float> s_texStencil [[texture(0)]], sampler _mtlsmp_s_texStencil [[sampler(0)]]". Slot is 1 -> 0. - 15-shadowmaps-simple: shader compilation error - 16-shadowmaps: //problem with essl -> metal: SAMPLER2D(u_shadowMap0, 4); sampler index is lost. Shadowmap is set to slot 4, but - metal shader uses sampler/texture slot 0. this could require changes outside of renderer_mtl? - packFloatToRGBA needs highp. currently it uses half. 24-nbody: no generated compute shaders for metal - 27-terrain: shaderc generates invalid metal shader for vs_terrain_height_texture. vertex output: half4 gl_Position [[position]], should be float4 - 31-rsm: - <program source>:6:23: error: type 'half4' (aka 'vector_half4') is not valid for attribute 'position' - half4 gl_Position [[position]]; - Known issues(driver problems??): OSX mac mini(late 2014), OSX10.11.3 : nanovg-rendering: color writemask off causes problem... - 03-raymarch: OSX nothing is visible ( depth/color order should be swapped in fragment output struct) - works fine with newer OSX + 03-raymarch: OSX nothing is visible ( depth/color order should be swapped in fragment output struct) + works fine with newer OSX iPad mini 2, iOS 8.1.1: 21-deferred: scissor not working properly - 26-occlusion: query doesn't work with two rendercommandencoders - Only on this device ( no problem on iPad Air 2 with iOS9.3.1) + 26-occlusion: query doesn't work with two rendercommandencoders + Only on this device ( no problem on iPad Air 2 with iOS9.3.1) TODOs: + - support multiple vertex buffers: 34-mvs + - framebufferMtl and TextureMtl resolve - FrameBufferMtl::postReset recreate framebuffer??? - renderpass load/resolve + renderpass load/resolve - capture with msaa: 07-callback - implement fb discard. problematic with multiple views that has same fb... - msaa color/depth/stencil is not saved. could have problem when we switch back to msaa framebuffer @@ -94,7 +85,7 @@ namespace bgfx { namespace mtl "LineStrip", "Point", }; - BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName)); + BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName) ); static const char* s_attribName[] = { @@ -104,6 +95,8 @@ namespace bgfx { namespace mtl "a_bitangent", "a_color0", "a_color1", + "a_color2", + "a_color3", "a_indices", "a_weight", "a_texcoord0", @@ -134,7 +127,7 @@ namespace bgfx { namespace mtl { MTLVertexFormatUChar2, MTLVertexFormatUChar2Normalized }, { MTLVertexFormatUChar2, MTLVertexFormatUChar2Normalized }, { MTLVertexFormatUChar3, MTLVertexFormatUChar3Normalized }, - { MTLVertexFormatUChar4, MTLVertexFormatUChar4Normalized } + { MTLVertexFormatUChar4, MTLVertexFormatUChar4Normalized }, }, //Uint10 @@ -143,7 +136,7 @@ namespace bgfx { namespace mtl { MTLVertexFormatUInt1010102Normalized, MTLVertexFormatUInt1010102Normalized }, { MTLVertexFormatUInt1010102Normalized, MTLVertexFormatUInt1010102Normalized }, { MTLVertexFormatUInt1010102Normalized, MTLVertexFormatUInt1010102Normalized }, - { MTLVertexFormatUInt1010102Normalized, MTLVertexFormatUInt1010102Normalized } + { MTLVertexFormatUInt1010102Normalized, MTLVertexFormatUInt1010102Normalized }, }, //Int16 @@ -151,7 +144,7 @@ namespace bgfx { namespace mtl { MTLVertexFormatShort2, MTLVertexFormatShort2Normalized }, { MTLVertexFormatShort2, MTLVertexFormatShort2Normalized }, { MTLVertexFormatShort3, MTLVertexFormatShort3Normalized }, - { MTLVertexFormatShort4, MTLVertexFormatShort4Normalized } + { MTLVertexFormatShort4, MTLVertexFormatShort4Normalized }, }, //Half @@ -159,7 +152,7 @@ namespace bgfx { namespace mtl { MTLVertexFormatHalf2, MTLVertexFormatHalf2 }, { MTLVertexFormatHalf2, MTLVertexFormatHalf2 }, { MTLVertexFormatHalf3, MTLVertexFormatHalf3 }, - { MTLVertexFormatHalf4, MTLVertexFormatHalf4 } + { MTLVertexFormatHalf4, MTLVertexFormatHalf4 }, }, //Float @@ -167,7 +160,7 @@ namespace bgfx { namespace mtl { MTLVertexFormatFloat, MTLVertexFormatFloat }, { MTLVertexFormatFloat2, MTLVertexFormatFloat2 }, { MTLVertexFormatFloat3, MTLVertexFormatFloat3 }, - { MTLVertexFormatFloat4, MTLVertexFormatFloat4 } + { MTLVertexFormatFloat4, MTLVertexFormatFloat4 }, }, }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); @@ -217,7 +210,7 @@ namespace bgfx { namespace mtl MTLCompareFunctionGreater, MTLCompareFunctionNotEqual, MTLCompareFunctionNever, - MTLCompareFunctionAlways + MTLCompareFunctionAlways, }; static const MTLStencilOperation s_stencilOp[] = @@ -229,7 +222,7 @@ namespace bgfx { namespace mtl MTLStencilOperationIncrementClamp, MTLStencilOperationDecrementWrap, MTLStencilOperationDecrementClamp, - MTLStencilOperationInvert + MTLStencilOperationInvert, }; static const MTLSamplerAddressMode s_textureAddress[] = @@ -327,7 +320,7 @@ namespace bgfx { namespace mtl { MTLPixelFormat(42) /*ABGR4Unorm*/, MTLPixelFormatInvalid }, // RGBA4 { MTLPixelFormat(41) /*A1BGR5Unorm*/, MTLPixelFormatInvalid }, // RGB5A1 { MTLPixelFormatRGB10A2Unorm, MTLPixelFormatInvalid }, // RGB10A2 - { MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid }, // R11G11B10F + { MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid }, // RG11B10F { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // UnknownDepth { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D16 { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D24 @@ -342,8 +335,8 @@ namespace bgfx { namespace mtl int s_msaa[5] = { 1,2,4,8,16 }; - #define SHADER_FUNCTION_NAME ("xlatMtlMain") - #define SHADER_UNIFORM_NAME ("_mtl_u") +#define SHADER_FUNCTION_NAME ("xlatMtlMain") +#define SHADER_UNIFORM_NAME ("_mtl_u") struct RendererContextMtl : public RendererContextI { @@ -369,7 +362,7 @@ namespace bgfx { namespace mtl { BX_TRACE("Init."); - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); @@ -384,7 +377,7 @@ namespace bgfx { namespace mtl if (NULL != NSClassFromString(@"CAMetalLayer") ) { - if (NULL == m_metalLayer) + if (NULL == m_metalLayer) #if BX_PLATFORM_IOS { CAMetalLayer* metalLayer = (CAMetalLayer*)g_platformData.nwh; @@ -399,10 +392,19 @@ namespace bgfx { namespace mtl } #elif BX_PLATFORM_OSX { - NSWindow* nsWindow = (NSWindow*)g_platformData.nwh; - [nsWindow.contentView setWantsLayer:YES]; - m_metalLayer = [CAMetalLayer layer]; - [nsWindow.contentView setLayer:m_metalLayer]; + NSObject* nvh = (NSObject*)g_platformData.nwh; + if ([nvh isKindOfClass:[CAMetalLayer class]]) + { + CAMetalLayer* metalLayer = (CAMetalLayer*)g_platformData.nwh; + m_metalLayer = metalLayer; + } + else + { + NSWindow* nsWindow = (NSWindow*)g_platformData.nwh; + [nsWindow.contentView setWantsLayer:YES]; + m_metalLayer = [CAMetalLayer layer]; + [nsWindow.contentView setLayer:m_metalLayer]; + } } #endif // BX_PLATFORM_* @@ -421,6 +423,7 @@ namespace bgfx { namespace mtl return false; } + retain(m_device); m_metalLayer.device = m_device; m_metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; @@ -447,29 +450,37 @@ namespace bgfx { namespace mtl "struct xlatMtlShaderOutput { float4 gl_Position [[position]]; float2 v_texcoord0; }; \n" "vertex xlatMtlShaderOutput xlatMtlMain (uint v_id [[ vertex_id ]]) \n" "{\n" - " xlatMtlShaderOutput _mtl_o;\n" + " xlatMtlShaderOutput _mtl_o;\n" " if (v_id==0) { _mtl_o.gl_Position = float4(-1.0,-1.0,0.0,1.0); _mtl_o.v_texcoord0 = float2(0.0,1.0); } \n" " else if (v_id==1) { _mtl_o.gl_Position = float4(3.0,-1.0,0.0,1.0); _mtl_o.v_texcoord0 = float2(2.0,1.0); } \n" " else { _mtl_o.gl_Position = float4(-1.0,3.0,0.0,1.0); _mtl_o.v_texcoord0 = float2(0.0,-1.0); }\n" " return _mtl_o;\n" - "}\n"; + "}\n" + ; - const char* fshSource = "using namespace metal; \n" - " struct xlatMtlShaderInput { float2 v_texcoord0; }; \n" - " fragment half4 xlatMtlMain (xlatMtlShaderInput _mtl_i[[stage_in]], texture2d<float> s_texColor [[texture(0)]], sampler _mtlsmp_s_texColor [[sampler(0)]] ) \n" - " { return half4(s_texColor.sample(_mtlsmp_s_texColor, _mtl_i.v_texcoord0)); } \n"; + const char* fshSource = + "using namespace metal;\n" + "struct xlatMtlShaderInput { float2 v_texcoord0; };\n" + "fragment half4 xlatMtlMain (xlatMtlShaderInput _mtl_i[[stage_in]], texture2d<float> s_texColor [[texture(0)]], sampler _mtlsmp_s_texColor [[sampler(0)]] )\n" + "{\n" + " return half4(s_texColor.sample(_mtlsmp_s_texColor, _mtl_i.v_texcoord0) );\n" + "}\n" + ; Library lib = m_device.newLibraryWithSource(vshSource); if (NULL != lib) { m_screenshotBlitProgramVsh.m_function = lib.newFunctionWithName(SHADER_FUNCTION_NAME); } + lib = m_device.newLibraryWithSource(fshSource); if (NULL != lib) { m_screenshotBlitProgramFsh.m_function = lib.newFunctionWithName(SHADER_FUNCTION_NAME); } + m_screenshotBlitProgram.create(&m_screenshotBlitProgramVsh, &m_screenshotBlitProgramFsh); + release(lib); reset(m_renderPipelineDescriptor); m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_metalLayer.pixelFormat; @@ -478,7 +489,7 @@ namespace bgfx { namespace mtl m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor); g_caps.supported |= (0 - | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL //NOTE: on IOS Gpu Family 1/2 have to set compare in shader + | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL | BGFX_CAPS_TEXTURE_COMPARE_ALL | BGFX_CAPS_TEXTURE_3D | BGFX_CAPS_VERTEX_ATTRIB_HALF @@ -486,28 +497,26 @@ namespace bgfx { namespace mtl | BGFX_CAPS_INSTANCING | BGFX_CAPS_FRAGMENT_DEPTH | BGFX_CAPS_BLEND_INDEPENDENT -// | BGFX_CAPS_COMPUTE // TODO: api/hw supports it but metal compute shaders are not yet supported | BGFX_CAPS_INDEX32 -// | BGFX_CAPS_DRAW_INDIRECT // TODO: support on iOS9+gpu family3+ and on macOS | BGFX_CAPS_TEXTURE_BLIT | BGFX_CAPS_TEXTURE_READ_BACK | BGFX_CAPS_OCCLUSION_QUERY | BGFX_CAPS_ALPHA_TO_COVERAGE - | BGFX_CAPS_TEXTURE_2D_ARRAY // supported on all platforms + | BGFX_CAPS_TEXTURE_2D_ARRAY ); if (BX_ENABLED(BX_PLATFORM_IOS) ) { if (iOSVersionEqualOrGreater("9.0.0") ) { - g_caps.limits.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192; + g_caps.limits.maxTextureSize = m_device.supportsFeatureSet( (MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192; } else { g_caps.limits.maxTextureSize = 4096; } - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS)); + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet( (MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } else if (BX_ENABLED(BX_PLATFORM_OSX) ) { @@ -518,7 +527,7 @@ namespace bgfx { namespace mtl //todo: vendor id, device id, gpu enum - m_hasPixelFormatDepth32Float_Stencil8 = false + m_hasPixelFormatDepth32Float_Stencil8 = false || BX_ENABLED(BX_PLATFORM_OSX) || (BX_ENABLED(BX_PLATFORM_IOS) && iOSVersionEqualOrGreater("9.0.0") ) ; @@ -533,7 +542,7 @@ namespace bgfx { namespace mtl if (BX_ENABLED(BX_PLATFORM_OSX) ) { - s_textureFormat[TextureFormat::R8].m_fmtSrgb = MTLPixelFormatInvalid; + s_textureFormat[TextureFormat::R8].m_fmtSrgb = MTLPixelFormatInvalid; s_textureFormat[TextureFormat::RG8].m_fmtSrgb = MTLPixelFormatInvalid; } @@ -557,46 +566,45 @@ namespace bgfx { namespace mtl : BGFX_CAPS_FORMAT_TEXTURE_NONE ; - if (!isCompressed((TextureFormat::Enum)(ii))) + if (!bimg::isCompressed(bimg::TextureFormat::Enum(ii) ) ) { - support |= BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER - | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA; + support |= 0 + | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER + | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA + ; } - //TODO: additional caps flags -// support |= BGFX_CAPS_FORMAT_TEXTURE_IMAGE : BGFX_CAPS_FORMAT_TEXTURE_NONE; - g_caps.formats[ii] = support; } - g_caps.formats[TextureFormat::A8] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); - g_caps.formats[TextureFormat::RG32I] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); - g_caps.formats[TextureFormat::RG32U] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); + g_caps.formats[TextureFormat::A8 ] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); + g_caps.formats[TextureFormat::RG32I ] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); + g_caps.formats[TextureFormat::RG32U ] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); g_caps.formats[TextureFormat::RGBA32I] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); g_caps.formats[TextureFormat::RGBA32U] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); - if (BX_ENABLED(BX_PLATFORM_IOS) ) { - s_textureFormat[TextureFormat::D24S8].m_fmt = MTLPixelFormatDepth32Float; + s_textureFormat[TextureFormat::D24S8].m_fmt = MTLPixelFormatDepth32Float_Stencil8; - g_caps.formats[TextureFormat::BC1] = - g_caps.formats[TextureFormat::BC2] = - g_caps.formats[TextureFormat::BC3] = - g_caps.formats[TextureFormat::BC4] = - g_caps.formats[TextureFormat::BC5] = + g_caps.formats[TextureFormat::BC1 ] = + g_caps.formats[TextureFormat::BC2 ] = + g_caps.formats[TextureFormat::BC3 ] = + g_caps.formats[TextureFormat::BC4 ] = + g_caps.formats[TextureFormat::BC5 ] = g_caps.formats[TextureFormat::BC6H] = - g_caps.formats[TextureFormat::BC7] = BGFX_CAPS_FORMAT_TEXTURE_NONE; + g_caps.formats[TextureFormat::BC7 ] = BGFX_CAPS_FORMAT_TEXTURE_NONE; - g_caps.formats[TextureFormat::RG32F] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); + g_caps.formats[TextureFormat::RG32F ] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); g_caps.formats[TextureFormat::RGBA32F] &= ~(BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA); } if (BX_ENABLED(BX_PLATFORM_OSX) ) { - s_textureFormat[TextureFormat::D24S8].m_fmt = (MTLPixelFormat)(m_device.depth24Stencil8PixelFormatSupported() ? - 255 /* Depth24Unorm_Stencil8 */ : - MTLPixelFormatDepth32Float_Stencil8); + s_textureFormat[TextureFormat::D24S8].m_fmt = (MTLPixelFormat)(m_device.depth24Stencil8PixelFormatSupported() + ? 255 /* Depth24Unorm_Stencil8 */ + : MTLPixelFormatDepth32Float_Stencil8) + ; g_caps.formats[TextureFormat::ETC2 ] = g_caps.formats[TextureFormat::ETC2A ] = @@ -621,15 +629,14 @@ namespace bgfx { namespace mtl } } - for(uint32_t ii=1; ii<5; ++ii) + for (uint32_t ii=1; ii<5; ++ii) { - if (!m_device.supportsTextureSampleCount(s_msaa[ii])) + if (!m_device.supportsTextureSampleCount(s_msaa[ii]) ) { s_msaa[ii] = s_msaa[ii-1]; } } - // Init reserved part of view name. for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { @@ -658,6 +665,11 @@ namespace bgfx { namespace mtl m_textures[ii].destroy(); } + m_screenshotBlitProgramVsh.destroy(); + m_screenshotBlitProgramFsh.destroy(); + m_screenshotBlitProgram.destroy(); + MTL_RELEASE(m_screenshotBlitRenderPipelineState); + captureFinish(); MTL_RELEASE(m_depthStencilDescriptor); @@ -669,10 +681,7 @@ namespace bgfx { namespace mtl MTL_RELEASE(m_samplerDescriptor); MTL_RELEASE(m_backBufferDepth); - if (BX_ENABLED(BX_PLATFORM_IOS) ) - { - MTL_RELEASE(m_backBufferStencil); - } + MTL_RELEASE(m_backBufferStencil); for (uint8_t i=0; i < MTL_MAX_FRAMES_IN_FLIGHT; ++i) { @@ -682,117 +691,117 @@ namespace bgfx { namespace mtl MTL_RELEASE(m_device); } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { return RendererType::Metal; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { return BGFX_RENDERER_METAL_NAME; } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } - void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override { VertexDecl& decl = m_vertexDecls[_handle.idx]; bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } - void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { VertexDeclHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE + void createShader(ShaderHandle _handle, Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } - void destroyShader(ShaderHandle _handle) BX_OVERRIDE + void destroyShader(ShaderHandle _handle) override { m_shaders[_handle.idx].destroy(); } - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE + void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { m_program[_handle.idx].create(&m_shaders[_vsh.idx], &m_shaders[_fsh.idx]); } - void destroyProgram(ProgramHandle _handle) BX_OVERRIDE + void destroyProgram(ProgramHandle _handle) override { m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE + void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); } - void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE + void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override { } - void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE + void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override { m_textures[_handle.idx].update(_side, _mip, _rect, _z, _depth, _pitch, _mem); } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { } - void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override { m_cmd.kick(false, true); m_commandBuffer = m_cmd.alloc(); @@ -803,7 +812,7 @@ namespace bgfx { namespace mtl uint32_t srcWidth = bx::uint32_max(1, texture.m_ptr.width() >> _mip); uint32_t srcHeight = bx::uint32_max(1, texture.m_ptr.height() >> _mip); - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); MTLRegion region = { { 0, 0, 0 }, { srcWidth, srcHeight, 1 } }; @@ -811,7 +820,7 @@ namespace bgfx { namespace mtl } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override { TextureMtl& texture = m_textures[_handle.idx]; @@ -839,35 +848,35 @@ namespace bgfx { namespace mtl release(mem); } - void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE + void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override { BX_UNUSED(_handle, _ptr); } - uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE + uintptr_t getInternal(TextureHandle _handle) override { BX_UNUSED(_handle); return 0; } - void destroyTexture(TextureHandle _handle) BX_OVERRIDE + void destroyTexture(TextureHandle _handle) override { m_textures[_handle.idx].destroy(); } - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) override { m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); } - void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle _handle) override { uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); if (UINT16_MAX != denseIdx) @@ -882,7 +891,7 @@ namespace bgfx { namespace mtl } } - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE + void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override { if (NULL != m_uniforms[_handle.idx]) { @@ -896,7 +905,7 @@ namespace bgfx { namespace mtl m_uniformReg.add(_handle, _name, data); } - void destroyUniform(UniformHandle _handle) BX_OVERRIDE + void destroyUniform(UniformHandle _handle) override { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; @@ -904,14 +913,14 @@ namespace bgfx { namespace mtl } //cmdPre - void requestScreenShotPre(const char* _filePath) BX_OVERRIDE + void requestScreenShotPre(const char* _filePath) { BX_UNUSED(_filePath); m_saveScreenshot = true; } //cmdPost - void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { BX_UNUSED(_handle); @@ -946,23 +955,24 @@ namespace bgfx { namespace mtl m_commandBuffer = m_cmd.alloc(); } - void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE + void updateViewName(ViewId _id, const char* _name) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { - bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name - , BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED - ); + bx::strCopy( + &s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] + , BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + , _name + ); } } - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE + void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override { bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* _marker, uint32_t /*_size*/) BX_OVERRIDE + void setMarker(const char* _marker, uint32_t /*_size*/) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) ) { @@ -970,14 +980,34 @@ namespace bgfx { namespace mtl } } - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override { m_occlusionQuery.invalidate(_handle); } - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE; + virtual void setName(Handle _handle, const char* _name) override + { + switch (_handle.type) + { + case Handle::Shader: + m_shaders[_handle.idx].m_function.setLabel(_name); + break; + + case Handle::Texture: + m_textures[_handle.idx].m_ptr.setLabel(_name); + break; + + default: + BX_CHECK(false, "Invalid handle type?! %d", _handle.type); + break; + } + } + + void submitBlit(BlitState& _bs, uint16_t _view); + + void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; - void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE + void blitSetup(TextVideoMemBlitter& _blitter) override { RenderCommandEncoder rce = m_renderCommandEncoder; @@ -991,9 +1021,10 @@ namespace bgfx { namespace mtl FrameBufferHandle fbh = BGFX_INVALID_HANDLE; - if ( NULL == rce || m_renderCommandEncoderFrameBufferHandle.idx != invalidHandle ) + if (NULL == rce + || m_renderCommandEncoderFrameBufferHandle.idx != kInvalidHandle) { - if ( m_renderCommandEncoder ) + if (m_renderCommandEncoder ) m_renderCommandEncoder.endEncoding(); RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor(); @@ -1045,7 +1076,7 @@ namespace bgfx { namespace mtl } float proj[16]; - bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f); + bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, false); PredefinedUniform& predefined = program.m_predefined[0]; uint8_t flags = predefined.m_type; @@ -1054,7 +1085,7 @@ namespace bgfx { namespace mtl m_textures[_blitter.m_texture.idx].commit(0, false, true); } - void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override { const uint32_t numVertices = _numIndices*4/6; if (0 < numVertices) @@ -1069,7 +1100,12 @@ namespace bgfx { namespace mtl } } - void flip(HMD& /*_hmd*/) BX_OVERRIDE + bool isDeviceRemoved() override + { + return false; + } + + void flip(HMD& /*_hmd*/) override { if (NULL == m_commandBuffer) { @@ -1077,7 +1113,7 @@ namespace bgfx { namespace mtl } // Present and commit the command buffer - if ( NULL != m_drawable) + if (NULL != m_drawable) { m_commandBuffer.presentDrawable(m_drawable); MTL_RELEASE(m_drawable); @@ -1085,22 +1121,6 @@ namespace bgfx { namespace mtl m_cmd.kick(true); m_commandBuffer = 0; - - //TODO: support multiple windows on OSX - /* - if (m_flip) - { - for (uint32_t ii = 1, num = m_numWindows; ii < num; ++ii) - { - m_glctx.swap(m_frameBuffers[m_windows[ii].idx].m_swapChain); - } - - if (!m_ovr.swap(_hmd) ) - { - m_glctx.swap(); - } - } - */ } void updateResolution(const Resolution& _resolution) @@ -1110,17 +1130,16 @@ namespace bgfx { namespace mtl : 1 ; - //TODO: there should be a way to specify if backbuffer needs stencil/depth. const uint32_t maskFlags = ~(0 - | BGFX_RESET_HMD_RECENTER - | BGFX_RESET_MAXANISOTROPY - | BGFX_RESET_DEPTH_CLAMP - | BGFX_RESET_SUSPEND - ); + | BGFX_RESET_HMD_RECENTER + | BGFX_RESET_MAXANISOTROPY + | BGFX_RESET_DEPTH_CLAMP + | BGFX_RESET_SUSPEND + ); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) + if (m_resolution.m_width != _resolution.m_width + || m_resolution.m_height != _resolution.m_height + || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) { int sampleCount = s_msaa[(_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; @@ -1128,9 +1147,9 @@ namespace bgfx { namespace mtl m_metalLayer.drawableSize = CGSizeMake(_resolution.m_width, _resolution.m_height); m_metalLayer.pixelFormat = (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) - ? MTLPixelFormatBGRA8Unorm_sRGB - : MTLPixelFormatBGRA8Unorm - ; + ? MTLPixelFormatBGRA8Unorm_sRGB + : MTLPixelFormatBGRA8Unorm + ; m_resolution = _resolution; m_resolution.m_flags &= ~BGFX_RESET_INTERNAL_FORCE; @@ -1148,7 +1167,8 @@ namespace bgfx { namespace mtl m_textureDescriptor.mipmapLevelCount = 1; m_textureDescriptor.sampleCount = sampleCount; m_textureDescriptor.arrayLength = 1; - if ( m_iOS9Runtime || m_macOS11Runtime ) + if (m_iOS9Runtime + || m_macOS11Runtime) { m_textureDescriptor.cpuCacheMode = MTLCPUCacheModeDefaultCache; m_textureDescriptor.storageMode = MTLStorageModePrivate; @@ -1159,18 +1179,26 @@ namespace bgfx { namespace mtl { release(m_backBufferDepth); } + m_backBufferDepth = m_device.newTextureWithDescriptor(m_textureDescriptor); + if (NULL != m_backBufferStencil) + { + release(m_backBufferStencil); + } if (m_hasPixelFormatDepth32Float_Stencil8) + { m_backBufferStencil = m_backBufferDepth; + retain(m_backBufferStencil); + } else { m_textureDescriptor.pixelFormat = MTLPixelFormatStencil8; m_backBufferStencil = m_device.newTextureWithDescriptor(m_textureDescriptor); } - if ( sampleCount > 1 ) + if (sampleCount > 1) { if (NULL != m_backBufferColorMSAA) { @@ -1183,10 +1211,10 @@ namespace bgfx { namespace mtl bx::HashMurmur2A murmur; murmur.begin(); murmur.add(1); - murmur.add((uint32_t)m_metalLayer.pixelFormat); - murmur.add((uint32_t)m_backBufferDepth.pixelFormat()); - murmur.add((uint32_t)m_backBufferStencil.pixelFormat()); - murmur.add((uint32_t)sampleCount); + murmur.add( (uint32_t)m_metalLayer.pixelFormat); + murmur.add( (uint32_t)m_backBufferDepth.pixelFormat() ); + murmur.add( (uint32_t)m_backBufferStencil.pixelFormat() ); + murmur.add( (uint32_t)sampleCount); m_backBufferPixelFormatHash = murmur.end(); for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) @@ -1199,7 +1227,7 @@ namespace bgfx { namespace mtl m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); m_textVideoMem.clear(); - if ( prevMetalLayerPixelFormat != m_metalLayer.pixelFormat) + if (prevMetalLayerPixelFormat != m_metalLayer.pixelFormat) { MTL_RELEASE(m_screenshotBlitRenderPipelineState) reset(m_renderPipelineDescriptor); @@ -1242,19 +1270,19 @@ namespace bgfx { namespace mtl MTLRegion region = { { 0, 0, 0 }, { m_resolution.m_width, m_resolution.m_height, 1 } }; - //TODO: enable screenshot target when capturing m_screenshotTarget.getBytes(m_capture, 4*m_resolution.m_width, 0, region, 0, 0); m_commandBuffer = m_cmd.alloc(); if (m_screenshotTarget.pixelFormat() == MTLPixelFormatRGBA8Uint) { - imageSwizzleBgra8( + bimg::imageSwizzleBgra8( m_capture + , m_resolution.m_width*4 , m_resolution.m_width , m_resolution.m_height - , m_resolution.m_width*4 , m_capture + , m_resolution.m_width*4 ); } @@ -1449,7 +1477,7 @@ namespace bgfx { namespace mtl } ProgramMtl& program = m_program[_clearQuad.m_program[numMrt-1].idx]; - m_renderCommandEncoder.setRenderPipelineState(program.getRenderPipelineState(state, 0, fbh, _clearQuad.m_vb->decl, 0)); + m_renderCommandEncoder.setRenderPipelineState(program.getRenderPipelineState(state, 0, fbh, _clearQuad.m_vb->decl, 0) ); uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize; @@ -1469,9 +1497,10 @@ namespace bgfx { namespace mtl bx::memCopy(mrtClear[ii], _palette[index], 16); } - bx::memCopy((uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset, - mrtClear, - bx::uint32_min(fragmentUniformBufferSize, sizeof(mrtClear))); + bx::memCopy( (uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset + , mrtClear + , bx::uint32_min(fragmentUniformBufferSize, sizeof(mrtClear) ) + ); } else { @@ -1483,9 +1512,10 @@ namespace bgfx { namespace mtl _clear.m_index[3]*1.0f/255.0f, }; - bx::memCopy((uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset, - rgba, - bx::uint32_min(fragmentUniformBufferSize, sizeof(rgba))); + bx::memCopy( (uint8_t*)m_uniformBuffer.contents() + m_uniformBufferFragmentOffset + , rgba + , bx::uint32_min(fragmentUniformBufferSize, sizeof(rgba) ) + ); } m_uniformBufferFragmentOffset += fragmentUniformBufferSize; @@ -1541,20 +1571,23 @@ namespace bgfx { namespace mtl { if (!isValid(_fbh) ) { - if ( NULL != m_backBufferColorMSAA ) + if (NULL != m_backBufferColorMSAA) { renderPassDescriptor.colorAttachments[0].texture = m_backBufferColorMSAA; - renderPassDescriptor.colorAttachments[0].resolveTexture = ((NULL != m_screenshotTarget) ? - m_screenshotTarget.m_obj : - currentDrawable().texture); + renderPassDescriptor.colorAttachments[0].resolveTexture = NULL != m_screenshotTarget + ? m_screenshotTarget.m_obj + : currentDrawable().texture + ; } else { - renderPassDescriptor.colorAttachments[0].texture = ((NULL != m_screenshotTarget) ? - m_screenshotTarget.m_obj : - currentDrawable().texture); + renderPassDescriptor.colorAttachments[0].texture = NULL != m_screenshotTarget + ? m_screenshotTarget.m_obj + : currentDrawable().texture + ; } - renderPassDescriptor.depthAttachment.texture = m_backBufferDepth; + + renderPassDescriptor.depthAttachment.texture = m_backBufferDepth; renderPassDescriptor.stencilAttachment.texture = m_backBufferStencil; } else @@ -1564,25 +1597,39 @@ namespace bgfx { namespace mtl for (uint32_t ii = 0; ii < frameBuffer.m_num; ++ii) { const TextureMtl& texture = m_textures[frameBuffer.m_colorHandle[ii].idx]; - renderPassDescriptor.colorAttachments[ii].texture = texture.m_ptrMSAA ? texture.m_ptrMSAA : texture.m_ptr; - renderPassDescriptor.colorAttachments[ii].resolveTexture = texture.m_ptrMSAA ? texture.m_ptr.m_obj : NULL; + renderPassDescriptor.colorAttachments[ii].texture = texture.m_ptrMSAA + ? texture.m_ptrMSAA + : texture.m_ptr + ; + renderPassDescriptor.colorAttachments[ii].resolveTexture = texture.m_ptrMSAA + ? texture.m_ptr.m_obj + : NULL + ; } if (isValid(frameBuffer.m_depthHandle) ) { const TextureMtl& texture = m_textures[frameBuffer.m_depthHandle.idx]; - renderPassDescriptor.depthAttachment.texture = texture.m_ptrMSAA ? texture.m_ptrMSAA : texture.m_ptr; + renderPassDescriptor.depthAttachment.texture = texture.m_ptrMSAA + ? texture.m_ptrMSAA + : texture.m_ptr + ; renderPassDescriptor.stencilAttachment.texture = texture.m_ptrStencil; - if ( texture.m_textureFormat == TextureFormat::D24S8)//TODO: msaa and stencil iOS8 hack + if (texture.m_textureFormat == TextureFormat::D24S8) { - if ( texture.m_ptr.pixelFormat() == 255 /* Depth24Unorm_Stencil8 */|| - texture.m_ptr.pixelFormat() == 260 /* Depth32Float_Stencil8 */ ) + if (texture.m_ptr.pixelFormat() == 255 /* Depth24Unorm_Stencil8 */ + || texture.m_ptr.pixelFormat() == 260 /* Depth32Float_Stencil8 */) { renderPassDescriptor.stencilAttachment.texture = renderPassDescriptor.depthAttachment.texture; } else - renderPassDescriptor.stencilAttachment.texture = texture.m_ptrMSAA ? texture.m_ptrMSAA : texture.m_ptrStencil; + { + renderPassDescriptor.stencilAttachment.texture = texture.m_ptrMSAA + ? texture.m_ptrMSAA + : texture.m_ptrStencil + ; + } } } } @@ -1677,8 +1724,8 @@ namespace bgfx { namespace mtl m_samplerDescriptor.normalizedCoordinates = TRUE; m_samplerDescriptor.maxAnisotropy = (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) ) ? m_maxAnisotropy : 1; - //NOTE: Comparison function can be specified in shader on all metal hw. - if ( m_macOS11Runtime || [m_device supportsFeatureSet:(MTLFeatureSet)4/*MTLFeatureSet_iOS_GPUFamily3_v1*/]) + if (m_macOS11Runtime + || [m_device supportsFeatureSet:(MTLFeatureSet)4 /*MTLFeatureSet_iOS_GPUFamily3_v1*/]) { const uint32_t cmpFunc = (_flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT; m_samplerDescriptor.compareFunction = 0 == cmpFunc ? MTLCompareFunctionNever : s_cmpFunc[cmpFunc]; @@ -1699,9 +1746,9 @@ namespace bgfx { namespace mtl BlitCommandEncoder getBlitCommandEncoder() { - if ( m_blitCommandEncoder == NULL) + if (m_blitCommandEncoder == NULL) { - if ( m_commandBuffer == NULL ) + if (m_commandBuffer == NULL) { m_commandBuffer = m_cmd.alloc(); } @@ -1802,7 +1849,7 @@ namespace bgfx { namespace mtl RendererContextI* rendererCreate() { s_renderMtl = BX_NEW(g_allocator, RendererContextMtl); - if (!s_renderMtl->init()) + if (!s_renderMtl->init() ) { BX_DELETE(g_allocator, s_renderMtl); s_renderMtl = NULL; @@ -1819,7 +1866,7 @@ namespace bgfx { namespace mtl void writeString(bx::WriterI* _writer, const char* _str) { - bx::write(_writer, _str, (int32_t)bx::strnlen(_str) ); + bx::write(_writer, _str, (int32_t)bx::strLen(_str) ); } void ShaderMtl::create(const Memory* _mem) @@ -1885,6 +1932,7 @@ namespace bgfx { namespace mtl if (NULL != lib) { m_function = lib.newFunctionWithName(SHADER_FUNCTION_NAME); + release(lib); } BGFX_FATAL(NULL != m_function @@ -1909,11 +1957,11 @@ namespace bgfx { namespace mtl bx::memSet(m_attributes, 0xff, sizeof(m_attributes) ); uint32_t used = 0; uint32_t instUsed = 0; - if (NULL != _vsh->m_function.m_obj ) + if (NULL != _vsh->m_function.m_obj) { for (MTLVertexAttribute* attrib in _vsh->m_function.m_obj.vertexAttributes) { - if (attrib.active ) + if (attrib.active) { const char* name = utf8String(attrib.name); uint32_t loc = (uint32_t)attrib.attributeIndex; @@ -1921,7 +1969,7 @@ namespace bgfx { namespace mtl for (uint8_t ii = 0; ii < Attrib::Count; ++ii) { - if (0 == bx::strncmp(s_attribName[ii],name)) + if (0 == bx::strCmp(s_attribName[ii],name) ) { m_attributes[ii] = loc; m_used[used++] = ii; @@ -1931,7 +1979,7 @@ namespace bgfx { namespace mtl for (uint32_t ii = 0; ii < BX_COUNTOF(s_instanceDataName); ++ii) { - if (0 == bx::strncmp(s_instanceDataName[ii],name)) + if (0 == bx::strCmp(s_instanceDataName[ii],name) ) { m_instanceData[instUsed++] = loc; } @@ -1966,6 +2014,8 @@ namespace bgfx { namespace mtl m_fshConstantBufferSize = 0; m_fshConstantBufferAlignmentMask = 0; + m_samplerCount = 0; + m_processedUniforms = false; m_numPredefined = 0; @@ -2019,7 +2069,7 @@ namespace bgfx { namespace mtl FrameBufferMtl& frameBuffer = s_renderMtl->m_frameBuffers[_fbHandle.idx]; murmur.add(frameBuffer.m_pixelFormatHash); } - murmur.add(_declHandle.idx); + murmur.add(s_renderMtl->m_vertexDecls[_declHandle.idx].m_hash); murmur.add(_numInstanceData); uint32_t hash = murmur.end(); @@ -2048,11 +2098,14 @@ namespace bgfx { namespace mtl for (uint32_t ii = 0; ii < frameBuffer.m_num; ++ii) { const TextureMtl& texture = s_renderMtl->m_textures[frameBuffer.m_colorHandle[ii].idx]; - pd.sampleCount = NULL != texture.m_ptrMSAA ? texture.m_ptrMSAA.sampleCount() : 1; + pd.sampleCount = NULL != texture.m_ptrMSAA + ? texture.m_ptrMSAA.sampleCount() + : 1 + ; pd.colorAttachments[ii].pixelFormat = texture.m_ptr.m_obj.pixelFormat; } - if (isValid(frameBuffer.m_depthHandle)) + if (isValid(frameBuffer.m_depthHandle) ) { const TextureMtl& texture = s_renderMtl->m_textures[frameBuffer.m_depthHandle.idx]; pd.depthAttachmentPixelFormat = texture.m_ptr.m_obj.pixelFormat; @@ -2062,8 +2115,10 @@ namespace bgfx { namespace mtl } else { - if ( texture.m_textureFormat == TextureFormat::D24S8) + if (texture.m_textureFormat == TextureFormat::D24S8) + { pd.stencilAttachmentPixelFormat = texture.m_ptr.m_obj.pixelFormat; + } } } } @@ -2123,10 +2178,10 @@ namespace bgfx { namespace mtl } } - pd.vertexFunction = m_vsh->m_function; + pd.vertexFunction = m_vsh->m_function; pd.fragmentFunction = m_fsh->m_function; - if (isValid(_declHandle)) + if (isValid(_declHandle) ) { VertexDescriptor vertexDesc = s_renderMtl->m_vertexDescriptor; reset(vertexDesc); @@ -2165,19 +2220,19 @@ namespace bgfx { namespace mtl BX_TRACE("stride: %d", (int)vertexDesc.layouts[1].stride); - if (_numInstanceData > 0) + if (0 < _numInstanceData) { for (uint32_t ii = 0; UINT16_MAX != m_instanceData[ii]; ++ii) { uint32_t loc = m_instanceData[ii]; - vertexDesc.attributes[loc].format = MTLVertexFormatFloat4; + vertexDesc.attributes[loc].format = MTLVertexFormatFloat4; vertexDesc.attributes[loc].bufferIndex = 2; - vertexDesc.attributes[loc].offset = ii*16; + vertexDesc.attributes[loc].offset = ii*16; } - vertexDesc.layouts[2].stride = _numInstanceData * 16; + vertexDesc.layouts[2].stride = _numInstanceData * 16; vertexDesc.layouts[2].stepFunction = MTLVertexStepFunctionPerInstance; - vertexDesc.layouts[2].stepRate = 1; + vertexDesc.layouts[2].stepRate = 1; } pd.vertexDescriptor = vertexDesc; @@ -2200,13 +2255,13 @@ namespace bgfx { namespace mtl UniformBuffer*& constantBuffer = (shaderType == 0 ? m_vshConstantBuffer : m_fshConstantBuffer); uint8_t fragmentBit = (1 == shaderType ? BGFX_UNIFORM_FRAGMENTBIT : 0); - for (MTLArgument* arg in (shaderType == 0 ? reflection.vertexArguments : reflection.fragmentArguments)) + for (MTLArgument* arg in (shaderType == 0 ? reflection.vertexArguments : reflection.fragmentArguments) ) { BX_TRACE("arg: %s type:%d", utf8String(arg.name), arg.type); if (arg.active) { if (arg.type == MTLArgumentTypeBuffer - && 0 == bx::strncmp(utf8String(arg.name), SHADER_UNIFORM_NAME) ) + && 0 == bx::strCmp(utf8String(arg.name), SHADER_UNIFORM_NAME) ) { BX_CHECK( arg.index == 0, "Uniform buffer must be in the buffer slot 0."); BX_CHECK( MTLDataTypeStruct == arg.bufferDataType, "%s's type must be a struct",SHADER_UNIFORM_NAME ); @@ -2239,15 +2294,10 @@ namespace bgfx { namespace mtl } switch (dataType) { - case MTLDataTypeFloat4 : - num *= 1; - break; - case MTLDataTypeFloat4x4: - num *= 4; - break; - case MTLDataTypeFloat3x3: - num *= 3; - break; + case MTLDataTypeFloat4: num *= 1; break; + case MTLDataTypeFloat4x4: num *= 4; break; + case MTLDataTypeFloat3x3: num *= 3; break; + default: BX_WARN(0, "Unsupported uniform MTLDataType: %d", uniform.dataType); break; @@ -2274,8 +2324,8 @@ namespace bgfx { namespace mtl } UniformType::Enum type = convertMtlType(dataType); - constantBuffer->writeUniformHandle((UniformType::Enum)(type|fragmentBit), uint32_t(uniform.offset), info->m_handle, uint16_t(num) ); - BX_TRACE("store %s %d offset:%d", name, info->m_handle, uint32_t(uniform.offset)); + constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), uint32_t(uniform.offset), info->m_handle, uint16_t(num) ); + BX_TRACE("store %s %d offset:%d", name, info->m_handle, uint32_t(uniform.offset) ); } } @@ -2284,10 +2334,25 @@ namespace bgfx { namespace mtl } else if (arg.type == MTLArgumentTypeTexture) { - if ( shaderType == 0 ) m_usedVertexSamplerStages |= 1<<arg.index; - else m_usedFragmentSamplerStages |= 1<<arg.index; + const char* name = utf8String(arg.name); + const UniformRegInfo* info = s_renderMtl->m_uniformReg.find(name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); - BX_TRACE("texture: %s index:%d", utf8String(arg.name), arg.index); + if (NULL != info) + { + if ( m_samplerCount >= BGFX_CONFIG_MAX_TEXTURE_SAMPLERS) + { + BX_WARN(NULL != info, "Too many samplers in shader(only %d is supported). User defined uniform '%s' won't be set.", BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, name); + } + else + { + m_samplers[m_samplerCount].m_index = uint32_t(arg.index); + m_samplers[m_samplerCount].m_uniform = info->m_handle; + m_samplers[m_samplerCount].m_fragment = fragmentBit ? 1 : 0; + ++m_samplerCount; + BX_TRACE("texture %s %d index:%d", name, info->m_handle, uint32_t(arg.index) ); + } + } } else if (arg.type == MTLArgumentTypeSampler) { @@ -2336,18 +2401,21 @@ namespace bgfx { namespace mtl { BX_UNUSED(_discard); - //TODO: cannot call this more than once per frame - if ( m_dynamic && _discard ) + if (m_dynamic + && _discard) { m_bufferIndex = (m_bufferIndex + 1) % MTL_MAX_FRAMES_IN_FLIGHT; bx::memCopy( (uint8_t*)getBuffer().contents() + _offset, _data, _size); } - else if ( NULL != s_renderMtl->m_renderCommandEncoder ) + else if (NULL != s_renderMtl->m_renderCommandEncoder) { s_renderMtl->m_cmd.release(m_buffers[m_bufferIndex]); - if (_offset == 0 && _size == m_size) + if (_offset == 0 + && _size == m_size) + { m_buffers[m_bufferIndex] = s_renderMtl->m_device.newBufferWithBytes(_data, _size, 0); + } else { const void* oldContent = m_buffers[m_bufferIndex].contents(); @@ -2380,14 +2448,14 @@ namespace bgfx { namespace mtl { m_sampler = s_renderMtl->getSamplerState(_flags); - ImageContainer imageContainer; + bimg::ImageContainer imageContainer; - if (imageParse(imageContainer, _mem->data, _mem->size) ) + if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) { uint8_t numMips = imageContainer.m_numMips; const uint8_t startLod = uint8_t(bx::uint32_min(_skip, numMips-1) ); numMips -= startLod; - const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) ); + const bimg::ImageBlockInfo& blockInfo = getBlockInfo(bimg::TextureFormat::Enum(imageContainer.m_format) ); const uint32_t textureWidth = bx::uint32_max(blockInfo.blockWidth, imageContainer.m_width >>startLod); const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod); const uint16_t numLayers = imageContainer.m_numLayers; @@ -2399,7 +2467,7 @@ namespace bgfx { namespace mtl m_requestedFormat = uint8_t(imageContainer.m_format); m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); const bool convert = m_textureFormat != m_requestedFormat; - const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); TextureDescriptor desc = s_renderMtl->m_textureDescriptor; @@ -2415,8 +2483,6 @@ namespace bgfx { namespace mtl desc.textureType = MTLTextureType2DArray; m_type = Texture2D; } - - desc.arrayLength = numLayers; } else if (imageContainer.m_cubeMap) { @@ -2437,25 +2503,25 @@ namespace bgfx { namespace mtl m_numMips = numMips; const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1); - const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) ); + const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) ); const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE); const bool renderTarget = 0 != (_flags&BGFX_TEXTURE_RT_MASK); - const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB) || imageContainer.m_srgb; + const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB); BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s RT[%c], WO[%c], CW[%c], sRGB[%c]" - , this - s_renderMtl->m_textures - , getName( (TextureFormat::Enum)m_textureFormat) - , getName( (TextureFormat::Enum)m_requestedFormat) - , numLayers - , textureWidth - , textureHeight - , imageContainer.m_cubeMap ? "x6" : "" - , renderTarget ? 'x' : '.' - , writeOnly ? 'x' : '.' - , computeWrite ? 'x' : '.' - , srgb ? 'x' : '.' - ); + , this - s_renderMtl->m_textures + , getName( (TextureFormat::Enum)m_textureFormat) + , getName( (TextureFormat::Enum)m_requestedFormat) + , numLayers + , textureWidth + , textureHeight + , imageContainer.m_cubeMap ? "x6" : "" + , renderTarget ? 'x' : '.' + , writeOnly ? 'x' : '.' + , computeWrite ? 'x' : '.' + , srgb ? 'x' : '.' + ); const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1); int sampleCount = s_msaa[msaaQuality]; @@ -2480,33 +2546,46 @@ namespace bgfx { namespace mtl desc.width = textureWidth; desc.height = textureHeight; desc.depth = bx::uint32_max(1,imageContainer.m_depth); - desc.mipmapLevelCount = imageContainer.m_numMips; + desc.mipmapLevelCount = numMips; desc.sampleCount = 1; + desc.arrayLength = numLayers; if (s_renderMtl->m_iOS9Runtime || s_renderMtl->m_macOS11Runtime) { desc.cpuCacheMode = MTLCPUCacheModeDefaultCache; - desc.storageMode = (MTLStorageMode)(writeOnly||isDepth(TextureFormat::Enum(m_textureFormat)) - ? 2 /*MTLStorageModePrivate*/ - : ((BX_ENABLED(BX_PLATFORM_IOS)) ? 0 /* MTLStorageModeShared */ : 1 /*MTLStorageModeManaged*/) - ); + desc.storageMode = (MTLStorageMode)(false + || writeOnly + || bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) ) + ? 2 /*MTLStorageModePrivate*/ + : (BX_ENABLED(BX_PLATFORM_IOS) + ? 0 /* MTLStorageModeShared */ + : 1 /* MTLStorageModeManaged */ + ) ); desc.usage = MTLTextureUsageShaderRead; if (computeWrite) + { desc.usage |= MTLTextureUsageShaderWrite; + } + if (renderTarget) + { desc.usage |= MTLTextureUsageRenderTarget; + } } m_ptr = s_renderMtl->m_device.newTextureWithDescriptor(desc); - if ( sampleCount > 1) + if (sampleCount > 1) { desc.textureType = MTLTextureType2DMultisample; desc.sampleCount = sampleCount; - if (s_renderMtl->m_iOS9Runtime || s_renderMtl->m_macOS11Runtime) + if (s_renderMtl->m_iOS9Runtime + || s_renderMtl->m_macOS11Runtime) + { desc.storageMode = (MTLStorageMode)( 2 /*MTLStorageModePrivate*/); + } m_ptrMSAA = s_renderMtl->m_device.newTextureWithDescriptor(desc); } @@ -2535,14 +2614,14 @@ namespace bgfx { namespace mtl height = bx::uint32_max(1, height); depth = bx::uint32_max(1, depth); - ImageMip mip; - if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) + bimg::ImageMip mip; + if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { const uint8_t* data = mip.m_data; if (convert) { - imageDecodeToBgra8(temp + bimg::imageDecodeToBgra8(temp , mip.m_data , mip.m_width , mip.m_height @@ -2601,10 +2680,10 @@ namespace bgfx { namespace mtl void TextureMtl::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) { - const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); + const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t rectpitch = _rect.m_width*bpp/8; const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; - const uint32_t slice = ((m_type == Texture3D) ? 0 : _side + _z * (m_type == TextureCube ? 6 : 1)); + const uint32_t slice = ( (m_type == Texture3D) ? 0 : _side + _z * (m_type == TextureCube ? 6 : 1) ); const uint16_t z = (m_type == Texture3D) ? _z : 0 ; const bool convert = m_textureFormat != m_requestedFormat; @@ -2615,23 +2694,23 @@ namespace bgfx { namespace mtl if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - imageDecodeToBgra8(temp + bimg::imageDecodeToBgra8(temp , data , _rect.m_width , _rect.m_height , srcpitch - , TextureFormat::Enum(m_requestedFormat) + , bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; } - if ( NULL != s_renderMtl->m_renderCommandEncoder ) + if (NULL != s_renderMtl->m_renderCommandEncoder) { s_renderMtl->m_cmd.finish(true); MTLRegion region = { - { _rect.m_x, _rect.m_y, z }, + { _rect.m_x, _rect.m_y, z }, { _rect.m_width, _rect.m_height, _depth }, }; @@ -2707,13 +2786,13 @@ namespace bgfx { namespace mtl { const TextureMtl& texture = s_renderMtl->m_textures[handle.idx]; - if ( 0 == m_width ) + if (0 == m_width) { m_width = texture.m_width; m_height = texture.m_height; } - if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) + if (bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) { m_depthHandle = handle; } @@ -2732,18 +2811,18 @@ namespace bgfx { namespace mtl for (uint32_t ii = 0; ii < m_num; ++ii) { const TextureMtl& texture = s_renderMtl->m_textures[m_colorHandle[ii].idx]; - murmur.add((uint32_t)texture.m_ptr.pixelFormat()); + murmur.add( (uint32_t)texture.m_ptr.pixelFormat() ); } - if (!isValid(m_depthHandle)) + if (!isValid(m_depthHandle) ) { - murmur.add((uint32_t)MTLPixelFormatInvalid); - murmur.add((uint32_t)MTLPixelFormatInvalid); + murmur.add( (uint32_t)MTLPixelFormatInvalid); + murmur.add( (uint32_t)MTLPixelFormatInvalid); } else { const TextureMtl& depthTexture = s_renderMtl->m_textures[m_depthHandle.idx]; - murmur.add((uint32_t)depthTexture.m_ptr.pixelFormat()); - murmur.add((uint32_t)(NULL != depthTexture.m_ptrStencil ? depthTexture.m_ptrStencil.pixelFormat() : MTLPixelFormatInvalid)); + murmur.add( (uint32_t)depthTexture.m_ptr.pixelFormat() ); + murmur.add( (uint32_t)(NULL != depthTexture.m_ptrStencil ? depthTexture.m_ptrStencil.pixelFormat() : MTLPixelFormatInvalid) ); } murmur.add(1); //SampleCount @@ -2760,13 +2839,12 @@ namespace bgfx { namespace mtl void FrameBufferMtl::postReset() { BX_WARN(false, "FrameBufferMtl::postReset not yet implemented"); - //TODO: what should we do here? } uint16_t FrameBufferMtl::destroy() { m_num = 0; - m_depthHandle.idx = invalidHandle; + m_depthHandle.idx = kInvalidHandle; uint16_t denseIdx = m_denseIdx; m_denseIdx = UINT16_MAX; @@ -2782,6 +2860,7 @@ namespace bgfx { namespace mtl void CommandQueueMtl::shutdown() { + finish(true); MTL_RELEASE(m_commandQueue); } @@ -2795,34 +2874,42 @@ namespace bgfx { namespace mtl static void commandBufferFinishedCallback(void* _data) { CommandQueueMtl* queue = (CommandQueueMtl*)_data; - if ( queue ) + if (queue) + { queue->m_framesSemaphore.post(); + } } void CommandQueueMtl::kick(bool _endFrame, bool _waitForFinish) { - if ( m_activeCommandBuffer ) + if (m_activeCommandBuffer) { - if ( _endFrame ) + if (_endFrame) { m_releaseWriteIndex = (m_releaseWriteIndex + 1) % MTL_MAX_FRAMES_IN_FLIGHT; m_activeCommandBuffer.addCompletedHandler(commandBufferFinishedCallback, this); } m_activeCommandBuffer.commit(); - if ( _waitForFinish ) + if (_waitForFinish) + { m_activeCommandBuffer.waitUntilCompleted(); + } + MTL_RELEASE(m_activeCommandBuffer); } } void CommandQueueMtl::finish(bool _finishAll) { - if ( _finishAll) + if (_finishAll) { - int count = m_activeCommandBuffer != NULL ? 2 : 3; + uint32_t count = m_activeCommandBuffer != NULL + ? 2 + : 3 + ; - for( int i=0; i< count; ++i) + for (uint32_t ii = 0; ii < count; ++ii) { consume(); } @@ -2864,7 +2951,7 @@ namespace bgfx { namespace mtl static void setTimestamp(void* _data) { - *((int64_t*)_data) = bx::getHPCounter(); + *( (int64_t*)_data) = bx::getHPCounter(); } void TimerQueryMtl::addHandlers(CommandBuffer& _commandBuffer) @@ -2955,12 +3042,96 @@ namespace bgfx { namespace mtl Query& query = m_query[(m_control.m_read + ii) % size]; if (query.m_handle.idx == _handle.idx) { - query.m_handle.idx = bgfx::invalidHandle; + query.m_handle.idx = bgfx::kInvalidHandle; } } } - void RendererContextMtl::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE + void RendererContextMtl::submitBlit(BlitState& _bs, uint16_t _view) + { + if (!_bs.hasItem(_view)) + return; + + if (0 != m_renderCommandEncoder) + { + m_renderCommandEncoder.endEncoding(); + m_renderCommandEncoder = 0; + } + + m_blitCommandEncoder = getBlitCommandEncoder(); + + while (_bs.hasItem(_view) ) + { + const BlitItem& blit = _bs.advance(); + + const TextureMtl& src = m_textures[blit.m_src.idx]; + const TextureMtl& dst = m_textures[blit.m_dst.idx]; + + uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; + uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; + uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; + uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; + uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; + uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; + uint32_t width = bx::uint32_min(srcWidth, dstWidth); + uint32_t height = bx::uint32_min(srcHeight, dstHeight); + uint32_t depth = bx::uint32_min(srcDepth, dstDepth); +#if BX_PLATFORM_OSX + bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK); +#endif // BX_PLATFORM_OSX + + if (MTLTextureType3D == src.m_ptr.textureType() ) + { + m_blitCommandEncoder.copyFromTexture( + src.m_ptr + , 0 + , 0 + , MTLOriginMake(blit.m_srcX, blit.m_srcY, blit.m_srcZ) + , MTLSizeMake(width, height, bx::uint32_imax(depth, 1) ) + , dst.m_ptr + , 0 + , 0 + , MTLOriginMake(blit.m_dstX, blit.m_dstY, blit.m_dstZ) + ); +#if BX_PLATFORM_OSX + if (m_macOS11Runtime + && readBack) + { + m_blitCommandEncoder.synchronizeResource(dst.m_ptr); + } +#endif // BX_PLATFORM_OSX + } + else + { + m_blitCommandEncoder.copyFromTexture( + src.m_ptr + , blit.m_srcZ + , blit.m_srcMip + , MTLOriginMake(blit.m_srcX, blit.m_srcY, 0) + , MTLSizeMake(width, height, 1) + , dst.m_ptr + , blit.m_dstZ + , blit.m_dstMip + , MTLOriginMake(blit.m_dstX, blit.m_dstY, 0) + ); +#if BX_PLATFORM_OSX + if (m_macOS11Runtime + && readBack) + { + m_blitCommandEncoder.synchronizeTexture(dst.m_ptr, 0, blit.m_dstMip); + } +#endif // BX_PLATFORM_OSX + } + } + + if (0 != m_blitCommandEncoder) + { + m_blitCommandEncoder.endEncoding(); + m_blitCommandEncoder = 0; + } + } + + void RendererContextMtl::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) { m_cmd.finish(false); @@ -2969,7 +3140,7 @@ namespace bgfx { namespace mtl m_commandBuffer = m_cmd.alloc(); } - int64_t elapsed = -bx::getHPCounter(); + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; m_gpuTimer.addHandlers(m_commandBuffer); @@ -3004,14 +3175,20 @@ namespace bgfx { namespace mtl m_textureDescriptor.mipmapLevelCount = 1; m_textureDescriptor.sampleCount = 1; m_textureDescriptor.arrayLength = 1; - if ( m_iOS9Runtime || m_macOS11Runtime ) + + if (m_iOS9Runtime + || m_macOS11Runtime) { m_textureDescriptor.cpuCacheMode = MTLCPUCacheModeDefaultCache; - m_textureDescriptor.storageMode = (MTLStorageMode)(BX_ENABLED(BX_PLATFORM_IOS) - ? 0 /* MTLStorageModeShared */ - : 1 /*MTLStorageModeManaged*/ - ); - m_textureDescriptor.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead; + m_textureDescriptor.storageMode = BX_ENABLED(BX_PLATFORM_IOS) + ? (MTLStorageMode)0 // MTLStorageModeShared + : (MTLStorageMode)1 // MTLStorageModeManaged + ; + + m_textureDescriptor.usage = 0 + | MTLTextureUsageRenderTarget + | MTLTextureUsageShaderRead + ; } m_screenshotTarget = m_device.newTextureWithDescriptor(m_textureDescriptor); @@ -3048,6 +3225,9 @@ namespace bgfx { namespace mtl currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); + RenderBind currentBind; + currentBind.clear(); + _render->m_hmdInitialized = false; const bool hmdEnabled = false; @@ -3057,15 +3237,12 @@ namespace bgfx { namespace mtl bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); - uint16_t programIdx = invalidHandle; + uint16_t programIdx = kInvalidHandle; SortKey key; uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; - BlitKey blitKey; - blitKey.decode(_render->m_blitKeys[0]); - uint16_t numBlitItems = _render->m_numBlitItems; - uint16_t blitItem = 0; + BlitState bs(_render); const uint64_t primType = 0; uint8_t primIndex = uint8_t(primType>>BGFX_STATE_PT_SHIFT); @@ -3093,9 +3270,9 @@ namespace bgfx { namespace mtl bool viewRestart = false; uint8_t eye = 0; uint8_t restartState = 0; - viewState.m_rect = _render->m_rect[0]; + viewState.m_rect = _render->m_view[0].m_rect; - int32_t numItems = _render->m_num; + int32_t numItems = _render->m_numRenderItems; for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;) { const uint64_t encodedKey = _render->m_sortKeys[item]; @@ -3106,7 +3283,10 @@ namespace bgfx { namespace mtl || key.m_view != view || item == numItems ; - const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ]; + + const uint32_t itemIdx = _render->m_sortValues[item]; + const RenderItem& renderItem = _render->m_renderItem[itemIdx]; + const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; ++item; if (viewChanged) @@ -3121,9 +3301,9 @@ namespace bgfx { namespace mtl } view = key.m_view; - programIdx = invalidHandle; + programIdx = kInvalidHandle; - viewRestart = ( (BGFX_VIEW_STEREO == (_render->m_viewFlags[view] & BGFX_VIEW_STEREO) ) ); + viewRestart = BGFX_VIEW_STEREO == (_render->m_view[view].m_flags & BGFX_VIEW_STEREO); viewRestart &= hmdEnabled; if (viewRestart) @@ -3142,7 +3322,7 @@ namespace bgfx { namespace mtl eye = 0; } - viewState.m_rect = _render->m_rect[view]; + viewState.m_rect = _render->m_view[view].m_rect; if (viewRestart) { @@ -3150,72 +3330,18 @@ namespace bgfx { namespace mtl viewState.m_rect.m_width /= 2; } - const uint8_t blitView = SortKey::decodeView(encodedKey); - for (; blitItem < numBlitItems && blitKey.m_view <= blitView; blitItem++) - { - if (0 != m_renderCommandEncoder) - { - m_renderCommandEncoder.endEncoding(); - m_renderCommandEncoder = 0; - } - m_blitCommandEncoder = getBlitCommandEncoder(); - - const BlitItem& blit = _render->m_blitItem[blitItem]; - blitKey.decode(_render->m_blitKeys[blitItem+1]); - - const TextureMtl& src = m_textures[blit.m_src.idx]; - const TextureMtl& dst = m_textures[blit.m_dst.idx]; - - uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; - uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; - uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; - uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; - uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; - uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; - uint32_t width = bx::uint32_min(srcWidth, dstWidth); - uint32_t height = bx::uint32_min(srcHeight, dstHeight); - uint32_t depth = bx::uint32_min(srcDepth, dstDepth); -#if BX_PLATFORM_OSX - bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK); -#endif // BX_PLATFORM_OSX - - if ( MTLTextureType3D == src.m_ptr.textureType()) - { - m_blitCommandEncoder.copyFromTexture(src.m_ptr, 0, 0, MTLOriginMake(blit.m_srcX, blit.m_srcY, blit.m_srcZ), MTLSizeMake(width, height, bx::uint32_imax(depth, 1)), - dst.m_ptr, 0, 0, MTLOriginMake(blit.m_dstX, blit.m_dstY, blit.m_dstZ)); -#if BX_PLATFORM_OSX - if (m_macOS11Runtime &&readBack) { - m_blitCommandEncoder.synchronizeResource(dst.m_ptr); - } -#endif // BX_PLATFORM_OSX - } - else - { - m_blitCommandEncoder.copyFromTexture(src.m_ptr, blit.m_srcZ, blit.m_srcMip, MTLOriginMake(blit.m_srcX, blit.m_srcY, 0), MTLSizeMake(width, height, 1), - dst.m_ptr, blit.m_dstZ, blit.m_dstMip, MTLOriginMake(blit.m_dstX, blit.m_dstY, 0)); -#if BX_PLATFORM_OSX - if (m_macOS11Runtime && readBack) { - m_blitCommandEncoder.synchronizeTexture(dst.m_ptr, 0, blit.m_dstMip); - } -#endif // BX_PLATFORM_OSX - } - } + submitBlit(bs, view); - if (0 != m_blitCommandEncoder) - { - m_blitCommandEncoder.endEncoding(); - m_blitCommandEncoder = 0; - } - - const Rect& scissorRect = _render->m_scissor[view]; + const Rect& scissorRect = _render->m_view[view].m_scissor; viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; - Clear& clr = _render->m_clear[view]; + Clear& clr = _render->m_view[view].m_clear; Rect viewRect = viewState.m_rect; bool clearWithRenderPass = false; - if ( NULL == m_renderCommandEncoder || fbh.idx != _render->m_fb[view].idx ) + if (NULL == m_renderCommandEncoder + || fbh.idx != _render->m_view[view].m_fbh.idx) { if (0 != m_renderCommandEncoder) { @@ -3225,15 +3351,15 @@ namespace bgfx { namespace mtl RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor(); renderPassDescriptor.visibilityResultBuffer = m_occlusionQuery.m_buffer; - fbh = _render->m_fb[view]; + fbh = _render->m_view[view].m_fbh; uint32_t width = m_resolution.m_width; uint32_t height = m_resolution.m_height; - if ( isValid(fbh) ) + if (isValid(fbh) ) { FrameBufferMtl& frameBuffer = m_frameBuffers[fbh.idx]; - width = frameBuffer.m_width; + width = frameBuffer.m_width; height = frameBuffer.m_height; } @@ -3245,14 +3371,13 @@ namespace bgfx { namespace mtl setFrameBuffer(renderPassDescriptor, fbh); - if ( clearWithRenderPass ) + if (clearWithRenderPass) { - - for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) + for (uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) { MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii]; - if ( desc.texture != NULL) + if (desc.texture != NULL) { if (0 != (BGFX_CLEAR_COLOR & clr.m_flags) ) { @@ -3285,16 +3410,18 @@ namespace bgfx { namespace mtl } } - //TODO: optimize store actions use discard flag RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment; if (NULL != depthAttachment.texture) { depthAttachment.clearDepth = clr.m_depth; depthAttachment.loadAction = 0 != (BGFX_CLEAR_DEPTH & clr.m_flags) - ? MTLLoadActionClear - : MTLLoadActionLoad - ; - depthAttachment.storeAction = NULL != m_backBufferColorMSAA ? MTLStoreActionDontCare : MTLStoreActionStore; + ? MTLLoadActionClear + : MTLLoadActionLoad + ; + depthAttachment.storeAction = NULL != m_backBufferColorMSAA + ? MTLStoreActionDontCare + : MTLStoreActionStore + ; } RenderPassStencilAttachmentDescriptor stencilAttachment = renderPassDescriptor.stencilAttachment; @@ -3302,22 +3429,26 @@ namespace bgfx { namespace mtl { stencilAttachment.clearStencil = clr.m_stencil; stencilAttachment.loadAction = 0 != (BGFX_CLEAR_STENCIL & clr.m_flags) - ? MTLLoadActionClear - : MTLLoadActionLoad - ; - stencilAttachment.storeAction = NULL != m_backBufferColorMSAA ? MTLStoreActionDontCare : MTLStoreActionStore; + ? MTLLoadActionClear + : MTLLoadActionLoad + ; + stencilAttachment.storeAction = NULL != m_backBufferColorMSAA + ? MTLStoreActionDontCare + : MTLStoreActionStore + ; } } else { - for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) + for (uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) { MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii]; - if ( desc.texture != NULL) + if (desc.texture != NULL) + { desc.loadAction = MTLLoadActionLoad; + } } - //TODO: optimize store actions use discard flag RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment; if (NULL != depthAttachment.texture) { @@ -3373,7 +3504,7 @@ namespace bgfx { namespace mtl { wasCompute = false; - programIdx = invalidHandle; + programIdx = kInvalidHandle; currentProgram = NULL; //invalidateCompute(); @@ -3406,8 +3537,10 @@ namespace bgfx { namespace mtl currentState.m_stateFlags = newFlags; currentState.m_stencil = newStencil; - programIdx = invalidHandle; - setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT)); + currentBind.clear(); + + programIdx = kInvalidHandle; + setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) ); const uint64_t pt = newFlags&BGFX_STATE_PT_MASK; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); @@ -3444,7 +3577,8 @@ namespace bgfx { namespace mtl else { Rect scissorRect; - scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]); + scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); + if (scissorRect.isZeroArea() ) { continue; @@ -3506,8 +3640,8 @@ namespace bgfx { namespace mtl } bool programChanged = false; - bool constantsChanged = draw.m_constBegin < draw.m_constEnd; - rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); + bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; + rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); if (key.m_program != programIdx || (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE|BGFX_STATE_BLEND_INDEPENDENT|BGFX_STATE_MSAA|BGFX_STATE_BLEND_ALPHA_TO_COVERAGE) & changedFlags @@ -3522,7 +3656,7 @@ namespace bgfx { namespace mtl currentState.m_stream[0].m_decl = draw.m_stream[0].m_decl; currentState.m_instanceDataStride = draw.m_instanceDataStride; - if (invalidHandle == programIdx) + if (kInvalidHandle == programIdx) { currentProgram = NULL; continue; @@ -3547,7 +3681,7 @@ namespace bgfx { namespace mtl if (NULL == pipelineState) { currentProgram = NULL; - programIdx = invalidHandle; + programIdx = kInvalidHandle; continue; } @@ -3558,7 +3692,7 @@ namespace bgfx { namespace mtl constantsChanged = true; } - if (invalidHandle != programIdx) + if (kInvalidHandle != programIdx) { ProgramMtl& program = m_program[programIdx]; @@ -3599,35 +3733,36 @@ namespace bgfx { namespace mtl m_uniformBufferVertexOffset = m_uniformBufferFragmentOffset; } + if (kInvalidHandle != programIdx) { - uint32_t usedVertexSamplerStages = 0; - uint32_t usedFragmentSamplerStages = 0; + ProgramMtl& program = m_program[programIdx]; - if (invalidHandle != programIdx) + for (uint32_t sampler = 0; sampler < program.m_samplerCount; ++sampler) { - ProgramMtl& program = m_program[programIdx]; - usedVertexSamplerStages = program.m_usedVertexSamplerStages; - usedFragmentSamplerStages = program.m_usedFragmentSamplerStages; - } + ProgramMtl::SamplerInfo& samplerInfo = program.m_samplers[sampler]; - for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) - { - const Binding& sampler = draw.m_bind[stage]; - Binding& current = currentState.m_bind[stage]; - if (current.m_idx != sampler.m_idx - || current.m_un.m_draw.m_textureFlags != sampler.m_un.m_draw.m_textureFlags + UniformHandle handle = samplerInfo.m_uniform; + int stage = *((int*)m_uniforms[handle.idx]); + + const Binding& bind = renderBind.m_bind[stage]; + Binding& current = currentBind.m_bind[stage]; + + if (current.m_idx != bind.m_idx + || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags || programChanged) { - if (invalidHandle != sampler.m_idx) + if (kInvalidHandle != bind.m_idx) { - TextureMtl& texture = m_textures[sampler.m_idx]; - texture.commit(stage, (usedVertexSamplerStages&(1<<stage))!=0, - (usedFragmentSamplerStages&(1<<stage))!=0, - sampler.m_un.m_draw.m_textureFlags); + TextureMtl& texture = m_textures[bind.m_idx]; + texture.commit(samplerInfo.m_index + , !samplerInfo.m_fragment + , samplerInfo.m_fragment + , bind.m_un.m_draw.m_textureFlags + ); } } - current = sampler; + current = bind; } } @@ -3644,7 +3779,7 @@ namespace bgfx { namespace mtl currentState.m_instanceDataOffset = draw.m_instanceDataOffset; uint16_t handle = draw.m_stream[0].m_handle.idx; - if (invalidHandle != handle) + if (kInvalidHandle != handle) { const VertexBufferMtl& vb = m_vertexBuffers[handle]; @@ -3743,33 +3878,27 @@ namespace bgfx { namespace mtl //invalidateCompute(); } - if (0 < _render->m_num) + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); + + if (0 < _render->m_numRenderItems) { captureElapsed = -bx::getHPCounter(); capture(); - rce = m_renderCommandEncoder; //TODO: ugly, can create new encoder + rce = m_renderCommandEncoder; captureElapsed += bx::getHPCounter(); } } if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) ) { - if (0 < _render->m_num) + if (0 < _render->m_numRenderItems) { rce.popDebugGroup(); } } - int64_t now = bx::getHPCounter(); - elapsed += now; - - static int64_t last = now; - - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = last; - - int64_t frameTime = now - last; - last = now; + int64_t timeEnd = bx::getHPCounter(); + int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; @@ -3792,7 +3921,9 @@ namespace bgfx { namespace mtl const int64_t timerFreq = bx::getHPFrequency(); - perfStats.cpuTimeEnd = now; + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeEnd; perfStats.cpuTimerFreq = timerFreq; perfStats.gpuTimeBegin = m_gpuTimer.m_begin; perfStats.gpuTimeEnd = m_gpuTimer.m_end; @@ -3800,6 +3931,8 @@ namespace bgfx { namespace mtl perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; perfStats.maxGpuLatency = maxGpuLatency; + perfStats.gpuMemoryMax = -INT64_MAX; + perfStats.gpuMemoryUsed = -INT64_MAX; rce.setTriangleFillMode(MTLTriangleFillModeFill); if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) @@ -3808,13 +3941,13 @@ namespace bgfx { namespace mtl TextVideoMem& tvm = m_textVideoMem; - static int64_t next = now; + static int64_t next = timeEnd; - if (now >= next) + if (timeEnd >= next) { - next = now + bx::getHPFrequency(); + next = timeEnd + timerFreq; - double freq = double(bx::getHPFrequency() ); + double freq = double(timerFreq); double toMs = 1000.0/freq; tvm.clear(); @@ -3839,9 +3972,9 @@ namespace bgfx { namespace mtl , !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' ' ); - double elapsedCpuMs = double(elapsed)*toMs; + double elapsedCpuMs = double(frameTime)*toMs; tvm.printf(10, pos++, 0x8e, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms] %c GPU %3.4f [ms] (latency %d)" - , _render->m_num + , _render->m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs @@ -3863,7 +3996,7 @@ namespace bgfx { namespace mtl } tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); - tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); +// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); @@ -3882,7 +4015,7 @@ namespace bgfx { namespace mtl } blit(this, _textVideoMemBlitter, tvm); - rce = m_renderCommandEncoder; //TODO: ugly, blit can create encoder + rce = m_renderCommandEncoder; rce.popDebugGroup(); } @@ -3891,17 +4024,16 @@ namespace bgfx { namespace mtl rce.pushDebugGroup("debugtext"); blit(this, _textVideoMemBlitter, _render->m_textVideoMem); - rce = m_renderCommandEncoder; //TODO: ugly, blit can create encoder + rce = m_renderCommandEncoder; rce.popDebugGroup(); } rce.endEncoding(); m_renderCommandEncoder = 0; - m_renderCommandEncoderFrameBufferHandle.idx = invalidHandle; + m_renderCommandEncoderFrameBufferHandle.idx = kInvalidHandle; - - if ( m_screenshotTarget ) + if (m_screenshotTarget) { RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor(); renderPassDescriptor.colorAttachments[0].texture = currentDrawable().texture; @@ -3919,7 +4051,7 @@ namespace bgfx { namespace mtl rce.drawPrimitives(MTLPrimitiveTypeTriangle, 0, 3, 1); rce.endEncoding(); - } + } } } /* namespace mtl */ } // namespace bgfx diff --git a/3rdparty/bgfx/src/renderer_noop.cpp b/3rdparty/bgfx/src/renderer_noop.cpp index 24fbfb4859d..02debefedc3 100644 --- a/3rdparty/bgfx/src/renderer_noop.cpp +++ b/3rdparty/bgfx/src/renderer_noop.cpp @@ -5,36 +5,38 @@ #include "bgfx_p.h" -#if BGFX_CONFIG_RENDERER_NOOP - namespace bgfx { namespace noop { struct RendererContextNOOP : public RendererContextI { RendererContextNOOP() { - // Pretend all features that are not returning results to CPU - // are available. + // Pretend all features are available. g_caps.supported = 0 - | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL - | BGFX_CAPS_TEXTURE_COMPARE_ALL - | BGFX_CAPS_TEXTURE_3D - | BGFX_CAPS_VERTEX_ATTRIB_HALF - | BGFX_CAPS_VERTEX_ATTRIB_UINT10 - | BGFX_CAPS_INSTANCING - | BGFX_CAPS_FRAGMENT_DEPTH + | BGFX_CAPS_ALPHA_TO_COVERAGE | BGFX_CAPS_BLEND_INDEPENDENT | BGFX_CAPS_COMPUTE - | BGFX_CAPS_FRAGMENT_ORDERING - | BGFX_CAPS_SWAP_CHAIN - | BGFX_CAPS_INDEX32 + | BGFX_CAPS_CONSERVATIVE_RASTER | BGFX_CAPS_DRAW_INDIRECT + | BGFX_CAPS_FRAGMENT_DEPTH + | BGFX_CAPS_FRAGMENT_ORDERING + | BGFX_CAPS_GRAPHICS_DEBUGGER | BGFX_CAPS_HIDPI - | BGFX_CAPS_TEXTURE_BLIT - | BGFX_CAPS_ALPHA_TO_COVERAGE - | BGFX_CAPS_CONSERVATIVE_RASTER + | BGFX_CAPS_HMD + | BGFX_CAPS_INDEX32 + | BGFX_CAPS_INSTANCING + | BGFX_CAPS_OCCLUSION_QUERY + | BGFX_CAPS_RENDERER_MULTITHREADED + | BGFX_CAPS_SWAP_CHAIN | BGFX_CAPS_TEXTURE_2D_ARRAY + | BGFX_CAPS_TEXTURE_3D + | BGFX_CAPS_TEXTURE_BLIT + | BGFX_CAPS_TEXTURE_COMPARE_ALL + | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL | BGFX_CAPS_TEXTURE_CUBE_ARRAY + | BGFX_CAPS_TEXTURE_READ_BACK + | BGFX_CAPS_VERTEX_ATTRIB_HALF + | BGFX_CAPS_VERTEX_ATTRIB_UINT10 ; } @@ -42,170 +44,179 @@ namespace bgfx { namespace noop { } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { return RendererType::Noop; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { return BGFX_RENDERER_NOOP_NAME; } - void flip(HMD& /*_hmd*/) BX_OVERRIDE + bool isDeviceRemoved() override + { + return false; + } + + void flip(HMD& /*_hmd*/) override { } - void createIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/, uint16_t /*_flags*/) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/, uint16_t /*_flags*/) override { } - void destroyIndexBuffer(IndexBufferHandle /*_handle*/) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle /*_handle*/) override { } - void createVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) override { } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint16_t /*_flags*/) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint16_t /*_flags*/) override { } - void destroyVertexBuffer(VertexBufferHandle /*_handle*/) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle /*_handle*/) override { } - void createDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/, uint16_t /*_flags*/) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/, uint16_t /*_flags*/) override { } - void updateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) override { } - void destroyDynamicIndexBuffer(IndexBufferHandle /*_handle*/) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle /*_handle*/) override { } - void createDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/, uint16_t /*_flags*/) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/, uint16_t /*_flags*/) override { } - void updateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) override { } - void destroyDynamicVertexBuffer(VertexBufferHandle /*_handle*/) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle /*_handle*/) override { } - void createShader(ShaderHandle /*_handle*/, Memory* /*_mem*/) BX_OVERRIDE + void createShader(ShaderHandle /*_handle*/, Memory* /*_mem*/) override { } - void destroyShader(ShaderHandle /*_handle*/) BX_OVERRIDE + void destroyShader(ShaderHandle /*_handle*/) override { } - void createProgram(ProgramHandle /*_handle*/, ShaderHandle /*_vsh*/, ShaderHandle /*_fsh*/) BX_OVERRIDE + void createProgram(ProgramHandle /*_handle*/, ShaderHandle /*_vsh*/, ShaderHandle /*_fsh*/) override { } - void destroyProgram(ProgramHandle /*_handle*/) BX_OVERRIDE + void destroyProgram(ProgramHandle /*_handle*/) override { } - void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) BX_OVERRIDE + void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) override { } - void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE + void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override { } - void updateTexture(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/, const Rect& /*_rect*/, uint16_t /*_z*/, uint16_t /*_depth*/, uint16_t /*_pitch*/, const Memory* /*_mem*/) BX_OVERRIDE + void updateTexture(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/, const Rect& /*_rect*/, uint16_t /*_z*/, uint16_t /*_depth*/, uint16_t /*_pitch*/, const Memory* /*_mem*/) override { } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { } - void readTexture(TextureHandle /*_handle*/, void* /*_data*/, uint8_t /*_mip*/) BX_OVERRIDE + void readTexture(TextureHandle /*_handle*/, void* /*_data*/, uint8_t /*_mip*/) override { } - void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) BX_OVERRIDE + void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) override { } - void overrideInternal(TextureHandle /*_handle*/, uintptr_t /*_ptr*/) BX_OVERRIDE + void overrideInternal(TextureHandle /*_handle*/, uintptr_t /*_ptr*/) override { } - uintptr_t getInternal(TextureHandle /*_handle*/) BX_OVERRIDE + uintptr_t getInternal(TextureHandle /*_handle*/) override { return 0; } - void destroyTexture(TextureHandle /*_handle*/) BX_OVERRIDE + void destroyTexture(TextureHandle /*_handle*/) override + { + } + + void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const Attachment* /*_attachment*/) override { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const Attachment* /*_attachment*/) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) override { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle /*_handle*/) override { } - void destroyFrameBuffer(FrameBufferHandle /*_handle*/) BX_OVERRIDE + void createUniform(UniformHandle /*_handle*/, UniformType::Enum /*_type*/, uint16_t /*_num*/, const char* /*_name*/) override { } - void createUniform(UniformHandle /*_handle*/, UniformType::Enum /*_type*/, uint16_t /*_num*/, const char* /*_name*/) BX_OVERRIDE + void destroyUniform(UniformHandle /*_handle*/) override { } - void destroyUniform(UniformHandle /*_handle*/) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) override { } - void requestScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) BX_OVERRIDE + void updateViewName(ViewId /*_id*/, const char* /*_name*/) override { } - void updateViewName(uint8_t /*_id*/, const char* /*_name*/) BX_OVERRIDE + void updateUniform(uint16_t /*_loc*/, const void* /*_data*/, uint32_t /*_size*/) override { } - void updateUniform(uint16_t /*_loc*/, const void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE + void setMarker(const char* /*_marker*/, uint32_t /*_size*/) override { } - void setMarker(const char* /*_marker*/, uint32_t /*_size*/) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle /*_handle*/) override { } - void invalidateOcclusionQuery(OcclusionQueryHandle /*_handle*/) BX_OVERRIDE + virtual void setName(Handle /*_handle*/, const char* /*_name*/) override { } - void submit(Frame* /*_render*/, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& /*_textVideoMemBlitter*/) BX_OVERRIDE + void submit(Frame* /*_render*/, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& /*_textVideoMemBlitter*/) override { } - void blitSetup(TextVideoMemBlitter& /*_blitter*/) BX_OVERRIDE + void blitSetup(TextVideoMemBlitter& /*_blitter*/) override { } - void blitRender(TextVideoMemBlitter& /*_blitter*/, uint32_t /*_numIndices*/) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& /*_blitter*/, uint32_t /*_numIndices*/) override { } }; @@ -224,19 +235,3 @@ namespace bgfx { namespace noop s_renderNOOP = NULL; } } /* namespace noop */ } // namespace bgfx - -#else - -namespace bgfx { namespace noop -{ - RendererContextI* rendererCreate() - { - return NULL; - } - - void rendererDestroy() - { - } -} /* namespace noop */ } // namespace bgfx - -#endif // BGFX_CONFIG_RENDERER_NOOP diff --git a/3rdparty/bgfx/src/renderer_vk.cpp b/3rdparty/bgfx/src/renderer_vk.cpp index 8e2f66c513f..5468aebc6a7 100644 --- a/3rdparty/bgfx/src/renderer_vk.cpp +++ b/3rdparty/bgfx/src/renderer_vk.cpp @@ -209,7 +209,7 @@ VK_IMPORT_DEVICE { VK_FORMAT_B4G4R4A4_UNORM_PACK16, VK_FORMAT_B4G4R4A4_UNORM_PACK16, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // RGBA4 { VK_FORMAT_B5G5R5A1_UNORM_PACK16, VK_FORMAT_B5G5R5A1_UNORM_PACK16, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // RGB5A1 { VK_FORMAT_A2R10G10B10_UNORM_PACK32, VK_FORMAT_A2R10G10B10_UNORM_PACK32, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // RGB10A2 - { VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // R11G11B10F + { VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // RG11B10F { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // UnknownDepth { VK_FORMAT_UNDEFINED, VK_FORMAT_R16_UNORM, VK_FORMAT_D16_UNORM, VK_FORMAT_UNDEFINED }, // D16 { VK_FORMAT_UNDEFINED, VK_FORMAT_X8_D24_UNORM_PACK32, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_UNDEFINED }, // D24 @@ -332,7 +332,7 @@ VK_IMPORT_DEVICE return; } - bx::alignedFree(g_allocator, _memory, BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT); + bx::alignedFree(g_allocator, _memory, 8); } static void VKAPI_PTR internalAllocationNotification(void* _userData, size_t _size, VkInternalAllocationType _allocationType, VkSystemAllocationScope _allocationScope) @@ -725,7 +725,7 @@ VK_IMPORT_DEVICE ErrorState::Enum errorState = ErrorState::Default; - m_fbh.idx = invalidHandle; + m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); @@ -747,7 +747,7 @@ VK_IMPORT_DEVICE if (NULL == m_vulkan1dll) { - BX_TRACE("Failed to load vulkan dynamic library."); + BX_TRACE("Init error: Failed to load vulkan dynamic library."); goto error; } @@ -763,7 +763,7 @@ VK_IMPORT if (!imported) { - BX_TRACE("Failed to load shared library functions."); + BX_TRACE("Init error: Failed to load shared library functions."); goto error; } @@ -831,7 +831,7 @@ VK_IMPORT if (VK_SUCCESS != result) { - BX_TRACE("vkCreateInstance failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateInstance failed %d: %s.", result, getName(result) ); goto error; } @@ -847,7 +847,7 @@ VK_IMPORT_INSTANCE if (!imported) { - BX_TRACE("Failed to load instance functions."); + BX_TRACE("Init error: Failed to load instance functions."); goto error; } @@ -882,7 +882,7 @@ VK_IMPORT_INSTANCE if (VK_SUCCESS != result) { - BX_TRACE("vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) ); goto error; } @@ -895,7 +895,7 @@ VK_IMPORT_INSTANCE if (VK_SUCCESS != result) { - BX_TRACE("vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) ); goto error; } @@ -961,6 +961,8 @@ VK_IMPORT_INSTANCE g_caps.vendorId = uint16_t(m_deviceProperties.vendorID); g_caps.deviceId = uint16_t(m_deviceProperties.deviceID); + g_caps.limits.maxTextureSize = m_deviceProperties.limits.maxImageDimension2D; + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_deviceProperties.limits.maxFragmentOutputAttachments, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); { // VkFormatProperties fp; @@ -986,7 +988,7 @@ VK_IMPORT_INSTANCE { uint8_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE; - const bool depth = isDepth(TextureFormat::Enum(ii) ); + const bool depth = bimg::isDepth(bimg::TextureFormat::Enum(ii) ); VkFormat fmt = depth ? s_textureFormat[ii].m_fmtDsv : s_textureFormat[ii].m_fmt @@ -1086,7 +1088,7 @@ VK_IMPORT_INSTANCE if (UINT32_MAX == m_qfiGraphics) { - BX_TRACE("Unable to find graphics queue."); + BX_TRACE("Init error: Unable to find graphics queue."); goto error; } } @@ -1145,7 +1147,7 @@ VK_IMPORT_INSTANCE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateDevice failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateDevice failed %d: %s.", result, getName(result) ); goto error; } } @@ -1162,7 +1164,7 @@ VK_IMPORT_DEVICE if (!imported) { - BX_TRACE("Failed to load device functions."); + BX_TRACE("Init error: Failed to load device functions."); goto error; } @@ -1171,7 +1173,7 @@ VK_IMPORT_DEVICE m_backBufferDepthStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT - // VK_FORMAT_D24_UNORM_S8_UINT +// VK_FORMAT_D24_UNORM_S8_UINT ; { @@ -1236,7 +1238,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateRenderPass failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateRenderPass failed %d: %s.", result, getName(result) ); goto error; } } @@ -1296,7 +1298,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateSurfaceKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateSurfaceKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1308,7 +1310,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkGetPhysicalDeviceSurfaceSupportKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkGetPhysicalDeviceSurfaceSupportKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1317,7 +1319,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1326,7 +1328,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1341,7 +1343,7 @@ VK_IMPORT_DEVICE result = vkGetPhysicalDeviceSurfacePresentModesKHR(m_physicalDevice, m_surface, &numPresentModes, NULL); if (VK_SUCCESS != result) { - BX_TRACE("vkGetPhysicalDeviceSurfacePresentModesKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkGetPhysicalDeviceSurfacePresentModesKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1375,7 +1377,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateSwapchainKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateSwapchainKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1384,13 +1386,13 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) ); goto error; } if (numSwapchainImages < m_sci.minImageCount) { - BX_TRACE("vkGetSwapchainImagesKHR: numSwapchainImages %d, minImageCount %d." + BX_TRACE("Init error: vkGetSwapchainImagesKHR: numSwapchainImages %d, minImageCount %d." , numSwapchainImages , m_sci.minImageCount ); @@ -1402,7 +1404,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) ); goto error; } @@ -1437,7 +1439,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateImage failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateImage failed %d: %s.", result, getName(result) ); goto error; } @@ -1459,7 +1461,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkAllocateMemory failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkAllocateMemory failed %d: %s.", result, getName(result) ); goto error; } @@ -1467,7 +1469,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkBindImageMemory failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkBindImageMemory failed %d: %s.", result, getName(result) ); goto error; } @@ -1494,7 +1496,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateImageView failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateImageView failed %d: %s.", result, getName(result) ); goto error; } @@ -1542,7 +1544,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateImageView failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateImageView failed %d: %s.", result, getName(result) ); goto error; } @@ -1551,7 +1553,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateFramebuffer failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateFramebuffer failed %d: %s.", result, getName(result) ); goto error; } @@ -1559,7 +1561,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateSemaphore failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateSemaphore failed %d: %s.", result, getName(result) ); goto error; } @@ -1578,7 +1580,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateFence failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateFence failed %d: %s.", result, getName(result) ); goto error; } @@ -1592,7 +1594,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { vkDestroy(m_fence); - BX_TRACE("vkCreateCommandPool failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateCommandPool failed %d: %s.", result, getName(result) ); goto error; } @@ -1609,7 +1611,7 @@ VK_IMPORT_DEVICE { vkDestroy(m_commandPool); vkDestroy(m_fence); - BX_TRACE("vkAllocateCommandBuffers failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkAllocateCommandBuffers failed %d: %s.", result, getName(result) ); goto error; } @@ -1695,7 +1697,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateDescriptorPool failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateDescriptorPool failed %d: %s.", result, getName(result) ); goto error; } @@ -1709,7 +1711,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreateDescriptorSetLayout failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreateDescriptorSetLayout failed %d: %s.", result, getName(result) ); goto error; } @@ -1725,7 +1727,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreatePipelineLayout failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreatePipelineLayout failed %d: %s.", result, getName(result) ); goto error; } @@ -1739,7 +1741,7 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - BX_TRACE("vkCreatePipelineCache failed %d: %s.", result, getName(result) ); + BX_TRACE("Init error: vkCreatePipelineCache failed %d: %s.", result, getName(result) ); goto error; } } @@ -1909,17 +1911,22 @@ VK_IMPORT_DEVICE unloadRenderDoc(m_renderdocdll); } - RendererType::Enum getRendererType() const BX_OVERRIDE + RendererType::Enum getRendererType() const override { return RendererType::Vulkan; } - const char* getRendererName() const BX_OVERRIDE + const char* getRendererName() const override { return BGFX_RENDERER_VULKAN_NAME; } - void flip(HMD& /*_hmd*/) BX_OVERRIDE + bool isDeviceRemoved() override + { + return false; + } + + void flip(HMD& /*_hmd*/) override { if (VK_NULL_HANDLE != m_swapchain) { @@ -1936,140 +1943,140 @@ VK_IMPORT_DEVICE } } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) BX_OVERRIDE + void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags, false); } - void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE + void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override { VertexDecl& decl = m_vertexDecls[_handle.idx]; bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE + void destroyVertexDecl(VertexDeclHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) BX_OVERRIDE + void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } - void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_size, NULL, _flags, false); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { BX_UNUSED(_handle, _offset, _size, _mem); // m_indexBuffers[_handle.idx].update(m_commandBuffer, _offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override { m_indexBuffers[_handle.idx].destroy(); } - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) BX_OVERRIDE + void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { VertexDeclHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override { BX_UNUSED(_handle, _offset, _size, _mem); // m_vertexBuffers[_handle.idx].update(m_commandBuffer, _offset, bx::uint32_min(_size, _mem->size), _mem->data); } - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE + void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override { m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE + void createShader(ShaderHandle _handle, Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } - void destroyShader(ShaderHandle _handle) BX_OVERRIDE + void destroyShader(ShaderHandle _handle) override { m_shaders[_handle.idx].destroy(); } - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE + void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL); } - void destroyProgram(ProgramHandle _handle) BX_OVERRIDE + void destroyProgram(ProgramHandle _handle) override { m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) BX_OVERRIDE + void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) override { } - void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE + void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override { } - void updateTexture(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/, const Rect& /*_rect*/, uint16_t /*_z*/, uint16_t /*_depth*/, uint16_t /*_pitch*/, const Memory* /*_mem*/) BX_OVERRIDE + void updateTexture(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/, const Rect& /*_rect*/, uint16_t /*_z*/, uint16_t /*_depth*/, uint16_t /*_pitch*/, const Memory* /*_mem*/) override { } - void updateTextureEnd() BX_OVERRIDE + void updateTextureEnd() override { } - void readTexture(TextureHandle /*_handle*/, void* /*_data*/, uint8_t /*_mip*/) BX_OVERRIDE + void readTexture(TextureHandle /*_handle*/, void* /*_data*/, uint8_t /*_mip*/) override { } - void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) BX_OVERRIDE + void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) override { } - void overrideInternal(TextureHandle /*_handle*/, uintptr_t /*_ptr*/) BX_OVERRIDE + void overrideInternal(TextureHandle /*_handle*/, uintptr_t /*_ptr*/) override { } - uintptr_t getInternal(TextureHandle /*_handle*/) BX_OVERRIDE + uintptr_t getInternal(TextureHandle /*_handle*/) override { return 0; } - void destroyTexture(TextureHandle /*_handle*/) BX_OVERRIDE + void destroyTexture(TextureHandle /*_handle*/) override { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const Attachment* /*_attachment*/) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const Attachment* /*_attachment*/) override { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) BX_OVERRIDE + void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) override { } - void destroyFrameBuffer(FrameBufferHandle /*_handle*/) BX_OVERRIDE + void destroyFrameBuffer(FrameBufferHandle /*_handle*/) override { } - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE + void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override { if (NULL != m_uniforms[_handle.idx]) { @@ -2083,45 +2090,52 @@ VK_IMPORT_DEVICE m_uniformReg.add(_handle, _name, data); } - void destroyUniform(UniformHandle _handle) BX_OVERRIDE + void destroyUniform(UniformHandle _handle) override { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; } - void requestScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) BX_OVERRIDE + void requestScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) override { } - void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE + void updateViewName(ViewId _id, const char* _name) override { - bx::strlcpy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name + bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + , _name ); } - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE + void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override { bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* /*_marker*/, uint32_t /*_size*/) BX_OVERRIDE + void setMarker(const char* /*_marker*/, uint32_t /*_size*/) override { } - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) BX_OVERRIDE + void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override { BX_UNUSED(_handle); } - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE; + virtual void setName(Handle _handle, const char* _name) override + { + BX_UNUSED(_handle, _name) + } + + void submitBlit(BlitState& _bs, uint16_t _view); + + void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; - void blitSetup(TextVideoMemBlitter& /*_blitter*/) BX_OVERRIDE + void blitSetup(TextVideoMemBlitter& /*_blitter*/) override { } - void blitRender(TextVideoMemBlitter& /*_blitter*/, uint32_t /*_numIndices*/) BX_OVERRIDE + void blitRender(TextVideoMemBlitter& /*_blitter*/, uint32_t /*_numIndices*/) override { } @@ -3492,18 +3506,18 @@ VK_DESTROY } } - uint16_t shaderSize; + uint32_t shaderSize; bx::read(&reader, shaderSize); #if 1 const void* code = reader.getDataPtr(); bx::skip(&reader, shaderSize+1); - m_code = alloc( ( (shaderSize+3)/4)*4); + m_code = alloc( ( ( (shaderSize+3)/4)*4) ); bx::memSet(m_code->data, 0, m_code->size); bx::memCopy(m_code->data , code - , shaderSize+1 + , shaderSize ); #else #include "../examples/runtime/shaders/spv/vert.spv.h" @@ -3528,7 +3542,12 @@ VK_DESTROY smci.flags = 0; smci.codeSize = m_code->size; smci.pCode = (const uint32_t*)m_code->data; - VK_CHECK(vkCreateShaderModule(s_renderVK->m_device, &smci, s_renderVK->m_allocatorCb, &m_module) ); + VK_CHECK(vkCreateShaderModule( + s_renderVK->m_device + , &smci + , s_renderVK->m_allocatorCb + , &m_module + ) ); bx::memSet(m_attrMask, 0, sizeof(m_attrMask) ); m_attrMask[Attrib::Position] = UINT16_MAX; @@ -3605,13 +3624,22 @@ VK_DESTROY { } + void RendererContextVK::submitBlit(BlitState& _bs, uint16_t _view) + { + while (_bs.hasItem(_view) ) + { + const BlitItem& blit = _bs.advance(); + BX_UNUSED(blit); + } + } + void RendererContextVK::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) { BX_UNUSED(_render, _clearQuad, _textVideoMemBlitter); updateResolution(_render->m_resolution); - int64_t elapsed = -bx::getHPCounter(); + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; // m_gpuTimer.begin(m_commandList); @@ -3644,8 +3672,8 @@ VK_DESTROY // bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); // setDebugWireframe(wireframe); - uint16_t currentSamplerStateIdx = invalidHandle; - uint16_t currentProgramIdx = invalidHandle; + uint16_t currentSamplerStateIdx = kInvalidHandle; + uint16_t currentProgramIdx = kInvalidHandle; uint32_t currentBindHash = 0; bool hasPredefined = false; bool commandListChanged = false; @@ -3654,10 +3682,7 @@ VK_DESTROY uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; - BlitKey blitKey; - blitKey.decode(_render->m_blitKeys[0]); - uint16_t numBlitItems = _render->m_numBlitItems; - uint16_t blitItem = 0; + BlitState bs(_render); uint32_t blendFactor = 0; @@ -3731,9 +3756,9 @@ VK_DESTROY // uint8_t eye = 0; // uint8_t restartState = 0; - viewState.m_rect = _render->m_rect[0]; + viewState.m_rect = _render->m_view[0].m_rect; - int32_t numItems = _render->m_num; + int32_t numItems = _render->m_numRenderItems; for (int32_t item = 0, restartItem = numItems; item < numItems || restartItem < numItems;) { const uint64_t encodedKey = _render->m_sortKeys[item]; @@ -3745,7 +3770,9 @@ VK_DESTROY || item == numItems ; - const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ]; + const uint32_t itemIdx = _render->m_sortValues[item]; + const RenderItem& renderItem = _render->m_renderItem[itemIdx]; + const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; ++item; if (viewChanged) @@ -3765,17 +3792,17 @@ finishAll(); view = key.m_view; currentPipeline = VK_NULL_HANDLE; - currentSamplerStateIdx = invalidHandle; + currentSamplerStateIdx = kInvalidHandle; BX_UNUSED(currentSamplerStateIdx); - currentProgramIdx = invalidHandle; + currentProgramIdx = kInvalidHandle; hasPredefined = false; - fbh = _render->m_fb[view]; + fbh = _render->m_view[view].m_fbh; setFrameBuffer(fbh); - viewState.m_rect = _render->m_rect[view]; - const Rect& rect = _render->m_rect[view]; - const Rect& scissorRect = _render->m_scissor[view]; + viewState.m_rect = _render->m_view[view].m_rect; + const Rect& rect = _render->m_view[view].m_rect; + const Rect& scissorRect = _render->m_view[view].m_scissor; viewHasScissor = !scissorRect.isZero(); viewScissorRect = viewHasScissor ? scissorRect : rect; @@ -3805,7 +3832,7 @@ BX_UNUSED(currentSamplerStateIdx); restoreScissor = false; - Clear& clr = _render->m_clear[view]; + Clear& clr = _render->m_view[view].m_clear; if (BGFX_CLEAR_NONE != clr.m_flags) { Rect clearRect = rect; @@ -3815,77 +3842,7 @@ BX_UNUSED(currentSamplerStateIdx); prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update. - const uint8_t blitView = SortKey::decodeView(encodedKey); - for (; blitItem < numBlitItems && blitKey.m_view <= blitView; blitItem++) - { - const BlitItem& blit = _render->m_blitItem[blitItem]; - blitKey.decode(_render->m_blitKeys[blitItem+1]); - BX_UNUSED(blit); - -// const TextureD3D12& src = m_textures[blit.m_src.idx]; -// const TextureD3D12& dst = m_textures[blit.m_dst.idx]; -// -// uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; -// uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; -// uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; -// uint32_t dstWidth = bx::uint32_min(dst.m_width, blit.m_dstX + blit.m_width) - blit.m_dstX; -// uint32_t dstHeight = bx::uint32_min(dst.m_height, blit.m_dstY + blit.m_height) - blit.m_dstY; -// uint32_t dstDepth = bx::uint32_min(dst.m_depth, blit.m_dstZ + blit.m_depth) - blit.m_dstZ; -// uint32_t width = bx::uint32_min(srcWidth, dstWidth); -// uint32_t height = bx::uint32_min(srcHeight, dstHeight); -// uint32_t depth = bx::uint32_min(srcDepth, dstDepth); -// -// if (TextureD3D12::Texture3D == src.m_type) -// { -// D3D12_BOX box; -// box.left = blit.m_srcX; -// box.top = blit.m_srcY; -// box.front = blit.m_srcZ; -// box.right = blit.m_srcX + width; -// box.bottom = blit.m_srcY + height;; -// box.back = blit.m_srcZ + bx::uint32_imax(1, depth); -// -// D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{ 0 }} }; -// D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{ 0 }} }; -// m_commandList->CopyTextureRegion(&dstLocation -// , blit.m_dstX -// , blit.m_dstY -// , blit.m_dstZ -// , &srcLocation -// , &box -// ); -// } -// else -// { -// D3D12_BOX box; -// box.left = blit.m_srcX; -// box.top = blit.m_srcY; -// box.front = 0; -// box.right = blit.m_srcX + width; -// box.bottom = blit.m_srcY + height;; -// box.back = 1; -// -// const uint32_t srcZ = TextureD3D12::TextureCube == src.m_type -// ? blit.m_srcZ -// : 0 -// ; -// const uint32_t dstZ = TextureD3D12::TextureCube == dst.m_type -// ? blit.m_dstZ -// : 0 -// ; -// -// D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{ dstZ*dst.m_numMips+blit.m_dstMip }} }; -// D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{ srcZ*src.m_numMips+blit.m_srcMip }} }; -// bool depthStencil = isDepth(TextureFormat::Enum(src.m_textureFormat) ); -// m_commandList->CopyTextureRegion(&dstLocation -// , blit.m_dstX -// , blit.m_dstY -// , 0 -// , &srcLocation -// , depthStencil ? NULL : &box -// ); -// } - } + submitBlit(bs, view); } if (isCompute) @@ -3912,7 +3869,7 @@ BX_UNUSED(currentSamplerStateIdx); currentBindHash = 0; } -// uint32_t bindHash = bx::hashMurmur2A(compute.m_bind, sizeof(compute.m_bind) ); +// uint32_t bindHash = bx::hash<bx::HashMurmur2A>(renderBind.m_bind, sizeof(renderBind.m_bind) ); // if (currentBindHash != bindHash) // { // currentBindHash = bindHash; @@ -3925,8 +3882,8 @@ BX_UNUSED(currentSamplerStateIdx); // // for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) // { -// const Binding& bind = compute.m_bind[ii]; -// if (invalidHandle != bind.m_idx) +// const Binding& bind = renderBind.m_bind[ii]; +// if (kInvalidHandle != bind.m_idx) // { // switch (bind.m_type) // { @@ -4001,10 +3958,10 @@ BX_UNUSED(currentSamplerStateIdx); // } bool constantsChanged = false; - if (compute.m_constBegin < compute.m_constEnd + if (compute.m_uniformBegin < compute.m_uniformEnd || currentProgramIdx != key.m_program) { - rendererUpdateUniforms(this, _render->m_uniformBuffer, compute.m_constBegin, compute.m_constEnd); + rendererUpdateUniforms(this, _render->m_uniformBuffer[compute.m_uniformIdx], compute.m_uniformBegin, compute.m_uniformEnd); currentProgramIdx = key.m_program; ProgramVK& program = m_program[currentProgramIdx]; @@ -4103,8 +4060,8 @@ BX_UNUSED(currentSamplerStateIdx); currentPipeline = VK_NULL_HANDLE; currentBindHash = 0; - currentSamplerStateIdx = invalidHandle; - currentProgramIdx = invalidHandle; + currentSamplerStateIdx = kInvalidHandle; + currentProgramIdx = kInvalidHandle; currentState.clear(); currentState.m_scissor = !draw.m_scissor; changedFlags = BGFX_STATE_MASK; @@ -4116,7 +4073,7 @@ BX_UNUSED(currentSamplerStateIdx); primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); } - rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); + rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); if (isValid(draw.m_stream[0].m_handle) ) { @@ -4138,7 +4095,7 @@ BX_UNUSED(currentSamplerStateIdx); ); uint16_t scissor = draw.m_scissor; - uint32_t bindHash = bx::hashMurmur2A(draw.m_bind, sizeof(draw.m_bind) ); + uint32_t bindHash = bx::hash<bx::HashMurmur2A>(renderBind.m_bind, sizeof(renderBind.m_bind) ); if (currentBindHash != bindHash || 0 != changedStencil || (hasFactor && blendFactor != draw.m_rgba) @@ -4164,8 +4121,8 @@ BX_UNUSED(currentSamplerStateIdx); // srvHandle[0].ptr = 0; // for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) // { -// const Binding& bind = draw.m_bind[stage]; -// if (invalidHandle != bind.m_idx) +// const Binding& bind = renderBind.m_bind[stage]; +// if (kInvalidHandle != bind.m_idx) // { // TextureD3D12& texture = m_textures[bind.m_idx]; // texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); @@ -4255,7 +4212,7 @@ BX_UNUSED(currentSamplerStateIdx); restoreScissor = false; VkRect2D rc; rc.offset.x = viewScissorRect.m_x; - rc.offset.x = viewScissorRect.m_y; + rc.offset.y = viewScissorRect.m_y; rc.extent.width = viewScissorRect.m_x + viewScissorRect.m_width; rc.extent.height = viewScissorRect.m_y + viewScissorRect.m_height; vkCmdSetScissor(m_commandBuffer, 0, 1, &rc); @@ -4265,7 +4222,7 @@ BX_UNUSED(currentSamplerStateIdx); { restoreScissor = true; Rect scissorRect; - scissorRect.setIntersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]); + scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); if (scissorRect.isZeroArea() ) { continue; @@ -4273,7 +4230,7 @@ BX_UNUSED(currentSamplerStateIdx); VkRect2D rc; rc.offset.x = scissorRect.m_x; - rc.offset.x = scissorRect.m_y; + rc.offset.y = scissorRect.m_y; rc.extent.width = scissorRect.m_x + scissorRect.m_width; rc.extent.height = scissorRect.m_y + scissorRect.m_height; vkCmdSetScissor(m_commandBuffer, 0, 1, &rc); @@ -4287,7 +4244,7 @@ BX_UNUSED(currentSamplerStateIdx); } bool constantsChanged = false; - if (draw.m_constBegin < draw.m_constEnd + if (draw.m_uniformBegin < draw.m_uniformEnd || currentProgramIdx != key.m_program || BGFX_STATE_ALPHA_REF_MASK & changedFlags) { @@ -4393,19 +4350,13 @@ BX_UNUSED(currentSamplerStateIdx); } } + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); + // m_batch.end(m_commandList); } - int64_t now = bx::getHPCounter(); - elapsed += now; - - static int64_t last = now; - - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = last; - - int64_t frameTime = now - last; - last = now; + int64_t timeEnd = bx::getHPCounter(); + int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; @@ -4435,7 +4386,9 @@ BX_UNUSED(presentMin, presentMax); const int64_t timerFreq = bx::getHPFrequency(); - perfStats.cpuTimeEnd = now; + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeEnd; perfStats.cpuTimerFreq = timerFreq; // perfStats.gpuTimeBegin = m_gpuTimer.m_begin; // perfStats.gpuTimeEnd = m_gpuTimer.m_end; @@ -4443,6 +4396,8 @@ BX_UNUSED(presentMin, presentMax); // perfStats.numDraw = statsKeyType[0]; // perfStats.numCompute = statsKeyType[1]; // perfStats.maxGpuLatency = maxGpuLatency; + perfStats.gpuMemoryMax = -INT64_MAX; + perfStats.gpuMemoryUsed = -INT64_MAX; if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { @@ -4451,12 +4406,13 @@ BX_UNUSED(presentMin, presentMax); // m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; - static int64_t next = now; + static int64_t next = timeEnd; - if (now >= next) + if (timeEnd >= next) { - next = now + bx::getHPFrequency(); - double freq = double(bx::getHPFrequency() ); + next = timeEnd + timerFreq; + + double freq = double(timerFreq); double toMs = 1000.0 / freq; tvm.clear(); @@ -4537,9 +4493,9 @@ BX_UNUSED(presentMin, presentMax); , !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' ' ); - double elapsedCpuMs = double(elapsed)*toMs; + double elapsedCpuMs = double(frameTime)*toMs; tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] " - , _render->m_num + , _render->m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs @@ -4573,7 +4529,7 @@ BX_UNUSED(presentMin, presentMax); } tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); - tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); +// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); diff --git a/3rdparty/bgfx/src/shader.cpp b/3rdparty/bgfx/src/shader.cpp index 76493223590..6e967d534eb 100644 --- a/3rdparty/bgfx/src/shader.cpp +++ b/3rdparty/bgfx/src/shader.cpp @@ -15,7 +15,7 @@ namespace bgfx bx::WriterI* writer = reinterpret_cast<bx::WriterI*>(_userData); char temp[512]; toString(temp, sizeof(temp), _instruction); - bx::write(writer, temp, (int32_t)bx::strnlen(temp) ); + bx::write(writer, temp, (int32_t)bx::strLen(temp) ); return true; } @@ -24,7 +24,7 @@ namespace bgfx bx::WriterI* writer = reinterpret_cast<bx::WriterI*>(_userData); char temp[512]; toString(temp, sizeof(temp), _instruction); - bx::write(writer, temp, (int32_t)bx::strnlen(temp) ); + bx::write(writer, temp, (int32_t)bx::strLen(temp) ); return true; } @@ -33,7 +33,7 @@ namespace bgfx bx::WriterI* writer = reinterpret_cast<bx::WriterI*>(_userData); char temp[512]; toString(temp, sizeof(temp), _instruction); - bx::write(writer, temp, (int32_t)bx::strnlen(temp) ); + bx::write(writer, temp, (int32_t)bx::strLen(temp) ); return true; } @@ -107,7 +107,7 @@ namespace bgfx bx::read(_reader, regCount, _err); } - uint16_t shaderSize; + uint32_t shaderSize; bx::read(_reader, shaderSize, _err); if (!_err->isOk() ) { return; } diff --git a/3rdparty/bgfx/src/shader_dx9bc.cpp b/3rdparty/bgfx/src/shader_dx9bc.cpp index b3f7c43ba94..a136b9249bb 100644 --- a/3rdparty/bgfx/src/shader_dx9bc.cpp +++ b/3rdparty/bgfx/src/shader_dx9bc.cpp @@ -443,12 +443,12 @@ namespace bgfx switch (_instruction.numOperands) { - case 6: size += read(_reader, _instruction.operand[currOp++], _err); - case 5: size += read(_reader, _instruction.operand[currOp++], _err); - case 4: size += read(_reader, _instruction.operand[currOp++], _err); - case 3: size += read(_reader, _instruction.operand[currOp++], _err); - case 2: size += read(_reader, _instruction.operand[currOp++], _err); - case 1: size += read(_reader, _instruction.operand[currOp++], _err); + case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; case 0: if (!valuesBeforeOpcode && 0 < info.numValues) @@ -482,12 +482,12 @@ namespace bgfx uint32_t currOp = 0; switch (_instruction.numOperands) { - case 6: size += write(_writer, _instruction.operand[currOp++], _err); - case 5: size += write(_writer, _instruction.operand[currOp++], _err); - case 4: size += write(_writer, _instruction.operand[currOp++], _err); - case 3: size += write(_writer, _instruction.operand[currOp++], _err); - case 2: size += write(_writer, _instruction.operand[currOp++], _err); - case 1: size += write(_writer, _instruction.operand[currOp++], _err); + case 6: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 5: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 4: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 3: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 2: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 1: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; case 0: break; } diff --git a/3rdparty/bgfx/src/shader_dxbc.cpp b/3rdparty/bgfx/src/shader_dxbc.cpp index b73b215a325..908fd11d65e 100644 --- a/3rdparty/bgfx/src/shader_dxbc.cpp +++ b/3rdparty/bgfx/src/shader_dxbc.cpp @@ -94,7 +94,7 @@ namespace bgfx { 2, 0 }, // SQRT { 1, 0 }, // SWITCH { 3, 0 }, // SINCOS - { 3, 0 }, // UDIV + { 4, 0 }, // UDIV { 3, 0 }, // ULT { 3, 0 }, // UGE { 4, 0 }, // UMUL @@ -1279,12 +1279,12 @@ namespace bgfx _instruction.numOperands = info.numOperands; switch (info.numOperands) { - case 6: size += read(_reader, _instruction.operand[currOp++], _err); - case 5: size += read(_reader, _instruction.operand[currOp++], _err); - case 4: size += read(_reader, _instruction.operand[currOp++], _err); - case 3: size += read(_reader, _instruction.operand[currOp++], _err); - case 2: size += read(_reader, _instruction.operand[currOp++], _err); - case 1: size += read(_reader, _instruction.operand[currOp++], _err); + case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; + case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; case 0: if (0 < info.numValues) { diff --git a/3rdparty/bgfx/src/topology.cpp b/3rdparty/bgfx/src/topology.cpp index 2804bc7ddf4..0be14ded4fd 100644 --- a/3rdparty/bgfx/src/topology.cpp +++ b/3rdparty/bgfx/src/topology.cpp @@ -5,7 +5,7 @@ #include <bx/allocator.h> #include <bx/debug.h> -#include <bx/fpumath.h> +#include <bx/math.h> #include <bx/sort.h> #include <bx/uint32_t.h> @@ -223,16 +223,6 @@ namespace bgfx return 0; } - inline uint32_t floatFlip(uint32_t _value) - { - using namespace bx; - const uint32_t tmp0 = uint32_sra(_value, 31); - const uint32_t tmp1 = uint32_neg(tmp0); - const uint32_t mask = uint32_or(tmp1, 0x80000000); - const uint32_t result = uint32_xor(_value, mask); - return result; - } - inline float favg3(float _a, float _b, float _c) { return (_a + _b + _c) * 1.0f/3.0f; @@ -281,10 +271,8 @@ namespace bgfx float distance1 = dfn(_dirOrPos, _vertices, _stride, idx1); float distance2 = dfn(_dirOrPos, _vertices, _stride, idx2); - union { float fl; uint32_t ui; } un; - un.fl = kfn(distance0, distance1, distance2); - - _keys[ii] = floatFlip(un.ui) ^ xorBits; + uint32_t ui = bx::floatToBits(kfn(distance0, distance1, distance2) ); + _keys[ii] = bx::floatFlip(ui) ^ xorBits; _values[ii] = ii; } } diff --git a/3rdparty/bgfx/src/vertexdecl.cpp b/3rdparty/bgfx/src/vertexdecl.cpp index a2d88a4ff84..ba00480dcd3 100644 --- a/3rdparty/bgfx/src/vertexdecl.cpp +++ b/3rdparty/bgfx/src/vertexdecl.cpp @@ -64,6 +64,7 @@ namespace bgfx } VertexDecl::VertexDecl() + : m_stride(0) { // BK - struct need to have ctor to qualify as non-POD data. // Need this to catch programming errors when serializing struct. @@ -127,6 +128,8 @@ namespace bgfx "Attrib::Bitangent", "Attrib::Color0", "Attrib::Color1", + "Attrib::Color2", + "Attrib::Color3", "Attrib::Indices", "Attrib::Weights", "Attrib::TexCoord0", @@ -151,7 +154,7 @@ namespace bgfx { bx::debugPrintf("vertexdecl %08x (%08x), stride %d\n" , _decl.m_hash - , bx::hashMurmur2A(_decl.m_attributes) + , bx::hash<bx::HashMurmur2A>(_decl.m_attributes) , _decl.m_stride ); @@ -196,6 +199,8 @@ namespace bgfx { Attrib::Bitangent, 0x0004 }, { Attrib::Color0, 0x0005 }, { Attrib::Color1, 0x0006 }, + { Attrib::Color2, 0x0018 }, + { Attrib::Color3, 0x0019 }, { Attrib::Indices, 0x000e }, { Attrib::Weight, 0x000f }, { Attrib::TexCoord0, 0x0010 }, @@ -389,9 +394,9 @@ namespace bgfx { switch (num) { - default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); - case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); - case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); + default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH; + case 3: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH; + case 2: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); BX_FALLTHROUGH; case 1: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f); } } @@ -399,9 +404,9 @@ namespace bgfx { switch (num) { - default: *packed++ = uint8_t(*_input++ * 255.0f); - case 3: *packed++ = uint8_t(*_input++ * 255.0f); - case 2: *packed++ = uint8_t(*_input++ * 255.0f); + default: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH; + case 3: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH; + case 2: *packed++ = uint8_t(*_input++ * 255.0f); BX_FALLTHROUGH; case 1: *packed++ = uint8_t(*_input++ * 255.0f); } } @@ -410,9 +415,9 @@ namespace bgfx { switch (num) { - default: *packed++ = uint8_t(*_input++); - case 3: *packed++ = uint8_t(*_input++); - case 2: *packed++ = uint8_t(*_input++); + default: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH; + case 3: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH; + case 2: *packed++ = uint8_t(*_input++); BX_FALLTHROUGH; case 1: *packed++ = uint8_t(*_input++); } } @@ -428,9 +433,9 @@ namespace bgfx { switch (num) { - default: - case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f); - case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); + default: BX_FALLTHROUGH; + case 3: packed |= uint32_t(*_input++ * 511.0f + 512.0f); BX_FALLTHROUGH; + case 2: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); BX_FALLTHROUGH; case 1: packed <<= 10; packed |= uint32_t(*_input++ * 511.0f + 512.0f); } } @@ -438,9 +443,9 @@ namespace bgfx { switch (num) { - default: - case 3: packed |= uint32_t(*_input++ * 1023.0f); - case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); + default: BX_FALLTHROUGH; + case 3: packed |= uint32_t(*_input++ * 1023.0f); BX_FALLTHROUGH; + case 2: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); BX_FALLTHROUGH; case 1: packed <<= 10; packed |= uint32_t(*_input++ * 1023.0f); } } @@ -449,9 +454,9 @@ namespace bgfx { switch (num) { - default: - case 3: packed |= uint32_t(*_input++); - case 2: packed <<= 10; packed |= uint32_t(*_input++); + default: BX_FALLTHROUGH; + case 3: packed |= uint32_t(*_input++); BX_FALLTHROUGH; + case 2: packed <<= 10; packed |= uint32_t(*_input++); BX_FALLTHROUGH; case 1: packed <<= 10; packed |= uint32_t(*_input++); } } @@ -468,9 +473,9 @@ namespace bgfx { switch (num) { - default: *packed++ = int16_t(*_input++ * 32767.0f); - case 3: *packed++ = int16_t(*_input++ * 32767.0f); - case 2: *packed++ = int16_t(*_input++ * 32767.0f); + default: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH; + case 3: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH; + case 2: *packed++ = int16_t(*_input++ * 32767.0f); BX_FALLTHROUGH; case 1: *packed++ = int16_t(*_input++ * 32767.0f); } } @@ -478,9 +483,9 @@ namespace bgfx { switch (num) { - default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); - case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); - case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); + default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH; + case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH; + case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); BX_FALLTHROUGH; case 1: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); } } @@ -489,9 +494,9 @@ namespace bgfx { switch (num) { - default: *packed++ = int16_t(*_input++); - case 3: *packed++ = int16_t(*_input++); - case 2: *packed++ = int16_t(*_input++); + default: *packed++ = int16_t(*_input++); BX_FALLTHROUGH; + case 3: *packed++ = int16_t(*_input++); BX_FALLTHROUGH; + case 2: *packed++ = int16_t(*_input++); BX_FALLTHROUGH; case 1: *packed++ = int16_t(*_input++); } } @@ -503,9 +508,9 @@ namespace bgfx uint16_t* packed = (uint16_t*)data; switch (num) { - default: *packed++ = bx::halfFromFloat(*_input++); - case 3: *packed++ = bx::halfFromFloat(*_input++); - case 2: *packed++ = bx::halfFromFloat(*_input++); + default: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH; + case 3: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH; + case 2: *packed++ = bx::halfFromFloat(*_input++); BX_FALLTHROUGH; case 1: *packed++ = bx::halfFromFloat(*_input++); } } @@ -544,9 +549,9 @@ namespace bgfx { switch (num) { - default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; - case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; - case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; + default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH; + case 3: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH; + case 2: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; BX_FALLTHROUGH; case 1: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f; } } @@ -554,9 +559,9 @@ namespace bgfx { switch (num) { - default: *_output++ = float(*packed++)*1.0f/255.0f; - case 3: *_output++ = float(*packed++)*1.0f/255.0f; - case 2: *_output++ = float(*packed++)*1.0f/255.0f; + default: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH; + case 3: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH; + case 2: *_output++ = float(*packed++)*1.0f/255.0f; BX_FALLTHROUGH; case 1: *_output++ = float(*packed++)*1.0f/255.0f; } } @@ -570,9 +575,9 @@ namespace bgfx { switch (num) { - default: - case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; - case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; + default: BX_FALLTHROUGH; + case 3: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; BX_FALLTHROUGH; + case 2: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; packed >>= 10; BX_FALLTHROUGH; case 1: *_output++ = (float(packed & 0x3ff) - 512.0f)*1.0f/511.0f; } } @@ -580,9 +585,9 @@ namespace bgfx { switch (num) { - default: - case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; - case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; + default: BX_FALLTHROUGH; + case 3: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; BX_FALLTHROUGH; + case 2: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; packed >>= 10; BX_FALLTHROUGH; case 1: *_output++ = float(packed & 0x3ff)*1.0f/1023.0f; } } @@ -596,9 +601,9 @@ namespace bgfx { switch (num) { - default: *_output++ = float(*packed++)*1.0f/32767.0f; - case 3: *_output++ = float(*packed++)*1.0f/32767.0f; - case 2: *_output++ = float(*packed++)*1.0f/32767.0f; + default: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH; + case 3: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH; + case 2: *_output++ = float(*packed++)*1.0f/32767.0f; BX_FALLTHROUGH; case 1: *_output++ = float(*packed++)*1.0f/32767.0f; } } @@ -606,9 +611,9 @@ namespace bgfx { switch (num) { - default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; - case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; - case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; + default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH; + case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH; + case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; BX_FALLTHROUGH; case 1: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f; } } @@ -620,9 +625,9 @@ namespace bgfx uint16_t* packed = (uint16_t*)data; switch (num) { - default: *_output++ = bx::halfToFloat(*packed++); - case 3: *_output++ = bx::halfToFloat(*packed++); - case 2: *_output++ = bx::halfToFloat(*packed++); + default: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH; + case 3: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH; + case 2: *_output++ = bx::halfToFloat(*packed++); BX_FALLTHROUGH; case 1: *_output++ = bx::halfToFloat(*packed++); } } @@ -636,9 +641,9 @@ namespace bgfx switch (num) { - case 1: *_output++ = 0.0f; - case 2: *_output++ = 0.0f; - case 3: *_output++ = 0.0f; + case 1: *_output++ = 0.0f; BX_FALLTHROUGH; + case 2: *_output++ = 0.0f; BX_FALLTHROUGH; + case 3: *_output++ = 0.0f; BX_FALLTHROUGH; default: break; } } @@ -807,7 +812,7 @@ namespace bgfx { float pos[4]; vertexUnpack(pos, Attrib::Position, _decl, _data, ii); - uint32_t hashValue = bx::hashMurmur2A(pos, 3*sizeof(float) ) & hashMask; + uint32_t hashValue = bx::hash<bx::HashMurmur2A>(pos, 3*sizeof(float) ) & hashMask; uint16_t offset = hashTable[hashValue]; for (; UINT16_MAX != offset; offset = next[offset]) diff --git a/3rdparty/bgfx/src/vs_clear.bin.h b/3rdparty/bgfx/src/vs_clear.bin.h index 46160b6bb76..628f94fcbc2 100644 --- a/3rdparty/bgfx/src/vs_clear.bin.h +++ b/3rdparty/bgfx/src/vs_clear.bin.h @@ -1,6 +1,6 @@ static const uint8_t vs_clear_glsl[164] = { - 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x61, 0x74, // VSH...........at + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x61, 0x74, // VSH...........at 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // tribute highp ve 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x76, // c3 a_position;.v 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // oid main ().{. @@ -12,52 +12,185 @@ static const uint8_t vs_clear_glsl[164] = 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // ion = tmpvar_1;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_clear_dx9[185] = +static const uint8_t vs_clear_spv[2083] = { - 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x03, 0xfe, 0xff, // VSH............. - 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... - 0x00, 0x03, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ - 0x1c, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....vs_3_0.Micro - 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh - 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 - 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384.. - 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, // Q..........?.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ - 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, // ................ - 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x24, 0x90, 0x00, 0x00, 0x40, 0xa0, // ..........$...@. - 0x00, 0x00, 0x15, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x08, 0x00, 0x00, 0x03, 0x02, // VSH............. + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, // #.........za.... + 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. + 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf9, 0x03, // ..main.......... + 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xf9, 0x03, // ..Output........ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // ......gl_Positio + 0x6e, 0x00, 0x05, 0x00, 0x05, 0x00, 0x1f, 0x17, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, // n.........@main( + 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x1b, 0x00, 0x00, 0x61, 0x5f, // vf3;..........a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, // position........ + 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, // .._varying_..... + 0x05, 0x00, 0xd5, 0x5d, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ...]..a_position + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ..........a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x40, 0x65, // tion..........@e + 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, // ntryPointOutput_ + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, // gl_Position..... + 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... + 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ......$Global... + 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view + 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x01, 0x00, // Rect............ + 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, // ..u_viewTexel... + 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x0b, // invView......... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ......u_proj.... + 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, // ..........u_invP + 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, // roj............. + 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ..u_viewProj.... + 0x07, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x0b, // iewProj......... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, // ......u_model... + 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode + 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, // lView........... + 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ..u_modelViewPro + 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, // j.............u_ + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x04, 0x00, 0xcf, 0x03, // alphaRef4....... + 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcd, 0x0f, // ..Output........ + 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, // ..@entryPointOut + 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, // put...G......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x0b, 0x00, // ......G......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x06, 0x00, // ......G...|..... + 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x00, 0x00, // ..@...H......... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#.......H..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. + 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x03, 0x00, // ......H......... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x03, 0x00, // ......H......... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#...`...H..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x05, 0x00, // ......H......... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x05, 0x00, // ......H......... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#.......H..... + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x07, 0x00, // ......H......... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x07, 0x00, // ......H......... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#...`...H..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x09, 0x00, // ......H......... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x09, 0x00, // ......H......... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#.......H..... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0b, 0x00, // ......H......... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xc5, 0x0b, // ..#... ...G..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x1e, 0x00, // ......G......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x1d, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xc8, 0x08, 0x00, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x95, 0x02, // ..!............. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x76, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf9, 0x03, // .. ...v......... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+............. + 0x80, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .? ............. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, // ..;............. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x03, 0x00, // ..;............. + 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . + 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......|...e...j. + 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ................ + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x65, 0x00, // ..e...e...|...e. + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x02, 0x00, 0xcf, 0x03, // ..e............. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xcf, 0x03, // .. ...L......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x06, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x03, 0x00, // ..;...L......... + 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x79, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........ya..;. + 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd5, 0x5d, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3e, 0x00, // .......]......>. + 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0xd5, 0x5d, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0xf9, 0x03, // .......]..9..... + 0x00, 0x00, 0xf5, 0x53, 0x00, 0x00, 0x1f, 0x17, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x51, 0x00, // ...S..........Q. + 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf8, 0x21, 0x00, 0x00, 0xf5, 0x53, 0x00, 0x00, 0x00, 0x00, // .......!...S.... + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0xf8, 0x21, 0x00, 0x00, 0xfd, 0x00, // ..>........!.... + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x1f, 0x17, // ..8...6......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, // ..........7..... + 0x00, 0x00, 0xa6, 0x1b, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xd7, 0x58, 0x00, 0x00, 0x3b, 0x00, // ...........X..;. + 0x04, 0x00, 0x76, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..v...........=. + 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0xa6, 0x1b, 0x00, 0x00, 0x51, 0x00, // ......#V......Q. + 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x45, 0x3c, 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0x00, 0x00, // ......E<..#V.... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x5f, 0x00, 0x00, 0x23, 0x56, // ..Q.......%_..#V + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x52, // ......Q........R + 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // ..#V......P..... + 0x00, 0x00, 0x78, 0x31, 0x00, 0x00, 0x45, 0x3c, 0x00, 0x00, 0x25, 0x5f, 0x00, 0x00, 0x0c, 0x52, // ..x1..E<..%_...R + 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x34, 0x24, // ......A.......4$ + 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x34, 0x24, // ..........>...4$ + 0x00, 0x00, 0x78, 0x31, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xf9, 0x03, 0x00, 0x00, 0xba, 0x3a, // ..x1..=........: + 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xba, 0x3a, 0x00, 0x00, 0x38, 0x00, // ...........:..8. + 0x01, 0x00, 0x00, // ... }; -static const uint8_t vs_clear_dx11[386] = +static const uint8_t vs_clear_dx9[175] = { - 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x01, 0x44, 0x58, 0x42, 0x43, // VSH.......p.DXBC - 0x35, 0x37, 0xf0, 0x90, 0x23, 0xc6, 0x3b, 0x7a, 0xd4, 0x66, 0x38, 0xf5, 0x51, 0x69, 0x19, 0xa8, // 57..#.;z.f8.Qi.. - 0x01, 0x00, 0x00, 0x00, 0x70, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ....p.......0... - 0xb0, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, // ........<...Aon9 - 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, 0x50, 0x00, 0x00, 0x00, // x...x.......P... - 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, // (.....$...$...$. - 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, // ..$...$......... - 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, // Q..........?.... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, // ................ - 0x00, 0x00, 0x0f, 0x90, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0xe4, 0x90, // ................ - 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0xaa, 0x90, // ................ - 0x01, 0x00, 0x44, 0xa0, 0x01, 0x00, 0x14, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, // ..D.........SHDR - 0x50, 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x14, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, // P...@......._... - 0x72, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, // r.......g.... .. - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, // ........6...r .. - 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // ....F.......6... - 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, // . .......@.....? - 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // >...ISGN,....... - 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .... ........... - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, // ............POSI - 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, // TION....OSGN,... - 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ - 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x00, 0x01, 0x01, 0x00, // SV_POSITION..... - 0x00, 0x00, // .. + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x03, // VSH............. + 0xfe, 0xff, 0xfe, 0xff, 0x14, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, // ......CTAB....#. + 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......vs_3_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 + 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, // 10.1..Q......... + 0x80, 0x3f, 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, 0x00, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, // ................ + 0x24, 0x90, 0x00, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x15, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // $...@.......... +}; +static const uint8_t vs_clear_dx11[388] = +{ + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x01, 0x00, 0x00, 0x44, 0x58, // VSH.......p...DX + 0x42, 0x43, 0x35, 0x37, 0xf0, 0x90, 0x23, 0xc6, 0x3b, 0x7a, 0xd4, 0x66, 0x38, 0xf5, 0x51, 0x69, // BC57..#.;z.f8.Qi + 0x19, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x70, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, // ......p.......0. + 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x41, 0x6f, // ..........<...Ao + 0x6e, 0x39, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, 0x50, 0x00, // n9x...x.......P. + 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // ..(.....$...$... + 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // $...$...$....... + 0xfe, 0xff, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // ..Q..........?.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, // ................ + 0xaa, 0x90, 0x01, 0x00, 0x44, 0xa0, 0x01, 0x00, 0x14, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, // ....D.........SH + 0x44, 0x52, 0x50, 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x14, 0x00, 0x00, 0x00, 0x5f, 0x00, // DRP...@......._. + 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, // ..r.......g.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, // ..........6...r + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, // ......F.......6. + 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ... .......@.... + 0x80, 0x3f, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, // .?>...ISGN,..... + 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, 0x07, 0x07, 0x00, 0x00, 0x50, 0x4f, // ..............PO + 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, // SITION....OSGN,. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ + 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x00, 0x01, // ..SV_POSITION... + 0x01, 0x00, 0x00, 0x00, // .... }; static const uint8_t vs_clear_mtl[504] = { - 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x75, 0x73, // VSH...........us 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { diff --git a/3rdparty/bgfx/src/vs_debugfont.bin.h b/3rdparty/bgfx/src/vs_debugfont.bin.h index 6d54586dab7..5a6517c5adf 100644 --- a/3rdparty/bgfx/src/vs_debugfont.bin.h +++ b/3rdparty/bgfx/src/vs_debugfont.bin.h @@ -1,6 +1,6 @@ static const uint8_t vs_debugfont_glsl[503] = { - 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod + 0x56, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... 0xd2, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ....attribute hi 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 a_color @@ -33,153 +33,389 @@ static const uint8_t vs_debugfont_glsl[503] = 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color1 = a_color 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}... }; -static const uint8_t vs_debugfont_dx9[395] = +static const uint8_t vs_debugfont_spv[3689] = { - 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod + 0x56, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0x44, 0x0e, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // D.....#......... + 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std + 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x8a, 0x14, 0x00, 0x00, // main............ + 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, // ................ + 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ + 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0xc3, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....Output...... + 0xc3, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // ........gl_Posit + 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion............. + 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ + 0xc3, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // ........v_color1 + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x08, 0x00, // v_texcoord0..... + 0x1f, 0x11, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, // ....@main(vf4;vf + 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // 4;vf3;vf2;...... + 0x8f, 0x22, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ."..a_color0.... + 0x05, 0x00, 0x05, 0x00, 0xf3, 0x54, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // .....T..a_color1 + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........NJ..a_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xd8, 0x4e, 0x00, 0x00, // sition.......N.. + 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... + 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... + 0x05, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. + 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi + 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, // ewRect.......... + 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. + 0x06, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi + 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. + 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... + 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. + 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in + 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, // vProj........... + 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. + 0x06, 0x00, 0x07, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in + 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... + 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. + 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo + 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xa4, 0x03, 0x00, 0x00, // delView......... + 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP + 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. + 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... + 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. + 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ + 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... + 0x05, 0x00, 0x05, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // .....?..a_color1 + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x8a, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ............a_co + 0x6c, 0x6f, 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xed, 0x2c, 0x00, 0x00, // lor1.........,.. + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ....a_position.. + 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....@,..a_texcoo + 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, // rd0.........a_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, // xcoord0......... + 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, // flattenTemp..... + 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .U..param....... + 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // o8..param....... + 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .8..param....... + 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // ....param....... + 0xd8, 0x0c, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // utput_gl_Positio + 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x64, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, // n.......d...Outp + 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ut......d....... + 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ + 0x64, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // d.......v_color1 + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ........d....... + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, // v_texcoord0..... + 0xcd, 0x0f, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd9, 0x05, 0x00, 0x00, // utput...G....... + 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ....@...H....... + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... + 0xa4, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... + 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... + 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... + 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... + 0xa4, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... + 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... + 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... + 0xa4, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... + 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... + 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... + 0xa4, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... + 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... + 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... + 0xa4, 0x03, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... + 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... + 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... + 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... + 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8a, 0x14, 0x00, 0x00, // ........G....... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... + 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd8, 0x0c, 0x00, 0x00, // ........G....... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xcd, 0x0f, 0x00, 0x00, // ........G....... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... + 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... + 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // ........ ....... + 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // ........ ....... + 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x06, 0x00, 0xc3, 0x04, 0x00, 0x00, // ................ + 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x07, 0x00, 0x98, 0x01, 0x00, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, // !............... + 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... + 0x40, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // @............... + 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... + 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... + 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, // ...........?+... + 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, // ............,... + 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ................ + 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... + 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........,....... + 0x74, 0x01, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // t............... + 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, // ....+........... + 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, // ....,........... + 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... + 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... + 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // .......+....... + 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xd9, 0x05, 0x00, 0x00, // j... ........... + 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xa4, 0x03, 0x00, 0x00, // e...j........... + 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ........e...e... + 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... + 0xd9, 0x05, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....e...e....... + 0x20, 0x00, 0x04, 0x00, 0x21, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x03, 0x00, 0x00, // ...!........... + 0x3b, 0x00, 0x04, 0x00, 0x21, 0x06, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...!...B....... + 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // +.......)....... + 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ...........e... + 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... + 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x8a, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... + 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... + 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... + 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... + 0x1e, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....d........... + 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... + 0x64, 0x04, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, // d...;........... + 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... + 0x13, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. + 0x3b, 0x00, 0x04, 0x00, 0x40, 0x07, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;...@........... + 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... + 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;.......o8...... + 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... + 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... + 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... + 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x8a, 0x14, 0x00, 0x00, // =........?...... + 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........,...... + 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... + 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... + 0x6f, 0x38, 0x00, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, // o8...?..>....8.. + 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, // .,..>.......@,.. + 0x39, 0x00, 0x08, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x1f, 0x11, 0x00, 0x00, // 9.......I&...... + 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .U..o8...8...... + 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... + 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... + 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. + 0x3e, 0x00, 0x03, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... + 0x9a, 0x02, 0x00, 0x00, 0x27, 0x41, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....'A.......... + 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdf, 0x1c, 0x00, 0x00, 0x27, 0x41, 0x00, 0x00, // =...........'A.. + 0x41, 0x00, 0x05, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x0d, 0x4e, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, // A........N...... + 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0d, 0x4e, 0x00, 0x00, 0xdf, 0x1c, 0x00, 0x00, // ....>....N...... + 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc1, 0x4d, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // A........M...... + 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x00, 0x00, // ....=........... + 0xc1, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x0e, 0x4e, 0x00, 0x00, // .M..A........N.. + 0xcd, 0x0f, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0e, 0x4e, 0x00, 0x00, // ........>....N.. + 0xe0, 0x1c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xc2, 0x4d, 0x00, 0x00, // ....A........M.. + 0x08, 0x10, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ........=....... + 0xe1, 0x1c, 0x00, 0x00, 0xc2, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x92, 0x02, 0x00, 0x00, // .....M..A....... + 0x01, 0x5c, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ............>... + 0x01, 0x5c, 0x00, 0x00, 0xe1, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, // ............8... + 0x36, 0x00, 0x05, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x1f, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... + 0x98, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8f, 0x22, 0x00, 0x00, // ....7........".. + 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf3, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // 7........T..7... + 0x95, 0x02, 0x00, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, // ....NJ..7....... + 0xd8, 0x4e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x7e, 0x58, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .N......~X..;... + 0x40, 0x07, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // @...........A... + 0x9a, 0x02, 0x00, 0x00, 0x83, 0x2e, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ................ + 0x3e, 0x00, 0x03, 0x00, 0x83, 0x2e, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... + 0x9a, 0x02, 0x00, 0x00, 0x76, 0x39, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // ....v9.......... + 0x3e, 0x00, 0x03, 0x00, 0x76, 0x39, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v9..t...A... + 0x90, 0x02, 0x00, 0x00, 0x2a, 0x39, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, // ....*9.......... + 0x3e, 0x00, 0x03, 0x00, 0x2a, 0x39, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...*9......=... + 0x18, 0x00, 0x00, 0x00, 0xd5, 0x18, 0x00, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ........NJ..Q... + 0x0d, 0x00, 0x00, 0x00, 0x5a, 0x3b, 0x00, 0x00, 0xd5, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....Z;.......... + 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2a, 0x48, 0x00, 0x00, 0xd5, 0x18, 0x00, 0x00, // Q.......*H...... + 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4a, 0x54, 0x00, 0x00, // ....Q.......JT.. + 0xd5, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........P....... + 0xa3, 0x33, 0x00, 0x00, 0x5a, 0x3b, 0x00, 0x00, 0x2a, 0x48, 0x00, 0x00, 0x4a, 0x54, 0x00, 0x00, // .3..Z;..*H..JT.. + 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x48, 0x2d, 0x00, 0x00, // ....A.......H-.. + 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // B...)...=...e... + 0x12, 0x3e, 0x00, 0x00, 0x48, 0x2d, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // .>..H-.......... + 0xbe, 0x3c, 0x00, 0x00, 0xa3, 0x33, 0x00, 0x00, 0x12, 0x3e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .<...3...>..A... + 0x9a, 0x02, 0x00, 0x00, 0x7e, 0x39, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....~9.......... + 0x3e, 0x00, 0x03, 0x00, 0x7e, 0x39, 0x00, 0x00, 0xbe, 0x3c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...~9...<..=... + 0x13, 0x00, 0x00, 0x00, 0x3c, 0x22, 0x00, 0x00, 0xd8, 0x4e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ....<"...N..A... + 0x90, 0x02, 0x00, 0x00, 0x4c, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, // ....L=.......... + 0x3e, 0x00, 0x03, 0x00, 0x4c, 0x3d, 0x00, 0x00, 0x3c, 0x22, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...L=..<"..=... + 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x22, 0x00, 0x00, 0x8f, 0x22, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ....="..."..A... + 0x9a, 0x02, 0x00, 0x00, 0x4d, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....M=.......... + 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x3d, 0x00, 0x00, 0x3d, 0x22, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...M=..="..=... + 0x1d, 0x00, 0x00, 0x00, 0x3e, 0x22, 0x00, 0x00, 0xf3, 0x54, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ....>"...T..A... + 0x9a, 0x02, 0x00, 0x00, 0x4e, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // ....N=.......... + 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x3d, 0x00, 0x00, 0x3e, 0x22, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...N=..>"..=... + 0xc3, 0x04, 0x00, 0x00, 0x0d, 0x53, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, // .....S.......... + 0x0d, 0x53, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .S..8.... +}; +static const uint8_t vs_debugfont_dx9[385] = +{ + 0x56, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x68, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // h.......$.CTAB.. - 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj... - 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs - 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.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, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 - 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ - 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, // ................ - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 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, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... - 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ - 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................ - 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ - 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, // ................ - 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, // ................ - 0x03, 0xe0, 0x03, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... + 0x5c, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x21, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........!.CTAB + 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, // ....W........... + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ........P...0... + 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........@....... + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. + 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, // vs_3_0.Microsoft + 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // (R) HLSL Shader + 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, // Compiler 10.1.. + 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, 0x00, 0x00, 0x00, 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, 0x02, 0x00, 0x55, 0x90, // ..............U. + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, // ................ + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, // ................ + 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, // ................ + 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, // ................ + 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x0f, 0xe0, 0x01, 0x00, 0xe4, 0x90, // ................ + 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x03, 0xe0, 0x03, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, // ................ + 0x00, // . }; -static const uint8_t vs_debugfont_dx11[974] = +static const uint8_t vs_debugfont_dx11[976] = { - 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod + 0x56, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0xa0, 0x03, 0x44, 0x58, 0x42, 0x43, 0x92, 0x16, 0xf8, 0xaa, 0xc4, 0x4c, 0xee, 0x93, 0x22, 0xee, // ..DXBC.....L..". - 0x2e, 0xcd, 0x17, 0x4a, 0xe5, 0x55, 0x01, 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0x00, 0x04, 0x00, // ...J.U.......... - 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x8c, 0x02, 0x00, 0x00, 0x14, 0x03, // ..0...0......... - 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x02, // ..Aon9.......... - 0xfe, 0xff, 0xc4, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, // ......4.....$... - 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, // 0...0...$...0... - 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // ................ - 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x02, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x03, 0x80, 0x03, 0x00, // ................ - 0x0f, 0x90, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0x55, 0x90, 0x02, 0x00, // ............U... - 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, // ................ - 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x00, // ................ - 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ - 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x03, 0xc0, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x01, 0x00, // ................ - 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0xe0, 0x03, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ - 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x54, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x55, 0x00, // ..SHDRT...@...U. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, // .._..........._. - 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, // .........._...r. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, // ......_...2..... - 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..g.... ........ - 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e.... ......e. - 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, // ... ......e...2 - 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, // ......h.......8. - 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x02, 0x00, // ..........V..... - 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F. .........2. - 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2......... - 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, // ..F. ........... - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F......... - 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ... ......F..... - 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..F. .........6. - 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, // ... ......F..... - 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, // ..6.... ......F. - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, // ......6...2 .... - 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x49, 0x53, // ..F.......>...IS - 0x47, 0x4e, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, // GN............h. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ......h......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x6e, 0x00, // ..............n. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ - 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......w......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x43, 0x4f, // ..............CO - 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, // LOR.POSITION.TEX - 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, // COORD.OSGN...... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ......h......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, // ..............t. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, // ......t......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x7a, 0x00, // ..............z. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, // ......SV_POSITIO - 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD - 0x00, 0xab, 0x00, 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ............@. + 0xa0, 0x03, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x92, 0x16, 0xf8, 0xaa, 0xc4, 0x4c, 0xee, 0x93, // ....DXBC.....L.. + 0x22, 0xee, 0x2e, 0xcd, 0x17, 0x4a, 0xe5, 0x55, 0x01, 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0x00, // "....J.U........ + 0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x8c, 0x02, 0x00, 0x00, // ....0...0....... + 0x14, 0x03, 0x00, 0x00, 0x41, 0x6f, 0x6e, 0x39, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, // ....Aon9........ + 0x00, 0x02, 0xfe, 0xff, 0xc4, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, // ........4.....$. + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x30, 0x00, // ..0...0...$...0. + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x02, 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ + 0x05, 0x00, 0x02, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x03, 0x80, // ................ + 0x03, 0x00, 0x0f, 0x90, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0x55, 0x90, // ..............U. + 0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, // ................ + 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ................ + 0x03, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, // ................ + 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, // ................ + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, // ................ + 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, // ................ + 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0xe0, 0x03, 0x00, 0xe4, 0x90, // ................ + 0xff, 0xff, 0x00, 0x00, 0x53, 0x48, 0x44, 0x52, 0x54, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, // ....SHDRT...@... + 0x55, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // U...Y...F. ..... + 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ...._........... + 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, // _..........._... + 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // r......._...2... + 0x03, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....g.... ...... + 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....e.... ...... + 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // e.... ......e... + 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, // 2 ......h....... + 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, // 8...........V... + 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....F. ......... + 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // 2...........F. . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, // F.......2....... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....F. ......... + 0xa6, 0x1a, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F....... + 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ..... ......F... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....F. ......... + 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // 6.... ......F... + 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....6.... ...... + 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, // F.......6...2 .. + 0x03, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>... + 0x49, 0x53, 0x47, 0x4e, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGN............ + 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // h............... + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........h....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, // ................ + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // n............... + 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........w....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, // ................ + 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, // COLOR.POSITION.T + 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, // EXCOORD.OSGN.... + 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........h....... + 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, 0x00, 0x00, // t............... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........t....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ + 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // z............... + 0x03, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT + 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, // ION.COLOR.TEXCOO + 0x52, 0x44, 0x00, 0xab, 0x00, 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // RD............@. }; -static const uint8_t vs_debugfont_mtl[847] = +static const uint8_t vs_debugfont_mtl[869] = { - 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH..."f..@...us - 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me - 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 a_colo - 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, // r0 [[attribute(0 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, // )]];. float4 a_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, // color1 [[attribu - 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // te(1)]];. float - 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, // 3 a_position [[a - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // ttribute(2)]];. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float2 a_texcoo - 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, // rd0 [[attribute( - 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // 3)]];.};.struct - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // put {. float4 g - 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, // l_Position [[pos - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // ition]];. float - 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // 4 v_color0;. fl - 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x20, // oat4 v_color1;. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float2 v_texcoo - 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // rd0;.};.struct x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif - 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, // orm {. float4x4 - 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // u_modelViewProj - 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, // ;.};.vertex xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, // MtlShaderOutput - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, // xlatMtlMain (xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, // tMtlShaderInput - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, // _mtl_i [[stage_i - 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, // n]], constant xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, // atMtlShaderUnifo - 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, // rm& _mtl_u [[buf - 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // fer(0)]]).{. xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu - 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // t _mtl_o;. floa - 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t4 tmpvar_1 = 0; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, // . tmpvar_1.w = - 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // 1.0;. tmpvar_1. - 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, // xyz = _mtl_i.a_p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // osition;. _mtl_ - 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, // o.gl_Position = - 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // (_mtl_u.u_modelV - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // iewProj * tmpvar - 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, // _1);. _mtl_o.v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // texcoord0 = _mtl - 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, // _i.a_texcoord0;. - 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _mtl_o.v_color - 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // 0 = _mtl_i.a_col - 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, // or0;. _mtl_o.v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // color1 = _mtl_i. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // a_color1;. retu - 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... + 0x56, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0x40, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, // @...using namesp + 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // ace metal;.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // t xlatMtlShaderI + 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // nput {. float4 + 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, // a_color0 [[attri + 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // bute(0)]];. flo + 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x5b, 0x5b, 0x61, // at4 a_color1 [[a + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // ttribute(1)]];. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // float3 a_positi + 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x32, // on [[attribute(2 + 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x61, 0x5f, // )]];. float2 a_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, // texcoord0 [[attr + 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x33, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, // ibute(3)]];.};.s + 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // truct xlatMtlSha + 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // derOutput {. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // oat4 gl_Position + 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // [[position]];. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // float4 v_color0 + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ;. float4 v_col + 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, // or1;. float2 v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // texcoord0;.};.st + 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad + 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // erUniform {. fl + 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // oat4x4 u_modelVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, // ewProj;.};.verte + 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // x xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // utput xlatMtlMai + 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // n (xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, // Input _mtl_i [[s + 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, // tage_in]], const + 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // ant xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // rUniform& _mtl_u + 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, // [[buffer(0)]]). + 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // {. xlatMtlShade + 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // rOutput _mtl_o;. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float4 tmpvar_ + 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 1 = 0;. tmpvar_ + 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 1.w = 1.0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // var_1.xyz = _mtl + 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, // _i.a_position;. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // _mtl_o.gl_Posit + 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // ion = (_mtl_u.u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, // modelViewProj * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // tmpvar_1);. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // l_o.v_texcoord0 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // = _mtl_i.a_texco + 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, // ord0;. _mtl_o.v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // _color0 = _mtl_i + 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // .a_color0;. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x5f, // l_o.v_color1 = _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, // mtl_i.a_color1;. + 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; extern const uint8_t* vs_debugfont_pssl; extern const uint32_t vs_debugfont_pssl_size; |