Follow instructions from https://gist.github.com/chayleaf/a8ad389e520e58b885779e051450707e for running
I couldn't get it to run, but it builds
Follow instructions from https://gist.github.com/chayleaf/a8ad389e520e58b885779e051450707e for running
I couldn't get it to run, but it builds
| { lib | |
| , wineWowPackages | |
| , stdenv | |
| , fetchFromGitHub | |
| , cmake | |
| , vulkan-headers | |
| , vulkan-loader | |
| }: | |
| stdenv.mkDerivation rec { | |
| pname = "fidelityfx-fsr2"; | |
| version = "2.2.0"; | |
| src = fetchFromGitHub { | |
| owner = "TheJackiMonster"; | |
| repo = "FidelityFX-FSR2"; | |
| rev = "74224a6077f9bd1a279e71b6ee9d81ec0420f6ca"; | |
| sha256 = "sha256-5ZdE6vgkalmSZbaAFJ49JIKdLgffnmZ4qbJyw3Ecw5s="; | |
| }; | |
| configurePhase = '' | |
| cd src/ffx-fsr2-api | |
| export WINEPREFIX="$PWD/build/wine" | |
| cmakeConfigurePhase | |
| ''; | |
| cmakeFlags = [ | |
| "-DFFX_FSR2_API_DX12=OFF" | |
| "-DFFX_FSR2_API_VK=ON" | |
| ]; | |
| installPhase = '' | |
| mkdir -p "$out" | |
| cp -r ../bin/ "$out/lib" | |
| ''; | |
| nativeBuildInputs = [ | |
| cmake wineWowPackages.minimal | |
| ]; | |
| buildInputs = [ | |
| vulkan-headers vulkan-loader | |
| ]; | |
| meta = with lib; { | |
| description = "FidelityFX Super Resolution 2"; | |
| homepage = "https://github.com/TheJackiMonster/FidelityFX-FSR2"; | |
| changelog = "https://github.com/TheJackiMonster/FidelityFX-FSR2/blob/${src.rev}/changelog.md"; | |
| license = licenses.mit; | |
| # maintainers = with maintainers; [ chayleaf ]; | |
| }; | |
| } |
| { lib | |
| , pkgs | |
| , stdenv | |
| , fetchFromGitHub | |
| , gamedir ? "valve" | |
| , enableGoldsourceSupport ? true | |
| , enableVgui ? false | |
| , enableVoicemgr ? false | |
| }: | |
| stdenv.mkDerivation { | |
| pname = "xash-rt-hlsdk"; | |
| version = "2023-02-17"; | |
| nativeBuildInputs = with pkgs; [cmake]; | |
| src = fetchFromGitHub { | |
| owner = "sultim-t"; | |
| repo = "hlsdk-xash3d"; | |
| rev = "826c81b74f4fb29a53b2e2c98388db1b81a9e517"; | |
| sha256 = if enableVgui then "sha256-avRkLbchZJjn/Y0ExkjZu9YikV1vS6Zj8kitOj3jA+Q=" else "sha256-rZz/UgH1pQRnme/sWkP8RTxzsWsjKxIMsh3jLhbEzFQ="; | |
| fetchSubmodules = enableVgui; | |
| }; | |
| cmakeFlags = let | |
| optionals = lib.optionals; | |
| optional = (cond: val: optionals cond [val]); | |
| cmakeBool = (x: if x then "ON" else "OFF"); | |
| in [ | |
| "-DUSE_VGUI=${cmakeBool enableVgui}" | |
| "-DGOLDSOURCE_SUPPORT=${cmakeBool enableGoldsourceSupport}" | |
| "-DUSE_VOICEMGR=${cmakeBool enableVoicemgr}" | |
| ] ++ (optional (gamedir != "valve") "-DGAMEDIR=${gamedir}"); | |
| meta = with lib; { | |
| description = "Fork of patched Half-Life SDK 2.3 from original Xash3D engine sources"; | |
| homepage = "https://github.com/sultim-t/hlsdk-xash3d"; | |
| license = with licenses; [ unfree ]; | |
| # maintainers = with maintainers; [ chayleaf ]; | |
| }; | |
| } |
| diff --git a/CMakeLists.txt b/CMakeLists.txt | |
| index ea0adc4..91286bb 100644 | |
| --- a/CMakeLists.txt | |
| +++ b/CMakeLists.txt | |
| @@ -253,7 +253,8 @@ if (WIN32) | |
| target_link_libraries(RayTracedGL1 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Source/FSR2/win32/ffx_fsr2_api_vk_x64.lib" ) | |
| endif() | |
| else() | |
| - message(FATAL_ERROR "On non-WIN32, please, provide static libraries of FSR2 or disable FSR2") | |
| + target_link_libraries(RayTracedGL1 PRIVATE "$ENV{FSR2_LIBS_PATH}/libffx_fsr2_api_x86_64.a" ) | |
| + target_link_libraries(RayTracedGL1 PRIVATE "$ENV{FSR2_LIBS_PATH}/libffx_fsr2_api_vk_x86_64.a" ) | |
| endif() | |
| # Debug windows - ImGui | |
| @@ -287,4 +288,4 @@ if (MSVC AND WIN32 AND NOT MSVC_VERSION VERSION_LESS 142) | |
| target_link_options(RtglExample PRIVATE $<$<CONFIG:Debug>:/INCREMENTAL>) | |
| target_compile_options(RtglExample PRIVATE $<$<CONFIG:Debug>:/ZI>) | |
| endif() | |
| -endif() | |
| \ No newline at end of file | |
| +endif() | |
| diff --git a/Include/RTGL1/RTGL1.h b/Include/RTGL1/RTGL1.h | |
| index 37357a8..df76a6f 100644 | |
| --- a/Include/RTGL1/RTGL1.h | |
| +++ b/Include/RTGL1/RTGL1.h | |
| @@ -56,6 +56,12 @@ typedef void CAMetalLayer; | |
| #ifdef RG_USE_SURFACE_XLIB | |
| #include <X11/Xlib.h> | |
| #endif // RG_USE_SURFACE_XLIB | |
| +#ifdef None | |
| +#undef None | |
| +#endif | |
| +#ifdef Success | |
| +#undef Success | |
| +#endif | |
| #ifdef __cplusplus | |
| extern "C" { | |
| @@ -899,9 +905,9 @@ typedef struct RgDrawFrameRenderResolutionParams | |
| { | |
| RgStructureType sType; | |
| void* pNext; | |
| - RgRenderUpscaleTechnique upscaleTechnique; | |
| - RgRenderSharpenTechnique sharpenTechnique; | |
| - RgRenderResolutionMode resolutionMode; | |
| + int upscaleTechnique; | |
| + int sharpenTechnique; | |
| + int resolutionMode; | |
| // Used, if resolutionMode is RG_RENDER_RESOLUTION_MODE_CUSTOM | |
| RgExtent2D customRenderSize; | |
| // If not null, final image will be downscaled to this size at the very end. | |
| diff --git a/Source/DebugPrint.h b/Source/DebugPrint.h | |
| index a7c4ea9..d96fc85 100644 | |
| --- a/Source/DebugPrint.h | |
| +++ b/Source/DebugPrint.h | |
| @@ -20,7 +20,7 @@ | |
| #pragma once | |
| -#include <format> | |
| +#include <fmt/core.h> | |
| #include <string_view> | |
| // TODO: fmt instead of std::format? for compile-time checks | |
| @@ -63,7 +63,7 @@ namespace debug | |
| } | |
| auto str = | |
| - std::vformat( msg, std::make_format_args( std::forward< Args >( args )... ) ); | |
| + fmt::v9::vformat( msg, fmt::v9::make_format_args( std::forward< Args >( args )... ) ); | |
| Print( severity, std::string_view( str ) ); | |
| } | |
| diff --git a/Source/FSR2/include/ffx_types.h b/Source/FSR2/include/ffx_types.h | |
| index 0079572..960f82f 100644 | |
| --- a/Source/FSR2/include/ffx_types.h | |
| +++ b/Source/FSR2/include/ffx_types.h | |
| @@ -23,13 +23,7 @@ | |
| #include <stdint.h> | |
| -#if defined (FFX_GCC) | |
| -/// FidelityFX exported functions | |
| #define FFX_API | |
| -#else | |
| -/// FidelityFX exported functions | |
| -#define FFX_API __declspec(dllexport) | |
| -#endif // #if defined (FFX_GCC) | |
| /// Maximum supported number of simultaneously bound SRVs. | |
| #define FFX_MAX_NUM_SRVS 16 | |
| diff --git a/Source/GltfExporter.cpp b/Source/GltfExporter.cpp | |
| index 22555dc..bab2b91 100644 | |
| --- a/Source/GltfExporter.cpp | |
| +++ b/Source/GltfExporter.cpp | |
| @@ -671,7 +671,13 @@ struct GltfTextures | |
| makeSampler( RG_SAMPLER_ADDRESS_MODE_CLAMP, RG_SAMPLER_ADDRESS_MODE_CLAMP ), | |
| }; | |
| auto findSampler = [ this ]( const RTGL1::TextureManager::ExportResult& r ) { | |
| - cgltf_sampler target = makeSampler( r.addressModeU, r.addressModeV ); | |
| + cgltf_sampler target = { | |
| + .name = nullptr, | |
| + .mag_filter = 0, // default | |
| + .min_filter = 0, // default | |
| + .wrap_s = r.addressModeU == RG_SAMPLER_ADDRESS_MODE_CLAMP ? 33071 : 10497, | |
| + .wrap_t = r.addressModeV == RG_SAMPLER_ADDRESS_MODE_CLAMP ? 33071 : 10497, | |
| + }; | |
| for( cgltf_sampler& found : allocSamplers ) | |
| { | |
| if( std::memcmp( &found, &target, sizeof( cgltf_sampler ) ) == 0 ) | |
| @@ -901,7 +907,7 @@ private: | |
| static float LuminousFluxToCandela( float lumens ) | |
| { | |
| // to lumens per steradian | |
| - return lumens / ( 4 * float( RTGL1::Utils::M_PI ) ); | |
| + return lumens / ( 4 * float( M_PI ) ); | |
| } | |
| static cgltf_light MakeLight( const RgDirectionalLightUploadInfo& sun ) | |
| diff --git a/Source/GltfImporter.cpp b/Source/GltfImporter.cpp | |
| index 72244fe..f58140d 100644 | |
| --- a/Source/GltfImporter.cpp | |
| +++ b/Source/GltfImporter.cpp | |
| @@ -29,7 +29,7 @@ | |
| #include "cgltf/cgltf.h" | |
| -#include <format> | |
| +#include <fmt/core.h> | |
| namespace RTGL1 | |
| { | |
| @@ -248,7 +248,7 @@ namespace | |
| { | |
| debugprintAttr( | |
| attr, | |
| - std::format( | |
| + fmt::v9::format( | |
| "Mismatch on attributes count (expected {}, but got {})", | |
| *vertexCount, | |
| attr.data->count ) ); | |
| @@ -909,7 +909,7 @@ void RTGL1::GltfImporter::UploadToScene( VkCommandBuffer cmd, | |
| constexpr auto candelaToLuminousFlux = []( float lumensPerSteradian ) { | |
| // to lumens | |
| - return lumensPerSteradian * ( 4 * float( Utils::M_PI ) ); | |
| + return lumensPerSteradian * ( 4 * float( M_PI ) ); | |
| }; | |
| auto makeExtras = []( const char* extradata ) { | |
| diff --git a/Source/ImageComposition.h b/Source/ImageComposition.h | |
| index b04091d..fcda7f2 100644 | |
| --- a/Source/ImageComposition.h | |
| +++ b/Source/ImageComposition.h | |
| @@ -20,6 +20,7 @@ | |
| #pragma once | |
| +#include <float.h> | |
| #include "Common.h" | |
| #include "ShaderManager.h" | |
| #include "Framebuffers.h" | |
| @@ -102,4 +103,4 @@ private: | |
| VkDescriptorSet descSet; | |
| }; | |
| -} | |
| \ No newline at end of file | |
| +} | |
| diff --git a/Source/Material.h b/Source/Material.h | |
| index c37da49..910ae45 100644 | |
| --- a/Source/Material.h | |
| +++ b/Source/Material.h | |
| @@ -25,6 +25,7 @@ | |
| #include "SamplerManager.h" | |
| #include <filesystem> | |
| +#include <optional> | |
| namespace RTGL1 | |
| { | |
| @@ -47,4 +48,4 @@ struct MaterialTextures | |
| uint32_t indices[ TEXTURES_PER_MATERIAL_COUNT ]; | |
| }; | |
| -} | |
| \ No newline at end of file | |
| +} | |
| diff --git a/Source/RenderResolutionHelper.h b/Source/RenderResolutionHelper.h | |
| index fa58857..285cf33 100644 | |
| --- a/Source/RenderResolutionHelper.h | |
| +++ b/Source/RenderResolutionHelper.h | |
| @@ -52,9 +52,9 @@ public: | |
| upscaledWidth = windowWidth; | |
| upscaledHeight = windowHeight; | |
| - upscaleTechnique = params.upscaleTechnique; | |
| - sharpenTechnique = params.sharpenTechnique; | |
| - resolutionMode = params.resolutionMode; | |
| + upscaleTechnique = (RgRenderUpscaleTechnique)params.upscaleTechnique; | |
| + sharpenTechnique = (RgRenderSharpenTechnique)params.sharpenTechnique; | |
| + resolutionMode = (RgRenderResolutionMode)params.resolutionMode; | |
| // check for correct values | |
| { | |
| @@ -233,4 +233,4 @@ private: | |
| RgRenderResolutionMode resolutionMode = RG_RENDER_RESOLUTION_MODE_CUSTOM; | |
| }; | |
| -} | |
| \ No newline at end of file | |
| +} | |
| diff --git a/Source/Scene.cpp b/Source/Scene.cpp | |
| index ff0ba0d..19bb315 100644 | |
| --- a/Source/Scene.cpp | |
| +++ b/Source/Scene.cpp | |
| @@ -269,17 +269,13 @@ bool RTGL1::Scene::InsertLightInfo( bool isStatic, const GenericLightPtr& light | |
| if( isStatic ) | |
| { | |
| // just check that there's no id collision | |
| - auto foundSameId = | |
| - std::ranges::find_if( staticLights, [ &light ]( const GenericLight& other ) { | |
| - return getIdFromRef( other ) == getId( light ); | |
| - } ); | |
| - | |
| - if( foundSameId != staticLights.end() ) | |
| - { | |
| - debug::Warning( | |
| - "Trying add a static light with a uniqueID {} that other light already has", | |
| - getId( light ) ); | |
| - return false; | |
| + for (auto it = staticLights.begin(); it != staticLights.end(); ++it) { | |
| + if (getIdFromRef(*it) == getId(light)) { | |
| + debug::Warning( | |
| + "Trying add a static light with a uniqueID {} that other light already has", | |
| + getId( light ) ); | |
| + return false; | |
| + } | |
| } | |
| // add to the list | |
| diff --git a/Source/ShaderManager.cpp b/Source/ShaderManager.cpp | |
| index b41032c..22f88e7 100644 | |
| --- a/Source/ShaderManager.cpp | |
| +++ b/Source/ShaderManager.cpp | |
| @@ -174,7 +174,7 @@ VkPipelineShaderStageCreateInfo ShaderManager::GetStageInfo( std::string_view na | |
| using namespace std::string_literals; | |
| throw RgException( RG_RESULT_ERROR_CANT_FIND_HARDCODED_RESOURCES, | |
| - std::format( "Can't find loaded shader with name \"{}\"", name ) ); | |
| + fmt::v9::format( "Can't find loaded shader with name \"{}\"", name ) ); | |
| } | |
| return VkPipelineShaderStageCreateInfo{ | |
| @@ -188,7 +188,7 @@ VkPipelineShaderStageCreateInfo ShaderManager::GetStageInfo( std::string_view na | |
| VkShaderModule ShaderManager::LoadModuleFromFile( const std::filesystem::path& path ) | |
| { | |
| std::ifstream shaderFile( path, std::ios::binary ); | |
| - std::vector< uint8_t > shaderSource( std::istreambuf_iterator( shaderFile ), {} ); | |
| + std::vector< uint8_t > shaderSource( std::istream_iterator<uint8_t>( shaderFile ), {} ); | |
| if( shaderSource.empty() ) | |
| { | |
| diff --git a/Source/Shaders/GenerateShaders.py b/Source/Shaders/GenerateShaders.py | |
| index da976d2..348a380 100644 | |
| --- a/Source/Shaders/GenerateShaders.py | |
| +++ b/Source/Shaders/GenerateShaders.py | |
| @@ -25,10 +25,10 @@ import subprocess | |
| import pathlib | |
| -TARGET_FOLDER_PATH = "../../Build/shaders/" | |
| +TARGET_FOLDER_PATH = "../../build/shaders/" | |
| -CACHE_FOLDER_PATH = "Build/" | |
| +CACHE_FOLDER_PATH = "build/" | |
| CACHE_FILE_NAME = "GenerateShadersCache.txt" | |
| EXTENSIONS = [ ".comp", ".vert", "frag", ".rgen", ".rahit", ".rchit", ".rmiss" ] | |
| DEPENDENCY_EXTENSIONS = [ ".h", ".inl" ] | |
| @@ -294,4 +294,4 @@ def main(): | |
| # main | |
| if __name__ == "__main__": | |
| - main() | |
| \ No newline at end of file | |
| + main() | |
| diff --git a/Source/Utils.h b/Source/Utils.h | |
| index 6ea9e6c..67eeb1b 100644 | |
| --- a/Source/Utils.h | |
| +++ b/Source/Utils.h | |
| @@ -196,8 +196,6 @@ namespace Utils | |
| RgTransform MakeTransform( const RgFloat3D& up, const RgFloat3D& forward, float scale ); | |
| RgTransform MakeTransform( const RgFloat3D& position, const RgFloat3D& forward ); | |
| - constexpr double M_PI = 3.1415926535897932384626433; | |
| - | |
| constexpr float DegToRad( float degrees ) | |
| { | |
| return degrees * float( M_PI ) / 180.0f; | |
| @@ -383,4 +381,4 @@ uint32_t Utils::GetWorkGroupCountT( T1 size, T2 groupSize ) | |
| static_cast< uint32_t >( groupSize ) ); | |
| } | |
| -} | |
| \ No newline at end of file | |
| +} | |
| diff --git a/Source/VertexCollector.cpp b/Source/VertexCollector.cpp | |
| index e1dfbf4..907b666 100644 | |
| --- a/Source/VertexCollector.cpp | |
| +++ b/Source/VertexCollector.cpp | |
| @@ -34,7 +34,7 @@ namespace | |
| auto MakeName( std::string_view basename, RTGL1::VertexCollectorFilterTypeFlags filter ) | |
| { | |
| - return std::format( "VC: {}-{}", | |
| + return fmt::v9::format( "VC: {}-{}", | |
| basename, | |
| filter & RTGL1::VertexCollectorFilterTypeFlagBits::CF_DYNAMIC ? "Dynamic" | |
| : "Static" ); | |
| diff --git a/Source/VertexCollector.h b/Source/VertexCollector.h | |
| index 774af34..1f8e072 100644 | |
| --- a/Source/VertexCollector.h | |
| +++ b/Source/VertexCollector.h | |
| @@ -147,7 +147,7 @@ private: | |
| private: | |
| static auto MakeName( std::string_view basename, bool isStaging ) | |
| { | |
| - return std::format( "{}{}", basename, isStaging ? " (staging)" : "" ); | |
| + return fmt::v9::format( "{}{}", basename, isStaging ? " (staging)" : "" ); | |
| } | |
| void Init( std::shared_ptr< Buffer > otherDeviceLocal, | |
| @@ -234,4 +234,4 @@ private: | |
| filters; | |
| }; | |
| -} | |
| \ No newline at end of file | |
| +} | |
| diff --git a/Source/VulkanDevice_Dev.cpp b/Source/VulkanDevice_Dev.cpp | |
| index fd40bea..4c0d64c 100644 | |
| --- a/Source/VulkanDevice_Dev.cpp | |
| +++ b/Source/VulkanDevice_Dev.cpp | |
| @@ -121,13 +121,6 @@ void RTGL1::VulkanDevice::Dev_Draw() const | |
| ImGui::Checkbox( "Vsync", &modifiers.vsync ); | |
| ImGui::SliderFloat( "Vertical FOV", &modifiers.fovDeg, 10, 120, "%.0f degrees" ); | |
| - static_assert( | |
| - std::is_same_v< int, std::underlying_type_t< RgRenderUpscaleTechnique > > ); | |
| - static_assert( | |
| - std::is_same_v< int, std::underlying_type_t< RgRenderSharpenTechnique > > ); | |
| - static_assert( | |
| - std::is_same_v< int, std::underlying_type_t< RgRenderResolutionMode > > ); | |
| - | |
| bool dlssOk = IsUpscaleTechniqueAvailable( RG_RENDER_UPSCALE_TECHNIQUE_NVIDIA_DLSS ); | |
| { | |
| ImGui::RadioButton( "Linear##Upscale", | |
| @@ -373,7 +366,7 @@ void RTGL1::VulkanDevice::Dev_Draw() const | |
| { | |
| const ImGuiTableColumnSortSpecs* srt = &sortspecs->Specs[ n ]; | |
| - std::strong_ordering ord{ 0 }; | |
| + std::strong_ordering ord = std::strong_ordering::equal; | |
| switch( srt->ColumnIndex ) | |
| { | |
| case 0: ord = ( a.callIndex <=> b.callIndex ); break; | |
| @@ -473,7 +466,7 @@ void RTGL1::VulkanDevice::Dev_Draw() const | |
| } | |
| else | |
| { | |
| - if( ImGui::BeginPopupContextItem( std::format( "##popup{}", i ).c_str() ) ) | |
| + if( ImGui::BeginPopupContextItem( fmt::v9::format( "##popup{}", i ).c_str() ) ) | |
| { | |
| if( ImGui::MenuItem( "Copy texture name" ) ) | |
| { | |
| @@ -683,7 +676,7 @@ void RTGL1::VulkanDevice::Dev_Draw() const | |
| ImGui::SliderFloat3( | |
| "World Forward vector", dev.worldTransform.forward.data, -1.0f, 1.0f ); | |
| ImGui::InputFloat( | |
| - std::format( "1 unit = {} meters", dev.worldTransform.scale ).c_str(), | |
| + fmt::v9::format( "1 unit = {} meters", dev.worldTransform.scale ).c_str(), | |
| &dev.worldTransform.scale ); | |
| } | |
| ImGui::EndDisabled(); | |
| @@ -756,7 +749,7 @@ void RTGL1::VulkanDevice::Dev_Draw() const | |
| { | |
| const ImGuiTableColumnSortSpecs* srt = &sortspecs->Specs[ n ]; | |
| - std::strong_ordering ord{ 0 }; | |
| + std::strong_ordering ord = std::strong_ordering::equal; | |
| switch( srt->ColumnIndex ) | |
| { | |
| case ColumnTextureIndex0: | |
| @@ -880,7 +873,7 @@ void RTGL1::VulkanDevice::Dev_Draw() const | |
| else | |
| { | |
| if( ImGui::BeginPopupContextItem( | |
| - std::format( "##popup{}", i ).c_str() ) ) | |
| + fmt::v9::format( "##popup{}", i ).c_str() ) ) | |
| { | |
| if( ImGui::MenuItem( "Copy texture name" ) ) | |
| { | |
| @@ -928,9 +921,9 @@ void RTGL1::VulkanDevice::Dev_Override( DrawFrameInfoCopy& copy ) const | |
| dst.fovYRadians = Utils::DegToRad( modifiers.fovDeg ); | |
| { | |
| - dst_resol.upscaleTechnique = modifiers.upscaleTechnique; | |
| - dst_resol.sharpenTechnique = modifiers.sharpenTechnique; | |
| - dst_resol.resolutionMode = modifiers.resolutionMode; | |
| + dst_resol.upscaleTechnique = (RgRenderUpscaleTechnique)modifiers.upscaleTechnique; | |
| + dst_resol.sharpenTechnique = (RgRenderSharpenTechnique)modifiers.sharpenTechnique; | |
| + dst_resol.resolutionMode = (RgRenderResolutionMode)modifiers.resolutionMode; | |
| dst_resol.customRenderSize = { | |
| ClampPix< uint32_t >( modifiers.customRenderSizeScale * | |
| float( renderResolution.UpscaledWidth() ) ), | |
| diff --git a/Source/VulkanDevice_Dev.h b/Source/VulkanDevice_Dev.h | |
| index adc359f..74e4b45 100644 | |
| --- a/Source/VulkanDevice_Dev.h | |
| +++ b/Source/VulkanDevice_Dev.h | |
| @@ -68,9 +68,9 @@ struct Devmode | |
| float fovDeg; | |
| bool vsync; | |
| - RgRenderUpscaleTechnique upscaleTechnique; | |
| - RgRenderSharpenTechnique sharpenTechnique; | |
| - RgRenderResolutionMode resolutionMode; | |
| + int upscaleTechnique; | |
| + int sharpenTechnique; | |
| + int resolutionMode; | |
| float customRenderSizeScale; | |
| bool pixelizedEnable; | |
| int pixelized[ 2 ]; | |
| diff --git a/Source/VulkanDevice_Init.cpp b/Source/VulkanDevice_Init.cpp | |
| index d01a449..ce4cba4 100644 | |
| --- a/Source/VulkanDevice_Init.cpp | |
| +++ b/Source/VulkanDevice_Init.cpp | |
| @@ -96,7 +96,7 @@ VkSurfaceKHR GetSurfaceFromUser( VkInstance instance, const RgInstanceCreateInfo | |
| wlInfo.display = info.pWaylandSurfaceCreateInfo->display; | |
| wlInfo.surface = info.pWaylandSurfaceCreateInfo->surface; | |
| - r = ( instance, &wlInfo, nullptr, &surface ); | |
| + r = vkCreateWaylandSurfaceKHR( instance, &wlInfo, nullptr, &surface ); | |
| VK_CHECKERROR( r ); | |
| return surface; |
| { lib | |
| , stdenv | |
| , fetchFromGitHub | |
| , cmake | |
| , python3 | |
| , shaderc | |
| , pkgs | |
| , vulkan-headers | |
| , vulkan-loader | |
| , xorg | |
| , libGL | |
| , fsr2 ? (pkgs.callPackage ./fsr2.nix {}) | |
| , enableWayland ? true | |
| , wayland | |
| , enableXcb ? true | |
| , enableXlib ? true | |
| , dlssSdk ? null | |
| }: | |
| stdenv.mkDerivation { | |
| pname = "raytracedgl1"; | |
| version = "hl1-2023-02-28"; | |
| srcs = fetchFromGitHub { | |
| owner = "sultim-t"; | |
| repo = "RayTracedGL1"; | |
| rev = "9d85bfef881f06eaef9f871186643c874e11cf3d"; | |
| sha256 = "sha256-vdq65j/PGxHXMYbgnwe3s+DHyn5M3PstaWP8tobtQpw="; | |
| fetchSubmodules = true; | |
| }; | |
| patches = [ ./linux-support.patch ]; | |
| postPatch = '' | |
| sed -i 's%GIT_TAG%# GIT_TAG%g' Source/glaze/CMakeLists.txt | |
| sed -i 's%GIT_REPOSITORY https://github.com/fmtlib/fmt%URL $ENV{FMT_ZIP}%g' Source/glaze/CMakeLists.txt | |
| sed -i 's%GIT_REPOSITORY https://github.com/tcbrindle/NanoRange%URL $ENV{NANORANGE_ZIP}%g' Source/glaze/CMakeLists.txt | |
| ''; | |
| FMT_ZIP = builtins.fetchurl { | |
| url = "https://github.com/fmtlib/fmt/releases/download/9.1.0/fmt-9.1.0.zip"; | |
| sha256 = "15n9yi6xzzs7g9rm87kg8y5yhl2zrqj3bjr845saa63f6swlrsyc"; | |
| }; | |
| NANORANGE_ZIP = builtins.fetchurl { | |
| url = "https://github.com/tcbrindle/NanoRange/archive/bf32251d65673fe170d602777c087786c529ead8.zip"; | |
| sha256 = "07m1a9z8qyw5kq8swz01xnrqgxl5dihdffiy3w3qak81plx7i2zn"; | |
| }; | |
| FSR2_LIBS_PATH = "${fsr2}/lib/ffx_fsr2_api"; | |
| DLSS_SDK_PATH = if dlssSdk == null then null else builtins.toString dlssSdk; | |
| cmakeFlags = let optional = (cond: x: lib.optionals cond [x]); in [] | |
| ++ (optional enableXcb "-DRG_WITH_SURFACE_XCB=ON") | |
| ++ (optional enableXlib "-DRG_WITH_SURFACE_XLIB=ON") | |
| ++ (optional enableWayland "-DRG_WITH_SURFACE_WAYLAND=ON") | |
| ++ (optional (dlssSdk != null) "-DRG_WITH_NVIDIA_DLSS=ON") | |
| ; | |
| nativeBuildInputs = [ cmake python3 shaderc ]; | |
| buildInputs = [ | |
| vulkan-headers vulkan-loader xorg.libX11 xorg.libXrandr xorg.libXinerama xorg.libXcursor xorg.libXi | |
| libGL | |
| ] ++ (lib.optionals enableWayland [ wayland ]); | |
| postBuild = '' | |
| pushd ../Source/Shaders | |
| python3 GenerateShaders.py | |
| popd | |
| ''; | |
| installPhase = '' | |
| mkdir -p $out/lib | |
| cp libRayTracedGL1.so $out/lib | |
| mkdir -p $out/include/RTGL1 | |
| cp ../Include/RTGL1/RTGL1.h $out/include/RTGL1/ | |
| mkdir -p $out/share/RTGL1/shaders | |
| cp ../Tools/CreateKTX2.py ../Tools/BlueNoise_LDR_RGBA_128.ktx2 $out/share/RTGL1/ | |
| cp shaders/*.spv $out/share/RTGL1/shaders/ | |
| ''; | |
| meta = with lib; { | |
| description = ""; | |
| homepage = "https://github.com/sultim-t/RayTracedGL1/"; | |
| license = licenses.mit; | |
| # maintainers = with maintainers; [ chayleaf ]; | |
| }; | |
| } |
| diff --git a/engine/platform/sdl/vid_sdl.c b/engine/platform/sdl/vid_sdl.c | |
| index ab457cd3..772ccfc2 100644 | |
| --- a/engine/platform/sdl/vid_sdl.c | |
| +++ b/engine/platform/sdl/vid_sdl.c | |
| @@ -611,8 +611,11 @@ void VID_RestoreScreenResolution( void ) | |
| #endif | |
| } | |
| -#if XASH_WIN32 // ICO support only for Win32 | |
| +#if XASH_WIN32 || XASH_RAYTRACING | |
| #include "SDL_syswm.h" | |
| +#endif | |
| + | |
| +#if XASH_WIN32 // ICO support only for Win32 | |
| static void WIN_SetWindowIcon( HICON ico ) | |
| { | |
| SDL_SysWMinfo wminfo; | |
| @@ -828,9 +831,29 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen ) | |
| SDL_SysWMinfo wmInfo; | |
| SDL_VERSION( &wmInfo.version ); | |
| SDL_GetWindowWMInfo( host.hWnd, &wmInfo ); | |
| - HWND hwnd = wmInfo.info.win.window; | |
| - | |
| - refState.rtglHwnd = hwnd; | |
| + switch (wmInfo.subsystem) { | |
| +#ifdef RG_USE_SURFACE_WIN32 | |
| + case SDL_SYSWM_WINDOWS: | |
| + HWND hwnd = wmInfo.info.win.window; | |
| + refState.rtglHwnd = hwnd; | |
| + refState.rtglKind = 0; | |
| + break; | |
| +#endif | |
| +#ifdef RG_USE_SURFACE_WAYLAND | |
| + case SDL_SYSWM_WAYLAND: | |
| + refState.rtglWlDisplay = wmInfo.info.wl.display; | |
| + refState.rtglWlSurface = wmInfo.info.wl.surface; | |
| + refState.rtglKind = 1; | |
| + break; | |
| +#endif | |
| +#ifdef RG_USE_SURFACE_XLIB | |
| + case SDL_SYSWM_X11: | |
| + refState.rtglXlibDisplay = wmInfo.info.x11.display; | |
| + refState.rtglXlibWin = wmInfo.info.x11.window; | |
| + refState.rtglKind = 2; | |
| + break; | |
| +#endif | |
| + } | |
| #endif | |
| } | |
| diff --git a/engine/ref_api.h b/engine/ref_api.h | |
| index 55edac98..1f55a049 100644 | |
| --- a/engine/ref_api.h | |
| +++ b/engine/ref_api.h | |
| @@ -114,7 +114,19 @@ typedef struct ref_globals_s | |
| int desktopBitsPixel; | |
| + // 0: w32, 1: wl, 2: x11 | |
| + int rtglKind; | |
| +#ifdef RG_USE_SURFACE_WIN32 | |
| void* rtglHwnd; | |
| +#endif | |
| +#ifdef RG_USE_SURFACE_WAYLAND | |
| + void *rtglWlDisplay; | |
| + void *rtglWlSurface; | |
| +#endif | |
| +#ifdef RG_USE_SURFACE_XLIB | |
| + void *rtglXlibDisplay; | |
| + unsigned int rtglXlibWin; | |
| +#endif | |
| } ref_globals_t; | |
| enum | |
| diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h | |
| index 72c58858..e4fd5cca 100644 | |
| --- a/ref/gl/gl_local.h | |
| +++ b/ref/gl/gl_local.h | |
| @@ -750,7 +750,6 @@ extern cvar_t *r_vbo; | |
| extern cvar_t *r_vbo_dlightmode; | |
| #if XASH_RAYTRACING | |
| -#define RG_USE_SURFACE_WIN32 | |
| #include <RTGL1/RTGL1.h> | |
| extern RgInstance rg_instance; | |
| diff --git a/ref/gl/gl_opengl.c b/ref/gl/gl_opengl.c | |
| index 5307ccb7..685ed31f 100644 | |
| --- a/ref/gl/gl_opengl.c | |
| +++ b/ref/gl/gl_opengl.c | |
| @@ -1138,16 +1138,44 @@ qboolean R_Init( void ) | |
| #if XASH_RAYTRACING | |
| { | |
| +#ifdef RG_USE_SURFACE_WIN32 | |
| RgWin32SurfaceCreateInfo win32Info = { | |
| .hinstance = GetModuleHandle( NULL ), | |
| .hwnd = gpGlobals->rtglHwnd, | |
| }; | |
| +#endif | |
| +#ifdef RG_USE_SURFACE_XLIB | |
| + RgXlibSurfaceCreateInfo x11Info = { | |
| + .dpy = gpGlobals->rtglXlibDisplay, | |
| + .window = gpGlobals->rtglXlibWin, | |
| + }; | |
| +#endif | |
| +#ifdef RG_USE_SURFACE_WAYLAND | |
| + RgWaylandSurfaceCreateInfo wlInfo = { | |
| + .display = gpGlobals->rtglWlDisplay, | |
| + .surface = gpGlobals->rtglWlSurface, | |
| + }; | |
| +#endif | |
| RgInstanceCreateInfo info = { | |
| .pAppName = "Xash", | |
| .pAppGUID = "986af412-bab4-4e44-a603-bfaf49e7ef4d", | |
| - .pWin32SurfaceInfo = &win32Info, | |
| + .pWin32SurfaceInfo = | |
| +#ifdef RG_USE_SURFACE_WIN32 | |
| + (gpGlobals->rtglKind == 0) ? &win32Info : | |
| +#endif | |
| + NULL, | |
| + .pWaylandSurfaceCreateInfo = | |
| +#ifdef RG_USE_SURFACE_WAYLAND | |
| + (gpGlobals->rtglKind == 1) ? &wlInfo : | |
| +#endif | |
| + NULL, | |
| + .pXlibSurfaceCreateInfo = | |
| +#ifdef RG_USE_SURFACE_XLIB | |
| + (gpGlobals->rtglKind == 2) ? &x11Info : | |
| +#endif | |
| + NULL, | |
| .pOverrideFolderPath = "rt/", | |
| diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c | |
| index 56548eb8..75967ee1 100644 | |
| --- a/ref/gl/gl_rmain.c | |
| +++ b/ref/gl/gl_rmain.c | |
| @@ -1186,6 +1186,12 @@ static void RT_TryDrawCustomChapterIntro() | |
| VectorSet( verts_16by9[ 3 ].position, +tx, +ty, 0 ); | |
| } | |
| + const float identity[] = { | |
| + 1.0f, 0.0f, 0.0f, 0.0f, | |
| + 0.0f, 1.0f, 0.0f, 0.0f, | |
| + 0.0f, 0.0f, 1.0f, 0.0f, | |
| + 0.0f, 0.0f, 0.0f, 1.0f, | |
| + }; | |
| // background | |
| { | |
| RgMeshPrimitiveInfo prim = { | |
| @@ -1202,7 +1208,7 @@ static void RT_TryDrawCustomChapterIntro() | |
| .emissive = 0, | |
| .pEditorInfo = NULL, | |
| }; | |
| - RgResult r = rgUploadNonWorldPrimitive( rg_instance, &prim, matrix4x4_identity, NULL ); | |
| + RgResult r = rgUploadNonWorldPrimitive( rg_instance, &prim, identity, NULL ); | |
| RG_CHECK( r ); | |
| } | |
| // text | |
| @@ -1222,7 +1228,7 @@ static void RT_TryDrawCustomChapterIntro() | |
| .pEditorInfo = NULL, | |
| }; | |
| - RgResult r = rgUploadNonWorldPrimitive( rg_instance, &prim, matrix4x4_identity, NULL ); | |
| + RgResult r = rgUploadNonWorldPrimitive( rg_instance, &prim, identity, NULL ); | |
| RG_CHECK( r ); | |
| } | |
| } | |
| @@ -1824,8 +1830,10 @@ void R_EndFrame( void ) | |
| }; | |
| // reinterpret cast to make matrices column-major | |
| - matrix4x4* v = ( matrix4x4* )&info.view; | |
| - Matrix4x4_Transpose( *v, RI.worldviewMatrix ); | |
| + matrix4x4 v; | |
| + Matrix4x4_Transpose( v, RI.worldviewMatrix ); | |
| + for (int i = 0; i < 16; ++i) | |
| + info.view[i] = v[i / 4][i % 4]; | |
| RgResult r = rgDrawFrame( rg_instance, &info ); | |
| RG_CHECK( r ); | |
| diff --git a/wscript b/wscript | |
| index 03105e6c..0c6a67e0 100644 | |
| --- a/wscript | |
| +++ b/wscript | |
| @@ -43,7 +43,7 @@ def is_enabled(self, ctx): | |
| Subproject('3rdparty/gl-wes-v2', lambda x: not x.env.DEDICATED and x.env.GLWES), | |
| Subproject('3rdparty/gl4es', lambda x: not x.env.DEDICATED and x.env.GL4ES), | |
| Subproject('ref/gl', lambda x: not x.env.DEDICATED and (x.env.GL or x.env.NANOGL or x.env.GLWES or x.env.GL4ES)), | |
| - Subproject('ref/soft', lambda x: not x.env.DEDICATED and x.env.SOFT), | |
| + Subproject('ref/soft', lambda x: False), | |
| Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED), | |
| Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED), | |
| Subproject('stub/client', lambda x: not x.env.DEDICATED), | |
| @@ -104,9 +104,6 @@ def options(opt): | |
| grp.add_option('--disable-gl', action='store_false', dest='GL', default=True, | |
| help = 'disable opengl renderer [default: %default]') | |
| - grp.add_option('--disable-soft', action='store_false', dest='SOFT', default=True, | |
| - help = 'disable soft renderer [default: %default]') | |
| - | |
| grp = opt.add_option_group('Utilities options') | |
| grp.add_option('--enable-utils', action = 'store_true', dest = 'ENABLE_UTILS', default = False, | |
| @@ -232,13 +229,13 @@ def configure(conf): | |
| '-Werror=implicit-function-declaration', | |
| '-Werror=int-conversion', | |
| '-Werror=implicit-int', | |
| - '-Werror=strict-prototypes', | |
| +# '-Werror=strict-prototypes', | |
| '-Werror=old-style-declaration', | |
| - '-Werror=old-style-definition', | |
| - '-Werror=declaration-after-statement', | |
| +# '-Werror=old-style-definition', | |
| +# '-Werror=declaration-after-statement', | |
| '-Werror=enum-conversion', | |
| '-Werror=jump-misses-init', | |
| - '-Werror=strict-prototypes', | |
| +# '-Werror=strict-prototypes', | |
| # '-Werror=nested-externs', | |
| '-fnonconst-initializers' # owcc | |
| ] | |
| @@ -287,7 +284,6 @@ def configure(conf): | |
| conf.env.GLWES = conf.options.GLWES or conf.options.ALL_RENDERERS | |
| conf.env.GL4ES = conf.options.GL4ES or conf.options.ALL_RENDERERS | |
| conf.env.GL = conf.options.GL or conf.options.ALL_RENDERERS | |
| - conf.env.SOFT = conf.options.SOFT or conf.options.ALL_RENDERERS | |
| conf.env.GAMEDIR = conf.options.GAMEDIR | |
| conf.define('XASH_GAMEDIR', conf.options.GAMEDIR) | |
| diff --git a/3rdparty/mainui/menus/VideoModes.cpp b/3rdparty/mainui/menus/VideoModes.cpp | |
| index 5aadcd6..10ac53e 100644 | |
| --- a/3rdparty/mainui/menus/VideoModes.cpp | |
| +++ b/3rdparty/mainui/menus/VideoModes.cpp | |
| @@ -309,7 +309,7 @@ void CMenuVidModes::_Init( void ) | |
| vintage.bUpdateImmediately = true; | |
| nvDlss.onCvarWrite = []( CMenuBaseItem* pSelf, void* pExtra ) { | |
| - int val = int( dynamic_cast< CMenuEditable* >( pSelf )->CvarValue() ); | |
| + int val = int( reinterpret_cast< CMenuEditable* >( pSelf )->CvarValue() ); | |
| EngFuncs::CvarSetValue( "rt_upscale_dlss", float( val ) ); | |
| if( val != 0 ) | |
| { | |
| @@ -318,7 +318,7 @@ void CMenuVidModes::_Init( void ) | |
| } | |
| }; | |
| amdFsr.onCvarWrite = []( CMenuBaseItem* pSelf, void* pExtra ) { | |
| - int val = int( dynamic_cast< CMenuEditable* >( pSelf )->CvarValue() ); | |
| + int val = int( reinterpret_cast< CMenuEditable* >( pSelf )->CvarValue() ); | |
| EngFuncs::CvarSetValue( "rt_upscale_fsr2", float( val ) ); | |
| if( val != 0 ) | |
| { | |
| @@ -327,7 +327,7 @@ void CMenuVidModes::_Init( void ) | |
| } | |
| }; | |
| vintage.onCvarWrite = []( CMenuBaseItem* pSelf, void* pExtra ) { | |
| - int val = int( dynamic_cast< CMenuEditable* >( pSelf )->CvarValue() ); | |
| + int val = int( reinterpret_cast< CMenuEditable* >( pSelf )->CvarValue() ); | |
| EngFuncs::CvarSetValue( "rt_ef_vintage", float( val ) ); | |
| if( val != 0 ) | |
| { |
| { lib | |
| , pkgs | |
| , stdenv | |
| , fetchFromGitHub | |
| , dedicated ? false | |
| , gamedir ? "valve" | |
| , enableBsp2 ? false # bsp2 support (for quake) | |
| , enableGles1 ? false # gles1 renderer (nanogl) | |
| , enableGles2 ? false # gles2 renderer (glwes) | |
| , enableGl4es ? false # gles2 renderer (gl4es) | |
| , enableGl ? true # opengl renderer | |
| , enableSoft ? true # soft renderer | |
| , enableUtils ? false # mdldec | |
| , rtgl ? (pkgs.callPackage ./rtgl.nix {}) | |
| , hlsdk ? (pkgs.callPackage ./hlsdk.nix {}) | |
| }: | |
| stdenv.mkDerivation rec { | |
| pname = "xash-rt"; | |
| version = "2023-03-01"; | |
| nativeBuildInputs = with pkgs; [python3 pkg-config makeWrapper]; | |
| buildInputs = with pkgs; [SDL2 libopus freetype fontconfig] | |
| ++ lib.optionals rtgl.passthru.enableWayland [pkgs.wayland]; | |
| src = fetchFromGitHub { | |
| owner = "a1batross"; | |
| repo = "xash-rt"; | |
| rev = "615616b4f87dbeaa47ec0846b8f5bd76ad87327c"; | |
| sha256 = "sha256-Mk8hmc9Xv4qYYG2lydveaG7FKsWtZFPkUiBGskBfCRA="; | |
| fetchSubmodules = true; | |
| }; | |
| patches = [ ./change-zip-date.patch ./xash-rt-linux.patch ]; | |
| configurePhase = let | |
| optionals = lib.optionals; | |
| optional = (cond: val: optionals cond [val]); | |
| flags = ["-8" "-P" "--prefix=/"] | |
| ++ (optional dedicated "-d") | |
| ++ (optionals (gamedir != "valve") ["--gamedir" gamedir]) | |
| ++ (optional enableBsp2 "--enable-bsp2") | |
| ++ (optional enableGles1 "--enable-gles1") | |
| ++ (optional enableGles2 "--enable-gles2") | |
| ++ (optional enableGl4es "--enable-gl4es") | |
| ++ (optional (!enableGl) "--disable-gl") | |
| ++ (optional (!enableSoft) "--disable-soft") | |
| ++ (optional enableUtils "--enable-utils") | |
| ; | |
| in '' | |
| python3 ./waf configure -T release ${lib.strings.escapeShellArgs flags} | |
| ''; | |
| RTGL1_SDK_PATH = builtins.toString rtgl; | |
| CXXFLAGS = | |
| "-I ${RTGL1_SDK_PATH}/include -D XASH_RAYTRACING=1" | |
| + (if rtgl.passthru.enableWayland then " -D RG_USE_SURFACE_WAYLAND" else "") | |
| + (if rtgl.passthru.enableXlib then " -D RG_USE_SURFACE_XLIB" else ""); | |
| CFLAGS = CXXFLAGS; | |
| LINKFLAGS = "-L ${RTGL1_SDK_PATH}/lib -l RayTracedGL1"; | |
| buildPhase = '' | |
| python3 ./waf build | |
| ''; | |
| installPhase = '' | |
| python3 ./waf install "--destdir=$out" | |
| mkdir $out/bin | |
| makeWrapper $out/lib/xash3d/xash3d $out/bin/xash3d --set XASH3D_EXTRAS_PAK1 $out/share/xash3d/valve/extras.pk3 | |
| mkdir -p $out/lib/xash3d/rt | |
| cp -r ${rtgl}/share/RTGL1/* $out/lib/xash3d/rt | |
| cp -r ${hlsdk}/valve/ $out/lib/xash3d/rt/valve | |
| ''; | |
| meta = with lib; { | |
| description = "Xash3D FWGS engine"; | |
| homepage = "https://github.com/FWGS/xash3d-fwgs"; | |
| license = with licenses; [ unfree gpl3 ]; | |
| # maintainers = with maintainers; [ chayleaf ]; | |
| }; | |
| } |