Skip to content

Commit

Permalink
Make ray pipelines compile
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Sep 14, 2024
1 parent 61b0095 commit 23b92f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 11 additions & 7 deletions Backends/Graphics5/Direct3D12/Sources/kope/direct3d12/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ void kope_d3d12_compute_pipeline_destroy(kope_d3d12_compute_pipeline *pipe) {
}
}

void kope_d3d12_ray_pipeline_init(kope_d3d12_device *device, kope_d3d12_ray_pipeline *pipe, const kope_d3d12_ray_pipeline_parameters *parameters) {
void kope_d3d12_ray_pipeline_init(kope_d3d12_device *device, kope_d3d12_ray_pipeline *pipe, const kope_d3d12_ray_pipeline_parameters *parameters,
ID3D12RootSignature *root_signature) {
D3D12_DXIL_LIBRARY_DESC lib = {0};
lib.DXILLibrary.pShaderBytecode = ray_code;
lib.DXILLibrary.BytecodeLength = ray_code_size;
Expand Down Expand Up @@ -392,10 +393,13 @@ void kope_d3d12_ray_pipeline_init(kope_d3d12_device *device, kope_d3d12_ray_pipe
shader_config.MaxPayloadSizeInBytes = 20;
shader_config.MaxAttributeSizeInBytes = 8;

D3D12_GLOBAL_ROOT_SIGNATURE global_signature = {0};
global_signature.pGlobalRootSignature = root_signature;

D3D12_RAYTRACING_PIPELINE_CONFIG pipeline_config = {0};
pipeline_config.MaxTraceRecursionDepth = 3;

D3D12_STATE_SUBOBJECT subobjects[4];
D3D12_STATE_SUBOBJECT subobjects[5];

subobjects[0].Type = D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY;
subobjects[0].pDesc = &lib;
Expand All @@ -406,15 +410,15 @@ void kope_d3d12_ray_pipeline_init(kope_d3d12_device *device, kope_d3d12_ray_pipe
subobjects[2].Type = D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG;
subobjects[2].pDesc = &shader_config;

// subobjects[3].Type = D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE;
// subobjects[3].pDesc = &globalSig;
subobjects[3].Type = D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE;
subobjects[3].pDesc = &global_signature;

subobjects[3].Type = D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG;
subobjects[3].pDesc = &pipeline_config;
subobjects[4].Type = D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG;
subobjects[4].pDesc = &pipeline_config;

D3D12_STATE_OBJECT_DESC desc;
desc.Type = D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE;
desc.NumSubobjects = 4;
desc.NumSubobjects = 5;
desc.pSubobjects = subobjects;

kinc_microsoft_affirm(device->device->CreateStateObject(&desc, IID_PPV_ARGS(&pipe->pipe)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ void kope_d3d12_compute_pipeline_init(kope_d3d12_device *device, kope_d3d12_comp

void kope_d3d12_compute_pipeline_destroy(kope_d3d12_compute_pipeline *pipe);

void kope_d3d12_ray_pipeline_init(kope_d3d12_device *device, kope_d3d12_ray_pipeline *pipe, const kope_d3d12_ray_pipeline_parameters *parameters);
struct ID3D12RootSignature;

void kope_d3d12_ray_pipeline_init(kope_d3d12_device *device, kope_d3d12_ray_pipeline *pipe, const kope_d3d12_ray_pipeline_parameters *parameters,
struct ID3D12RootSignature *root_signature);

void kope_d3d12_ray_pipeline_destroy(kope_d3d12_ray_pipeline *pipe);

Expand Down

0 comments on commit 23b92f3

Please sign in to comment.