From 48430fb306f74d156030ed80e78144cdee4ae208 Mon Sep 17 00:00:00 2001 From: RaveYard Date: Wed, 6 Jul 2022 11:45:36 +0200 Subject: [PATCH] Add --preview switch that significantly reduces sample count --- src/lightmap/cpuraytracer.cpp | 3 +++ src/lightmap/cpuraytracer.h | 3 --- src/lightmap/gpuraytracer.cpp | 4 ++++ src/lightmap/gpuraytracer.h | 3 --- src/main.cpp | 12 +++++++++++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/lightmap/cpuraytracer.cpp b/src/lightmap/cpuraytracer.cpp index e7f71f3..21d23c6 100644 --- a/src/lightmap/cpuraytracer.cpp +++ b/src/lightmap/cpuraytracer.cpp @@ -17,6 +17,9 @@ extern bool VKDebug; extern int NumThreads; +extern int coverageSampleCount; +extern int bounceSampleCount; + CPURaytracer::CPURaytracer() { } diff --git a/src/lightmap/cpuraytracer.h b/src/lightmap/cpuraytracer.h index cba0b73..5b6a2ce 100644 --- a/src/lightmap/cpuraytracer.h +++ b/src/lightmap/cpuraytracer.h @@ -92,9 +92,6 @@ private: static void RunJob(int count, std::function callback); - const int coverageSampleCount = 256; - const int bounceSampleCount = 2048; - LevelMesh* mesh = nullptr; std::vector HemisphereVectors; std::vector Lights; diff --git a/src/lightmap/gpuraytracer.cpp b/src/lightmap/gpuraytracer.cpp index 7a70fa9..1e9c437 100644 --- a/src/lightmap/gpuraytracer.cpp +++ b/src/lightmap/gpuraytracer.cpp @@ -29,6 +29,10 @@ extern bool VKDebug; +extern int coverageSampleCount; +extern int bounceSampleCount; +extern int ambientSampleCount; + GPURaytracer::GPURaytracer() { device = std::make_unique(0, VKDebug); diff --git a/src/lightmap/gpuraytracer.h b/src/lightmap/gpuraytracer.h index de81a4d..4767da7 100644 --- a/src/lightmap/gpuraytracer.h +++ b/src/lightmap/gpuraytracer.h @@ -90,9 +90,6 @@ private: static float RadicalInverse_VdC(uint32_t bits); static vec2 Hammersley(uint32_t i, uint32_t N); - const int coverageSampleCount = 256; - const int bounceSampleCount = 2048; - const int ambientSampleCount = 2048; int rayTraceImageSize = 1024; LevelMesh* mesh = nullptr; diff --git a/src/main.cpp b/src/main.cpp index e1163ae..dee26d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -119,6 +119,10 @@ bool CPURaytrace = false; bool VKDebug = false; bool DumpMesh = false; +int coverageSampleCount = 256; +int bounceSampleCount = 2048; +int ambientSampleCount = 2048; + // PRIVATE DATA DEFINITIONS ------------------------------------------------ static option long_opts[] = @@ -157,10 +161,11 @@ static option long_opts[] = {"cpu-raytrace", no_argument, 0, 'C'}, {"vkdebug", no_argument, 0, 'D'}, {"dump-mesh", no_argument, 0, 1004}, + {"preview", no_argument, 0, 1005}, {0,0,0,0} }; -static const char short_opts[] = "wVgGvbNrReEm:o:f:p:s:d:PqtzZXx5cj:S:CD:"; +static const char short_opts[] = "wVgGvbNrReEm:o:f:p:s:d:PqtzZXx5cj:S:CD::"; // CODE -------------------------------------------------------------------- @@ -457,6 +462,11 @@ static void ParseArgs(int argc, char **argv) case 1004: DumpMesh = true; break; + case 1005: + coverageSampleCount = 4; + bounceSampleCount = 16; + ambientSampleCount = 16; + break; case 1000: ShowUsage(); exit(0);