veldrid-raytracer icon indicating copy to clipboard operation
veldrid-raytracer copied to clipboard

Unable to run with high NumSamples in RayTracingApplication.cs

Open TekuSP opened this issue 7 years ago • 6 comments

Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'C:\Users\TekuSP\Desktop\veldrid-raytracer-master\bin\Debug\raytracer\netcoreapp2.0\Shaders\RayTraceCompute-compute.hlsl.bytes'. at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.IO.File.InternalReadAllBytes(String path) at System.IO.File.ReadAllBytes(String path) at RayTracer.RayTracingApplication.LoadShaderBytes(String name) in C:\Users\TekuSP\Desktop\veldrid-raytracer-master\src\raytracer\RayTracingApplication.cs:line 526 at RayTracer.RayTracingApplication.CreateDeviceResources() in C:\Users\TekuSP\Desktop\veldrid-raytracer-master\src\raytracer\RayTracingApplication.cs:line 497 at RayTracer.RayTracingApplication.Run() in C:\Users\TekuSP\Desktop\veldrid-raytracer-master\src\raytracer\RayTracingApplication.cs:line 66 at RayTracer.Program.Main(String[] args) in C:\Users\TekuSP\Desktop\veldrid-raytracer-master\src\raytracer\Program.cs:line 7 Press any key to continue . . .

Happens for example at 80. 8 works fine.

TekuSP avatar May 22 '18 17:05 TekuSP

Windows 10 17672.1000. .NET 4.7.2 .NET Core 2.1.200 NVIDIA 1060 and having all these Windows 10 SDKs https://i.imgur.com/4CohZGF.png

TekuSP avatar May 22 '18 17:05 TekuSP

Hrm, I don't see what that message would have to do with the sample count. Are you sure that is related?

mellinoe avatar May 31 '18 02:05 mellinoe

Lowering NumSamples removes this issue. Adding more makes this issue.

This is only error I get.

TekuSP avatar Jun 03 '18 16:06 TekuSP

The error is about missing shader bytecode, which could be the same as #1 . I'm not sure how changing NumSamples could affect the loading of shader code, though. I have seen that the compute shader can time out (crash the app), if NumSamples is too high, though.

mellinoe avatar Jun 03 '18 16:06 mellinoe

Too high? You mean like 30? I can replicate this bug by changing NumSamples.

I am running it on NVIDIA 1060 with latest driver. https://pastebin.com/5iz7PYdH

TekuSP avatar Jun 05 '18 11:06 TekuSP

@TekuSP I see what the problem is now. Sorry for doubting you before -- this was a very unusual issue 😅 .

It turns out that if the sample count is too high, the HLSL compiler starts to hit the timeout value that I have in place (2 seconds). It seems that cranking up the outer loop limit causes the compilation to take significantly longer. At 64 samples, it takes about 10 seconds (!) to compile the HLSL compute shader. I've made the FXC timeout much longer to allow for this. On my GTX 770, I'm able to get to about 80 samples before the compute shader starts timing out.

mellinoe avatar Jun 05 '18 16:06 mellinoe