diff --git a/src/bgfx_p.h b/src/bgfx_p.h index c44ecf082..68ad07635 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -3957,7 +3957,6 @@ namespace bgfx void setIndexBuffer(IndexBufferHandle _handle, const IndexBuffer& _ib, uint32_t _firstIndex, uint32_t _numIndices) { - BX_ASSERT(UINT32_MAX != m_draw.m_streamMask, "bgfx::setVertexCount was already called for this draw call."); m_draw.m_startIndex = _firstIndex; m_draw.m_numIndices = _numIndices; m_draw.m_indexBuffer = _handle; @@ -3966,7 +3965,6 @@ namespace bgfx void setIndexBuffer(const DynamicIndexBuffer& _dib, uint32_t _firstIndex, uint32_t _numIndices) { - BX_ASSERT(UINT32_MAX != m_draw.m_streamMask, "bgfx::setVertexCount was already called for this draw call."); const uint32_t indexSize = 0 == (_dib.m_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; m_draw.m_startIndex = _dib.m_startIndex + _firstIndex; m_draw.m_numIndices = bx::min(_numIndices, _dib.m_size/indexSize); @@ -3976,7 +3974,6 @@ namespace bgfx void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) { - BX_ASSERT(UINT32_MAX != m_draw.m_streamMask, "bgfx::setVertexCount was already called for this draw call."); const uint32_t indexSize = _tib->isIndex16 ? 2 : 4; const uint32_t numIndices = bx::min(_numIndices, _tib->size/indexSize); m_draw.m_indexBuffer = _tib->handle; diff --git a/src/dxgi.cpp b/src/dxgi.cpp index 98644a14f..eb9dd20a4 100644 --- a/src/dxgi.cpp +++ b/src/dxgi.cpp @@ -586,7 +586,7 @@ namespace bgfx if (FAILED(hr) ) { - BX_TRACE("Failed to create swap chain."); + BX_TRACE("Failed to create swap chain, hr 0x%08x.", hr); return hr; } @@ -633,7 +633,7 @@ namespace bgfx if (SUCCEEDED(hr) ) { swapChain2->SetMaximumFrameLatency(bx::max(1, _scd.maxFrameLatency) ); - DX_RELEASE(swapChain2, 0); + DX_RELEASE(swapChain2, 1); } } diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index fb313eae5..300cf2676 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -3565,6 +3565,32 @@ namespace bgfx { namespace d3d11 } } + static bool isZeroColorClear(const Clear& _clear, const float _palette[][4]) + { + if (0 == (BGFX_CLEAR_COLOR & _clear.m_flags) ) + { + return false; + } + + if (0 != (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags) ) + { + const uint8_t index = _clear.m_index[0]; + + return UINT8_MAX != index + && 0.0f == _palette[index][0] + && 0.0f == _palette[index][1] + && 0.0f == _palette[index][2] + && 0.0f == _palette[index][3] + ; + } + + return 0 == _clear.m_index[0] + && 0 == _clear.m_index[1] + && 0 == _clear.m_index[2] + && 0 == _clear.m_index[3] + ; + } + void clearQuad(const ClearQuad& _clearQuad, const Rect& _rect, const Clear& _clear, const float _palette[][4]) { uint32_t width; @@ -3584,9 +3610,20 @@ namespace bgfx { namespace d3d11 const Rect fbRect(0, 0, bx::narrowCast(width), bx::narrowCast(height) ); + const bool intColor = true + && isValid(m_fbh) + && m_frameBuffers[m_fbh.idx].m_intColor + && 0 != (_clear.m_flags & BGFX_CLEAR_COLOR) + && !isZeroColorClear(_clear, _palette) + ; + const bool needsQuadClear = true && isValid(m_fbh) - && m_frameBuffers[m_fbh.idx].m_needsQuadClear + && !intColor + && (false + || m_frameBuffers[m_fbh.idx].m_needsQuadClear + || (m_frameBuffers[m_fbh.idx].m_needsQuadClearZero && isZeroColorClear(_clear, _palette) ) + ) ; if (_rect.isEqual(fbRect) @@ -5428,7 +5465,15 @@ namespace bgfx { namespace d3d11 s_renderD3D11->m_deviceCtx->OMSetRenderTargets(0, NULL, NULL); destroySwapChainViews(); - DX_CHECK(s_renderD3D11->m_dxgi.resizeBuffers(m_swapChain, scd) ); + const HRESULT hr = s_renderD3D11->m_dxgi.resizeBuffers(m_swapChain, scd); + + if (FAILED(hr) ) + { + BX_TRACE("Failed to resize swap chain, hr 0x%08x.", hr); + DX_RELEASE(m_swapChain, 0); + m_num = 0; + return; + } createSwapChainViews(); } @@ -5614,6 +5659,7 @@ namespace bgfx { namespace d3d11 m_width = 0; m_height = 0; m_needsQuadClear = false; + m_intColor = false; if (0 < m_numTh) { @@ -5727,6 +5773,18 @@ namespace bgfx { namespace d3d11 } else if (Access::Write == at.access) { + m_needsQuadClearZero |= 0 != at.mip + || 0 != at.layer + || 1 < texture.m_numLayers + ; + + { + const bx::EncodingType::Enum encoding = bx::EncodingType::Enum(bimg::getBlockInfo(bimg::TextureFormat::Enum(texture.m_textureFormat) ).encoding); + m_intColor |= bx::EncodingType::Int == encoding + || bx::EncodingType::Uint == encoding + ; + } + D3D11_RENDER_TARGET_VIEW_DESC desc; desc.Format = texture.getSrvFormat(); switch (texture.m_type) diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h index f7983f6ed..effeabb08 100644 --- a/src/renderer_d3d11.h +++ b/src/renderer_d3d11.h @@ -408,6 +408,8 @@ namespace bgfx { namespace d3d11 , m_numUav(0) , m_needPresent(false) , m_needsQuadClear(false) + , m_needsQuadClearZero(false) + , m_intColor(false) { bx::memSet(&m_desc, 0, sizeof(m_desc) ); bx::memSet(m_rtv, 0, sizeof(m_rtv) ); @@ -452,6 +454,8 @@ namespace bgfx { namespace d3d11 uint8_t m_numUav; bool m_needPresent; bool m_needsQuadClear; + bool m_needsQuadClearZero; + bool m_intColor; }; struct TimerQueryD3D11 diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index e8bb65790..0868301cf 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -472,6 +472,18 @@ namespace bgfx { namespace d3d12 _commandList->ResourceBarrier(1, &barrier); } + void setResourceBarrier(ID3D12GraphicsCommandList* _commandList, const ID3D12Resource* _resource, D3D12_RESOURCE_STATES _stateBefore, D3D12_RESOURCE_STATES _stateAfter, uint32_t _subresource) + { + D3D12_RESOURCE_BARRIER barrier; + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; + barrier.Transition.pResource = const_cast(_resource); + barrier.Transition.Subresource = _subresource; + barrier.Transition.StateBefore = _stateBefore; + barrier.Transition.StateAfter = _stateAfter; + _commandList->ResourceBarrier(1, &barrier); + } + BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunused-const-variable"); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration"); @@ -1715,7 +1727,6 @@ namespace bgfx { namespace d3d12 DX_RELEASE(outBlob, 0); } - /// m_directAccessSupport = true && BX_ENABLED(BX_PLATFORM_XBOXONE) && m_architecture.UMA @@ -2904,7 +2915,7 @@ namespace bgfx { namespace d3d12 if (NULL != swapFb) { - DX_RELEASE(backBuffer, 0); + DX_RELEASE(backBuffer, swapFb->getSwapChainDesc().bufferCount); } } @@ -3365,7 +3376,8 @@ namespace bgfx { namespace d3d12 for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) { TextureD3D12& texture = m_textures[frameBuffer.m_texture[ii].idx]; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + const Attachment& at = frameBuffer.m_attachment[frameBuffer.m_colorAttachIdx[ii]]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, at.mip, 1, at.layer, at.numLayers); } if (isValid(frameBuffer.m_depth) ) @@ -3457,7 +3469,8 @@ namespace bgfx { namespace d3d12 for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) { TextureD3D12& texture = m_textures[frameBuffer.m_texture[ii].idx]; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_RENDER_TARGET); + const Attachment& at = frameBuffer.m_attachment[frameBuffer.m_colorAttachIdx[ii]]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_RENDER_TARGET, at.mip, 1, at.layer, at.numLayers); } if (isValid(frameBuffer.m_depth) ) @@ -3891,7 +3904,9 @@ namespace bgfx { namespace d3d12 murmur.add(0 < frameBuffer.m_num ? m_textures[frameBuffer.m_texture[0].idx].m_flags & BGFX_TEXTURE_RT_MSAA_MASK - : UINT64_C(0) + : isValid(frameBuffer.m_depth) + ? m_textures[frameBuffer.m_depth.idx].m_flags & BGFX_TEXTURE_RT_MSAA_MASK + : UINT64_C(0) ); } else @@ -4028,9 +4043,13 @@ namespace bgfx { namespace d3d12 // (BGFX_SWAP_CHAIN_MSAA_*), not main's. desc.SampleDesc = frameBuffer.getSwapChainDesc().sampleDesc; } - else if (0 < frameBuffer.m_num) + else if (0 < frameBuffer.m_num || isValid(frameBuffer.m_depth) ) { - const uint64_t flags = m_textures[frameBuffer.m_texture[0].idx].m_flags; + const TextureHandle th = 0 < frameBuffer.m_num + ? frameBuffer.m_texture[0] + : frameBuffer.m_depth + ; + const uint64_t flags = m_textures[th.idx].m_flags; const uint32_t msaaQuality = bx::satSub(uint32_t( (flags & BGFX_TEXTURE_RT_MSAA_MASK) >> BGFX_TEXTURE_RT_MSAA_SHIFT), 1u); desc.SampleDesc = s_msaa[msaaQuality]; @@ -4720,28 +4739,28 @@ namespace bgfx { namespace d3d12 srvd->Texture3D.ResourceMinLODClamp = 0; break; } + } - if (_stencil) + if (_stencil) + { + srvd->Format = DXGI_FORMAT_R32G8X24_TYPELESS == s_textureFormat[_texture.m_textureFormat].m_fmt + ? DXGI_FORMAT_X32_TYPELESS_G8X24_UINT + : DXGI_FORMAT_X24_TYPELESS_G8_UINT + ; + srvd->Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + + switch (srvd->ViewDimension) { - srvd->Format = DXGI_FORMAT_R32G8X24_TYPELESS == s_textureFormat[_texture.m_textureFormat].m_fmt - ? DXGI_FORMAT_X32_TYPELESS_G8X24_UINT - : DXGI_FORMAT_X24_TYPELESS_G8_UINT - ; - srvd->Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + case D3D12_SRV_DIMENSION_TEXTURE2D: + srvd->Texture2D.PlaneSlice = 1; + break; - switch (srvd->ViewDimension) - { - case D3D12_SRV_DIMENSION_TEXTURE2D: - srvd->Texture2D.PlaneSlice = 1; - break; + case D3D12_SRV_DIMENSION_TEXTURE2DARRAY: + srvd->Texture2DArray.PlaneSlice = 1; + break; - case D3D12_SRV_DIMENSION_TEXTURE2DARRAY: - srvd->Texture2DArray.PlaneSlice = 1; - break; - - default: - break; - } + default: + break; } } @@ -6864,6 +6883,9 @@ namespace bgfx { namespace d3d12 videoDecoderDestroy(m_videoDecoder); m_videoDecoder = NULL; + bx::free(g_allocator, m_subStates); + m_subStates = NULL; + if (NULL != m_ptr) { if (NULL != m_directAccessPtr) @@ -7243,8 +7265,51 @@ namespace bgfx { namespace d3d12 return 1 < s_msaa[msaaQuality].Count; } + uint32_t TextureD3D12::getNumSlices() const + { + return Texture3D == m_type + ? 1 + : bx::max(m_numLayers, 1) * (TextureCube == m_type ? 6 : 1) + ; + } + + uint32_t TextureD3D12::getNumPtrMips() const + { + return NULL != m_singleMsaa + ? 1 + : bx::max(m_numMips, 1) + ; + } + + uint32_t TextureD3D12::getNumSubresources() const + { + return getNumPtrMips() * getNumSlices(); + } + D3D12_RESOURCE_STATES TextureD3D12::setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state) { + if (NULL != m_subStates) + { + const uint32_t numSubresources = getNumSubresources(); + + for (uint32_t ii = 0; ii < numSubresources; ++ii) + { + if (m_subStates[ii] != _state) + { + setResourceBarrier(_commandList, m_ptr, m_subStates[ii], _state, ii); + m_subStates[ii] = _state; + } + } + + const D3D12_RESOURCE_STATES old = m_state; + m_state = _state; + + bx::free(g_allocator, m_subStates); + m_subStates = NULL; + + return old; + } + if (m_state != _state) { setResourceBarrier(_commandList @@ -7259,6 +7324,58 @@ namespace bgfx { namespace d3d12 return _state; } + void TextureD3D12::setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state, uint16_t _firstMip, uint16_t _numMips, uint16_t _firstSlice, uint16_t _numSlices) + { + const uint32_t mipCount = getNumPtrMips(); + const uint32_t sliceCount = getNumSlices(); + + const uint32_t firstMip = bx::min(_firstMip, mipCount - 1); + const uint32_t numMips = 0 == _numMips + ? mipCount - firstMip + : bx::min(_numMips, mipCount - firstMip) + ; + + const uint32_t firstSlice = bx::min(_firstSlice, sliceCount - 1); + const uint32_t numSlices = 0 == _numSlices + ? sliceCount - firstSlice + : bx::min(_numSlices, sliceCount - firstSlice) + ; + + if (0 == firstMip + && 0 == firstSlice + && numMips == mipCount + && numSlices == sliceCount) + { + setState(_commandList, _state); + return; + } + + if (NULL == m_subStates) + { + const uint32_t numSubresources = getNumSubresources(); + m_subStates = (D3D12_RESOURCE_STATES*)bx::alloc(g_allocator, numSubresources*sizeof(D3D12_RESOURCE_STATES) ); + + for (uint32_t ii = 0; ii < numSubresources; ++ii) + { + m_subStates[ii] = m_state; + } + } + + for (uint32_t slice = firstSlice, sliceEnd = firstSlice + numSlices; slice < sliceEnd; ++slice) + { + for (uint32_t mip = firstMip, mipEnd = firstMip + numMips; mip < mipEnd; ++mip) + { + const uint32_t subresource = mip + slice*mipCount; + + if (m_subStates[subresource] != _state) + { + setResourceBarrier(_commandList, m_ptr, m_subStates[subresource], _state, subresource); + m_subStates[subresource] = _state; + } + } + } + } + void RendererContextD3D12::generateMips(ID3D12GraphicsCommandList* _commandList, TextureD3D12& _texture) { if (NULL == m_mipGen @@ -7491,7 +7608,25 @@ namespace bgfx { namespace d3d12 }; static_assert(BX_COUNTOF(nodeMask) == BX_COUNTOF(presentQueue) ); - DX_CHECK(s_renderD3D12->m_dxgi.resizeBuffers(m_swapChain, scd, nodeMask, presentQueue) ); + const HRESULT hr = s_renderD3D12->m_dxgi.resizeBuffers(m_swapChain, scd, nodeMask, presentQueue); + + if (FAILED(hr) ) + { + BX_TRACE("Failed to resize swap chain, hr 0x%08x.", hr); + +#if !BX_PLATFORM_LINUX + if (NULL != m_frameLatencyWaitableObject) + { + CloseHandle( (HANDLE)m_frameLatencyWaitableObject); + m_frameLatencyWaitableObject = NULL; + } +#endif // !BX_PLATFORM_LINUX + + DX_RELEASE(m_swapChain, 0); + m_swapChainFormat = DXGI_FORMAT_UNKNOWN; + m_num = 0; + return; + } m_state = D3D12_RESOURCE_STATE_PRESENT; m_swapChainFormat = scd.format; @@ -7860,6 +7995,7 @@ namespace bgfx { namespace d3d12 else if (Access::Write == at.access) { m_texture[m_num] = at.handle; + m_colorAttachIdx[m_num] = uint8_t(ii); D3D12_CPU_DESCRIPTOR_HANDLE rtv = { rtvDescriptor.ptr + m_num * rtvDescriptorSize }; D3D12_RENDER_TARGET_VIEW_DESC desc; @@ -8047,7 +8183,7 @@ namespace bgfx { namespace d3d12 , _state ); - DX_RELEASE(colorBuffer, 0); + DX_RELEASE(colorBuffer, getSwapChainDesc().bufferCount); bx::swap(m_state, _state); } @@ -9360,7 +9496,7 @@ namespace bgfx { namespace d3d12 ? bind.m_samplerFlags : uint32_t(texture.m_flags) ; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ, bind.m_firstMip, bind.m_numMips, bind.m_firstLayer, bind.m_numLayers); scratchBuffer.allocSrv(srvHandle[stage], texture, bind.m_firstLayer, bind.m_numLayers, bind.m_firstMip, bind.m_numMips , 0 != (resolvedFlags & BGFX_SAMPLER_SAMPLE_STENCIL) , program.getTextureDimension(uint8_t(stage) ) @@ -9723,7 +9859,7 @@ namespace bgfx { namespace d3d12 ? bind.m_samplerFlags : uint32_t(texture.m_flags) ; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ, bind.m_firstMip, bind.m_numMips, bind.m_firstLayer, bind.m_numLayers); scratchBuffer.allocSrv(srvHandle[stage], texture, bind.m_firstLayer, bind.m_numLayers, bind.m_firstMip, bind.m_numMips , 0 != (resolvedFlags & BGFX_SAMPLER_SAMPLE_STENCIL) , program.getTextureDimension(uint8_t(stage) ) diff --git a/src/renderer_d3d12.h b/src/renderer_d3d12.h index 834e01c1b..b49f02300 100644 --- a/src/renderer_d3d12.h +++ b/src/renderer_d3d12.h @@ -441,6 +441,7 @@ namespace bgfx { namespace d3d12 , m_handle(NULL) , m_directAccessPtr(NULL) , m_state(D3D12_RESOURCE_STATE_COMMON) + , m_subStates(NULL) , m_numMips(0) , m_videoDecoder(NULL) { @@ -455,6 +456,13 @@ namespace bgfx { namespace d3d12 void update(ID3D12GraphicsCommandList* _commandList, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void resolve(ID3D12GraphicsCommandList* _commandList, uint8_t _resolve, uint32_t _layer, uint32_t _numLayers, uint32_t _mip); D3D12_RESOURCE_STATES setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state); + + void setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state, uint16_t _firstMip, uint16_t _numMips, uint16_t _firstSlice, uint16_t _numSlices); + + uint32_t getNumSlices() const; + uint32_t getNumPtrMips() const; + uint32_t getNumSubresources() const; + bool isMsaaSurface() const; bool isMultisampled() const; @@ -466,6 +474,7 @@ namespace bgfx { namespace d3d12 HANDLE m_handle; void* m_directAccessPtr; D3D12_RESOURCE_STATES m_state; + D3D12_RESOURCE_STATES* m_subStates; uint64_t m_flags; uint32_t m_width; uint32_t m_height; @@ -535,6 +544,7 @@ namespace bgfx { namespace d3d12 uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; + uint8_t m_colorAttachIdx[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; D3D12_RESOURCE_STATES m_state; bool m_needPresent; diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index dbaac09df..709fe5d2c 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -3152,6 +3152,8 @@ namespace bgfx { namespace gl } } + m_glctx.makeCurrent(NULL); + if (m_needPresent) { // Ensure the back buffer is bound as the source of the flip @@ -3745,6 +3747,9 @@ namespace bgfx { namespace gl , true ); bx::free(g_allocator, data); + + m_glctx.makeCurrent(NULL); + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) ); } void updateViewName(ViewId _id, const char* _name) override @@ -3849,6 +3854,8 @@ namespace bgfx { namespace gl GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) ); } + BGFX_GL_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame); + GL_CHECK(glViewport(0, 0, width, height) ); GL_CHECK(glDisable(GL_SCISSOR_TEST) ); @@ -3925,6 +3932,10 @@ namespace bgfx { namespace gl void dbgTextRenderEnd(TextVideoMemBlitter& /*_blitter*/) override { + BGFX_GL_PROFILER_END(); + + m_glctx.makeCurrent(NULL); + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) ); } void updateResolution(const SwapChain& _swapChain, uint32_t _reset) @@ -4010,6 +4021,12 @@ namespace bgfx { namespace gl && m_rtMsaa) { FrameBufferGL& frameBuffer = m_frameBuffers[m_fbh.idx]; + + m_glctx.makeCurrent(UINT16_MAX != frameBuffer.m_denseIdx + ? frameBuffer.m_swapChain + : NULL + ); + frameBuffer.resolve(); m_rtMsaa = false; } @@ -7152,6 +7169,8 @@ namespace bgfx { namespace gl void FrameBufferGL::create(uint8_t _num, const Attachment* _attachment) { + s_renderGL->m_glctx.makeCurrent(NULL); + GL_CHECK(glGenFramebuffers(1, &m_fbo[0]) ); m_denseIdx = UINT16_MAX; @@ -9828,17 +9847,13 @@ namespace bgfx { namespace gl max = frameTime; } - dbgTextSubmit(this, _textVideoMemBlitter, tvm, _render->m_debugFrameBuffer, _render->m_debugTextScale); - BGFX_GL_PROFILER_END(); + + dbgTextSubmit(this, _textVideoMemBlitter, tvm, _render->m_debugFrameBuffer, _render->m_debugTextScale); } else if (_render->m_debug & BGFX_DEBUG_TEXT) { - BGFX_GL_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame); - dbgTextSubmit(this, _textVideoMemBlitter, _render->m_textVideoMem, _render->m_debugFrameBuffer, _render->m_debugTextScale); - - BGFX_GL_PROFILER_END(); } if (0 != m_vao) diff --git a/src/renderer_webgpu.cpp b/src/renderer_webgpu.cpp index 32e909084..1854b53fa 100644 --- a/src/renderer_webgpu.cpp +++ b/src/renderer_webgpu.cpp @@ -5607,7 +5607,9 @@ WGPU_IMPORT .usage = m_surfaceConfig.usage, }; - return WGPU_CHECK(wgpuTextureCreateView(m_texture, &textureViewDesc) ); + WGPUTextureView textureView = WGPU_CHECK(wgpuTextureCreateView(m_texture, &textureViewDesc) ); + + return textureView; } void SwapChainWGPU::present()