fixing lots of warnings
This commit is contained in:
@@ -111,7 +111,7 @@ void BufferAllocation::updateContents(uint64 regionOffset, uint64 regionSize, vo
|
||||
vmaUnmapMemory(graphics->getAllocator(), staging->allocation);
|
||||
|
||||
Gfx::QueueType prevOwner = owner;
|
||||
// transferOwnership(Gfx::QueueType::TRANSFER);
|
||||
transferOwnership(Gfx::QueueType::TRANSFER);
|
||||
|
||||
PCommand cmd = graphics->getQueueCommands(Gfx::QueueType::GRAPHICS)->getCommands();
|
||||
VkBufferCopy copy = {
|
||||
@@ -125,7 +125,7 @@ void BufferAllocation::updateContents(uint64 regionOffset, uint64 regionSize, vo
|
||||
pipelineBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT);
|
||||
|
||||
// transferOwnership(prevOwner);
|
||||
transferOwnership(prevOwner);
|
||||
graphics->getDestructionManager()->queueResourceForDestruction(std::move(staging));
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ void BufferAllocation::readContents(uint64 regionOffset, uint64 regionSize, void
|
||||
OBufferAllocation staging = new BufferAllocation(graphics, "ReadStaging", stagingInfo, stagingAlloc, Gfx::QueueType::GRAPHICS);
|
||||
|
||||
Gfx::QueueType prevOwner = owner;
|
||||
// transferOwnership(Gfx::QueueType::TRANSFER);
|
||||
transferOwnership(Gfx::QueueType::TRANSFER);
|
||||
|
||||
PCommandPool pool = graphics->getQueueCommands(Gfx::QueueType::TRANSFER);
|
||||
PCommand cmd = pool->getCommands();
|
||||
@@ -164,7 +164,7 @@ void BufferAllocation::readContents(uint64 regionOffset, uint64 regionSize, void
|
||||
pool->submitCommands();
|
||||
cmd->getFence()->wait(1000000);
|
||||
|
||||
// transferOwnership(prevOwner);
|
||||
transferOwnership(prevOwner);
|
||||
|
||||
uint8* data;
|
||||
VK_CHECK(vmaMapMemory(graphics->getAllocator(), staging->allocation, (void**)&data));
|
||||
@@ -276,11 +276,11 @@ void Buffer::rotateBuffer(uint64 size, bool preserveContents) {
|
||||
return;
|
||||
}
|
||||
buffers.add(nullptr);
|
||||
createBuffer(size, buffers.size() - 1);
|
||||
createBuffer(size, (uint32)buffers.size() - 1);
|
||||
if (preserveContents) {
|
||||
copyBuffer(currentBuffer, buffers.size() - 1);
|
||||
}
|
||||
currentBuffer = buffers.size() - 1;
|
||||
currentBuffer = (uint32)buffers.size() - 1;
|
||||
}
|
||||
|
||||
void Buffer::createBuffer(uint64 size, uint32 destIndex) {
|
||||
|
||||
@@ -18,7 +18,6 @@ class Command {
|
||||
Command(PGraphics graphics, PCommandPool pool);
|
||||
~Command();
|
||||
constexpr VkCommandBuffer getHandle() { return handle; }
|
||||
void reset();
|
||||
void begin();
|
||||
void end();
|
||||
void beginRenderPass(PRenderPass renderPass, PFramebuffer framebuffer);
|
||||
@@ -46,8 +45,6 @@ class Command {
|
||||
OFence fence;
|
||||
OSemaphore signalSemaphore;
|
||||
State state;
|
||||
VkViewport currentViewport;
|
||||
VkRect2D currentScissor;
|
||||
VkCommandBuffer handle;
|
||||
PRenderPass boundRenderPass;
|
||||
PFramebuffer boundFramebuffer;
|
||||
@@ -91,12 +88,12 @@ class RenderCommand : public Gfx::RenderCommand {
|
||||
virtual void traceRays(uint32 width, uint32 height, uint32 depth) override;
|
||||
|
||||
private:
|
||||
PGraphicsPipeline pipeline;
|
||||
PRayTracingPipeline rtPipeline;
|
||||
bool ready;
|
||||
PGraphicsPipeline pipeline = nullptr;
|
||||
PRayTracingPipeline rtPipeline = nullptr;
|
||||
bool ready = false;
|
||||
Array<PCommandBoundResource> boundResources;
|
||||
VkViewport currentViewport;
|
||||
VkRect2D currentScissor;
|
||||
VkViewport currentViewport = VkViewport();
|
||||
VkRect2D currentScissor = VkRect2D();
|
||||
PGraphics graphics;
|
||||
std::thread::id threadId;
|
||||
VkCommandBuffer handle;
|
||||
@@ -123,10 +120,8 @@ class ComputeCommand : public Gfx::ComputeCommand {
|
||||
|
||||
private:
|
||||
PComputePipeline pipeline;
|
||||
bool ready;
|
||||
bool ready = false;
|
||||
Array<PCommandBoundResource> boundResources;
|
||||
VkViewport currentViewport;
|
||||
VkRect2D currentScissor;
|
||||
PGraphics graphics;
|
||||
std::thread::id threadId;
|
||||
VkCommandBuffer handle;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
VkBool32 Seele::Vulkan::debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData) {
|
||||
VkBool32 Seele::Vulkan::debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void*) {
|
||||
std::cerr << pCallbackData->pMessage << std::endl;
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
||||
@@ -97,11 +97,11 @@ DescriptorPool::DescriptorPool(PGraphics graphics, PDescriptorLayout layout)
|
||||
perTypeSizes[binding.descriptorType] += 512;
|
||||
}
|
||||
Array<VkDescriptorPoolSize> poolSizes;
|
||||
for (const auto [type, num] : perTypeSizes) {
|
||||
VkDescriptorPoolSize size;
|
||||
size.descriptorCount = num;
|
||||
size.type = cast(type);
|
||||
poolSizes.add(size);
|
||||
for (const auto& [type, num] : perTypeSizes) {
|
||||
poolSizes.add(VkDescriptorPoolSize{
|
||||
.type = cast(type),
|
||||
.descriptorCount = num,
|
||||
});
|
||||
}
|
||||
VkDescriptorPoolCreateInfo createInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
||||
@@ -473,7 +473,7 @@ std::mutex layoutLock;
|
||||
Map<uint32, VkPipelineLayout> cachedLayouts;
|
||||
|
||||
void PipelineLayout::create() {
|
||||
for (auto [name, desc] : descriptorSetLayouts) {
|
||||
for (const auto& [_, desc] : descriptorSetLayouts) {
|
||||
PDescriptorLayout layout = desc.cast<DescriptorLayout>();
|
||||
layout->create();
|
||||
uint32 parameterIndex = parameterMapping[layout->getName()];
|
||||
|
||||
@@ -24,7 +24,7 @@ class DescriptorLayout : public Gfx::DescriptorLayout {
|
||||
private:
|
||||
PGraphics graphics;
|
||||
uint32 constantsSize = 0;
|
||||
VkShaderStageFlags constantsStages;
|
||||
VkShaderStageFlags constantsStages = 0;
|
||||
Array<VkDescriptorSetLayoutBinding> bindings;
|
||||
Map<std::string, DescriptorMapping> mappings;
|
||||
VkDescriptorSetLayout layoutHandle;
|
||||
@@ -74,7 +74,6 @@ class DescriptorSet : public Gfx::DescriptorSet, public CommandBoundResource {
|
||||
private:
|
||||
std::vector<uint8> constantData;
|
||||
OBufferAllocation constantsBuffer;
|
||||
VkShaderStageFlags constantsStageFlags;
|
||||
List<VkDescriptorImageInfo> imageInfos;
|
||||
List<VkDescriptorBufferInfo> bufferInfos;
|
||||
List<VkWriteDescriptorSetAccelerationStructureKHR> accelerationInfos;
|
||||
|
||||
@@ -968,11 +968,11 @@ void Graphics::createDevice(GraphicsInitializer initializer) {
|
||||
transferQueue = 0;
|
||||
queues.add(new Queue(this, graphicsQueueInfo.familyIndex, graphicsQueueInfo.queueIndex));
|
||||
if (computeQueueInfo.familyIndex != -1) {
|
||||
computeQueue = queues.size();
|
||||
computeQueue = (uint32)queues.size();
|
||||
queues.add(new Queue(this, computeQueueInfo.familyIndex, computeQueueInfo.queueIndex));
|
||||
}
|
||||
if (transferQueueInfo.familyIndex != -1) {
|
||||
transferQueue = queues.size();
|
||||
transferQueue = (uint32)queues.size();
|
||||
queues.add(new Queue(this, transferQueueInfo.familyIndex, transferQueueInfo.queueIndex));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,23 +11,23 @@ using namespace Seele;
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
PipelineCache::PipelineCache(PGraphics graphics, const std::string& cacheFilePath) : graphics(graphics), cacheFile(cacheFilePath) {
|
||||
Array<uint8> cacheData;
|
||||
std::ifstream stream(cacheFilePath, std::ios::binary | std::ios::ate);
|
||||
VkPipelineCacheCreateInfo cacheCreateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.initialDataSize = 0,
|
||||
};
|
||||
if (stream.good()) {
|
||||
Array<uint8> cacheData;
|
||||
uint32 fileSize = static_cast<uint32>(stream.tellg());
|
||||
cacheData.resize(fileSize);
|
||||
stream.seekg(0);
|
||||
stream.read((char*)cacheData.data(), fileSize);
|
||||
cacheCreateInfo.initialDataSize = fileSize;
|
||||
cacheCreateInfo.pInitialData = cacheData.data();
|
||||
std::cout << "Loaded " << fileSize << " bytes from pipeline cache" << std::endl;
|
||||
}
|
||||
VkPipelineCacheCreateInfo cacheCreateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.initialDataSize = cacheData.size(),
|
||||
.pInitialData = cacheData.data(),
|
||||
};
|
||||
|
||||
VK_CHECK(vkCreatePipelineCache(graphics->getDevice(), &cacheCreateInfo, nullptr, &cache));
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ PRayTracingPipeline PipelineCache::createPipeline(Gfx::RayTracingPipelineCreateI
|
||||
const VkBufferUsageFlags sbtBufferUsage =
|
||||
VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT;
|
||||
const VmaMemoryUsage sbtMemoryUsage = VMA_MEMORY_USAGE_AUTO;
|
||||
|
||||
|
||||
uint64 rayGenStride = align<uint64>(handleSize + createInfo.rayGenGroup.parameters.size(), handleAlignment);
|
||||
uint64 hitStride = handleSize;
|
||||
for (const auto& h : createInfo.hitGroups) {
|
||||
@@ -685,7 +685,6 @@ PRayTracingPipeline PipelineCache::createPipeline(Gfx::RayTracingPipelineCreateI
|
||||
rayGenBuffer->pipelineBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_SHADER_READ_BIT,
|
||||
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
|
||||
|
||||
|
||||
Array<uint8> hitSbt(hitStride * createInfo.hitGroups.size());
|
||||
for (uint64 i = 0; i < createInfo.hitGroups.size(); ++i) {
|
||||
std::memcpy(hitSbt.data() + i * hitStride, sbt.data() + sbtOffset, handleSize);
|
||||
@@ -695,9 +694,8 @@ PRayTracingPipeline PipelineCache::createPipeline(Gfx::RayTracingPipelineCreateI
|
||||
}
|
||||
hitBuffer->updateContents(0, hitSbt.size(), hitSbt.data());
|
||||
hitBuffer->pipelineBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_SHADER_READ_BIT,
|
||||
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
|
||||
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
|
||||
|
||||
|
||||
Array<uint8> missSbt(missStride * createInfo.missGroups.size());
|
||||
for (uint64 i = 0; i < createInfo.missGroups.size(); ++i) {
|
||||
std::memcpy(missSbt.data() + i * missStride, sbt.data() + sbtOffset, handleSize);
|
||||
@@ -707,11 +705,11 @@ PRayTracingPipeline PipelineCache::createPipeline(Gfx::RayTracingPipelineCreateI
|
||||
}
|
||||
missBuffer->updateContents(0, missSbt.size(), missSbt.data());
|
||||
missBuffer->pipelineBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_SHADER_READ_BIT,
|
||||
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
|
||||
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
|
||||
|
||||
ORayTracingPipeline pipeline =
|
||||
new RayTracingPipeline(graphics, pipelineHandle, std::move(rayGenBuffer), rayGenStride, std::move(hitBuffer),
|
||||
hitStride, std::move(missBuffer), missStride, nullptr, 0, createInfo.pipelineLayout);
|
||||
new RayTracingPipeline(graphics, pipelineHandle, std::move(rayGenBuffer), rayGenStride, std::move(hitBuffer), hitStride,
|
||||
std::move(missBuffer), missStride, nullptr, 0, createInfo.pipelineLayout);
|
||||
PRayTracingPipeline handle = pipeline;
|
||||
rayTracingPipelines[hash] = std::move(pipeline);
|
||||
return handle;
|
||||
|
||||
@@ -23,8 +23,8 @@ class QueryPool {
|
||||
std::string name;
|
||||
VkQueryPipelineStatisticFlags flags;
|
||||
// ring buffer
|
||||
uint64 head = 0;
|
||||
uint64 tail = 0;
|
||||
uint32 head = 0;
|
||||
uint32 tail = 0;
|
||||
uint64 numAvailable;
|
||||
uint32 numQueries;
|
||||
uint32 resultsStride;
|
||||
|
||||
@@ -34,7 +34,7 @@ void Semaphore::rotateSemaphore() {
|
||||
currentHandle = i;
|
||||
return;
|
||||
}
|
||||
currentHandle = handles.size();
|
||||
currentHandle = (uint32)handles.size();
|
||||
handles.add(new SemaphoreHandle(graphics, "Semaphore"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user