Adding DXC

This commit is contained in:
Dynamitos
2024-04-12 09:27:30 +02:00
parent 4dc2df800a
commit efb2c0e169
17 changed files with 164 additions and 76 deletions
+12 -6
View File
@@ -82,7 +82,7 @@ void Command::endRenderPass()
state = State::Begin;
}
void Command::executeCommands(const Array<Gfx::ORenderCommand>& commands)
void Command::executeCommands(Array<Gfx::ORenderCommand> commands)
{
assert(state == State::RenderPass);
if(commands.size() == 0)
@@ -95,18 +95,18 @@ void Command::executeCommands(const Array<Gfx::ORenderCommand>& commands)
{
auto command = Gfx::PRenderCommand(commands[i]).cast<RenderCommand>();
command->end();
executingRenders.add(command);
for(auto& descriptor : command->boundDescriptors)
{
boundDescriptors.add(descriptor);
//std::cout << "Cmd " << handle << " bound descriptor " << descriptor->getHandle() << std::endl;
}
cmdBuffers[i] = command->getHandle();
executingRenders.add(std::move(commands[i]));
}
vkCmdExecuteCommands(handle, (uint32)cmdBuffers.size(), cmdBuffers.data());
}
void Command::executeCommands(const Array<Gfx::OComputeCommand>& commands)
void Command::executeCommands(Array<Gfx::OComputeCommand> commands)
{
if(commands.size() == 0)
{
@@ -117,13 +117,13 @@ void Command::executeCommands(const Array<Gfx::OComputeCommand>& commands)
{
auto command = Gfx::PComputeCommand(commands[i]).cast<ComputeCommand>();
command->end();
executingComputes.add(command);
for(auto& descriptor : command->boundDescriptors)
{
boundDescriptors.add(descriptor);
//std::cout << "Cmd " << handle << " bound descriptor " << descriptor->getHandle() << std::endl;
}
cmdBuffers[i] = command->getHandle();
executingComputes.add(std::move(commands[i]));
}
vkCmdExecuteCommands(handle, (uint32)cmdBuffers.size(), cmdBuffers.data());
}
@@ -487,12 +487,18 @@ PCommand CommandPool::getCommands()
}
void CommandPool::cacheCommands(Array<ORenderCommand> commands)
{
allocatedRenderCommands.addAll(commands);
for(auto&& command : commands)
{
allocatedRenderCommands.add(std::move(command));
}
}
void CommandPool::cacheCommands(Array<OComputeCommand> commands)
{
allocatedComputeCommands.addAll(commands);
for(auto&& command : commands)
{
allocatedComputeCommands.add(std::move(command));
}
}
ORenderCommand CommandPool::createRenderCommand(const std::string& name)
+5 -5
View File
@@ -22,8 +22,8 @@ public:
void end();
void beginRenderPass(PRenderPass renderPass, PFramebuffer framebuffer);
void endRenderPass();
void executeCommands(const Array<Gfx::ORenderCommand> &secondaryCommands);
void executeCommands(const Array<Gfx::OComputeCommand> &secondaryCommands);
void executeCommands(Array<Gfx::ORenderCommand> secondaryCommands);
void executeCommands(Array<Gfx::OComputeCommand> secondaryCommands);
void waitForSemaphore(VkPipelineStageFlags stages, PSemaphore waitSemaphore);
void checkFence();
void waitForCommand(uint32 timeToWait = 1000000u);
@@ -50,8 +50,8 @@ private:
PFramebuffer boundFramebuffer;
Array<PSemaphore> waitSemaphores;
Array<VkPipelineStageFlags> waitFlags;
Array<PRenderCommand> executingRenders;
Array<PComputeCommand> executingComputes;
Array<ORenderCommand> executingRenders;
Array<OComputeCommand> executingComputes;
Array<PDescriptorSet> boundDescriptors;
friend class RenderCommand;
friend class CommandPool;
@@ -123,7 +123,7 @@ public:
private:
PComputePipeline pipeline;
bool ready;
Array<DescriptorSet *> boundDescriptors;
Array<PDescriptorSet> boundDescriptors;
VkViewport currentViewport;
VkRect2D currentScissor;
PGraphics graphics;
+2 -2
View File
@@ -118,12 +118,12 @@ void Graphics::waitDeviceIdle()
void Graphics::executeCommands(Array<Gfx::ORenderCommand> commands)
{
getGraphicsCommands()->getCommands()->executeCommands(commands);
getGraphicsCommands()->getCommands()->executeCommands(std::move(commands));
}
void Graphics::executeCommands(Array<Gfx::OComputeCommand> commands)
{
getComputeCommands()->getCommands()->executeCommands(commands);
getComputeCommands()->getCommands()->executeCommands(std::move(commands));
}
Gfx::OTexture2D Graphics::createTexture2D(const TextureCreateInfo &createInfo)
+2 -2
View File
@@ -1,5 +1,6 @@
#include "Shader.h"
#include "Graphics.h"
#include "Graphics/slang-compile.h"
#include "slang.h"
#include "slang-com-ptr.h"
#include "stdlib.h"
@@ -29,7 +30,7 @@ uint32 Seele::Vulkan::Shader::getShaderHash() const
void Shader::create(const ShaderCreateInfo& createInfo)
{
Slang::ComPtr<slang::IBlob> kernelBlob = generateShader(createInfo, SLANG_SPIRV);
VkShaderModuleCreateInfo moduleInfo =
{
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
@@ -40,7 +41,6 @@ void Shader::create(const ShaderCreateInfo& createInfo)
};
VK_CHECK(vkCreateShaderModule(graphics->getDevice(), &moduleInfo, nullptr, &module));
hash = CRC::Calculate(entryPointName.data(), entryPointName.size(), CRC::CRC_32());
hash = CRC::Calculate(kernelBlob->getBufferPointer(), kernelBlob->getBufferSize(), CRC::CRC_32(), hash);
/*
specializedComponent->getEntryPointCode(