fixing lots of warnings

This commit is contained in:
Dynamitos
2025-03-26 13:38:48 +01:00
parent edfe34a394
commit 9cce5977c5
33 changed files with 204 additions and 185 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ class IndexBuffer : public Buffer {
virtual void executePipelineBarrier(SeAccessFlags srcAccess, SePipelineStageFlags srcStage, SeAccessFlags dstAccess,
SePipelineStageFlags dstStage) = 0;
Gfx::SeIndexType indexType;
uint64 numIndices;
uint64 numIndices = 0;
};
DEFINE_REF(IndexBuffer)
@@ -81,7 +81,7 @@ class ShaderBuffer : public Buffer {
virtual void updateContents(uint64 offset, uint64 size, void* data) = 0;
virtual void* map() = 0;
virtual void unmap() = 0;
constexpr uint32 getNumElements() const { return numElements; }
constexpr uint64 getNumElements() const { return numElements; }
virtual void clear() = 0;
@@ -91,7 +91,7 @@ class ShaderBuffer : public Buffer {
virtual void executePipelineBarrier(SeAccessFlags srcAccess, SePipelineStageFlags srcStage, SeAccessFlags dstAccess,
SePipelineStageFlags dstStage) = 0;
uint32 numElements;
uint64 numElements;
};
DEFINE_REF(ShaderBuffer)
} // namespace Gfx
@@ -74,6 +74,8 @@ void RayTracingPass::beginFrame(const Component::Camera& cam) {
}
void RayTracingPass::render() {
texture->changeLayout(Gfx::SE_IMAGE_LAYOUT_GENERAL, Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
Array<Gfx::RayTracingHitGroup> callableGroups;
Array<Gfx::PBottomLevelAS> accelerationStructures;
Array<InstanceData> instanceData;
@@ -168,15 +170,9 @@ void RayTracingPass::render() {
}
pass++;
std::cout << pass << std::endl;
texture->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR,
Gfx::SE_ACCESS_TRANSFER_READ_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT);
Array<Gfx::ORenderCommand> commands;
commands.add(std::move(command));
graphics->executeCommands(std::move(commands));
viewport->getOwner()->getBackBuffer()->changeLayout(Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, Gfx::SE_ACCESS_NONE,
Gfx::SE_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, Gfx::SE_ACCESS_TRANSFER_WRITE_BIT,
Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT);
graphics->copyTexture(Gfx::PTexture2D(texture), viewport->getOwner()->getBackBuffer());
}
void RayTracingPass::endFrame() {}
@@ -200,6 +196,8 @@ void RayTracingPass::publishOutputs() {
texture->changeLayout(Gfx::SE_IMAGE_LAYOUT_GENERAL, Gfx::SE_ACCESS_NONE, Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
Gfx::SE_ACCESS_SHADER_WRITE_BIT,
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT | Gfx::SE_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR);
resources->registerRenderPassOutput("BASEPASS_COLOR", Gfx::RenderTargetAttachment(texture, Gfx::SE_IMAGE_LAYOUT_UNDEFINED,
Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL));
ShaderCompilationInfo compileInfo = {
.name = "RayGenMiss",
.modules = {"RayGen", "AnyHit", "Miss"},
@@ -131,7 +131,7 @@ void ToneMappingPass::render() {
Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
histogramLayout->reset();
Gfx::PDescriptorSet histogramSet = histogramLayout->allocateDescriptorSet();
histogramSet = histogramLayout->allocateDescriptorSet();
histogramSet->updateConstants("minLogLum", 0, &minLogLum);
histogramSet->updateConstants("inverseLogLumRange", 0, &inverseLogLumRange);
histogramSet->updateConstants("timeCoeff", 0, &timeCoeff);
@@ -10,8 +10,8 @@ WaterRenderer::WaterRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDescri
: graphics(graphics), scene(scene) {
skyBox = AssetRegistry::findTexture("", "skyboxsun5deg_tn")->getTexture().cast<Gfx::TextureCube>();
logN = (int)log2(params.N);
threadGroupsX = ceil(params.N / 8.0f);
threadGroupsY = ceil(params.N / 8.0f);
threadGroupsX = (uint32)ceil(params.N / 8.0f);
threadGroupsY = (uint32)ceil(params.N / 8.0f);
materialUniforms = graphics->createUniformBuffer(UniformBufferCreateInfo{
.sourceData =
@@ -263,7 +263,7 @@ WaterRenderer::WaterRenderer(Gfx::PGraphics graphics, PScene scene, Gfx::PDescri
.windSpeed = 2,
.windDirection = 22,
.fetch = 100000,
.spreadBlend = 0.642,
.spreadBlend = 0.642f,
.swell = 1,
.peakEnhancement = 1,
.shortWavesFade = 0.25f,
@@ -523,8 +523,8 @@ void WaterRenderer::updateFFTDescriptor() {
spectrumBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_SHADER_READ_BIT,
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
params.deltaTime = Gfx::getCurrentFrameDelta();
params.frameTime = Gfx::getCurrentFrameTime();
params.deltaTime = (float)Gfx::getCurrentFrameDelta();
params.frameTime = (float)Gfx::getCurrentFrameTime();
paramsBuffer->updateContents(0, sizeof(ComputeParams), &params);
paramsBuffer->pipelineBarrier(Gfx::SE_ACCESS_TRANSFER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT, Gfx::SE_ACCESS_UNIFORM_READ_BIT,
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
@@ -57,8 +57,8 @@ class WaterRenderer {
};
StaticArray<DisplaySpectrumSettings, 8> displaySpectrums;
struct ComputeParams {
float frameTime;
float deltaTime;
float frameTime = 0.0f;
float deltaTime = 0.0f;
float gravity = 9.81f;
float repeatTime = 200.0f;
float depth = 20.0f;
+1 -1
View File
@@ -50,7 +50,7 @@ class StaticMeshVertexData : public VertexData {
constexpr static const char* BITANGENTS_NAME = "biTangents";
Gfx::OShaderBuffer colors;
constexpr static const char* COLORS_NAME = "colors";
Array<PositionType> posData{debug_resource::get("VertexPositions")};
Array<PositionType> posData;
Array<TexCoordType> texData[MAX_TEXCOORDS];
Array<NormalType> norData;
Array<TangentType> tanData;
+6 -6
View File
@@ -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) {
+6 -11
View File
@@ -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;
+2 -2
View File
@@ -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;
}
+6 -6
View File
@@ -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()];
+1 -2
View File
@@ -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;
+2 -2
View File
@@ -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));
}
+14 -16
View File
@@ -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;
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -34,7 +34,7 @@ void Semaphore::rotateSemaphore() {
currentHandle = i;
return;
}
currentHandle = handles.size();
currentHandle = (uint32)handles.size();
handles.add(new SemaphoreHandle(graphics, "Semaphore"));
}
+1 -1
View File
@@ -139,7 +139,7 @@ void Seele::beginCompilation(const ShaderCompilationInfo& info, SlangCompileTarg
slang::ProgramLayout* signature = specializedComponent->getLayout(0, diagnostics.writeRef());
CHECK_DIAGNOSTICS();
std::cout << info.name << std::endl;
//std::cout << info.name << std::endl;
for (uint32 i = 0; i < signature->getParameterCount(); ++i) {
auto param = signature->getParameterByIndex(i);
layout->addMapping(param->getName(), param->getBindingIndex());