suppress warnings

This commit is contained in:
Kbz-8
2023-12-10 23:12:22 +01:00
parent 1cfb8745e2
commit 52ca0c0d1b
21 changed files with 60 additions and 48 deletions

View File

@@ -35,7 +35,7 @@ jobs:
# Build the lib
- name: Build MacroLibX
run: make -j
run: make -j && make fclean && make -j DEBUG=true
# Build the test
- name: Build Test

View File

@@ -35,7 +35,7 @@ jobs:
# Build the lib
- name: Build MacroLibX
run: make TOOLCHAIN=gcc -j
run: make TOOLCHAIN=gcc -j && make fclean && make TOOLCHAIN=gcc DEBUG=true -j
# Build the test
- name: Build Test

View File

@@ -41,7 +41,7 @@ jobs:
# Build the lib
- name: Build MacroLibX
run: make -j
run: make -j && make fclean && make DEBUG=true -j
# Build the test
- name: Build Test

View File

@@ -6,14 +6,13 @@
# By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/10/04 16:43:41 by maldavid #+# #+# #
# Updated: 2023/12/07 15:25:52 by kbz_8 ### ########.fr #
# Updated: 2023/12/10 23:08:16 by kbz_8 ### ########.fr #
# #
# **************************************************************************** #
NAME = libmlx.so
SRCS = $(wildcard $(addsuffix /*.cpp, ./src/core))
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/core/**))
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform))
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer))
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**))
@@ -32,15 +31,16 @@ MODE = "release"
CXX = clang++
ifeq ($(TOOLCHAIN), gcc)
CXX = g++
endif
CXXFLAGS = -std=c++17 -O3 -fPIC
CXXFLAGS = -std=c++17 -O3 -fPIC -Wall -Wextra -Werror
INCLUDES = -I./includes -I./src -I./third_party
LDLIBS =
ifeq ($(TOOLCHAIN), gcc)
CXX = g++
CXXFLAGS += -Wno-error=cpp
endif
ifeq ($(OS), Darwin)
LDLIBS += -lSDL2
endif

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2023/12/08 18:52:47 by kbz_8 ### ########.fr */
/* Updated: 2023/12/10 22:19:59 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -69,7 +69,6 @@ namespace mlx::core
std::function<int(void*)> _loop_hook;
std::unique_ptr<Input> _in;
void* _param = nullptr;
bool _is_loop_running = false;
};
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
/* Updated: 2023/12/09 16:52:08 by kbz_8 ### ########.fr */
/* Updated: 2023/12/10 22:20:38 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,7 +16,8 @@ namespace mlx
{
GraphicsSupport::GraphicsSupport(std::size_t w, std::size_t h, const std::string& title, int id) :
_window(std::make_shared<MLX_Window>(w, h, title)),
_renderer(std::make_unique<Renderer>()), _text_put_pipeline(std::make_unique<TextPutPipeline>()),
_text_put_pipeline(std::make_unique<TextPutPipeline>()),
_renderer(std::make_unique<Renderer>()),
_id(id)
{
_renderer->setWindow(_window.get());

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */
/* Updated: 2023/12/09 16:52:29 by kbz_8 ### ########.fr */
/* Updated: 2023/12/10 22:49:11 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -41,7 +41,6 @@ namespace mlx
void MLX_Window::destroy() noexcept
{
std::cout << "prout" << std::endl;
if(_win != nullptr)
{
SDL_DestroyWindow(_win);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/08 18:55:57 by maldavid #+# #+# */
/* Updated: 2023/11/16 13:54:25 by maldavid ### ########.fr */
/* Updated: 2023/12/10 23:05:14 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -59,7 +59,7 @@ namespace mlx
_buffer = VK_NULL_HANDLE;
}
void Buffer::createBuffer(VkBufferUsageFlags usage, VmaAllocationCreateInfo info, VkDeviceSize size, const char* name)
void Buffer::createBuffer(VkBufferUsageFlags usage, VmaAllocationCreateInfo info, VkDeviceSize size, [[maybe_unused]] const char* name)
{
VkBufferCreateInfo bufferInfo{};
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
@@ -74,7 +74,7 @@ namespace mlx
alloc_name.append("_index_buffer");
else if(usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)
alloc_name.append("_vertex_buffer");
else if((usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) != 1)
else if(!(usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT))
alloc_name.append("_buffer");
_allocation = Render_Core::get().getAllocator().createBuffer(&bufferInfo, &info, _buffer, alloc_name.c_str());
#else

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 18:45:52 by maldavid #+# #+# */
/* Updated: 2023/11/16 13:57:42 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:22:28 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,7 +16,7 @@
namespace mlx
{
void UBO::create(Renderer* renderer, uint32_t size, const char* name)
void UBO::create(Renderer* renderer, uint32_t size, [[maybe_unused]] const char* name)
{
_renderer = renderer;

View File

@@ -6,7 +6,7 @@
/* By: kbz_8 <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/20 22:02:37 by kbz_8 #+# #+# */
/* Updated: 2023/11/14 12:45:29 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:44:55 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,9 +22,18 @@
#ifdef MLX_COMPILER_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"
#pragma clang diagnostic ignored "-Weverything"
#include <renderer/core/memory.h>
#pragma clang diagnostic pop
#elif defined(MLX_COMPILER_GCC)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wparentheses"
#include <renderer/core/memory.h>
#pragma GCC diagnostic pop
#else
#include <renderer/core/memory.h>
#endif

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/17 23:33:34 by maldavid #+# #+# */
/* Updated: 2023/11/20 12:04:51 by maldavid ### ########.fr */
/* Updated: 2023/12/10 23:04:04 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -25,7 +25,14 @@
#ifdef DEBUG
#ifndef MLX_COMPILER_MSVC
#ifdef MLX_COMPILER_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-W#warnings"
#endif
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
#ifdef MLX_COMPILER_CLANG
#pragma clang diagnostic pop
#endif
#else
#pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances")
#endif

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 17:53:06 by maldavid #+# #+# */
/* Updated: 2023/11/18 17:07:21 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:45:21 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,9 +16,6 @@ namespace mlx
{
void Fence::init()
{
VkSemaphoreCreateInfo semaphoreInfo{};
semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
VkFenceCreateInfo fenceInfo{};
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/19 14:05:25 by maldavid #+# #+# */
/* Updated: 2023/11/20 07:21:57 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:25:36 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -83,7 +83,7 @@ namespace mlx
createInfo.pfnUserCallback = ValidationLayers::debugCallback;
}
VKAPI_ATTR VkBool32 VKAPI_CALL ValidationLayers::debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData)
VKAPI_ATTR VkBool32 VKAPI_CALL ValidationLayers::debugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, [[maybe_unused]] VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, [[maybe_unused]] void* pUserData)
{
if(messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
{

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/23 18:37:28 by maldavid #+# #+# */
/* Updated: 2023/11/18 17:23:16 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:25:59 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,7 +18,7 @@ namespace mlx
void DescriptorSetLayout::init(std::vector<std::pair<int, VkDescriptorType>> binds, VkShaderStageFlagBits stage)
{
std::vector<VkDescriptorSetLayoutBinding> bindings(binds.size());
for(int i = 0; i < binds.size(); i++)
for(std::size_t i = 0; i < binds.size(); i++)
{
bindings[i].binding = binds[i].first;
bindings[i].descriptorCount = 1;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/31 18:03:35 by maldavid #+# #+# */
/* Updated: 2023/11/16 14:01:47 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:46:08 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -69,7 +69,7 @@ namespace mlx
void Texture::setPixel(int x, int y, uint32_t color) noexcept
{
if(x < 0 || y < 0 || x > getWidth() || y > getHeight())
if(x < 0 || y < 0 || static_cast<uint32_t>(x) > getWidth() || static_cast<uint32_t>(y) > getHeight())
return;
if(_map == nullptr)
openCPUmap();
@@ -79,7 +79,7 @@ namespace mlx
int Texture::getPixel(int x, int y) noexcept
{
if(x < 0 || y < 0 || x > getWidth() || y > getHeight())
if(x < 0 || y < 0 || static_cast<uint32_t>(x) > getWidth() || static_cast<uint32_t>(y) > getHeight())
return 0;
if(_map == nullptr)
openCPUmap();

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/31 15:14:50 by maldavid #+# #+# */
/* Updated: 2023/11/16 13:44:58 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:33:59 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,7 +29,7 @@ namespace mlx
void PixelPutPipeline::setPixel(uint32_t x, uint32_t y, uint32_t color) noexcept
{
if(x < 0 || y < 0 || x > _width || y > _height)
if(x > _width || y > _height)
return;
_cpu_map[(y * _width) + x] = color;
_has_been_modified = true;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/18 17:25:16 by maldavid #+# #+# */
/* Updated: 2023/11/20 07:25:47 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:21:10 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -23,9 +23,9 @@ namespace mlx
_pass.init(_swapchain.getImagesFormat());
_cmd.init();
for(int i = 0; i < _swapchain.getImagesNumber(); i++)
for(std::size_t i = 0; i < _swapchain.getImagesNumber(); i++)
_framebuffers.emplace_back().init(_pass, _swapchain.getImage(i));
for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
_semaphores[i].init();
_uniform_buffer.reset(new UBO);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/18 17:14:45 by maldavid #+# #+# */
/* Updated: 2023/12/08 19:12:06 by kbz_8 ### ########.fr */
/* Updated: 2023/12/10 22:19:41 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -109,7 +109,7 @@ namespace mlx
inline uint32_t getActiveImageIndex() noexcept { return _current_frame_index; }
inline uint32_t getImageIndex() noexcept { return _image_index; }
constexpr inline void requireFrameBufferResize(int index) noexcept { _framebufferResized = true; }
constexpr inline void requireFrameBufferResize() noexcept { _framebufferResized = true; }
~Renderer() = default;

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 18:21:36 by maldavid #+# #+# */
/* Updated: 2023/11/20 07:24:40 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:32:27 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,7 +18,7 @@
namespace mlx
{
static const VkClearValue clearColor = { 0.0f, 0.0f, 0.0f, 1.0f };
static const VkClearValue clearColor = {{{ 0.0f, 0.0f, 0.0f, 1.0f }}}; // wtf, this mess to satisfy a warning
void RenderPass::init(VkFormat attachement_format)
{

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 18:22:28 by maldavid #+# #+# */
/* Updated: 2023/11/18 17:15:10 by maldavid ### ########.fr */
/* Updated: 2023/12/10 22:32:54 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -68,7 +68,7 @@ namespace mlx
tmp.resize(imageCount);
vkGetSwapchainImagesKHR(device, _swapChain, &imageCount, tmp.data());
for(int i = 0; i < imageCount; i++)
for(std::size_t i = 0; i < imageCount; i++)
{
_images[i].create(tmp[i], surfaceFormat.format, _extent.width, _extent.height);
_images[i].transitionLayout(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */
/* Updated: 2023/12/07 22:29:45 by kbz_8 ### ########.fr */
/* Updated: 2023/12/10 22:34:35 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,7 +46,7 @@ namespace mlx
for(char c : text)
{
if(c < 32 || c > 127)
if(c < 32)
continue;
stbtt_aligned_quad q;