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

This commit is contained in:
Branimir Karadžić
2026-09-12 22:43:02 +00:00
committed by GitHub
parent a0b5c3deaa
commit 8ee74e8260
9 changed files with 74 additions and 242 deletions
-35
View File
@@ -944,7 +944,6 @@ namespace bgfx { namespace d3d12
);
m_fbh = BGFX_INVALID_HANDLE;
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
bx::memSet(&m_mainSwapChain, 0, sizeof(m_mainSwapChain) );
#if USE_D3D12_DYNAMIC_LIB
@@ -2162,12 +2161,6 @@ namespace bgfx { namespace d3d12
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;
}
#if BX_PLATFORM_WINDOWS
dumpInfoQueue();
DX_RELEASE_W(m_infoQueue, 0);
@@ -2831,27 +2824,6 @@ namespace bgfx { namespace d3d12
}
}
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;
m_uniformReg.remove(_handle);
}
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override
{
FrameBufferD3D12* swapFb = NULL;
@@ -2977,11 +2949,6 @@ namespace bgfx { namespace d3d12
);
}
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);
@@ -4528,9 +4495,7 @@ namespace bgfx { namespace d3d12
TextureD3D12 m_textures[BGFX_CONFIG_MAX_TEXTURES];
VertexLayout m_vertexLayouts[BGFX_CONFIG_MAX_VERTEX_LAYOUTS];
FrameBufferD3D12 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS+1];
void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
Matrix4 m_predefinedUniforms[PredefinedUniform::Count];
UniformRegistry m_uniformReg;
StateCacheT<ID3D12PipelineState*> m_pipelineStateCache;