From ab27eb80db72e01e03fcb5742efcda5fc59362c4 Mon Sep 17 00:00:00 2001 From: happytanuki Date: Tue, 27 May 2025 00:21:53 +0900 Subject: [PATCH] linux build pass --- .vscode/c_cpp_properties.json | 11 +++ .vscode/launch.json | 55 +++++++++++++ .vscode/settings.json | 98 ++++++++++++++++++++++++ .vscode/tasks.json | 36 +++++++++ CMakeLists.txt | 3 + Client/src/asset/loader.cpp | 2 +- Client/src/stb/stb_image.cpp | 7 ++ Client/src/vulkan/devices_and_queues.cpp | 11 ++- 8 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..2d1106e --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,11 @@ +{ + "configurations": [ + { + "compileCommands": "build/compile_commands.json", + "intelliSenseMode": "linux-gcc-x64", + "cStandard": "c17", + "cppStandard": "c++20" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7b16b2a --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,55 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb)Client Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/Client/Client", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/Client/", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ], + "preLaunchTask": "${defaultBuildTask}" + }, + { + "name": "(gdb)Server Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/Server/Server", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build/Server/", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "Set Disassembly Flavor to Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ], + "preLaunchTask": "${defaultBuildTask}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..44fecb4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,98 @@ +{ + "files.associations": { + "cctype": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "charconv": "cpp", + "chrono": "cpp", + "compare": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "format": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "semaphore": "cpp", + "span": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeinfo": "cpp", + "variant": "cpp", + "__bit_reference": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__node_handle": "cpp", + "__split_buffer": "cpp", + "__threading_support": "cpp", + "__verbose_abort": "cpp", + "ios": "cpp", + "locale": "cpp", + "print": "cpp", + "queue": "cpp", + "stack": "cpp", + "fstream": "cpp", + "regex": "cpp", + "assert": "cpp", + "pointers": "cpp", + "future": "cpp", + "zstring": "cpp", + "set": "cpp", + "util": "cpp", + "expected": "cpp", + "complex": "cpp", + "__config": "cpp", + "ranges": "cpp", + "valarray": "cpp", + "__tree": "cpp", + "map": "cpp", + "iostream": "cpp", + "any": "cpp", + "clocale": "cpp", + "codecvt": "cpp", + "list": "cpp", + "unordered_set": "cpp", + "numeric": "cpp", + "source_location": "cpp", + "numbers": "cpp" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..86df2b3 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,36 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "cppbuild", + "label": "ninja-build", + "command": "ninja", + "args": [], + "options": { + "cwd": "${workspaceFolder}/build/" + }, + "group": { + "kind": "build", + "isDefault": true + }, + "dependsOn": ["cmake"] + }, + { + "type": "shell", + "label": "cmake", + "command": "cmake", + "args": [ + "..", + "-G", + "Ninja" + ], + "options": { + "cwd": "${workspaceFolder}/build/" + }, + "group": { + "kind": "build", + "isDefault": false + } + }, + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 077a882..88f4c4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.5) set(PROJECT_NAME "Asteroid") + +set(CMAKE_BUILD_TYPE Debug) + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) endif() diff --git a/Client/src/asset/loader.cpp b/Client/src/asset/loader.cpp index ec12848..d6421fa 100644 --- a/Client/src/asset/loader.cpp +++ b/Client/src/asset/loader.cpp @@ -23,7 +23,7 @@ void Loader::loadModel(inModel model) { uv); } - for (Vertex& const it : model.vertices) { + for (const Vertex& it : model.vertices) { model.original_offset.x += it.position.x / model.vertices.size(); model.original_offset.y += it.position.y / model.vertices.size(); model.original_offset.z += it.position.z / model.vertices.size(); diff --git a/Client/src/stb/stb_image.cpp b/Client/src/stb/stb_image.cpp index 38c72e9..bdc0ce6 100644 --- a/Client/src/stb/stb_image.cpp +++ b/Client/src/stb/stb_image.cpp @@ -1,2 +1,9 @@ +#ifndef NDEBUG + #undef __OPTIMIZE__ +#endif #define STB_IMAGE_IMPLEMENTATION #include "stb/stb_image.h" + +#ifndef NDEBUG + #define __OPTIMIZE__ 1 +#endif \ No newline at end of file diff --git a/Client/src/vulkan/devices_and_queues.cpp b/Client/src/vulkan/devices_and_queues.cpp index 358419a..c0229ee 100644 --- a/Client/src/vulkan/devices_and_queues.cpp +++ b/Client/src/vulkan/devices_and_queues.cpp @@ -140,8 +140,15 @@ void Graphics::CreateLogicalDeviceAndQueues() { } VkPhysicalDeviceFeatures required_features = {}; - required_features.depthBounds = true; - required_features.depthClamp = true; + VkPhysicalDeviceFeatures supported_features; + vkGetPhysicalDeviceFeatures(physical_device_, &supported_features); + + if (supported_features.depthBounds) { + required_features.depthBounds = VK_TRUE; + } + if (supported_features.depthClamp) { + required_features.depthClamp = VK_TRUE; + } VkDeviceCreateInfo device_info = {}; device_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;