How to use the D3D12 Raytracing Fallback Layer?

Manda Rajo 141 Reputation points
2022-12-01T14:06:27.733+00:00

I want to use this D3D12 Raytracing Fallback Layer with this example D3D12RaytracingHelloWorld.

  • When I try to download the GitHub project of DirectX-Graphics-Samples then I got a .zip file but it has a message "Windows cannot open the folder. The compressed (zipped) Folder ... is invalid.", I even repeated the same download multiple times since many months ago, and I tried 7-Zip to force extract but there are a lot of missing files then.
  • I can download the .cpp and .h files of a sample one by one from GitHub (it's the sample in the link I showed above (D3D12RaytracingHelloWorld). But the include file "CompiledShaders\Raytracing.hlsl.h" doesn't exist, I tried to find "Raytracing.hlsl.h" (that contains g_pRaytracing) in GitHub but I couldn't find.

Is there a hope of chance to use the Fallback Layer to emulate Ray Tracing?

This is the project "DXR-Fallback-Layer" only to build "DXRFallbackLayer.lib".
266212-fallback.jpg

D3D12RaytracingHelloWorld.cpp

The sample D3D12RaytracingHelloWorld, but there is a comment in the code below telling that I cannot open "CompiledShaders\Raytracing.hlsl.h", then it causes this error: 'g_pRaytracing': undeclared identifier.

   ...  
   #include "stdafx.h"  
   #include "D3D12RaytracingHelloWorld.h"  
   #include "DirectXRaytracingHelper.h"  
   #include "CompiledShaders\Raytracing.hlsl.h" // <-- fatal error C1083: Cannot open include file: 'CompiledShaders\Raytracing.hlsl.h': No such file or directory  
     
   using namespace std;  
   using namespace DX;  
     
   const wchar_t* D3D12RaytracingHelloWorld::c_hitGroupName = L"MyHitGroup";  
   const wchar_t* D3D12RaytracingHelloWorld::c_raygenShaderName = L"MyRaygenShader";  
   const wchar_t* D3D12RaytracingHelloWorld::c_closestHitShaderName = L"MyClosestHitShader";  
   const wchar_t* D3D12RaytracingHelloWorld::c_missShaderName = L"MyMissShader";  
     
   ...  
     
   // Create a raytracing pipeline state object (RTPSO).  
   // An RTPSO represents a full set of shaders reachable by a DispatchRays() call,  
   // with all configuration options resolved, such as local signatures and other state.  
   void D3D12RaytracingHelloWorld::CreateRaytracingPipelineStateObject()  
   {  
       ...  
       // DXIL library  
       // This contains the shaders and their entrypoints for the state object.  
       // Since shaders are not considered a subobject, they need to be passed in via DXIL library subobjects.  
       auto lib = raytracingPipeline.CreateSubobject<CD3DX12_DXIL_LIBRARY_SUBOBJECT>();  
       D3D12_SHADER_BYTECODE libdxil = CD3DX12_SHADER_BYTECODE((void *)g_pRaytracing, ARRAYSIZE(g_pRaytracing));  
       lib->SetDXILLibrary(&libdxil);  
       ...  
   }  

Goal

The Fallback Layer is almost forgotten, but I'm building a serious project, I'm building a programming language GLSL/HLSL/C# like but advanced and I need real debug info and breakpoints, because it's easier to debug with emulator on CPU than with GPU because I can only draw debug lines with CPU for example, I can only print with CPU.

Developer technologies C++
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Minxin Yu 13,501 Reputation points Microsoft External Staff
    2022-12-02T06:06:52.897+00:00

    Hi, @Manda Rajo

    I am able to find CompiledShaders\Raytracing.hlsl.h in the directory below. Did you build helloworld project before? Build the D3D12RaytracingHelloWorld project and it will generate the Raytracing.hlsl.h file.

    Note: I open the project in Visual Studio 2022 latest version. VS Code is not supported on Q&A.

    266457-image.png

    You do not need to worry about the error. It does not affect building.
    266459-image.png

    Windows cannot open the folder. The compressed (zipped) Folder ... is invalid.

    The issue is more related to Github and your machine. I cannot reproduce your problem. You can ask for help on Github.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Manda Rajo 141 Reputation points
    2022-12-02T09:40:15.643+00:00

    @MinxinYuMSFT, thank you. So if I understand, the solution is to use Visual Studio and download the .zip file. But I cannot do for reasons, I repeated the same thing since many months ago but still the same problem. I hope that when DirectX 13 will be released next year then maybe there won't be a problem anymore.

    I forgot to mention that I can download the Fallback Layer from different place TeamWisp/DXR-Fallback-Layer because the download from Microsoft is broken when I click the [<> Code] button and "Download ZIP", and it's corrupted "Windows cannot open the folder".

    Did you build helloworld project before?

    I'm using VSCode and I downloaded the helloworld .h & .cpp files one by one from GitHub, which means that I didn't put a compilation priority because I made the CMakeLists by me, with missing information.

    I checked "D3D12RaytracingHelloWorld.vcxproj" and it has text Include="Raytracing.hlsl" but I don't know where is that file?

    <FxCompile Include=**"Raytracing.hlsl"**>  
      <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Library</ShaderType>  
      <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">6.3</ShaderModel>  
      <VariableName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">g_p%(Filename)</VariableName>  
      <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)CompiledShaders\%**(Filename).hlsl.h**</HeaderFileOutput>  
      <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Library</ShaderType>  
      <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">6.3</ShaderModel>  
      <VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">g_p%(Filename)</VariableName>  
      <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)CompiledShaders\%**(Filename).hlsl.h**</HeaderFileOutput>  
    

    </FxCompile>


  3. Manda Rajo 141 Reputation points
    2022-12-05T16:25:03.9+00:00

    @Minxin Yu

    Have you tried using git clone instead of download zip file?

    I tried but the latest percentage I remember stuck on 27% (500 MB+), because it's too slow, not normal, but when I came back then it's suddenly 100% (failed). The reason I download from Linux is the normal Download ZIP from Windows didn't work, and I was hoping that it will work on Linux but it doesn't work.
    267237-git-clone-failed.png

    How to fix that problem? Maybe I should wait for the release of DirectX 13?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.