-
Notifications
You must be signed in to change notification settings - Fork 12
Add rendering stuff, cross-platform support, camera controller & SDL input logic #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AR-DEV-1
wants to merge
46
commits into
Redot-Engine:master
Choose a base branch
from
AR-DEV-1:rendering-hardware-abstraction
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
6458806
Start workin' on RHI
AR-DEV-1 b58cba3
Idk how I missed these, they coulda been major security vulnerabilities
AR-DEV-1 7b92c6b
Do what CodeRabbit said & add Wayland support (still doesn't work)
AR-DEV-1 64c0d2f
Fix includes
AR-DEV-1 c955c7d
Add uniform management
AR-DEV-1 eebea86
Add texture loadin' support
AR-DEV-1 b433315
Add framebuffer handles, render targets & dynamic/transient buffers s…
AR-DEV-1 436c405
Add depth & stencil testing, Alpha blending modes, dedicated sampler …
AR-DEV-1 d1694ef
Draco is 3D!
AR-DEV-1 64615cd
Add camera controller & remove all std imports (replaced by the tradi…
AR-DEV-1 27f83bc
Apply suggestions
AR-DEV-1 80af026
Fix issues
AR-DEV-1 43141d2
Minor improvements & fixes
AR-DEV-1 b448c46
Add mesh abstraction + compilation of shaders when building
AR-DEV-1 97d97ee
Add transform system
AR-DEV-1 c2c80b5
Upgrade render pipeline architecture (material + RenderGraph refactor)
AR-DEV-1 2f2f08c
Start working on Quad/Sprite renderer
AR-DEV-1 e43bcea
Merge branch 'master' of https://github.com/Redot-Engine/DraconicEngi…
AR-DEV-1 b117660
Work on QuadRenderer
AR-DEV-1 463ab5e
QuadRenderer finally works!
AR-DEV-1 e148291
Merge branch 'Redot-Engine:master' into rendering-hardware-abstraction
AR-DEV-1 6dcdc0f
Small stuff
AR-DEV-1 1046f1d
Apply some suggestions
AR-DEV-1 833d9a8
Forgot these
AR-DEV-1 d28e09f
Minor fixes
AR-DEV-1 62db8b7
Minor fixes
AR-DEV-1 7183e07
Fix incorrect declaration
AR-DEV-1 1065b03
Fix Wayland
AR-DEV-1 570b52a
Wayland works!
AR-DEV-1 05c8310
Compile shaderc
AR-DEV-1 cb36c8f
Remove sync window SDL loop so Draco may run on Windows [skip ci]
AR-DEV-1 4540c3a
PR cleanup
AR-DEV-1 c40f59c
Update CMake version
AR-DEV-1 abad3ef
Add missing include
AR-DEV-1 e94b9de
Add caching to CI
AR-DEV-1 dd90c75
Merge branch 'master' into rendering-hardware-abstraction
AR-DEV-1 ff5480f
Fix compiler error
AR-DEV-1 f8c737c
Apply suggestions
AR-DEV-1 5862d99
Merge branch 'master' into rendering-hardware-abstraction
AR-DEV-1 9b61dd6
Use our own types & constants
AR-DEV-1 3b6f166
Merge branch 'master' into rendering-hardware-abstraction
AR-DEV-1 c6007b8
Cleanup + improvements
AR-DEV-1 5373a78
Merge branch 'Redot-Engine:master' into rendering-hardware-abstraction
AR-DEV-1 e79fa0b
Fix errors
AR-DEV-1 de86d2c
Apply some suggestions
AR-DEV-1 e720027
Code cleanup
AR-DEV-1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: 🐧 Linux Builds | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - '**' | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
|
||
| jobs: | ||
| build-linux: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - name: Checkout Source Code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Clang Compiler | ||
| uses: egor-tensin/setup-clang@v1 | ||
| with: | ||
| version: 20 | ||
|
|
||
| - name: Install System Dependencies | ||
| run: | | ||
| wget https://github.com/Kitware/CMake/releases/download/v4.3.0/cmake-4.3.0-linux-x86_64.tar.gz | ||
| tar -xzf cmake-4.3.0-linux-x86_64.tar.gz | ||
| echo "$(pwd)/cmake-4.3.0-linux-x86_64/bin" >> $GITHUB_PATH | ||
|
|
||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| ninja-build \ | ||
| ccache \ | ||
| llvm-20 \ | ||
| llvm-20-tools \ | ||
| clang-tools-20 \ | ||
| libc++-20-dev \ | ||
| libc++abi-20-dev \ | ||
| libgl1-mesa-dev \ | ||
| libegl1-mesa-dev \ | ||
| libwayland-egl1-mesa \ | ||
| libasound2-dev \ | ||
| libpulse-dev \ | ||
| libwayland-dev \ | ||
| libx11-dev \ | ||
| libxext-dev \ | ||
| libxrender-dev \ | ||
| libxrandr-dev \ | ||
| libxinerama-dev \ | ||
| libxcursor-dev \ | ||
| libxi-dev \ | ||
| libxtst-dev | ||
| echo "/usr/lib/llvm-20/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Verify LLVM Toolchain | ||
| run: | | ||
| which clang | ||
| which clang++ | ||
| which clang-scan-deps | ||
| clang --version | ||
| clang++ --version | ||
| clang-scan-deps --version | ||
|
|
||
| - name: Cache Build Artifacts | ||
| uses: hendrikmuhs/[email protected] | ||
| with: | ||
| key: ${{ runner.os }}-ccache-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-ccache- | ||
| max-size: "500M" | ||
|
|
||
| - name: Configure Build System | ||
| run: | | ||
| cmake --preset debug \ | ||
| -B build/debug \ | ||
| -DCMAKE_C_COMPILER=clang \ | ||
| -DCMAKE_CXX_COMPILER=clang++ \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \ | ||
| -DCMAKE_INSTALL_RPATH="\$ORIGIN:\$ORIGIN/engine/native" | ||
|
|
||
| - name: Compile Target Binary | ||
| run: | | ||
| cmake --build build/debug -j$(nproc) | ||
|
|
||
| - name: Run Unit Tests | ||
| run: | | ||
| ctest --test-dir build/debug --output-on-failure -j$(nproc) | ||
|
|
||
| - name: Upload Engine Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: linux_debug | ||
| path: build/debug/ | ||
| if-no-files-found: error | ||
| retention-days: 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 4.0) | |
| project(DraconicEngine LANGUAGES C CXX) | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure of the best spot to put it, but Windows headers need if(WIN32)
add_compile_definitions("_${CMAKE_SYSTEM_PROCESSOR}_")
endif()Add this and #27, then Windows will compile fine. |
||
| find_package(Git QUIET) | ||
| find_package(Threads REQUIRED) | ||
|
|
||
| if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") | ||
| message(STATUS "Updating submodules...") | ||
|
|
@@ -22,5 +23,51 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") | |
| include(CTest) | ||
|
AR-DEV-1 marked this conversation as resolved.
|
||
| include(Compiler) | ||
| include(Modules) | ||
| include(Shaders) | ||
|
AR-DEV-1 marked this conversation as resolved.
|
||
|
|
||
| add_subdirectory(engine/native) | ||
| # Subdirectories for engine libs | ||
| add_subdirectory(engine/native) | ||
|
|
||
| # Main Executable | ||
| add_executable(draconic engine/native/main/main.cpp) | ||
|
|
||
| target_link_libraries(draconic | ||
| PRIVATE | ||
| core | ||
| math | ||
| io | ||
| memory | ||
| platform | ||
| input | ||
| rendering | ||
| scene | ||
| bgfx | ||
| bx | ||
| bimg | ||
| ) | ||
|
AR-DEV-1 marked this conversation as resolved.
|
||
|
|
||
| if(UNIX AND NOT APPLE) | ||
| target_link_libraries(draconic PRIVATE SDL3::SDL3-static Threads::Threads dl) | ||
| target_link_options(draconic PRIVATE -Wl,--whole-archive $<TARGET_FILE:SDL3::SDL3-static> -Wl,--no-whole-archive) | ||
| elseif(APPLE) | ||
| target_link_libraries(draconic PRIVATE SDL3::SDL3-static) | ||
| target_link_options(draconic PRIVATE -Wl,-force_load,$<TARGET_FILE:SDL3::SDL3-static>) | ||
| else() | ||
| target_link_libraries(draconic PRIVATE SDL3::SDL3-static) | ||
| endif() | ||
|
|
||
| compile_shaders(draconic) | ||
|
|
||
| set(TEST_IMAGE | ||
| "${CMAKE_SOURCE_DIR}/assets/draconic_logo_no_text.png" | ||
| ) | ||
|
|
||
| add_custom_command( | ||
| TARGET draconic POST_BUILD | ||
|
|
||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
| ${TEST_IMAGE} | ||
| $<TARGET_FILE_DIR:draconic>/test.png | ||
|
|
||
| COMMENT "Copying test texture..." | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| include_guard(GLOBAL) | ||
|
|
||
| set(SHADER_SRC_DIR "${CMAKE_SOURCE_DIR}/engine/native/rendering/shaders") | ||
| set(SHADER_BIN_DIR "${CMAKE_BINARY_DIR}") | ||
| set(BGFX_INCLUDE "${CMAKE_SOURCE_DIR}/engine/native/thirdparty/bgfx/src") | ||
|
|
||
| function(compile_shaders TARGET_NAME) | ||
| file(MAKE_DIRECTORY ${SHADER_BIN_DIR}) | ||
|
|
||
| if(APPLE) | ||
| set(VERTEX_PROFILE "metal") | ||
| set(FRAGMENT_PROFILE "metal") | ||
| set(SHADER_PLATFORM "osx") | ||
| elseif(WIN32) | ||
| set(VERTEX_PROFILE "s_5_0") | ||
| set(FRAGMENT_PROFILE "s_5_0") | ||
| set(SHADER_PLATFORM "windows") | ||
| else() | ||
| set(VERTEX_PROFILE "spirv") | ||
| set(FRAGMENT_PROFILE "spirv") | ||
| set(SHADER_PLATFORM "linux") | ||
| endif() | ||
|
|
||
| set(VERTEX_INPUT "${SHADER_SRC_DIR}/vs.sc") | ||
| set(VERTEX_OUTPUT "${SHADER_BIN_DIR}/vs.bin") | ||
|
|
||
| set(FRAGMENT_INPUT "${SHADER_SRC_DIR}/fs.sc") | ||
| set(FRAGMENT_OUTPUT "${SHADER_BIN_DIR}/fs.bin") | ||
|
|
||
| set(QUAD_VERTEX_INPUT "${SHADER_SRC_DIR}/vs_quad.sc") | ||
| set(QUAD_VERTEX_OUTPUT "${SHADER_BIN_DIR}/vs_quad.bin") | ||
|
|
||
| set(QUAD_FRAGMENT_INPUT "${SHADER_SRC_DIR}/fs_quad.sc") | ||
| set(QUAD_FRAGMENT_OUTPUT "${SHADER_BIN_DIR}/fs_quad.bin") | ||
|
|
||
| set(VARYING_DEF "${SHADER_SRC_DIR}/varying.def.sc") | ||
| set(QUAD_VARYING_DEF "${SHADER_SRC_DIR}/varying_quad.def.sc") | ||
|
|
||
| add_custom_command( | ||
| TARGET draconic POST_BUILD | ||
| COMMENT "Compiling asset pipelines and core engine shaders via native tools..." | ||
|
|
||
| COMMAND $<TARGET_FILE:shaderc> | ||
| -f ${VERTEX_INPUT} | ||
| -o ${VERTEX_OUTPUT} | ||
| --type vertex | ||
| --platform ${SHADER_PLATFORM} | ||
| -p ${VERTEX_PROFILE} | ||
| --varyingdef ${VARYING_DEF} | ||
| -i ${BGFX_INCLUDE} | ||
|
|
||
| COMMAND $<TARGET_FILE:shaderc> | ||
| -f ${FRAGMENT_INPUT} | ||
| -o ${FRAGMENT_OUTPUT} | ||
| --type fragment | ||
| --platform ${SHADER_PLATFORM} | ||
| -p ${FRAGMENT_PROFILE} | ||
| --varyingdef ${VARYING_DEF} | ||
| -i ${BGFX_INCLUDE} | ||
|
|
||
| COMMAND $<TARGET_FILE:shaderc> | ||
| -f ${QUAD_VERTEX_INPUT} | ||
| -o ${QUAD_VERTEX_OUTPUT} | ||
| --type vertex | ||
| --platform ${SHADER_PLATFORM} | ||
| -p ${VERTEX_PROFILE} | ||
| --varyingdef ${QUAD_VARYING_DEF} | ||
| -i ${BGFX_INCLUDE} | ||
|
|
||
| COMMAND $<TARGET_FILE:shaderc> | ||
| -f ${QUAD_FRAGMENT_INPUT} | ||
| -o ${QUAD_FRAGMENT_OUTPUT} | ||
| --type fragment | ||
| --platform ${SHADER_PLATFORM} | ||
| -p ${FRAGMENT_PROFILE} | ||
| --varyingdef ${QUAD_VARYING_DEF} | ||
| -i ${BGFX_INCLUDE} | ||
|
|
||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VERTEX_OUTPUT} $<TARGET_FILE_DIR:draconic> | ||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FRAGMENT_OUTPUT} $<TARGET_FILE_DIR:draconic> | ||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QUAD_VERTEX_OUTPUT} $<TARGET_FILE_DIR:draconic> | ||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QUAD_FRAGMENT_OUTPUT} $<TARGET_FILE_DIR:draconic> | ||
| ) | ||
| endfunction() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,12 @@ | ||
| add_modules_library(core SHARED) | ||
| add_modules_library(input) | ||
| add_modules_library(rendering) | ||
| add_modules_library(scene) | ||
|
|
||
| add_subdirectory(thirdparty SYSTEM) | ||
| add_subdirectory(platform) | ||
|
|
||
| add_modules_library(core SHARED) | ||
| target_link_libraries(core PUBLIC definitions math memory) | ||
| target_link_libraries(core PUBLIC definitions math io memory) | ||
| target_link_libraries(input PRIVATE SDL3::SDL3-static core) | ||
| target_link_libraries(rendering PUBLIC rhi rendergraph mesh material quad_renderer renderer) | ||
| target_link_libraries(scene PUBLIC renderable transform_component camera) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| add_modules_library(definitions PIC) | ||
| add_modules_library(math) | ||
| add_modules_library(io) | ||
| add_modules_library(memory) | ||
| target_link_libraries(math PUBLIC definitions) | ||
| target_link_libraries(memory PUBLIC definitions) | ||
|
|
||
| target_link_libraries(math PUBLIC definitions bx) | ||
| target_link_libraries(io PUBLIC definitions stb_image) | ||
| target_link_libraries(memory PUBLIC definitions math) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| module; | ||
|
|
||
| #include <vector> | ||
| #include <string> | ||
| #include <fstream> | ||
| #include <print> | ||
|
|
||
| module core.io.filesystem; | ||
|
|
||
| import core.stdtypes; | ||
|
|
||
| namespace draco::core::io::filesystem | ||
| { | ||
| std::vector<u8> load_binary(const std::string& path) | ||
| { | ||
| // Open at the end (ate) to get size and in binary mode | ||
| std::ifstream file(path, std::ios::binary | std::ios::ate); | ||
|
|
||
| if (!file.is_open()) { | ||
| std::println("Error: Could not open file at: {}", path); | ||
| // Return an empty vector | ||
| return {}; | ||
| } | ||
|
|
||
| std::streamsize size = file.tellg(); | ||
| if (size < 0) { | ||
| std::println("Error: File is empty or unreadable: {}", path); | ||
| return {}; | ||
| } | ||
|
|
||
| if (size == 0) { | ||
| return {}; | ||
| } | ||
|
|
||
| file.seekg(0, std::ios::beg); | ||
|
|
||
| std::vector<u8> buffer(static_cast<std::size_t>(size)); | ||
| if (file.read(reinterpret_cast<char*>(buffer.data()), size)) { | ||
| return buffer; | ||
| } | ||
|
|
||
| std::println("Error: Failed to read file contents: {}", path); | ||
| return {}; | ||
|
AR-DEV-1 marked this conversation as resolved.
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module; | ||
|
|
||
| #include <vector> | ||
| #include <string> | ||
| #include <fstream> | ||
|
|
||
| export module core.io.filesystem; | ||
|
|
||
| import core.stdtypes; | ||
|
|
||
| export namespace draco::core::io::filesystem | ||
| { | ||
| // Returns a buffer of the file data | ||
| std::vector<u8> load_binary(const std::string& path); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.