🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Null textures in DX12

Started by
3 comments, last by microsista 3 years, 1 month ago

Hello, I am a student trying to implement my own real time pathtracer in DXR but I am facing a problem with properly loading textures into GPU memory under DX12. The app is based on Microsoft's DXR Samples and this is how I load the texture file:

This is how I copy It from the upload heap into default heap along with other buffers

This is how the CreateTextureSRV method is implemented:

CreateDDSTextureFromFile12 is copied from “Introduction to 3D Game Programming in DirectX 12” by Frank Luna

This is how the texture appears in PIX

descriptor heap with the texture view

This is how it looks

Full source code in experimental branch: Microsista/Pathtracer (github.com)

What am I doing wrong? I've been sitting on this since yesterday and I can't figure it out.

Thanks

Advertisement

I've managed to load textures onto the GPU and display them, but it works only when running directly from the .exe file

and not when running inside visual studio, what could be the reason for that?

I would guess it's an issue from you using partial paths, and relying on the “current directory” of the program. When you run an exe normally, by default the current directory will be set to the directory containing your executable (so likely <ProjectDir>\x64\Debug). When you debug from Visual Studio however, VS will set the current directory according to the “Working Directory” project property that you can edit under the “Debugging" section. By default this is <ProjectDir>, which is different than what you get when running the exe manually. I would guess you're actually failing to open the .dds file when debugging from VS, which you can confirm by stepping through CreateDDSTextureFromFile12. You can also try confirming by using the full absolute path to your .dds instead of a partial path.

Thanks! The problem was that I had an exact copy of the textures folder inside the working directory, but for some reason they didn't work. After switching to the executable directory they work perfectly fine!

This topic is closed to new replies.

Advertisement