separate gpu validation flag

This commit is contained in:
jacob 2025-11-02 08:43:53 -06:00
parent 444db417a5
commit 6a5f65d291
5 changed files with 42 additions and 34 deletions

View File

@ -104,6 +104,7 @@ JobPoolId AsyncPool(void);
* } * }
* *
*/ */
#define RunJob(job_func, ...) (1); \ #define RunJob(job_func, ...) (1); \
do { \ do { \
job_func##_Desc __desc = { .count = 1, .pool = CurrentPool(), .func = job_func, __VA_ARGS__ }; \ job_func##_Desc __desc = { .count = 1, .pool = CurrentPool(), .func = job_func, __VA_ARGS__ }; \

View File

@ -70,6 +70,7 @@
#define FLOOD_DEBUG 0 #define FLOOD_DEBUG 0
#define GPU_DEBUG 1 #define GPU_DEBUG 1
#define GPU_DEBUG_VALIDATION 0
/* If virtual fibers are enabled, each fiber will get its own OS thread, /* If virtual fibers are enabled, each fiber will get its own OS thread,
* and fiber suspend/resume will be emulated using OS thread primitives. * and fiber suspend/resume will be emulated using OS thread primitives.

View File

@ -132,28 +132,34 @@ void GPU_D12_InitDevice(void)
{ {
__profn("Enable debug layer"); __profn("Enable debug layer");
ID3D12Debug *debug_controller0 = 0; 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); ID3D12Debug_Release(debug_controller0);
dxgi_factory_flags |= DXGI_CREATE_FACTORY_DEBUG; 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 #endif
/* Create factory */ /* Create factory */

View File

@ -834,7 +834,7 @@ JobDef(Build, _, __)
////////////////////////////// //////////////////////////////
//- Dirty check //- Dirty check
//- Return rebuild code if metaprogram is dirty /* Return rebuild code if metaprogram is dirty */
{ {
/* Read old metahash */ /* Read old metahash */
u64 old_metahash = 0; u64 old_metahash = 0;
@ -888,17 +888,19 @@ JobDef(Build, _, __)
//- Generate compiler params //- Generate compiler params
CompilerParams cp = ZI; CompilerParams cp = ZI;
{ {
//- Shared definitions //- Common
PushStringToList(arena, &cp.defs, Lit("-DIsConsoleApp=0")); {
PushStringToList(arena, &cp.defs, Lit("-DRtcIsEnabled=1")); PushStringToList(arena, &cp.defs, Lit("-DIsConsoleApp=0"));
PushStringToList(arena, &cp.defs, Lit("-DAsanIsEnabled=0")); PushStringToList(arena, &cp.defs, Lit("-DRtcIsEnabled=1"));
PushStringToList(arena, &cp.defs, Lit("-DCrtlibIsEnabled=1")); PushStringToList(arena, &cp.defs, Lit("-DAsanIsEnabled=0"));
PushStringToList(arena, &cp.defs, Lit("-DDebinfoEnabled=1")); PushStringToList(arena, &cp.defs, Lit("-DCrtlibIsEnabled=1"));
PushStringToList(arena, &cp.defs, Lit("-DDeveloperIsEnabled=1")); PushStringToList(arena, &cp.defs, Lit("-DDebinfoEnabled=1"));
PushStringToList(arena, &cp.defs, Lit("-DProfilingIsEnabled=0")); PushStringToList(arena, &cp.defs, Lit("-DDeveloperIsEnabled=1"));
PushStringToList(arena, &cp.defs, Lit("-DUnoptimizedIsEnabled=1")); PushStringToList(arena, &cp.defs, Lit("-DProfilingIsEnabled=0"));
PushStringToList(arena, &cp.defs, Lit("-DTestsAreEnabled=0")); PushStringToList(arena, &cp.defs, Lit("-DUnoptimizedIsEnabled=1"));
PushStringToList(arena, &cp.defs, Lit("-DHotSwappingIsEnabled=1")); PushStringToList(arena, &cp.defs, Lit("-DTestsAreEnabled=0"));
PushStringToList(arena, &cp.defs, Lit("-DHotSwappingIsEnabled=1"));
}
//- Msvc //- 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("-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("-wd4702")); /* unreachable code */
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4127")); /* conditional expression is constant */ 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 //- Clang
@ -958,11 +961,8 @@ JobDef(Build, _, __)
//- Dxc //- Dxc
{ {
#if GPU_DEBUG
PushStringToList(arena, &cp.flags_dxc, Lit("-Od")); PushStringToList(arena, &cp.flags_dxc, Lit("-Od"));
PushStringToList(arena, &cp.flags_dxc, Lit("-Zi -Qembed_debug")); PushStringToList(arena, &cp.flags_dxc, Lit("-Zi -Qembed_debug"));
#endif
// PushStringToList(arena, &cp.flags_dxc, Lit("-fno-caret-diagnostics"));
} }
} }

View File

@ -190,8 +190,8 @@ void CSDef(FloodCS, Semantic(Vec3U32, sv_dispatchthreadid))
f32 RandAngleFromPos(Vec2U32 pos, u32 ray_index) f32 RandAngleFromPos(Vec2U32 pos, u32 ray_index)
{ {
ConstantBuffer<ShadeSig> sig = shade_sig; ConstantBuffer<ShadeSig> sig = shade_sig;
Texture3D<u32> noise_tex = UniformResourceFromRid(sig.noise);
Texture3D<u32> noise_tex = UniformResourceFromRid(sig.noise);
Vec3I32 noise_coord = Vec3U32(1, 1, 1); Vec3I32 noise_coord = Vec3U32(1, 1, 1);
noise_coord += Vec3I32(pos.xy, ray_index); noise_coord += Vec3I32(pos.xy, ray_index);
// noise_coord.xyz += sig.frame_seed.xyz; // noise_coord.xyz += sig.frame_seed.xyz;
@ -297,7 +297,7 @@ void CSDef(ShadeCS, Semantic(Vec3U32, sv_dispatchthreadid))
// hysterisis = 0.2; // hysterisis = 0.2;
// hysterisis = 0.4; // hysterisis = 0.4;
// hysterisis = 0.5; // hysterisis = 0.5;
// hysterisis = 0.9; // hysterisis = 0.95;
color.rgb = lerp(color.rgb, read_tex[id].rgb, hysterisis); color.rgb = lerp(color.rgb, read_tex[id].rgb, hysterisis);
target_tex[id] = color; target_tex[id] = color;
} }