GPUOpen-LibrariesAndSDKs / RenderPipelineShaders

Render Pipeline Shaders SDK
MIT License
312 stars 24 forks source link

RPSL explorer can't compile files #28

Open Mcgode opened 1 year ago

Mcgode commented 1 year ago

Using Visual Studio on Windows, whenever I try to load an uncompiled .rpsl file, I get the following error:

Failed to compile RPSL 'rps_hlslc/rps-hlslc.exe "${PROJECT_DIR}\my_file.rpsl" -od ""${PROJECT_DIR}\\tmp"" -m my_file -O3 -rps-target-dll -rps-bc -cbe=0

Turns out this is because of the following line from rpsl_explorer.hpp:

rpsHlslcCmdLine << "rps_hlslc/rps-hlslc.exe \"" << pendingFileName << "\" -od \"" << tmpDir << "\" -m "
                                << moduleName << " -O3 -rps-target-dll -rps-bc -cbe=0";

Changing the line accordingly for windows fixes the issue, but will most likely not work for Linux:

rpsHlslcCmdLine << "rps_hlslc\\rps-hlslc.exe \"" << pendingFileName << "\" -od " << tmpDir << " -m "
                                << moduleName << " -O3 -rps-target-dll -rps-bc -cbe=0";

This does not happen is the file was already compiled, as the explorer fetches the already compiled version instead. This might be why the issue went unnoticed

FlorianHerickAMD commented 1 year ago

I cannot reproduce this issue by getting a fresh clone of this repo, running the explorer and loading e.g. any of the test rpsl samples on my Windows system. Could you provide us the specific error that occured (presumably during new process creation at compilation time here), the rpsl file it occured with and the path that file is located at?

Mcgode commented 1 year ago

I'll go over my repro steps:

Failed to compile RPSL 'rps_hlslc/rps-hlslc.exe "${PROJECT_DIR}\tests\gui\test_triangle.rpsl" -od ""${PROJECT_DIR}\tests\gui\tmp"" -m test_triangle -O3 -rps-target-dll -rps-bc -cbe=0'

Mcgode commented 1 year ago

Trying the provided command in the Windows command line results in the following error: 'rps_hlslc/rps-hlslc.exe' is not recognized as an internal or external command, operable program or batch file. Powershell has a similar error message.

Looks like a dir seperator issue, so moving to a backslash (rps_hlslc\rps-hlslc.exe) solves this issue. However we get another error:

${PROJECT_DIR}\out\build\x64-Debug\tools\rpsl_explorer> rps_hlslc\rps-hlslc.exe "${PROJECT_DIR}\tests\gui\test_triangle.rpsl" -od ""${PROJECT_DIR}\\tests\\gui\\tmp"" -m test_triangle -O3 -rps-target-dll -rps-bc -cbe=0
rps-hlslc.exe: Too many positional arguments specified!
Can specify at most 1 positional arguments: See: rps_hlslc\rps-hlslc.exe -help

Tough if I fix the double double-quote from the command, it finally works properly:

${PROJECT_DIR}\out\build\x64-Debug\tools\rpsl_explorer> rps_hlslc\rps-hlslc.exe "${PROJECT_DIR}\tests\gui\test_triangle.rpsl" -od "${PROJECT_DIR}\\tests\\gui\\tmp" -m test_triangle -O3 -rps-target-dll -rps-bc -cbe=0

${PROJECT_DIR}\out\build\x64-Debug\tools\rpsl_explorer>
FlorianHerickAMD commented 1 year ago

It is very peculiar that even by closely following your repro steps the issue it not reproducible. Did you generate the CMake files with the build.bat file we provide.

We will nevertheless include these changes in the next update or a small maintenance one because they make sense.