refactor: Clean up RHI interface and implement descriptor set pooling

- Remove unnecessary inline keywords from RHICommandList
- Add TextureType enum for proper texture type classification
- Update DescriptorSet API to support binding with pipeline layout
- Simplify D3D12CommandList implementation
- Implement descriptor set binding with pipeline layout for both D3D12 and OpenGL
This commit is contained in:
2026-03-25 20:50:40 +08:00
parent 6bbd35873b
commit 04a80d10e7
12 changed files with 132 additions and 116 deletions

View File

@@ -43,6 +43,12 @@ void D3D12DescriptorSet::Shutdown() {
}
}
void D3D12DescriptorSet::Bind() {
}
void D3D12DescriptorSet::Unbind() {
}
void D3D12DescriptorSet::Update(uint32_t offset, RHIResourceView* view) {
(void)offset;
(void)view;
@@ -53,10 +59,6 @@ void D3D12DescriptorSet::UpdateSampler(uint32_t offset, RHISampler* sampler) {
(void)sampler;
}
void* D3D12DescriptorSet::GetNativeHandle() {
return this;
}
D3D12_GPU_DESCRIPTOR_HANDLE D3D12DescriptorSet::GetGPUHandle(uint32_t index) const {
if (m_heap == nullptr) {
return D3D12_GPU_DESCRIPTOR_HANDLE{0};
@@ -65,5 +67,14 @@ D3D12_GPU_DESCRIPTOR_HANDLE D3D12DescriptorSet::GetGPUHandle(uint32_t index) con
return D3D12_GPU_DESCRIPTOR_HANDLE{ handle.ptr };
}
void D3D12DescriptorSet::WriteConstant(uint32_t binding, const void* data, size_t size, size_t offset) {
size_t requiredSize = offset + size;
if (m_constantBufferData.size() < requiredSize) {
m_constantBufferData.resize(requiredSize);
}
memcpy(m_constantBufferData.data() + offset, data, size);
m_constantBufferDirty = true;
}
} // namespace RHI
} // namespace XCEngine