Optimized encoder bind state, and uniform updates. (#3976)

This commit is contained in:
Branimir Karadžić
2026-09-12 15:43:02 -07:00
committed by GitHub
parent a0b5c3deaa
commit 8ee74e8260
9 changed files with 74 additions and 242 deletions

View File

@@ -1317,7 +1317,6 @@ VK_IMPORT_DEVICE
VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT swapchainMaintenance1Features = {};
m_fbh = BGFX_INVALID_HANDLE;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_mainSwapChain, 0, sizeof(m_mainSwapChain) );
bool imported = true;
@@ -2540,12 +2539,6 @@ VK_IMPORT_DEVICE
m_textures[ii].destroy();
}
for (uint32_t ii = 0; ii < BX_COUNTOF(m_uniforms); ++ii)
{
bx::free(g_allocator, m_uniforms[ii]);
m_uniforms[ii] = NULL;
}
m_backBuffer.destroy();
m_cmd.shutdown();
@@ -2897,26 +2890,6 @@ VK_IMPORT_DEVICE
}
}
void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override
{
if (NULL != m_uniforms[_handle.idx])
{
bx::free(g_allocator, m_uniforms[_handle.idx]);
}
const uint32_t size = bx::alignUp(g_uniformTypeSize[_type] * _num, 16);
void* data = bx::alloc(g_allocator, size);
bx::memSet(data, 0, size);
m_uniforms[_handle.idx] = data;
m_uniformReg.add(_handle, _name);
}
void destroyUniform(UniformHandle _handle) override
{
bx::free(g_allocator, m_uniforms[_handle.idx]);
m_uniforms[_handle.idx] = NULL;
}
void requestScreenShot(FrameBufferHandle _fbh, const char* _filePath) override
{
FrameBufferVK& frameBuffer = getFrameBuffer(_fbh);
@@ -2966,11 +2939,6 @@ VK_IMPORT_DEVICE
);
}
void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override
{
bx::memCopy(m_uniforms[_loc], _data, _size);
}
void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override
{
m_occlusionQuery.invalidate(_handle);
@@ -5240,9 +5208,7 @@ VK_IMPORT_DEVICE
VertexLayout m_vertexLayouts[BGFX_CONFIG_MAX_VERTEX_LAYOUTS];
FrameBufferVK m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS];
void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
Matrix4 m_predefinedUniforms[PredefinedUniform::Count];
UniformRegistry m_uniformReg;
StateCacheT<VkPipeline> m_pipelineStateCache;
StateCacheT<VkDescriptorSetLayout> m_descriptorSetLayoutCache;