Skip to content

Commit

Permalink
Use D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND to fix raytracing descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Sep 16, 2024
1 parent ece7aa6 commit 2df609a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/integrations/kope.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ static void write_root_signature(FILE *output, descriptor_set *all_descriptor_se
fprintf(output, "\tranges%i[%" PRIu64 "].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_CBV;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].BaseShaderRegister = %i;\n", table_index, range_index, cbv_index);
fprintf(output, "\tranges%i[%" PRIu64 "].NumDescriptors = 1;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;\n", table_index,
range_index);

cbv_index += 1;

Expand All @@ -284,13 +286,17 @@ static void write_root_signature(FILE *output, descriptor_set *all_descriptor_se
fprintf(output, "\tranges%i[%" PRIu64 "].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].BaseShaderRegister = %i;\n", table_index, range_index, uav_index);
fprintf(output, "\tranges%i[%" PRIu64 "].NumDescriptors = 1;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;\n", table_index,
range_index);

uav_index += 1;
}
else {
fprintf(output, "\tranges%i[%" PRIu64 "].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].BaseShaderRegister = %i;\n", table_index, range_index, srv_index);
fprintf(output, "\tranges%i[%" PRIu64 "].NumDescriptors = 1;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;\n", table_index,
range_index);

srv_index += 1;
}
Expand All @@ -303,6 +309,8 @@ static void write_root_signature(FILE *output, descriptor_set *all_descriptor_se
fprintf(output, "\tranges%i[%" PRIu64 "].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].BaseShaderRegister = %i;\n", table_index, range_index, srv_index);
fprintf(output, "\tranges%i[%" PRIu64 "].NumDescriptors = 1;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;\n", table_index,
range_index);

srv_index += 1;

Expand Down Expand Up @@ -344,6 +352,8 @@ static void write_root_signature(FILE *output, descriptor_set *all_descriptor_se
fprintf(output, "\tranges%i[%" PRIu64 "].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].BaseShaderRegister = %i;\n", table_index, range_index, sampler_index);
fprintf(output, "\tranges%i[%" PRIu64 "].NumDescriptors = 1;\n", table_index, range_index);
fprintf(output, "\tranges%i[%" PRIu64 "].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;\n", table_index,
range_index);
sampler_index += 1;
break;
}
Expand Down

0 comments on commit 2df609a

Please sign in to comment.