Add Vulkan quad integration path

This commit is contained in:
2026-03-27 13:52:56 +08:00
parent 4b21b5d3d1
commit 727b6ca249
23 changed files with 1574 additions and 39 deletions

View File

@@ -1,7 +1,9 @@
#include "XCEngine/RHI/Vulkan/VulkanCommandList.h"
#include "XCEngine/RHI/Vulkan/VulkanBuffer.h"
#include "XCEngine/RHI/Vulkan/VulkanDescriptorSet.h"
#include "XCEngine/RHI/Vulkan/VulkanDevice.h"
#include "XCEngine/RHI/Vulkan/VulkanPipelineLayout.h"
#include "XCEngine/RHI/Vulkan/VulkanPipelineState.h"
#include "XCEngine/RHI/Vulkan/VulkanResourceView.h"
#include "XCEngine/RHI/Vulkan/VulkanTexture.h"
@@ -217,17 +219,66 @@ void VulkanCommandList::SetPipelineState(RHIPipelineState* pso) {
}
void VulkanCommandList::SetGraphicsDescriptorSets(uint32_t firstSet, uint32_t count, RHIDescriptorSet** descriptorSets, RHIPipelineLayout* pipelineLayout) {
(void)firstSet;
(void)count;
(void)descriptorSets;
(void)pipelineLayout;
if (count == 0 || descriptorSets == nullptr || m_commandBuffer == VK_NULL_HANDLE) {
return;
}
VkPipelineLayout nativePipelineLayout = VK_NULL_HANDLE;
if (pipelineLayout != nullptr) {
nativePipelineLayout = static_cast<VulkanPipelineLayout*>(pipelineLayout)->GetPipelineLayout();
} else if (m_currentPipelineState != nullptr) {
nativePipelineLayout = m_currentPipelineState->GetPipelineLayout();
}
if (nativePipelineLayout == VK_NULL_HANDLE) {
return;
}
std::vector<VkDescriptorSet> nativeSets;
nativeSets.reserve(count);
for (uint32_t i = 0; i < count; ++i) {
auto* descriptorSet = static_cast<VulkanDescriptorSet*>(descriptorSets[i]);
if (descriptorSet == nullptr || descriptorSet->GetDescriptorSet() == VK_NULL_HANDLE) {
return;
}
nativeSets.push_back(descriptorSet->GetDescriptorSet());
}
vkCmdBindDescriptorSets(
m_commandBuffer,
VK_PIPELINE_BIND_POINT_GRAPHICS,
nativePipelineLayout,
firstSet,
static_cast<uint32_t>(nativeSets.size()),
nativeSets.data(),
0,
nullptr);
}
void VulkanCommandList::SetComputeDescriptorSets(uint32_t firstSet, uint32_t count, RHIDescriptorSet** descriptorSets, RHIPipelineLayout* pipelineLayout) {
(void)firstSet;
(void)count;
(void)descriptorSets;
(void)pipelineLayout;
if (count == 0 || descriptorSets == nullptr || m_commandBuffer == VK_NULL_HANDLE || pipelineLayout == nullptr) {
return;
}
std::vector<VkDescriptorSet> nativeSets;
nativeSets.reserve(count);
for (uint32_t i = 0; i < count; ++i) {
auto* descriptorSet = static_cast<VulkanDescriptorSet*>(descriptorSets[i]);
if (descriptorSet == nullptr || descriptorSet->GetDescriptorSet() == VK_NULL_HANDLE) {
return;
}
nativeSets.push_back(descriptorSet->GetDescriptorSet());
}
vkCmdBindDescriptorSets(
m_commandBuffer,
VK_PIPELINE_BIND_POINT_COMPUTE,
static_cast<VulkanPipelineLayout*>(pipelineLayout)->GetPipelineLayout(),
firstSet,
static_cast<uint32_t>(nativeSets.size()),
nativeSets.data(),
0,
nullptr);
}
void VulkanCommandList::SetPrimitiveTopology(PrimitiveTopology topology) {