From 876b3c98d5f3debd5a081c466a387fbfd5575079 Mon Sep 17 00:00:00 2001 From: Dynamitos Date: Tue, 16 Jan 2024 21:11:57 +0100 Subject: [PATCH] Fixing warnings --- cmake/SuperBuild.cmake | 6 +++++- src/Engine/Graphics/RenderPass/DepthPrepass.cpp | 4 +--- src/Engine/Graphics/Vulkan/Allocator.cpp | 2 +- src/Engine/Graphics/Vulkan/Allocator.h | 5 ++++- src/Engine/Graphics/Vulkan/Debug.cpp | 2 +- src/Engine/Graphics/Vulkan/PipelineCache.cpp | 8 ++++---- src/Engine/Graphics/Vulkan/RenderPass.h | 1 - src/Engine/Graphics/Vulkan/Shader.cpp | 9 ++------- src/Engine/Graphics/Vulkan/Shader.h | 12 ++++++++++-- src/Engine/System/KeyboardInput.cpp | 4 ++-- src/Engine/Window/GameView.cpp | 2 +- 11 files changed, 31 insertions(+), 24 deletions(-) diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index 2f79ec5..e03d22e 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -82,7 +82,11 @@ if(WIN32) ${SLANG_ROOT}/lib/slang.lib DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) elseif(APPLE) - + set(SLANG_ROOT ${EXTERNAL_ROOT}/vcpkg/packages/shader-slang_arm64-osx/) + set_target_properties(shader-slang PROPERTIES IMPORTED_LOCATION ${SLANG_ROOT}/bin/libslang.dylib) + install(FILES + ${SLANG_ROOT}/bin/libslang.dylib + DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) endif() target_include_directories(shader-slang INTERFACE $ diff --git a/src/Engine/Graphics/RenderPass/DepthPrepass.cpp b/src/Engine/Graphics/RenderPass/DepthPrepass.cpp index f504d5e..fd59f6d 100644 --- a/src/Engine/Graphics/RenderPass/DepthPrepass.cpp +++ b/src/Engine/Graphics/RenderPass/DepthPrepass.cpp @@ -16,8 +16,6 @@ DepthPrepass::DepthPrepass(Gfx::PGraphics graphics, PScene scene) : RenderPass(graphics, scene) , descriptorSets(3) { - UniformBufferCreateInfo uniformInitializer; - depthPrepassLayout = graphics->createPipelineLayout(); depthPrepassLayout->addDescriptorLayout(INDEX_VIEW_PARAMS, viewParamsLayout); if (graphics->supportMeshShading()) @@ -174,6 +172,6 @@ void DepthPrepass::createRenderPass() renderPass = graphics->createRenderPass(std::move(layout), viewport); } -void DepthPrepass::modifyRenderPassMacros(Map& defines) +void DepthPrepass::modifyRenderPassMacros(Map&) { } diff --git a/src/Engine/Graphics/Vulkan/Allocator.cpp b/src/Engine/Graphics/Vulkan/Allocator.cpp index 769ea0e..8125226 100644 --- a/src/Engine/Graphics/Vulkan/Allocator.cpp +++ b/src/Engine/Graphics/Vulkan/Allocator.cpp @@ -365,7 +365,7 @@ OStagingBuffer StagingManager::create(uint64 size, Gfx::QueueType owner) return stagingBuffer; } -void StagingManager::release(OStagingBuffer buffer) +void StagingManager::release(OStagingBuffer) { //freeBuffers.add(std::move(buffer)); } diff --git a/src/Engine/Graphics/Vulkan/Allocator.h b/src/Engine/Graphics/Vulkan/Allocator.h index 8869a9e..947bbf6 100644 --- a/src/Engine/Graphics/Vulkan/Allocator.h +++ b/src/Engine/Graphics/Vulkan/Allocator.h @@ -58,7 +58,10 @@ public: { return allocatedMemory; } - + constexpr VkMemoryPropertyFlags getProperties() const + { + return properties; + } constexpr void* map() { if (!canMap) diff --git a/src/Engine/Graphics/Vulkan/Debug.cpp b/src/Engine/Graphics/Vulkan/Debug.cpp index bd5eb7a..4d81d8c 100644 --- a/src/Engine/Graphics/Vulkan/Debug.cpp +++ b/src/Engine/Graphics/Vulkan/Debug.cpp @@ -3,7 +3,7 @@ using namespace Seele::Vulkan; -VkBool32 Seele::Vulkan::debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *layerPrefix, const char *msg, void *) +VkBool32 Seele::Vulkan::debugCallback(VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *layerPrefix, const char *msg, void *) { std::cerr << layerPrefix << ": " << msg << std::endl; return VK_FALSE; diff --git a/src/Engine/Graphics/Vulkan/PipelineCache.cpp b/src/Engine/Graphics/Vulkan/PipelineCache.cpp index 61e670f..11e33e1 100644 --- a/src/Engine/Graphics/Vulkan/PipelineCache.cpp +++ b/src/Engine/Graphics/Vulkan/PipelineCache.cpp @@ -135,8 +135,8 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::LegacyPipelineCreateInfo gf .depthWriteEnable = gfxInfo.depthStencilState.depthWriteEnable, .depthCompareOp = cast(gfxInfo.depthStencilState.depthCompareOp), .depthBoundsTestEnable = gfxInfo.depthStencilState.depthBoundsTestEnable, - .front = (VkStencilOp)gfxInfo.depthStencilState.front, - .back = (VkStencilOp)gfxInfo.depthStencilState.back, + .front = {(VkStencilOp)gfxInfo.depthStencilState.front}, + .back = {(VkStencilOp)gfxInfo.depthStencilState.back}, .minDepthBounds = gfxInfo.depthStencilState.minDepthBounds, .maxDepthBounds = gfxInfo.depthStencilState.maxDepthBounds, }; @@ -307,8 +307,8 @@ PGraphicsPipeline PipelineCache::createPipeline(Gfx::MeshPipelineCreateInfo gfxI .depthWriteEnable = gfxInfo.depthStencilState.depthWriteEnable, .depthCompareOp = cast(gfxInfo.depthStencilState.depthCompareOp), .depthBoundsTestEnable = gfxInfo.depthStencilState.depthBoundsTestEnable, - .front = (VkStencilOp)gfxInfo.depthStencilState.front, - .back = (VkStencilOp)gfxInfo.depthStencilState.back, + .front = {(VkStencilOp)gfxInfo.depthStencilState.front}, + .back = {(VkStencilOp)gfxInfo.depthStencilState.back}, .minDepthBounds = gfxInfo.depthStencilState.minDepthBounds, .maxDepthBounds = gfxInfo.depthStencilState.maxDepthBounds, }; diff --git a/src/Engine/Graphics/Vulkan/RenderPass.h b/src/Engine/Graphics/Vulkan/RenderPass.h index 7e626fa..ffc11d6 100644 --- a/src/Engine/Graphics/Vulkan/RenderPass.h +++ b/src/Engine/Graphics/Vulkan/RenderPass.h @@ -33,7 +33,6 @@ public: return subpassContents; } private: - uint32 framebufferHash; PGraphics graphics; VkRenderPass renderPass; Array clearValues; diff --git a/src/Engine/Graphics/Vulkan/Shader.cpp b/src/Engine/Graphics/Vulkan/Shader.cpp index 94aafbd..d0af9d0 100644 --- a/src/Engine/Graphics/Vulkan/Shader.cpp +++ b/src/Engine/Graphics/Vulkan/Shader.cpp @@ -3,7 +3,7 @@ #include "slang.h" #include "slang-com-ptr.h" #include "stdlib.h" -#include +#include using namespace Seele; using namespace Seele::Vulkan; @@ -28,7 +28,7 @@ uint32 Seele::Vulkan::Shader::getShaderHash() const return hash; } -#define CHECK_RESULT(x) {SlangResult r = x; if(r != 0) {throw std::runtime_error(std::format("Error: {0}", r));}} +#define CHECK_RESULT(x) {SlangResult r = x; if(r != 0) {throw std::runtime_error(fmt::format("Error: {0}", r));}} #define CHECK_DIAGNOSTICS() {if(diagnostics) {std::cout << (const char*)diagnostics->getBufferPointer() << std::endl; assert(false);}} void Shader::create(const ShaderCreateInfo& createInfo) @@ -115,11 +115,6 @@ void Shader::create(const ShaderCreateInfo& createInfo) ); CHECK_DIAGNOSTICS(); - for (uint32 i = 0; i < reflection->getParameterCount(); ++i) - { - slang::VariableLayoutReflection* varLayout = reflection->getParameterByIndex(i); - //std::cout << varLayout->getName() << " in space " << varLayout->getBindingSpace() << " index " << varLayout->getBindingIndex() << std::endl; - } VkShaderModuleCreateInfo moduleInfo = { .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, diff --git a/src/Engine/Graphics/Vulkan/Shader.h b/src/Engine/Graphics/Vulkan/Shader.h index ba4404f..b3aa057 100644 --- a/src/Engine/Graphics/Vulkan/Shader.h +++ b/src/Engine/Graphics/Vulkan/Shader.h @@ -17,15 +17,23 @@ public: void create(const ShaderCreateInfo& createInfo); - VkShaderModule getModuleHandle() const + constexpr VkShaderModule getModuleHandle() const { return module; } - const char* getEntryPointName() const + constexpr const char* getEntryPointName() const { //SLang renames all entry points to main, so we dont need that return "main";//entryPointName.c_str(); } + constexpr ShaderType getShaderType() const + { + return type; + } + constexpr VkShaderStageFlags getStage() const + { + return stage; + } //Map getDescriptorLayouts(); uint32 getShaderHash() const; private: diff --git a/src/Engine/System/KeyboardInput.cpp b/src/Engine/System/KeyboardInput.cpp index 540ed08..36023de 100644 --- a/src/Engine/System/KeyboardInput.cpp +++ b/src/Engine/System/KeyboardInput.cpp @@ -28,7 +28,7 @@ void KeyboardInput::update(Component::KeyboardInput& input) lastMouseY = mouseY; } -void KeyboardInput::keyCallback(KeyCode code, InputAction action, KeyModifier modifier) +void KeyboardInput::keyCallback(KeyCode code, InputAction action, KeyModifier) { keys[code] = action != InputAction::RELEASE; } @@ -39,7 +39,7 @@ void KeyboardInput::mouseCallback(double x, double y) mouseY = y; } -void KeyboardInput::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) +void KeyboardInput::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier) { if (button == MouseButton::MOUSE_BUTTON_1) { diff --git a/src/Engine/Window/GameView.cpp b/src/Engine/Window/GameView.cpp index 8d0b103..94c187a 100644 --- a/src/Engine/Window/GameView.cpp +++ b/src/Engine/Window/GameView.cpp @@ -74,7 +74,7 @@ void GameView::render() renderGraph.render(cam); } -void GameView::applyArea(URect rect) +void GameView::applyArea(URect) { renderGraph.updateViewport(viewport); }