@@ -2700,12 +2700,13 @@ VK_IMPORT_DEVICE
2700
2700
void blitRender (TextVideoMemBlitter& _blitter, uint32_t _numIndices) override
2701
2701
{
2702
2702
const uint32_t numVertices = _numIndices*4 /6 ;
2703
- if (0 < numVertices && m_backBuffer.isRenderable () )
2703
+
2704
+ if (0 < numVertices
2705
+ && m_backBuffer.isRenderable () )
2704
2706
{
2705
- m_indexBuffers[_blitter.m_ib ->handle .idx ].update (m_commandBuffer, 0 , _numIndices*2 , _blitter.m_ib ->data );
2707
+ m_indexBuffers[_blitter.m_ib ->handle .idx ].update (m_commandBuffer, 0 , _numIndices*2 , _blitter.m_ib ->data , true );
2706
2708
m_vertexBuffers[_blitter.m_vb ->handle .idx ].update (m_commandBuffer, 0 , numVertices*_blitter.m_layout .m_stride , _blitter.m_vb ->data , true );
2707
2709
2708
-
2709
2710
VkRenderPassBeginInfo rpbi;
2710
2711
rpbi.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
2711
2712
rpbi.pNext = NULL ;
@@ -2720,7 +2721,6 @@ VK_IMPORT_DEVICE
2720
2721
2721
2722
vkCmdBeginRenderPass (m_commandBuffer, &rpbi, VK_SUBPASS_CONTENTS_INLINE);
2722
2723
vkCmdDrawIndexed (m_commandBuffer, _numIndices, 1 , 0 , 0 , 0 );
2723
-
2724
2724
vkCmdEndRenderPass (m_commandBuffer);
2725
2725
}
2726
2726
}
@@ -4454,25 +4454,26 @@ VK_IMPORT_DEVICE
4454
4454
return createHostBuffer (_size, flags, _buffer, _memory, _data);
4455
4455
}
4456
4456
4457
- StagingBufferVK allocFromScratchStagingBuffer (uint32_t _size, uint32_t _align, const void * _data = NULL )
4457
+ StagingBufferVK allocFromScratchStagingBuffer (uint32_t _size, uint32_t _align, const void * _data = NULL , bool _tryScratch = true )
4458
4458
{
4459
4459
BGFX_PROFILER_SCOPE (" allocFromScratchStagingBuffer" , kColorResource );
4460
4460
4461
4461
StagingBufferVK result;
4462
4462
ScratchBufferVK &scratch = m_scratchStagingBuffer[m_cmd.m_currentFrameInFlight ];
4463
4463
4464
- if (_size <= BGFX_CONFIG_MAX_STAGING_SIZE_FOR_SCRATCH_BUFFER)
4464
+ if (_tryScratch
4465
+ && _size <= BGFX_CONFIG_MAX_STAGING_SIZE_FOR_SCRATCH_BUFFER)
4465
4466
{
4466
4467
const uint32_t scratchOffset = scratch.alloc (_size, _align);
4467
4468
4468
- if (scratchOffset != UINT32_MAX )
4469
+ if (UINT32_MAX != scratchOffset )
4469
4470
{
4470
- result.m_isFromScratch = true ;
4471
- result.m_size = _size;
4472
- result.m_offset = scratchOffset;
4473
- result.m_buffer = scratch.m_buffer ;
4471
+ result.m_isFromScratch = true ;
4472
+ result.m_size = _size;
4473
+ result.m_offset = scratchOffset;
4474
+ result.m_buffer = scratch.m_buffer ;
4474
4475
result.m_deviceMem = scratch.m_deviceMem ;
4475
- result.m_data = scratch.m_data + result.m_offset ;
4476
+ result.m_data = scratch.m_data + result.m_offset ;
4476
4477
4477
4478
if (_data != NULL )
4478
4479
{
@@ -4489,9 +4490,9 @@ VK_IMPORT_DEVICE
4489
4490
4490
4491
VK_CHECK (createStagingBuffer (_size, &result.m_buffer , &result.m_deviceMem , _data));
4491
4492
4492
- result.m_size = _size;
4493
+ result.m_size = _size;
4493
4494
result.m_offset = 0 ;
4494
- result.m_data = NULL ;
4495
+ result.m_data = NULL ;
4495
4496
4496
4497
return result;
4497
4498
}
@@ -4839,7 +4840,7 @@ VK_DESTROY
4839
4840
BGFX_PROFILER_SCOPE (" BufferVK::update" , kColorFrame );
4840
4841
BX_UNUSED (_discard);
4841
4842
4842
- StagingBufferVK stagingBuffer = s_renderVK->allocFromScratchStagingBuffer (_size, 8 , _data);
4843
+ StagingBufferVK stagingBuffer = s_renderVK->allocFromScratchStagingBuffer (_size, 8 , _data, !_discard );
4843
4844
4844
4845
VkBufferCopy region;
4845
4846
region.srcOffset = stagingBuffer.m_offset ;
0 commit comments