RHI: Add DescriptorSet abstraction for D3D12 and OpenGL backends
- Add RHIDescriptorSet base class with Update/UpdateSampler/GetNativeHandle - Add RHIDescriptorPool with AllocateSet/FreeSet methods - Add SetGraphicsDescriptorSets/SetComputeDescriptorSets to RHICommandList - Implement D3D12DescriptorSet using descriptor heap allocation - Implement OpenGLDescriptorSet using TextureUnitAllocator - Add CreateDescriptorPool/CreateDescriptorSet factory methods to RHIDevice - Fix unit test SetVertexBuffer -> SetVertexBuffers API - Add SetVertexBuffer convenience method for D3D12 backward compatibility - Update CMakeLists.txt with new source files
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLShader.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLFramebuffer.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLRenderPass.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLDescriptorSet.h"
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace XCEngine {
|
||||
@@ -650,6 +651,38 @@ void OpenGLCommandList::SetPipelineState(RHIPipelineState* pipelineState) {
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetGraphicsDescriptorSets(
|
||||
uint32_t firstSet,
|
||||
uint32_t count,
|
||||
RHIDescriptorSet** descriptorSets,
|
||||
RHIPipelineLayout* pipelineLayout) {
|
||||
(void)firstSet;
|
||||
(void)pipelineLayout;
|
||||
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
if (descriptorSets[i] != nullptr) {
|
||||
OpenGLDescriptorSet* glSet = static_cast<OpenGLDescriptorSet*>(descriptorSets[i]);
|
||||
glSet->Bind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetComputeDescriptorSets(
|
||||
uint32_t firstSet,
|
||||
uint32_t count,
|
||||
RHIDescriptorSet** descriptorSets,
|
||||
RHIPipelineLayout* pipelineLayout) {
|
||||
(void)firstSet;
|
||||
(void)pipelineLayout;
|
||||
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
if (descriptorSets[i] != nullptr) {
|
||||
OpenGLDescriptorSet* glSet = static_cast<OpenGLDescriptorSet*>(descriptorSets[i]);
|
||||
glSet->Bind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLCommandList::SetVertexBuffers(uint32_t startSlot, uint32_t count, RHIResourceView** buffers, const uint64_t* offsets, const uint32_t* strides) {
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (!buffers[i]) continue;
|
||||
|
||||
Reference in New Issue
Block a user