Skip to content

Commit

Permalink
Init from local
Browse files Browse the repository at this point in the history
  • Loading branch information
vs-shirokii committed Jun 16, 2024
1 parent c05d622 commit 30b3ae1
Show file tree
Hide file tree
Showing 104 changed files with 21,139 additions and 63 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/common/rendering/rt/unordered_dense"]
path = src/common/rendering/rt/unordered_dense
url = C:/Dev/gzdoom/src/common/rendering/rt
28 changes: 24 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ if (NOT VCPKG_TOOLCHAIN)
set(VCPKG_MANIFEST_FEATURES)
endif()

set(CMAKE_CXX_STANDARD 17)

option( HAVE_RT "Enable RayTracing support" ON )


if( HAVE_RT )
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -155,7 +163,11 @@ IF( NOT CMAKE_BUILD_TYPE )
ENDIF()

set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created." )
set( ZDOOM_EXE_NAME "gzdoom" CACHE FILEPATH "Name of the executable to create" )
if( HAVE_RT )
set( ZDOOM_EXE_NAME "gzdoom" CACHE FILEPATH "Name of the executable to create" )
else()
set( ZDOOM_EXE_NAME "gzdoom-rt" CACHE FILEPATH "Name of the executable to create" )
endif()
if( MSVC )
# Allow the user to use ZDOOM_OUTPUT_DIR as a single release point.
# Use zdoom, zdoomd, zdoom64, and zdoomd64 for the binary names
Expand Down Expand Up @@ -238,8 +250,8 @@ if( ${TARGET_ARCHITECTURE} MATCHES "x86_64" )
set( HAVE_VM_JIT ON )
endif()

option (HAVE_VULKAN "Enable Vulkan support" ON)
option (HAVE_GLES2 "Enable GLES2 support" ON)
option (HAVE_VULKAN "Enable Vulkan support" OFF)
option (HAVE_GLES2 "Enable GLES2 support" OFF)

# no, we're not using external asmjit for now, we made too many modifications to our's.
# if the asmjit author uses our changes then we'll update this.
Expand All @@ -258,6 +270,12 @@ if( MSVC )
# Disable run-time type information
set( ALL_C_FLAGS "/GF /Gy /permissive-" )

if ( HAVE_RT )
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_RT=1" )
else()
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_RT=0" )
endif()

if ( HAVE_VULKAN )
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_VULKAN" )
endif()
Expand Down Expand Up @@ -290,6 +308,8 @@ if( MSVC )
else()
set( REL_LINKER_FLAGS "" )
set( ALL_C_FLAGS "-ffp-contract=off" )

set( ALL_C_FLAGS "${ALL_C_FLAGS} /DHAVE_RT=0" )

if ( HAVE_VULKAN )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DHAVE_VULKAN" )
Expand Down
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# Welcome to GZDoom!
# GZDoom: Ray Traced

[![Continuous Integration](https://github.com/ZDoom/gzdoom/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/ZDoom/gzdoom/actions/workflows/continuous_integration.yml)
**GZDoom: Ray Traced** introduces a path tracing renderer to **GZDoom**, a Doom source port.

## GZDoom is a modder-friendly OpenGL and Vulkan source port based on the DOOM engine

Copyright (c) 1998-2023 ZDoom + GZDoom teams, and contributors
## Local Build

Doom Source (c) 1997 id Software, Raven Software, and contributors
Windows

Please see license files for individual contributor licenses
1. Run `auto-setup-windows.cmd` to configure and build via CMake
* This will produce `build/RelWithDebInfo/gzdoom.exe` (and Visual Studio solution `build/GZDoom.sln`)
1. Copy from a release package into `build/RelWithDebInfo/` folder:
1. `rt` folder
1. `libsndfile-1.dll`
1. `openal32.dll`
1. `zmusic.dll`
1. Run `build/RelWithDebInfo/gzdoom.exe`

Special thanks to Coraline of the EDGE team for allowing us to use her [README.md](https://github.com/3dfxdev/EDGE/blob/master/README.md) as a template for this one.
##

### Licensed under the GPL v3
##### https://www.gnu.org/licenses/quick-guide-gplv3.en.html
---

## How to build GZDoom
Licensed under the [GNU General Public License Version 3](LICENSE).
Copyright (c) 1998-2023 ZDoom + GZDoom teams, and contributors.
Doom Source (c) 1997 id Software, Raven Software, and contributors.
Please see license files for individual contributor licenses.

To build GZDoom, please see the [wiki](https://zdoom.org/wiki/) and see the "Programmer's Corner" on the bottom-right corner of the page to build for your platform.
---

# Resources
- https://zdoom.org/ - Home Page
- https://forum.zdoom.org/ - Forum
- https://zdoom.org/wiki/ - Wiki
- https://dsc.gg/zdoom - Discord Server
- https://docs.google.com/spreadsheets/d/1pvwXEgytkor9SClCiDn4j5AH7FedyXS-ocCbsuQIXDU/edit?usp=sharing - Translation sheet (Google Docs)
[Home Page](https://zdoom.org/) |
[Forum](https://forum.zdoom.org/) |
[Wiki](https://zdoom.org/wiki/) |
[Discord Server](https://dsc.gg/zdoom) |
[Translation sheet (Google Docs)](https://docs.google.com/spreadsheets/d/1pvwXEgytkor9SClCiDn4j5AH7FedyXS-ocCbsuQIXDU/edit?usp=sharing)
26 changes: 25 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ add_definitions( -DTHIS_IS_GZDOOM )
if( WIN32 )

add_definitions( -D_WIN32 )
add_definitions( -DRAYTRACED )

set( PROJECT_LIBRARIES
psapi
Expand Down Expand Up @@ -601,6 +602,7 @@ file( GLOB HEADER_FILES
common/rendering/gl_load/*.h
common/rendering/gles/*.h
common/rendering/hwrenderer/data/*.h
common/rendering/rt/*.h
common/rendering/vulkan/*.h
common/rendering/vulkan/system/*.h
common/rendering/vulkan/renderer/*.h
Expand Down Expand Up @@ -632,7 +634,6 @@ file( GLOB HEADER_FILES
rendering/swrenderer/viewport/*.h
rendering/hwrenderer/*.h
rendering/hwrenderer/scene/*.h
*.h
)

set ( SWRENDER_SOURCES
Expand Down Expand Up @@ -782,6 +783,15 @@ if (HAVE_GLES2)
list (APPEND FASTMATH_SOURCES ${GLES_SOURCES})
endif()

if (HAVE_RT)
set(RT_SOURCES
common/rendering/rt/rt_main.cpp
common/rendering/rt/rt_cutscene.cpp
)

list (APPEND FASTMATH_SOURCES ${RT_SOURCES})
endif()

if (HAVE_VULKAN)
list (APPEND FASTMATH_SOURCES ${VULKAN_SOURCES})
endif()
Expand Down Expand Up @@ -1239,6 +1249,19 @@ list( REMOVE_ITEM GAME_NONPCH_SOURCES ${PCH_SOURCES} )

add_executable( zdoom WIN32 MACOSX_BUNDLE ${GAME_SOURCES} )

if( HAVE_RT )
if ( DEFINED ENV{RTGL1_SDK_PATH} )
include_directories( $ENV{RTGL1_SDK_PATH}/Include )
# VS hot reload
if ( MSVC AND WIN32 AND NOT MSVC_VERSION VERSION_LESS 142 )
target_link_options( zdoom PRIVATE $<$<CONFIG:Debug>:/INCREMENTAL> )
target_compile_options( zdoom PRIVATE $<$<CONFIG:Debug>:/ZI> )
endif()
else()
message(FATAL_ERROR "Environment variable RTGL1_SDK_PATH is not set. It should point to RTGL1 library directory")

Check failure on line 1261 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / Visual Studio 2022 | Release

Environment variable RTGL1_SDK_PATH is not set. It should point to RTGL1

Check failure on line 1261 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / Visual Studio 2022 | Debug

Environment variable RTGL1_SDK_PATH is not set. It should point to RTGL1

Check failure on line 1261 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / Visual Studio 2019 | Release

Environment variable RTGL1_SDK_PATH is not set. It should point to RTGL1
endif()
endif()

target_precompile_headers( zdoom PRIVATE g_pch.h )

set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${ZD_FASTMATH_FLAG} )
Expand Down Expand Up @@ -1499,6 +1522,7 @@ source_group("Common\\Rendering\\Hardware Renderer\\Data" REGULAR_EXPRESSION "^$
source_group("Common\\Rendering\\Hardware Renderer\\Postprocessing" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/hwrenderer/postprocessing/.+")
source_group("Common\\Rendering\\OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl_load/.+")
source_group("Common\\Rendering\\OpenGL Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl/.+")
source_group("Common\\Rendering\\RT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/rt/.+")
source_group("Common\\Rendering\\GLES Backend" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gles/.+")
source_group("Common\\Rendering\\Vulkan Renderer\\System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/system/.+")
source_group("Common\\Rendering\\Vulkan Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/vulkan/renderer/.+")
Expand Down
8 changes: 8 additions & 0 deletions src/am_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ CUSTOM_CVAR(Int, am_cheat, 0, 0)


CVAR(Int, am_rotate, 0, CVAR_ARCHIVE);
#if !HAVE_RT
CVAR(Int, am_overlay, 0, CVAR_ARCHIVE);
#else
CVAR(Int, am_overlay, 1, CVAR_ARCHIVE);
#endif
CVAR(Bool, am_showsecrets, true, CVAR_ARCHIVE);
CVAR(Bool, am_showmonsters, true, CVAR_ARCHIVE);
CVAR(Bool, am_showitems, false, CVAR_ARCHIVE);
Expand Down Expand Up @@ -3320,8 +3324,10 @@ void DAutomap::Drawer (int bottom)

drawAuthorMarkers();

#if !HAVE_RT // it's kinda invisible
if (!viewactive)
drawCrosshair(AMColors[AMColors.XHairColor]);
#endif

drawMarks();
showSS();
Expand Down Expand Up @@ -3465,11 +3471,13 @@ void AM_ToggleMap()
}
else
{
#if !HAVE_RT // only one click for am_overlay, do not cycle
if (am_overlay == 1 && viewactive)
{
viewactive = false;
}
else
#endif
{
AM_Stop();
}
Expand Down
8 changes: 8 additions & 0 deletions src/common/2d/v_2ddrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,14 @@ void F2DDrawer::AddPixel(int x1, int y1, uint32_t color)
PalEntry p = (PalEntry)color;
p.a = 255;

#if HAVE_RT
{
// emulate via quad
twod->AddColorOnlyQuad(x1 - 1, y1 - 1, 2, 2, p);
return;
}
#endif

RenderCommand dg;

dg.mType = DrawTypePoints;
Expand Down
4 changes: 4 additions & 0 deletions src/common/console/c_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ static GameAtExit *ExitCmdList;
static char *work = NULL;
static int worklen = 0;

#if !HAVE_RT
CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE)
#else
CUSTOM_CVAR(Int, con_scale, 3, CVAR_ARCHIVE)
#endif
{
if (self < 0) self = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/cutscenes/screenjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ void ScreenJobDraw()

if (cutscene.runner)
{
#if !HAVE_RT // do not draw black quad
twod->ClearScreen();
#endif
ScaleOverrider ovr(twod);
IFVIRTUALPTRNAME(cutscene.runner, NAME_ScreenJobRunner, RunFrame)
{
Expand Down
16 changes: 16 additions & 0 deletions src/common/engine/d_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,21 @@
#include "gamestate.h"
#include "i_interface.h"

#if HAVE_RT
#include "rt/rt_helpers.h"
#endif

int eventhead;
int eventtail;
event_t events[MAXEVENTS];

#if !HAVE_RT
CVAR(Float, m_sensitivity_x, 2.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, m_sensitivity_y, 2.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
#else
CVAR(Float, m_sensitivity_x, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, m_sensitivity_y, 0.75f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
#endif
CVAR(Bool, invertmouse, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE); // Invert mouse look down/up?
CVAR(Bool, invertmousex, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE); // Invert mouse look left/right?

Expand All @@ -75,6 +84,13 @@ void D_ProcessEvents (void)
event_t *ev = &events[eventtail];
eventtail = (eventtail + 1) & (MAXEVENTS - 1);

#if HAVE_RT
if (RT_IgnoreUserInput())
{
continue;
}
#endif

if (ev->type == EV_KeyUp && keywasdown[ev->data1])
{
delayedevents.Push(ev);
Expand Down
4 changes: 4 additions & 0 deletions src/common/engine/i_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ CVAR(Bool, vid_fps, false, 0)

EXTERN_CVAR(Bool, ui_generic)

#if !HAVE_RT
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
#else
CUSTOM_CVAR(String, language, "default", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
#endif
{
GStrings.UpdateLanguage(self);
UpdateGenericUI(ui_generic);
Expand Down
3 changes: 3 additions & 0 deletions src/common/engine/i_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ struct WadStuff
{
FString Path;
FString Name;
#if HAVE_RT
FString Autoname;
#endif
};


Expand Down
1 change: 1 addition & 0 deletions src/common/filesystem/include/resourcefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ struct FResourceEntry
uint16_t Flags;
uint16_t Method;
int16_t Namespace;
const char* SystemFilePath;
};

void SetMainThread();
Expand Down
7 changes: 6 additions & 1 deletion src/common/filesystem/source/file_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
}
// for internal access we use the normalized form of the relative path.
Entries[count].FileName = NormalizeFileName(entry.FilePathRel.c_str());
Entries[count].SystemFilePath = stringpool->Strdup(Entries[count].FileName);
Entries[count].CompressedSize = Entries[count].Length = entry.Length;
Entries[count].Flags = RESFF_FULLPATH;
Entries[count].ResourceID = -1;
Expand All @@ -153,6 +154,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
bool FDirectory::Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf)
{
NumLumps = AddDirectory(FileName, filter, Printf);
PostProcessArchive(filter);
return true;
}

Expand All @@ -167,7 +169,10 @@ FileReader FDirectory::GetEntryReader(uint32_t entry, int readertype, int)
FileReader fr;
if (entry < NumLumps)
{
std::string fn = mBasePath; fn += Entries[entry].FileName;
std::string fn = mBasePath;
fn += Entries[entry].SystemFilePath ?
Entries[entry].SystemFilePath :
Entries[entry].FileName;
fr.OpenFile(fn.c_str());
if (readertype == READER_CACHED)
{
Expand Down
5 changes: 5 additions & 0 deletions src/common/fonts/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,12 @@ FTranslationID FFont::GetColorTranslation (EColorRange range, PalEntry *color) c
if (Translations.Size() == 0) return NO_TRANSLATION;
assert(Translations.Size() == (unsigned)NumTextColors);

#if !HAVE_RT
if (noTranslate)
#else
// no support for translation with RT
if (true)
#endif
{
PalEntry retcolor = PalEntry(255, 255, 255, 255);
if (range >= 0 && range < NumTextColors && range != CR_UNTRANSLATED)
Expand Down
3 changes: 3 additions & 0 deletions src/common/fonts/hexfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ struct HexDataSource
{
double lum = i == 1 ? 0.01 : 0.5 + (i - 2) * (0.5 / 17.);
uint8_t lumb = (uint8_t(lum * 255));
#if HAVE_RT // make the newconsolefont more contrast
lumb = lumb > 100 ? 255 : lumb;
#endif

ConsolePal[i] = PalEntry(255, lumb, lumb, lumb);
lumb = i * 255 / 17;
Expand Down
4 changes: 4 additions & 0 deletions src/common/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ CVAR (Int, m_showinputgrid, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, m_blockcontrollers, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

CVAR (Float, snd_menuvolume, 0.6f, CVAR_ARCHIVE)
#if !HAVE_RT
CVAR(Int, m_use_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
#else
CVAR(Int, m_use_mouse, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
#endif
CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Bool, m_cleanscale, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
// Option Search
Expand Down
Loading

0 comments on commit 30b3ae1

Please sign in to comment.