Adding some barriers
This commit is contained in:
@@ -124,7 +124,6 @@ void DebugPass::createRenderPass()
|
|||||||
gfxInfo.vertexShader = vertexShader;
|
gfxInfo.vertexShader = vertexShader;
|
||||||
gfxInfo.fragmentShader = fragmentShader;
|
gfxInfo.fragmentShader = fragmentShader;
|
||||||
gfxInfo.rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_LINE;
|
gfxInfo.rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_LINE;
|
||||||
gfxInfo.rasterizationState.lineWidth = 5.f;
|
|
||||||
gfxInfo.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
gfxInfo.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||||
gfxInfo.pipelineLayout = std::move(pipelineLayout);
|
gfxInfo.pipelineLayout = std::move(pipelineLayout);
|
||||||
gfxInfo.renderPass = renderPass;
|
gfxInfo.renderPass = renderPass;
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ void RenderPass::beginFrame(const Component::Camera& cam)
|
|||||||
.data = (uint8*)&viewParams,
|
.data = (uint8*)&viewParams,
|
||||||
};
|
};
|
||||||
viewParamsBuffer->updateContents(uniformUpdate);
|
viewParamsBuffer->updateContents(uniformUpdate);
|
||||||
|
viewParamsBuffer->pipelineBarrier(
|
||||||
|
Gfx::SE_ACCESS_TRANSFER_WRITE_BIT,
|
||||||
|
Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
|
Gfx::SE_ACCESS_MEMORY_READ_BIT,
|
||||||
|
Gfx::SE_PIPELINE_STAGE_ALL_COMMANDS_BIT);
|
||||||
viewParamsLayout->reset();
|
viewParamsLayout->reset();
|
||||||
viewParamsSet = viewParamsLayout->allocateDescriptorSet();
|
viewParamsSet = viewParamsLayout->allocateDescriptorSet();
|
||||||
viewParamsSet->updateBuffer(0, viewParamsBuffer);
|
viewParamsSet->updateBuffer(0, viewParamsBuffer);
|
||||||
|
|||||||
@@ -72,6 +72,12 @@ void VertexData::createDescriptors()
|
|||||||
.numElements = instanceData.size(),
|
.numElements = instanceData.size(),
|
||||||
.dynamic = false,
|
.dynamic = false,
|
||||||
});
|
});
|
||||||
|
matInst.instanceBuffer->pipelineBarrier(
|
||||||
|
Gfx::SE_ACCESS_TRANSFER_WRITE_BIT,
|
||||||
|
Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
|
Gfx::SE_ACCESS_MEMORY_READ_BIT,
|
||||||
|
Gfx::SE_PIPELINE_STAGE_VERTEX_SHADER_BIT
|
||||||
|
);
|
||||||
matInst.descriptorSet = instanceDataLayout->allocateDescriptorSet();
|
matInst.descriptorSet = instanceDataLayout->allocateDescriptorSet();
|
||||||
|
|
||||||
matInst.meshDataBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
matInst.meshDataBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||||
@@ -82,6 +88,12 @@ void VertexData::createDescriptors()
|
|||||||
.numElements = meshes.size(),
|
.numElements = meshes.size(),
|
||||||
.dynamic = false,
|
.dynamic = false,
|
||||||
});
|
});
|
||||||
|
matInst.meshDataBuffer->pipelineBarrier(
|
||||||
|
Gfx::SE_ACCESS_TRANSFER_WRITE_BIT,
|
||||||
|
Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
|
Gfx::SE_ACCESS_MEMORY_READ_BIT,
|
||||||
|
Gfx::SE_PIPELINE_STAGE_VERTEX_SHADER_BIT
|
||||||
|
);
|
||||||
matInst.descriptorSet->updateBuffer(0, matInst.instanceBuffer);
|
matInst.descriptorSet->updateBuffer(0, matInst.instanceBuffer);
|
||||||
matInst.descriptorSet->updateBuffer(1, matInst.meshDataBuffer);
|
matInst.descriptorSet->updateBuffer(1, matInst.meshDataBuffer);
|
||||||
matInst.descriptorSet->updateBuffer(2, meshletBuffer);
|
matInst.descriptorSet->updateBuffer(2, meshletBuffer);
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
thread_local OCommandPool Seele::Vulkan::Graphics::graphicsCommands = nullptr;
|
thread_local PCommandPool Seele::Vulkan::Graphics::graphicsCommands = nullptr;
|
||||||
thread_local OCommandPool Seele::Vulkan::Graphics::computeCommands = nullptr;
|
thread_local PCommandPool Seele::Vulkan::Graphics::computeCommands = nullptr;
|
||||||
thread_local OCommandPool Seele::Vulkan::Graphics::transferCommands = nullptr;
|
thread_local PCommandPool Seele::Vulkan::Graphics::transferCommands = nullptr;
|
||||||
thread_local OCommandPool Seele::Vulkan::Graphics::dedicatedTransferCommands = nullptr;
|
thread_local PCommandPool Seele::Vulkan::Graphics::dedicatedTransferCommands = nullptr;
|
||||||
|
|
||||||
Graphics::Graphics()
|
Graphics::Graphics()
|
||||||
: instance(VK_NULL_HANDLE)
|
: instance(VK_NULL_HANDLE)
|
||||||
@@ -35,15 +35,12 @@ Graphics::Graphics()
|
|||||||
Graphics::~Graphics()
|
Graphics::~Graphics()
|
||||||
{
|
{
|
||||||
vkDeviceWaitIdle(handle);
|
vkDeviceWaitIdle(handle);
|
||||||
graphicsCommands = nullptr;
|
|
||||||
computeCommands = nullptr;
|
|
||||||
transferCommands = nullptr;
|
|
||||||
dedicatedTransferCommands = nullptr;
|
|
||||||
pipelineCache = nullptr;
|
pipelineCache = nullptr;
|
||||||
allocator = nullptr;
|
allocator = nullptr;
|
||||||
destructionManager = nullptr;
|
destructionManager = nullptr;
|
||||||
allocatedFramebuffers.clear();
|
allocatedFramebuffers.clear();
|
||||||
shaderCompiler = nullptr;
|
shaderCompiler = nullptr;
|
||||||
|
pools.clear();
|
||||||
vkDestroyDevice(handle, nullptr);
|
vkDestroyDevice(handle, nullptr);
|
||||||
DestroyDebugReportCallbackEXT(instance, nullptr, callback);
|
DestroyDebugReportCallbackEXT(instance, nullptr, callback);
|
||||||
vkDestroyInstance(instance, nullptr);
|
vkDestroyInstance(instance, nullptr);
|
||||||
@@ -315,7 +312,8 @@ PCommandPool Graphics::getGraphicsCommands()
|
|||||||
{
|
{
|
||||||
if(graphicsCommands == nullptr)
|
if(graphicsCommands == nullptr)
|
||||||
{
|
{
|
||||||
graphicsCommands = new CommandPool(this, graphicsQueue);
|
std::unique_lock l(poolLock);
|
||||||
|
graphicsCommands = pools.add(new CommandPool(this, graphicsQueue));
|
||||||
}
|
}
|
||||||
return graphicsCommands;
|
return graphicsCommands;
|
||||||
}
|
}
|
||||||
@@ -323,7 +321,8 @@ PCommandPool Graphics::getComputeCommands()
|
|||||||
{
|
{
|
||||||
if(computeCommands == nullptr)
|
if(computeCommands == nullptr)
|
||||||
{
|
{
|
||||||
computeCommands = new CommandPool(this, computeQueue);
|
std::unique_lock l(poolLock);
|
||||||
|
computeCommands = pools.add(new CommandPool(this, computeQueue));
|
||||||
}
|
}
|
||||||
return computeCommands;
|
return computeCommands;
|
||||||
}
|
}
|
||||||
@@ -331,7 +330,8 @@ PCommandPool Graphics::getTransferCommands()
|
|||||||
{
|
{
|
||||||
if(transferCommands == nullptr)
|
if(transferCommands == nullptr)
|
||||||
{
|
{
|
||||||
transferCommands = new CommandPool(this, transferQueue);
|
std::unique_lock l(poolLock);
|
||||||
|
transferCommands = pools.add(new CommandPool(this, transferQueue));
|
||||||
}
|
}
|
||||||
return transferCommands;
|
return transferCommands;
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,8 @@ PCommandPool Graphics::getDedicatedTransferCommands()
|
|||||||
{
|
{
|
||||||
if(dedicatedTransferCommands == nullptr)
|
if(dedicatedTransferCommands == nullptr)
|
||||||
{
|
{
|
||||||
dedicatedTransferCommands = new CommandPool(this, dedicatedTransferQueue != nullptr ? dedicatedTransferQueue : transferQueue);
|
std::unique_lock l(poolLock);
|
||||||
|
dedicatedTransferCommands = pools.add(new CommandPool(this, dedicatedTransferQueue != nullptr ? dedicatedTransferQueue : transferQueue));
|
||||||
}
|
}
|
||||||
return dedicatedTransferCommands;
|
return dedicatedTransferCommands;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,10 +88,12 @@ protected:
|
|||||||
OQueue computeQueue;
|
OQueue computeQueue;
|
||||||
OQueue transferQueue;
|
OQueue transferQueue;
|
||||||
OQueue dedicatedTransferQueue;
|
OQueue dedicatedTransferQueue;
|
||||||
thread_local static OCommandPool graphicsCommands;
|
thread_local static PCommandPool graphicsCommands;
|
||||||
thread_local static OCommandPool computeCommands;
|
thread_local static PCommandPool computeCommands;
|
||||||
thread_local static OCommandPool transferCommands;
|
thread_local static PCommandPool transferCommands;
|
||||||
thread_local static OCommandPool dedicatedTransferCommands;
|
thread_local static PCommandPool dedicatedTransferCommands;
|
||||||
|
std::mutex poolLock;
|
||||||
|
Array<OCommandPool> pools;
|
||||||
VkPhysicalDeviceProperties props;
|
VkPhysicalDeviceProperties props;
|
||||||
VkPhysicalDeviceFeatures2 features;
|
VkPhysicalDeviceFeatures2 features;
|
||||||
VkPhysicalDeviceVulkan11Features features11;
|
VkPhysicalDeviceVulkan11Features features11;
|
||||||
|
|||||||
Reference in New Issue
Block a user