mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-02-09 07:41:03 +00:00
Add automatic fallback to CPU ray tracing if no vulkan device supports the ray tracing extension
This commit is contained in:
parent
9b6cd720dd
commit
04b01426e6
1 changed files with 20 additions and 6 deletions
|
@ -694,16 +694,30 @@ void FProcessor::BuildLightmaps()
|
||||||
Level.SetupLights();
|
Level.SetupLights();
|
||||||
LightmapMesh = std::make_unique<LevelMesh>(Level, Level.Samples, LMDims);
|
LightmapMesh = std::make_unique<LevelMesh>(Level, Level.Samples, LMDims);
|
||||||
|
|
||||||
if (CPURaytrace)
|
std::unique_ptr<GPURaytracer> gpuraytracer;
|
||||||
|
if (!CPURaytrace)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
gpuraytracer = std::make_unique<GPURaytracer>();
|
||||||
|
}
|
||||||
|
catch (std::exception msg)
|
||||||
|
{
|
||||||
|
printf("%s\n", msg.what());
|
||||||
|
printf("Falling back to CPU ray tracing\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpuraytracer)
|
||||||
|
{
|
||||||
|
gpuraytracer->Raytrace(LightmapMesh.get());
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
CPURaytracer raytracer;
|
CPURaytracer raytracer;
|
||||||
raytracer.Raytrace(LightmapMesh.get());
|
raytracer.Raytrace(LightmapMesh.get());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
GPURaytracer raytracer;
|
|
||||||
raytracer.Raytrace(LightmapMesh.get());
|
|
||||||
}
|
|
||||||
LightmapMesh->CreateTextures();
|
LightmapMesh->CreateTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue