diff --git a/src/base/base.cgh b/src/base/base.cgh index 80f8e899..ff5c4ca3 100644 --- a/src/base/base.cgh +++ b/src/base/base.cgh @@ -111,7 +111,7 @@ #endif //- 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 //- Windows NTDDI version @@ -429,8 +429,13 @@ //~ Type helper macros //- Struct -#define Struct(name) typedef struct name name; struct name -#define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name +#if IsLanguageC + #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) //- Union diff --git a/src/gpu/gpu_dx12/gpu_dx12_core.c b/src/gpu/gpu_dx12/gpu_dx12_core.c index 936ee407..ab3e2243 100644 --- a/src/gpu/gpu_dx12/gpu_dx12_core.c +++ b/src/gpu/gpu_dx12/gpu_dx12_core.c @@ -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); } - G_D12.bindless_rootsig = rootsig; + G_D12.global_rootsig = rootsig; if (blob) { @@ -737,7 +737,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc) HRESULT hr = 0; b32 ok = 1; 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; 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); - LogInfoF("Creating pipeline %F", FmtString(pipeline_name)); + LogInfoF("Creating pipeline '%F'", FmtString(pipeline_name)); // Create PSO ID3D12PipelineState *pso = 0; @@ -882,7 +882,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc) String ps = DataFromResource(desc.ps.resource); 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.BytecodeLength = vs.len; 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); 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; } } @@ -913,14 +913,14 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc) String cs = DataFromResource(desc.cs.resource); 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.BytecodeLength = cs.len; } hr = ID3D12Device_CreateComputePipelineState(G_D12.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso); 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; } } @@ -939,7 +939,7 @@ G_D12_Pipeline *G_D12_PipelineFromDesc(G_D12_PipelineDesc desc) Panic(error_str); } - LogInfoF("Created pipeline %F", FmtString(pipeline_name)); + LogInfoF("Created pipeline '%F'", FmtString(pipeline_name)); pipeline->pso = pso; pipeline->error = error_str; @@ -2902,10 +2902,10 @@ i64 G_CommitCommandList(G_CommandListHandle cl_handle) descriptor_heaps_set = 1; } - // Bind rootsig + // Bind root signature if (!compute_rootsig_set) { - ID3D12GraphicsCommandList_SetComputeRootSignature(d3d_cl, G_D12.bindless_rootsig); + ID3D12GraphicsCommandList_SetComputeRootSignature(d3d_cl, G_D12.global_rootsig); compute_rootsig_set = 1; } @@ -3013,10 +3013,10 @@ i64 G_CommitCommandList(G_CommandListHandle cl_handle) descriptor_heaps_set = 1; } - // Bind rootsig + // Bind root signature if (!graphics_rootsig_set) { - ID3D12GraphicsCommandList_SetGraphicsRootSignature(d3d_cl, G_D12.bindless_rootsig); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(d3d_cl, G_D12.global_rootsig); graphics_rootsig_set = 1; } diff --git a/src/gpu/gpu_dx12/gpu_dx12_core.h b/src/gpu/gpu_dx12/gpu_dx12_core.h index 5da72de5..adbc30e7 100644 --- a/src/gpu/gpu_dx12/gpu_dx12_core.h +++ b/src/gpu/gpu_dx12/gpu_dx12_core.h @@ -614,8 +614,8 @@ Struct(G_D12_Ctx) // Descriptor heaps G_D12_DescriptorHeap descriptor_heaps[G_D12_DescriptorHeapKind_COUNT]; - // Rootsig - ID3D12RootSignature *bindless_rootsig; + // Root signature + ID3D12RootSignature *global_rootsig; // Pipelines G_D12_PipelineBin pipeline_bins[1024];