Skip to content

Commit

Permalink
Filesystem Case Sensitivity Fixes
Browse files Browse the repository at this point in the history
* Correct case sensitivity on various C++ and shader paths.
* Fix case sensitivity issues in the Meson build scripts.
* Switch from using ad-hoc path joining to the proper path joining function in Meson build scripts.

See merge request lightspeedrtx/dxvk-remix-nv!745
  • Loading branch information
anon-apple committed Mar 14, 2024
1 parent ab19292 commit d3a6711
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 56 deletions.
86 changes: 44 additions & 42 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ project(
)

global_src_root_norm = meson.global_source_root().replace('\\', '/')
current_build_dir_norm = meson.current_build_dir().replace('\\', '/')

# Fetch dependencies
# `get_dependencies` is intentionally called twice. Why?:
Expand All @@ -40,9 +41,9 @@ global_src_root_norm = meson.global_source_root().replace('\\', '/')
# Implications: in very rare circumstances (clean clone, editing meson), get_dependencies
# script will be called twice on the same build. This will not be noticeable as packman
# early outs if everything's already fetched, so the waste is negligible + forgiveable.
get_dependencies_script_path = global_src_root_norm + '/scripts-common/update-deps.cmd'
get_dependencies_script_path = join_paths(global_src_root_norm, 'scripts-common/update-deps.cmd')
message('Downloading dependencies...')
packman_out = run_command(get_dependencies_script_path)
packman_out = run_command(get_dependencies_script_path, check: true)
message(packman_out.stdout().strip())
if packman_out.returncode() != 0
message(packman_out.stderr().strip())
Expand Down Expand Up @@ -181,9 +182,9 @@ test_include_dirs = [
test_include_path = include_directories(test_include_dirs)

if (cpu_family == 'x86_64')
dxvk_library_path = meson.global_source_root() + '/lib'
dxvk_library_path = join_paths(global_src_root_norm, 'lib')
else
dxvk_library_path = meson.global_source_root() + '/lib32'
dxvk_library_path = join_paths(global_src_root_norm, 'lib32')
endif

dxvk_extradep = [ ]
Expand Down Expand Up @@ -235,8 +236,8 @@ lib_shlwapi = dxvk_compiler.find_library('shlwapi')
dxvk_extradep += lib_shlwapi

if enable_rtxio == true
rtxio_bin_path = global_src_root_norm + '/external/rtxio/bin'
rtxio_lib = dxvk_compiler.find_library('rtxio', dirs : join_paths(meson.global_source_root(), 'external/rtxio/lib'))
rtxio_bin_path = join_paths(global_src_root_norm, 'external/rtxio/bin')
rtxio_lib = dxvk_compiler.find_library('rtxio', dirs : join_paths(global_src_root_norm, 'external/rtxio/lib'))
rtxio_include_path = include_directories('external/rtxio/include')
dxvk_extradep += rtxio_lib
endif
Expand All @@ -256,15 +257,15 @@ def_spec_ext = '.def'
glsl_compiler = find_program('external/glslangvalidator/glslangValidator')
slang_compiler = find_program('external/slang/slangc')
python_interpreter = find_program('python3', 'python')
shader_compile_script = meson.global_source_root() + '/scripts-common/compile_shaders.py'
shader_compile_script = join_paths(global_src_root_norm, 'scripts-common/compile_shaders.py')

# GLSL compiler...

# The ShaderManager::compileShaders() function also uses glslangValidator to compile shader source for debug purpose.
# If the command here is changed, the command in that function should also be updated.
glsl_args = [ '-V', '--vn', '@BASENAME@', '@INPUT@', '-o', '@OUTPUT@', '--target-env', 'vulkan1.2', '@EXTRA_ARGS@' ]

if run_command(glsl_compiler, [ '--quiet', '--version' ]).returncode() == 0
if run_command(glsl_compiler, [ '--quiet', '--version' ], check: false).returncode() == 0
glsl_args += [ '--quiet' ]
endif

Expand Down Expand Up @@ -294,7 +295,7 @@ message('##############')

full_version = meson.project_version()

git_rev_parse_out = run_command('git',['rev-parse','--verify','--short=8', 'HEAD'])
git_rev_parse_out = run_command('git', ['rev-parse','--verify','--short=8', 'HEAD'], check: false)
git_hash = ''
if git_rev_parse_out.returncode() != 0
error('Failed to get current git hash')
Expand All @@ -305,7 +306,7 @@ endif

found_tag = ''
ci_commit_tag = ''
get_env_out = run_command(python_interpreter.full_path(),[global_src_root_norm + './scripts-common/get_env.py', 'CI_COMMIT_TAG'])
get_env_out = run_command(python_interpreter.full_path(), [join_paths(global_src_root_norm, 'scripts-common/get_env.py'), 'CI_COMMIT_TAG'], check: false)
if get_env_out.returncode() != 0
warning('get_env.py failed, ' + get_env_out.stderr().strip())
else
Expand All @@ -318,7 +319,7 @@ if b_found_ci_commit_tag
found_tag = ci_commit_tag
else
git_describe_tag = ''
git_describe_out = run_command('git',['describe','--always','--exact-match', git_hash])
git_describe_out = run_command('git', ['describe','--always','--exact-match', git_hash], check: false)
if git_describe_out.returncode() == 0
git_describe_tag = git_describe_out.stdout().replace('\n','')
message('Found tag via git describe: ' + git_describe_tag)
Expand Down Expand Up @@ -348,15 +349,15 @@ endif
message('Full version: ' + full_version)

dxvk_version = vcs_tag(
command: [python_interpreter.full_path(), global_src_root_norm + './scripts-common/echo.py', full_version],
command: [python_interpreter.full_path(), join_paths(global_src_root_norm, 'scripts-common/echo.py'), full_version],
input: 'version.h.in',
output: 'version.h')

#################################
# Handle external dependencies ##
#################################

output_dir = global_src_root_norm + '/_output/'
output_dir = join_paths(global_src_root_norm, '_output/')

# Get script paths
if build_os == 'windows'
Expand All @@ -368,8 +369,8 @@ elif build_os == 'linux'
else
script_extension = ''
endif
copy_script_path = global_src_root_norm + '/scripts-common/copy' + script_extension
recursive_copy_path = global_src_root_norm + '/scripts-common/recursive_copy' + script_extension
copy_script_path = join_paths(global_src_root_norm, 'scripts-common/copy' + script_extension)
recursive_copy_path = join_paths(global_src_root_norm, 'scripts-common/recursive_copy' + script_extension)

if get_option('enable_tracy')
add_project_arguments('-DTRACY_ENABLE', language : 'cpp')
Expand All @@ -380,9 +381,9 @@ if get_option('enable_tracy')
endif

if get_option('buildtype') == 'debug'
debug_or_release = 'debug'
usd_debug_or_release = 'Debug'
else
debug_or_release = 'release'
usd_debug_or_release = 'Release'
endif

# embedding compiler
Expand All @@ -397,18 +398,18 @@ mdl_include_dir = include_directories('external/omni_core_materials')
nv_usd_include_path = include_directories('external/nv_usd/include/')
boost_include_path = include_directories('external/nv_usd/include/boost-1_78/')

usd_include_paths = [nv_usd_include_path, boost_include_path]
usd_include_paths = [nv_usd_include_path, boost_include_path]

vk_include_path = include_directories('./include/vulkan/include')

lssusd_include_paths = [nv_usd_include_path, boost_include_path, vk_include_path]

nvapi_include_paths = include_directories('external/nvapi')
nvapi_lib_path = join_paths(meson.global_source_root(), 'external/nvapi/amd64')
nvapi_lib_path = join_paths(global_src_root_norm, 'external/nvapi/amd64')
nvapi_lib = dxvk_compiler.find_library('nvapi64', dirs : nvapi_lib_path)

# Cache lib locations
usd_lib_path = meson.global_source_root() + '/external/nv_usd/'+ debug_or_release + '/'
usd_lib_path = join_paths(global_src_root_norm, 'external/nv_usd/' + usd_debug_or_release + '/')
usd_lib = dxvk_compiler.find_library('usd_ms', dirs : usd_lib_path)
if get_option('buildtype') == 'debug'
tbb_lib = dxvk_compiler.find_library('tbb_debug', dirs : usd_lib_path)
Expand All @@ -417,36 +418,36 @@ else
endif

reflex_include_path = include_directories( 'external/reflex/inc')
reflex_lib_path = join_paths(meson.global_source_root(), 'external/reflex/lib')
reflex_lib_path = join_paths(global_src_root_norm, 'external/reflex/lib')
reflex_lib = dxvk_compiler.find_library('NvLowLatencyVk', dirs : reflex_lib_path)

aftermath_include_path = include_directories( 'external/aftermath/include')
aftermath_lib_path = join_paths(meson.global_source_root(), 'external/aftermath/lib/x64/')
aftermath_lib_path = join_paths(global_src_root_norm, 'external/aftermath/lib/x64/')
aftermath_lib = dxvk_compiler.find_library('GFSDK_Aftermath_Lib.x64', dirs : aftermath_lib_path)

# this is repeated below, since we overwrite dlss_lib_path in src/dxvk/meson.build for some reason
dlss_root_path = 'external/ngx_sdk_dlss'
dlss_lib_path = meson.global_source_root() + '/' + dlss_root_path + '/Lib/Windows_x86_64/rel/'
dlss_lib_path = join_paths(global_src_root_norm, dlss_root_path, 'lib/Windows_x86_64/rel/')
dlfg_root_path = 'external/ngx_sdk_dlfg'
dlfg_lib_path = meson.global_source_root() + '/' + dlfg_root_path + '/Lib/Windows_x86_64/rel/'
dlfg_lib_path = join_paths(global_src_root_norm, dlfg_root_path, 'lib/Windows_x86_64/rel/')

nrd_lib_path = meson.global_source_root() + '/external/nrd/Lib/Release/'
nrd_lib_path = join_paths(global_src_root_norm, 'external/nrd/Lib/Release/')
if get_option('buildtype') == 'debug'
nrd_lib_path = meson.global_source_root() + '/external/nrd/Lib/Debug/'
nrd_lib_path = join_paths(global_src_root_norm, 'external/nrd/Lib/Debug/')
endif
lss_usd_plugins_path = meson.global_source_root() + '/usd_plugins/'
lss_usd_plugins_path = join_paths(global_src_root_norm, 'usd_plugins/')

rtxdi_include_path = include_directories('submodules/rtxdi/rtxdi-sdk/include')
# Need to use the include path as an argument to the shader build string,
# and I couldn't find how to convert the IncludeDirs thing to a string... Meson.
rtxdi_include_path_string = meson.global_source_root() + '/submodules/rtxdi/rtxdi-sdk/include'
rtxdi_include_path_string = join_paths(global_src_root_norm, 'submodules/rtxdi/rtxdi-sdk/include')

if not dxvk_is_ninja
# Copy dependencies that must be in same dir as executable to _output dir
recursive_copy_usd_target = custom_target('recursive_copy_usd',
output : ['recursive_copy_usd'],
build_by_default : true,
command : [recursive_copy_path, usd_lib_path + '/usd/', output_dir + 'usd/'] )
command : [recursive_copy_path, join_paths(usd_lib_path, 'usd/'), join_paths(output_dir, 'usd/')] )

copy_usd_dll_target = custom_target('copy_usd_dll',
output : ['copy_usd_dll'],
Expand Down Expand Up @@ -501,7 +502,7 @@ if not dxvk_is_ninja
recursive_copy_lss_usd_plugins_target = custom_target('recursive_copy_lss_usd_plugins',
output : ['recursive_copy_lss_usd_plugins'],
build_by_default : true,
command : [recursive_copy_path, lss_usd_plugins_path, output_dir + 'lss/usd_plugins/'] )
command : [recursive_copy_path, lss_usd_plugins_path, join_paths(output_dir, 'lss/usd_plugins/')] )

if enable_rtxio == true
copy_rtxio_target = custom_target('copy_rtxio',
Expand Down Expand Up @@ -579,16 +580,16 @@ if dxvk_is_ninja

# ... and now we do this again, because src/dxvk/meson.build overwrites this for some reason
dlss_root_path = 'external/ngx_sdk_dlss'
dlss_lib_path = meson.global_source_root().replace('\\', '/') + '/' + dlss_root_path + '/Lib/Windows_x86_64/rel/'
dlss_lib_path = join_paths(global_src_root_norm, dlss_root_path, 'Lib/Windows_x86_64/rel/')
dlfg_root_path = 'external/ngx_sdk_dlfg'
dlfg_lib_path = meson.global_source_root().replace('\\', '/') + '/' + dlfg_root_path + '/Lib/Windows_x86_64/rel/'
dlfg_lib_path = join_paths(global_src_root_norm, dlfg_root_path, 'Lib/Windows_x86_64/rel/')

# meson seems to force / as the path separator in custom_target
# ... except in the case where the path separators are inconsistent, in which case it does nothing
# force / as the path separator here to make sure it stays consistent
nrd_lib_path = global_src_root_norm + '/external/nrd/Lib/Release/'
if get_option('buildtype') == 'debug'
nrd_lib_path = global_src_root_norm + '/external/nrd/Lib/Debug/'
nrd_lib_path = join_paths(global_src_root_norm, 'external/nrd/Lib/Release/')
if get_option('buildtype') == 'debug'
nrd_lib_path = join_paths(global_src_root_norm, 'external/nrd/Lib/Debug/')
endif

apic_copy_targets = []
Expand Down Expand Up @@ -618,7 +619,8 @@ if dxvk_is_ninja

# add data from gametargets.conf to dxvkrt_copy_targets
game_targets_run = run_command(python_interpreter,
meson.global_source_root() + '\\vsgen\\get_game_target_list.py')
join_paths(global_src_root_norm, 'vsgen/get_game_target_list.py'),
check: true)
game_targets = game_targets_run.stdout().strip()

if game_targets != ''
Expand All @@ -627,7 +629,7 @@ if dxvk_is_ninja
key = s[0]
target_suffix = key.underscorify()
output_path = s[1]

dxvkrt_copy_targets += { key : { 'output_path': output_path, 'target_suffix': target_suffix } }

# note: this doesn't go into the VS generator command line, gametargets.conf is read from python directly
Expand All @@ -646,8 +648,8 @@ if dxvk_is_ninja
copy_usd = custom_target('recursive_copy_usd_' + target_suffix,
output : ['recursive_copy_usd_' + target_suffix],
command : [recursive_copy_path,
usd_lib_path + 'usd/',
output_path + '/usd/'] )
join_paths(usd_lib_path, 'usd/'),
join_paths(output_path, 'usd/')] )

copy_usd_dll = custom_target('copy_usd_dll_' + target_suffix,
output : ['copy_usd_dll_' + target_suffix],
Expand Down Expand Up @@ -716,7 +718,7 @@ if dxvk_is_ninja
output : ['recursive_copy_lss_usd_plugins_' + target_suffix],
command : [recursive_copy_path,
lss_usd_plugins_path,
output_path + 'lss/usd_plugins/'] )
join_paths(output_path, 'lss/usd_plugins/')] )

if enable_rtxio == true
copy_rtxio = custom_target('copy_rtxio_' + target_suffix,
Expand Down Expand Up @@ -747,7 +749,7 @@ if dxvk_is_ninja
copy_target = run_target('copy_' + target_suffix.replace('apics_', ''),
depends: copy_target_depends,
command : [copy_script_path,
meson.current_build_dir().replace('\\', '/') + '/src/d3d9',
join_paths(current_build_dir_norm, 'src/d3d9'),
output_path,
'd3d9*'])

Expand All @@ -763,7 +765,7 @@ if dxvk_is_ninja
# generate VS project files for ninja
# note: this writes to <source root>/_vs, which is outside the build directory
vsproj = run_command(python_interpreter,
meson.global_source_root() + '\\vsgen\\generate_vs_project_files.py',
join_paths(global_src_root_norm, 'vsgen/generate_vs_project_files.py'),
vs_gen_cmdline,
check: false)

Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "rtx_render/rtx_initializer.h"
#include "rtx_render/rtx_scene_manager.h"
#include "rtx_render/rtx_reflex.h"
#include "rtx_render/rtx_game_Capturer.h"
#include "rtx_render/rtx_game_capturer.h"

#include "rtx_render/rtx_denoise_type.h"
#include "../util/util_lazy.h"
Expand Down
9 changes: 5 additions & 4 deletions src/dxvk/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,13 @@ nrd_dep = declare_dependency(
include_directories : nrd_include_dir
)

dlss_include_dir = include_directories(join_paths('../../', dlss_root_path, 'Include'))
dlss_lib_path = join_paths(meson.global_source_root(), dlss_root_path + '/Lib/Windows_x86_64/x86_64')
dlfg_include_dir = include_directories(join_paths('../../', dlfg_root_path, 'Include'))
# Note: Include directory paths must be relative paths due to a limitation in Meson (currently at least)
dlss_include_dir = include_directories(join_paths('../../', dlss_root_path, 'include'))
dlss_lib_path = join_paths(global_src_root_norm, dlss_root_path, 'lib/Windows_x86_64/x86_64')
dlfg_include_dir = include_directories(join_paths('../../', dlfg_root_path, 'include'))
cc = meson.get_compiler('c')
dlss_lib_name = 'nvsdk_ngx_d'
if get_option('buildtype') == 'debug'
if get_option('buildtype') == 'debug'
dlss_lib_name = 'nvsdk_ngx_d_dbg'
endif
dlss_lib = cc.find_library(dlss_lib_name, dirs : dlss_lib_path)
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/rtx_render/rtx_lights_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <pxr/usd/usdLux/cylinderLight.h>
#include <pxr/usd/usdLux/distantLight.h>
#include <pxr/usd/usdLux/blackbody.h>
#include "pxr/usd/usdLux/lightapi.h"
#include <pxr/usd/usdLux/lightAPI.h>
#include "../../lssusd/usd_include_end.h"

#define WRITE_CTOR_INIT(name, usd_attr, type, minVal, maxVal, defaultVal) \
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/rtx_render/rtx_mod_usd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <pxr/usd/usdLux/diskLight.h>
#include <pxr/usd/usdLux/cylinderLight.h>
#include <pxr/usd/usdLux/distantLight.h>
#include "pxr/usd/usdLux/lightapi.h"
#include <pxr/usd/usdLux/lightAPI.h>
#include <pxr/usd/usdLux/blackbody.h>
#include <pxr/usd/usdSkel/bindingAPI.h>
#include <pxr/usd/usdShade/materialBindingAPI.h>
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/shaders/rtx/external/NRD.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
#define NRD_ROUGHNESS_ENCODING 1
#define NRD_USE_SQRT_LINEAR_ROUGHNESS 0

#include "../../../external/nrd/Shaders/include/NRD.hlsli"
#include "../../../external/nrd/Shaders/Include/NRD.hlsli"

#if NRD_USE_SQRT_LINEAR_ROUGHNESS != 0
#error Not supported NRD configs. Please update NRD.hlsli and ***RECOMPILE*** NRD library.
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/shaders/rtx/pass/demodulate/demodulate.comp.slang
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "rtx/utility/geometry_flags.slangh"
#include "rtx/concept/ray/ray_helper.slangh"
#include "rtx/algorithm/integrator_helpers.slangh"
#include "rtx/external/nrd.slangh"
#include "rtx/external/NRD.slangh"

struct DemodulationData
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "rtx/concept/surface/surface.slangh"
#include "rtx/concept/surface_material/surface_material.slangh"
#include "rtx/algorithm/integrator_helpers.slangh"
#include "rtx/external/nrd.slangh"
#include "rtx/external/NRD.slangh"

#define UPDATE_NEE_CACHE 1
#include "rtx/algorithm/nee_cache.h"
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/shaders/rtx/utility/gbuffer_helpers.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "rtx/concept/surface/surface.slangh"
#include "rtx/concept/surface_material/surface_material.slangh"
#include "rtx/utility/geometry_flags.slangh"
#include "rtx/external/nrd.slangh"
#include "rtx/external/NRD.slangh"

MinimalRayInteraction minimalRayInteractionReadFromGBuffer(
Ray originalRay,
Expand Down
2 changes: 1 addition & 1 deletion src/lssusd/game_exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <pxr/usd/usdGeom/camera.h>
#include <pxr/usd/usdGeom/xform.h>
#include <pxr/usd/usdGeom/xformCommonAPI.h>
#include <pxr/usd/usdLux/lightapi.h>
#include <pxr/usd/usdLux/lightAPI.h>
#include <pxr/usd/usdLux/sphereLight.h>
#include <pxr/usd/usdLux/distantLight.h>
#include <pxr/usd/usdLux/domeLight.h>
Expand Down
2 changes: 1 addition & 1 deletion src/lssusd/game_exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "usd_include_begin.h"
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usd/attribute.h>
#include <pxr/usd/usdLux/lightapi.h>
#include <pxr/usd/usdLux/lightAPI.h>
#include "usd_include_end.h"

#include "game_exporter_common.h"
Expand Down
2 changes: 1 addition & 1 deletion src/util/log/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "METRICS.h"
#include "metrics.h"

#include "../util_env.h"
#include "util_math.h"
Expand Down

0 comments on commit d3a6711

Please sign in to comment.