formatting

This commit is contained in:
jacob 2026-03-17 21:43:17 -05:00
parent 5c7e8d4ffc
commit 3b01c70734
3 changed files with 22 additions and 17 deletions

View File

@ -111,7 +111,7 @@
#endif #endif
//- False-sharing prevention //- False-sharing prevention
// TODO: Eventually hard-code to something like 128 if Apple silicon is ever supported // TODO: Eventually hard-code to something like 128 if we ever decide to support Apple M-series
#define IsolationSize 64 #define IsolationSize 64
//- Windows NTDDI version //- Windows NTDDI version
@ -429,8 +429,13 @@
//~ Type helper macros //~ Type helper macros
//- Struct //- Struct
#define Struct(name) typedef struct name name; struct name #if IsLanguageC
#define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name #define Struct(name) typedef struct name name; struct name
#define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name
#else
#define Struct(name) struct name
#define AlignedStruct(name, n) struct alignas(n) name
#endif
#define AlignedBlock(n) struct alignas(n) #define AlignedBlock(n) struct alignas(n)
//- Union //- Union

View File

@ -551,7 +551,7 @@ void G_Bootstrap(void)
{ {
hr = ID3D12Device_CreateRootSignature(G_D12.device, 0, ID3D10Blob_GetBufferPointer(blob), ID3D10Blob_GetBufferSize(blob), &IID_ID3D12RootSignature, (void **)&rootsig); hr = ID3D12Device_CreateRootSignature(G_D12.device, 0, ID3D10Blob_GetBufferPointer(blob), ID3D10Blob_GetBufferSize(blob), &IID_ID3D12RootSignature, (void **)&rootsig);
} }
G_D12.bindless_rootsig = rootsig; G_D12.global_rootsig = rootsig;
if (blob) if (blob)
{ {
@ -737,7 +737,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc)
HRESULT hr = 0; HRESULT hr = 0;
b32 ok = 1; b32 ok = 1;
String error_str = Zi; String error_str = Zi;
b32 is_compute = IsResourceNil(desc.vs.resource) || IsResourceNil(desc.ps.resource); b32 is_compute = !IsResourceNil(desc.cs.resource);
String pipeline_name = Zi; String pipeline_name = Zi;
if (is_compute) if (is_compute)
@ -769,7 +769,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc)
} }
pipeline_name.len = MinU64(pipeline_name.len, G_D12_MaxNameLen); pipeline_name.len = MinU64(pipeline_name.len, G_D12_MaxNameLen);
LogInfoF("Creating pipeline %F", FmtString(pipeline_name)); LogInfoF("Creating pipeline '%F'", FmtString(pipeline_name));
// Create PSO // Create PSO
ID3D12PipelineState *pso = 0; ID3D12PipelineState *pso = 0;
@ -882,7 +882,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc)
String ps = DataFromResource(desc.ps.resource); String ps = DataFromResource(desc.ps.resource);
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc = Zi; D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc = Zi;
{ {
pso_desc.pRootSignature = G_D12.bindless_rootsig; pso_desc.pRootSignature = G_D12.global_rootsig;
pso_desc.VS.pShaderBytecode = vs.text; pso_desc.VS.pShaderBytecode = vs.text;
pso_desc.VS.BytecodeLength = vs.len; pso_desc.VS.BytecodeLength = vs.len;
pso_desc.PS.pShaderBytecode = ps.text; pso_desc.PS.pShaderBytecode = ps.text;
@ -904,7 +904,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc)
hr = ID3D12Device_CreateGraphicsPipelineState(G_D12.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso); hr = ID3D12Device_CreateGraphicsPipelineState(G_D12.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso);
if (FAILED(hr)) if (FAILED(hr))
{ {
error_str = StringF(scratch.arena, "Failed to create graphics pipeline \"%F\"", FmtString(pipeline_name)); error_str = StringF(scratch.arena, "Failed to create graphics pipeline '%F'", FmtString(pipeline_name));
ok = 0; ok = 0;
} }
} }
@ -913,14 +913,14 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc)
String cs = DataFromResource(desc.cs.resource); String cs = DataFromResource(desc.cs.resource);
D3D12_COMPUTE_PIPELINE_STATE_DESC pso_desc = Zi; D3D12_COMPUTE_PIPELINE_STATE_DESC pso_desc = Zi;
{ {
pso_desc.pRootSignature = G_D12.bindless_rootsig; pso_desc.pRootSignature = G_D12.global_rootsig;
pso_desc.CS.pShaderBytecode = cs.text; pso_desc.CS.pShaderBytecode = cs.text;
pso_desc.CS.BytecodeLength = cs.len; pso_desc.CS.BytecodeLength = cs.len;
} }
hr = ID3D12Device_CreateComputePipelineState(G_D12.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso); hr = ID3D12Device_CreateComputePipelineState(G_D12.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso);
if (FAILED(hr)) if (FAILED(hr))
{ {
error_str = StringF(scratch.arena, "Failed to create compute pipeline \"%F\"", FmtString(pipeline_name)); error_str = StringF(scratch.arena, "Failed to create compute pipeline '%F'", FmtString(pipeline_name));
ok = 0; ok = 0;
} }
} }
@ -939,7 +939,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc)
Panic(error_str); Panic(error_str);
} }
LogInfoF("Created pipeline %F", FmtString(pipeline_name)); LogInfoF("Created pipeline '%F'", FmtString(pipeline_name));
pipeline->pso = pso; pipeline->pso = pso;
pipeline->error = error_str; pipeline->error = error_str;
@ -2902,10 +2902,10 @@ i64 G_CommitCommandList(G_CommandListHandle cl_handle)
descriptor_heaps_set = 1; descriptor_heaps_set = 1;
} }
// Bind rootsig // Bind root signature
if (!compute_rootsig_set) if (!compute_rootsig_set)
{ {
ID3D12GraphicsCommandList_SetComputeRootSignature(d3d_cl, G_D12.bindless_rootsig); ID3D12GraphicsCommandList_SetComputeRootSignature(d3d_cl, G_D12.global_rootsig);
compute_rootsig_set = 1; compute_rootsig_set = 1;
} }
@ -3013,10 +3013,10 @@ i64 G_CommitCommandList(G_CommandListHandle cl_handle)
descriptor_heaps_set = 1; descriptor_heaps_set = 1;
} }
// Bind rootsig // Bind root signature
if (!graphics_rootsig_set) if (!graphics_rootsig_set)
{ {
ID3D12GraphicsCommandList_SetGraphicsRootSignature(d3d_cl, G_D12.bindless_rootsig); ID3D12GraphicsCommandList_SetGraphicsRootSignature(d3d_cl, G_D12.global_rootsig);
graphics_rootsig_set = 1; graphics_rootsig_set = 1;
} }

View File

@ -614,8 +614,8 @@ Struct(G_D12_Ctx)
// Descriptor heaps // Descriptor heaps
G_D12_DescriptorHeap descriptor_heaps[G_D12_DescriptorHeapKind_COUNT]; G_D12_DescriptorHeap descriptor_heaps[G_D12_DescriptorHeapKind_COUNT];
// Rootsig // Root signature
ID3D12RootSignature *bindless_rootsig; ID3D12RootSignature *global_rootsig;
// Pipelines // Pipelines
G_D12_PipelineBin pipeline_bins[1024]; G_D12_PipelineBin pipeline_bins[1024];