Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bundas102 committed Apr 12, 2022
0 parents commit 0e8be8e
Show file tree
Hide file tree
Showing 1,132 changed files with 183,495 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Topmost EditorConfig file; do not look at files higher up in the directory tree
root = true

# Set default editor config for all files:
# - 4 spaces, no trailing whitespaces
# - final newline for slightly cleaner diffs when changing the last line
# - native end-of-line in case we want to open a file elsewhere, git converts to LF for non-Windows
# - use utf-8 as default
[*]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = crlf
charset = utf-8

# Override trailing whitespace setting for Markdown since there it's actually useful
[*.{md}]
trim_trailing_whitespace = false

# Override settings for project files to use the same settings as Visual Studio
[*.{vcxproj,vcxproj.filters}]
indent_size = 2
insert_final_newline = false
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Bin/*
*.user
*.sdf
*.opensdf
*.suo
*.ptx
*.pyc
*.VC.db
*.VC.opendb
.vs/*
.vscode/
*.pyc
*.o
*slang-dump-*
*.mp4
Source/Externals/.packman/*
Media
Tools/.packman
Tests/data
*.tlog
61 changes: 61 additions & 0 deletions Build/deploycommon.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@echo off
setlocal

rem %1 -> Falcor Core Directory Path
rem %2 -> Platform Short Name
rem %3 -> Output Directory
rem %4 -> WINDSDK Directory

setlocal

set ExtDir=%1\Externals\.packman\
set OutDir=%3
set FalcorDir=%1\Falcor\
if not exist "%OutDir%" mkdir "%OutDir%"

set IsDebug=0
if "%OutDir:~-6%" == "Debug\" set IsDebug=1

rem Copy Falcor's files
if not exist %OutDir%\Data\ mkdir %OutDir%\Data >nul
call %~dp0\deployproject.bat %FalcorDir% %OutDir%

rem Copy externals
if %IsDebug% EQU 0 (
robocopy %ExtDir%\deps\bin\ %OutDir% /E /r:0 >nul
) else (
robocopy %ExtDir%\deps\debug\bin\ %OutDir% /E /r:0 >nul
robocopy %ExtDir%\deps\bin\ %OutDir% assimp-vc142-mt.* /r:0 >nul
rem Needed for OpenVDB (debug version links to release version of Half_2.5)
robocopy %ExtDir%\deps\bin\ %OutDir% Half-2_5.* /r:0 >nul
)
robocopy %ExtDir%\python\ %OutDir% Python36*.dll /r:0 >nul
robocopy %ExtDir%\python %OutDir%\Python /E /r:0 >nul
robocopy %ExtDir%\slang\bin\windows-x64\release %OutDir% *.dll /r:0 >nul
robocopy %ExtDir%\WinPixEventRuntime\bin\x64 %OutDir% WinPixEventRuntime.dll /r:0 >nul
robocopy %ExtDir%\dxcompiler\bin\x64 %OutDir% dxil.dll /r:0 >nul
robocopy %ExtDir%\dxcompiler\bin\x64 %OutDir% dxcompiler.dll /r:0 >nul
robocopy %ExtDir%\Cuda\bin\ %OutDir% cudart*.dll /r:0 >nul
robocopy %ExtDir%\Cuda\bin\ %OutDir% nvrtc*.dll /r:0 >nul
robocopy %ExtDir%\Cuda\bin\ %OutDir% cublas*.dll /r:0 >nul

rem Copy NVAPI
set NvApiDir=%ExtDir%\nvapi
set NvApiTargetDir=%OutDir%\Shaders\NVAPI
if exist %NvApiDir% (
if not exist %NvApiTargetDir% mkdir %NvApiTargetDir% >nul
copy /y %NvApiDir%\nvHLSLExtns.h %NvApiTargetDir%
copy /y %NvApiDir%\nvHLSLExtnsInternal.h %NvApiTargetDir%
copy /y %NvApiDir%\nvShaderExtnEnums.h %NvApiTargetDir%
)

rem Copy NanoVDB
set NanoVDBApiDir=%ExtDir%\nanovdb
set NanoVDBTargetDir=%OutDir%\Shaders\NanoVDB
if exist %NanoVDBApiDir% (
if not exist %NanoVDBTargetDir% mkdir %NanoVDBTargetDir% >nul
copy /y %NanoVDBApiDir%\include\nanovdb\PNanoVDB.h %NanoVDBTargetDir%
)

rem robocopy sets the error level to something that is not zero even if the copy operation was successful. Set the error level to zero
exit /b 0
7 changes: 7 additions & 0 deletions Build/deployproject.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

rem %1==projectDir %2==outputdir
setlocal

IF not exist %2\Data\ ( mkdir %2\Data >nul )
IF exist %1\data\ ( xcopy %1\Data\*.* %2\Data /s /y /d /q >nul)

160 changes: 160 additions & 0 deletions Build/packman/bootstrap/configure.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
:: Copyright 2019 NVIDIA CORPORATION
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

set PM_PACKMAN_VERSION=6.15

:: Specify where packman command is rooted
set PM_INSTALL_PATH=%~dp0..

:: The external root may already be configured and we should do minimal work in that case
if defined PM_PACKAGES_ROOT goto ENSURE_DIR

:: If the folder isn't set we assume that the best place for it is on the drive that we are currently
:: running from
set PM_DRIVE=%CD:~0,2%

set PM_PACKAGES_ROOT=%PM_DRIVE%\packman-repo

:: We use *setx* here so that the variable is persisted in the user environment
echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT%
setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT%
if %errorlevel% neq 0 ( goto ERROR )

:: The above doesn't work properly from a build step in VisualStudio because a separate process is
:: spawned for it so it will be lost for subsequent compilation steps - VisualStudio must
:: be launched from a new process. We catch this odd-ball case here:
if defined PM_DISABLE_VS_WARNING goto ENSURE_DIR
if not defined VSLANG goto ENSURE_DIR
echo The above is a once-per-computer operation. Unfortunately VisualStudio cannot pick up environment change
echo unless *VisualStudio is RELAUNCHED*.
echo If you are launching VisualStudio from command line or command line utility make sure
echo you have a fresh launch environment (relaunch the command line or utility).
echo If you are using 'linkPath' and referring to packages via local folder links you can safely ignore this warning.
echo You can disable this warning by setting the environment variable PM_DISABLE_VS_WARNING.
echo.

:: Check for the directory that we need. Note that mkdir will create any directories
:: that may be needed in the path
:ENSURE_DIR
if not exist "%PM_PACKAGES_ROOT%" (
echo Creating directory %PM_PACKAGES_ROOT%
mkdir "%PM_PACKAGES_ROOT%"
)
if %errorlevel% neq 0 ( goto ERROR_MKDIR_PACKAGES_ROOT )

:: The Python interpreter may already be externally configured
if defined PM_PYTHON_EXT (
set PM_PYTHON=%PM_PYTHON_EXT%
goto PACKMAN
)

set PM_PYTHON_VERSION=3.7.4-windows-x86_64
set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python
set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION%
set PM_PYTHON=%PM_PYTHON_DIR%\python.exe

if exist "%PM_PYTHON%" goto PACKMAN
if not exist "%PM_PYTHON_BASE_DIR%" call :CREATE_PYTHON_BASE_DIR

set PM_PYTHON_PACKAGE=python@%PM_PYTHON_VERSION%.cab
for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a
set TARGET=%TEMP_FILE_NAME%.zip
call "%~dp0fetch_file_from_s3.cmd" %PM_PYTHON_PACKAGE% "%TARGET%"
if %errorlevel% neq 0 ( goto ERROR )

for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_folder.ps1" -parentPath "%PM_PYTHON_BASE_DIR%"') do set TEMP_FOLDER_NAME=%%a
echo Unpacking Python interpreter ...
"%SystemRoot%\system32\expand.exe" -F:* "%TARGET%" "%TEMP_FOLDER_NAME%" 1> nul
del "%TARGET%"
:: Failure during extraction to temp folder name, need to clean up and abort
if %errorlevel% neq 0 (
call :CLEAN_UP_TEMP_FOLDER
goto ERROR
)

:: If python has now been installed by a concurrent process we need to clean up and then continue
if exist "%PM_PYTHON%" (
call :CLEAN_UP_TEMP_FOLDER
goto PACKMAN
) else (
if exist "%PM_PYTHON_DIR%" ( rd /s /q "%PM_PYTHON_DIR%" > nul )
)

:: Perform atomic rename
rename "%TEMP_FOLDER_NAME%" "%PM_PYTHON_VERSION%" 1> nul
:: Failure during move, need to clean up and abort
if %errorlevel% neq 0 (
call :CLEAN_UP_TEMP_FOLDER
goto ERROR
)

:PACKMAN
:: The packman module may already be externally configured
if defined PM_MODULE_DIR_EXT (
set PM_MODULE_DIR=%PM_MODULE_DIR_EXT%
) else (
set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION%
)

set PM_MODULE=%PM_MODULE_DIR%\packman.py

if exist "%PM_MODULE%" goto ENSURE_7ZA

set PM_MODULE_PACKAGE=packman-common@%PM_PACKMAN_VERSION%.zip
for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do set TEMP_FILE_NAME=%%a
set TARGET=%TEMP_FILE_NAME%
call "%~dp0fetch_file_from_s3.cmd" %PM_MODULE_PACKAGE% "%TARGET%"
if %errorlevel% neq 0 ( goto ERROR )

echo Unpacking ...
"%PM_PYTHON%" -S -s -u -E "%~dp0\install_package.py" "%TARGET%" "%PM_MODULE_DIR%"
if %errorlevel% neq 0 ( goto ERROR )

del "%TARGET%"

:ENSURE_7ZA
set PM_7Za_VERSION=16.02.4
set PM_7Za_PATH=%PM_PACKAGES_ROOT%\7za\%PM_7ZA_VERSION%
if exist "%PM_7Za_PATH%" goto END
set PM_7Za_PATH=%PM_PACKAGES_ROOT%\chk\7za\%PM_7ZA_VERSION%
if exist "%PM_7Za_PATH%" goto END

"%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" pull "%PM_MODULE_DIR%\deps.packman.xml"
if %errorlevel% neq 0 ( goto ERROR )

goto END

:ERROR_MKDIR_PACKAGES_ROOT
echo Failed to automatically create packman packages repo at %PM_PACKAGES_ROOT%.
echo Please set a location explicitly that packman has permission to write to, by issuing:
echo.
echo setx PM_PACKAGES_ROOT {path-you-choose-for-storing-packman-packages-locally}
echo.
echo Then launch a new command console for the changes to take effect and run packman command again.
exit /B %errorlevel%

:ERROR
echo !!! Failure while configuring local machine :( !!!
exit /B %errorlevel%

:CLEAN_UP_TEMP_FOLDER
rd /S /Q "%TEMP_FOLDER_NAME%"
exit /B

:CREATE_PYTHON_BASE_DIR
:: We ignore errors and clean error state - if two processes create the directory one will fail which is fine
md "%PM_PYTHON_BASE_DIR%" > nul 2>&1
exit /B 0

:END
36 changes: 36 additions & 0 deletions Build/packman/bootstrap/fetch_file_from_s3.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:: Copyright 2019 NVIDIA CORPORATION
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

:: You need to specify <package-name> <target-path> as input to this command
@setlocal
@set PACKAGE_NAME=%1
@set TARGET_PATH=%2

@echo Fetching %PACKAGE_NAME% ...

@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% ^
-output %TARGET_PATH%
:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes:
@if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED
@if %~z2==0 goto ERROR_DOWNLOAD_FAILED

@endlocal
@exit /b 0

:ERROR_DOWNLOAD_FAILED
@echo Failed to download file from S3
@echo Most likely because endpoint cannot be reached or file %PACKAGE_NAME% doesn't exist
@endlocal
@exit /b 1
76 changes: 76 additions & 0 deletions Build/packman/bootstrap/fetch_file_from_s3.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<#
Copyright 2019 NVIDIA CORPORATION
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#>

param(
[Parameter(Mandatory=$true)][string]$sourceName=$null,
[string]$output="out.exe"
)
$source = "http://bootstrap.packman.nvidia.com/" + $sourceName
$filename = $output

$triesLeft = 3

do
{
$triesLeft -= 1
$req = [System.Net.httpwebrequest]::Create($source)
$req.cookiecontainer = New-Object System.net.CookieContainer

try
{
Write-Host "Connecting to bootstrap.packman.nvidia.com ..."
$res = $req.GetResponse()
if($res.StatusCode -eq "OK") {
Write-Host "Downloading ..."
[int]$goal = $res.ContentLength
$reader = $res.GetResponseStream()
$writer = new-object System.IO.FileStream $fileName, "Create"
[byte[]]$buffer = new-object byte[] 4096
[int]$total = [int]$count = 0
do
{
$count = $reader.Read($buffer, 0, $buffer.Length);
$writer.Write($buffer, 0, $count);
$total += $count
if($goal -gt 0) {
Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
} else {
Write-Progress "Downloading $url" "Saving $total bytes..." -id 0
}
} while ($count -gt 0)

$triesLeft = 0
}
}
catch
{
Write-Host "Error downloading $source!"
Write-Host $_.Exception|format-list -force
}
finally
{
if ($reader)
{
$reader.Close()
}
if ($writer)
{
$writer.Flush()
$writer.Close()
}
}
} while ($triesLeft -gt 0)

Loading

0 comments on commit 0e8be8e

Please sign in to comment.