diff --git a/src/base/base_job.h b/src/base/base_job.h index 23333a63..a996e01b 100644 --- a/src/base/base_job.h +++ b/src/base/base_job.h @@ -104,6 +104,7 @@ JobPoolId AsyncPool(void); * } * */ + #define RunJob(job_func, ...) (1); \ do { \ job_func##_Desc __desc = { .count = 1, .pool = CurrentPool(), .func = job_func, __VA_ARGS__ }; \ diff --git a/src/config.h b/src/config.h index 29f64ab0..19d12830 100644 --- a/src/config.h +++ b/src/config.h @@ -70,6 +70,7 @@ #define FLOOD_DEBUG 0 #define GPU_DEBUG 1 +#define GPU_DEBUG_VALIDATION 0 /* If virtual fibers are enabled, each fiber will get its own OS thread, * and fiber suspend/resume will be emulated using OS thread primitives. diff --git a/src/gpu/gpu_dx12/gpu_dx12.c b/src/gpu/gpu_dx12/gpu_dx12.c index 1f1de412..436d0521 100644 --- a/src/gpu/gpu_dx12/gpu_dx12.c +++ b/src/gpu/gpu_dx12/gpu_dx12.c @@ -132,28 +132,34 @@ void GPU_D12_InitDevice(void) { __profn("Enable debug layer"); ID3D12Debug *debug_controller0 = 0; - hr = D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug_controller0); - if (FAILED(hr)) { - Panic(Lit("Failed to create ID3D12Debug0")); + hr = D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug_controller0); + if (FAILED(hr)) + { + Panic(Lit("Failed to create ID3D12Debug0")); + } + ID3D12Debug_EnableDebugLayer(debug_controller0); +#if GPU_DEBUG_VALIDATION + { + ID3D12Debug1 *debug_controller1 = 0; + { + hr = ID3D12Debug_QueryInterface(debug_controller0, &IID_ID3D12Debug1, (void **)&debug_controller1); + if (FAILED(hr)) + { + Panic(Lit("Failed to create ID3D12Debug1")); + } + ID3D12Debug1_SetEnableGPUBasedValidation(debug_controller1, 1); + } + ID3D12Debug_Release(debug_controller1); + } +#endif } - - ID3D12Debug1 *debug_controller1 = 0; - hr = ID3D12Debug_QueryInterface(debug_controller0, &IID_ID3D12Debug1, (void **)&debug_controller1); - if (FAILED(hr)) - { - Panic(Lit("Failed to create ID3D12Debug1")); - } - - ID3D12Debug_EnableDebugLayer(debug_controller0); - - /* FIXME: Enable this */ - ID3D12Debug1_SetEnableGPUBasedValidation(debug_controller1, 1); - - ID3D12Debug_Release(debug_controller1); ID3D12Debug_Release(debug_controller0); dxgi_factory_flags |= DXGI_CREATE_FACTORY_DEBUG; } +#endif +#if GPU_DEBUG == 0 && GPU_DEBUG_VALIDATION != 0 +# error Gpu validation is enabled but gpu debugging is not #endif /* Create factory */ diff --git a/src/meta/meta.c b/src/meta/meta.c index e88f300f..be7f56d9 100644 --- a/src/meta/meta.c +++ b/src/meta/meta.c @@ -834,7 +834,7 @@ JobDef(Build, _, __) ////////////////////////////// //- Dirty check - //- Return rebuild code if metaprogram is dirty + /* Return rebuild code if metaprogram is dirty */ { /* Read old metahash */ u64 old_metahash = 0; @@ -888,17 +888,19 @@ JobDef(Build, _, __) //- Generate compiler params CompilerParams cp = ZI; { - //- Shared definitions - PushStringToList(arena, &cp.defs, Lit("-DIsConsoleApp=0")); - PushStringToList(arena, &cp.defs, Lit("-DRtcIsEnabled=1")); - PushStringToList(arena, &cp.defs, Lit("-DAsanIsEnabled=0")); - PushStringToList(arena, &cp.defs, Lit("-DCrtlibIsEnabled=1")); - PushStringToList(arena, &cp.defs, Lit("-DDebinfoEnabled=1")); - PushStringToList(arena, &cp.defs, Lit("-DDeveloperIsEnabled=1")); - PushStringToList(arena, &cp.defs, Lit("-DProfilingIsEnabled=0")); - PushStringToList(arena, &cp.defs, Lit("-DUnoptimizedIsEnabled=1")); - PushStringToList(arena, &cp.defs, Lit("-DTestsAreEnabled=0")); - PushStringToList(arena, &cp.defs, Lit("-DHotSwappingIsEnabled=1")); + //- Common + { + PushStringToList(arena, &cp.defs, Lit("-DIsConsoleApp=0")); + PushStringToList(arena, &cp.defs, Lit("-DRtcIsEnabled=1")); + PushStringToList(arena, &cp.defs, Lit("-DAsanIsEnabled=0")); + PushStringToList(arena, &cp.defs, Lit("-DCrtlibIsEnabled=1")); + PushStringToList(arena, &cp.defs, Lit("-DDebinfoEnabled=1")); + PushStringToList(arena, &cp.defs, Lit("-DDeveloperIsEnabled=1")); + PushStringToList(arena, &cp.defs, Lit("-DProfilingIsEnabled=0")); + PushStringToList(arena, &cp.defs, Lit("-DUnoptimizedIsEnabled=1")); + PushStringToList(arena, &cp.defs, Lit("-DTestsAreEnabled=0")); + PushStringToList(arena, &cp.defs, Lit("-DHotSwappingIsEnabled=1")); + } //- Msvc { @@ -928,6 +930,7 @@ JobDef(Build, _, __) PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4200")); /* nonstandard extension used: zero-sized array in struct/union */ PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4702")); /* unreachable code */ PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4127")); /* conditional expression is constant */ + PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4305")); /* 'initializing': truncation from 'double' to 'f32' */ } //- Clang @@ -958,11 +961,8 @@ JobDef(Build, _, __) //- Dxc { -#if GPU_DEBUG PushStringToList(arena, &cp.flags_dxc, Lit("-Od")); PushStringToList(arena, &cp.flags_dxc, Lit("-Zi -Qembed_debug")); -#endif - // PushStringToList(arena, &cp.flags_dxc, Lit("-fno-caret-diagnostics")); } } diff --git a/src/pp/pp_draw.gpu b/src/pp/pp_draw.gpu index 8dfaf4f3..e6b50a5c 100644 --- a/src/pp/pp_draw.gpu +++ b/src/pp/pp_draw.gpu @@ -190,8 +190,8 @@ void CSDef(FloodCS, Semantic(Vec3U32, sv_dispatchthreadid)) f32 RandAngleFromPos(Vec2U32 pos, u32 ray_index) { ConstantBuffer sig = shade_sig; - Texture3D noise_tex = UniformResourceFromRid(sig.noise); + Texture3D noise_tex = UniformResourceFromRid(sig.noise); Vec3I32 noise_coord = Vec3U32(1, 1, 1); noise_coord += Vec3I32(pos.xy, ray_index); // noise_coord.xyz += sig.frame_seed.xyz; @@ -297,7 +297,7 @@ void CSDef(ShadeCS, Semantic(Vec3U32, sv_dispatchthreadid)) // hysterisis = 0.2; // hysterisis = 0.4; // hysterisis = 0.5; - // hysterisis = 0.9; + // hysterisis = 0.95; color.rgb = lerp(color.rgb, read_tex[id].rgb, hysterisis); target_tex[id] = color; }