|
@@ -49,11 +49,12 @@ void CustomDX12API::initializePipeline()
|
|
|
{ // add default shaders
|
|
{ // add default shaders
|
|
|
pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(
|
|
pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
0, DX12_SHADER_REGISTER_S_SAMPLER, 0, 0, SAMPLER_DESCRIPTOR_HEAP);
|
|
0, DX12_SHADER_REGISTER_S_SAMPLER, 0, 0, SAMPLER_DESCRIPTOR_HEAP);
|
|
|
- pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(2,
|
|
|
|
|
|
|
+ pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
|
|
+ firstTextureHeapIndex,
|
|
|
DX12_SHADER_REGISTER_T_SHADER_RESOURCE,
|
|
DX12_SHADER_REGISTER_T_SHADER_RESOURCE,
|
|
|
0,
|
|
0,
|
|
|
1,
|
|
1,
|
|
|
- TEXTURE_DESCRIPTOR_HEAP,
|
|
|
|
|
|
|
+ GLOBAL_DESCRIPTOR_HEAP,
|
|
|
1);
|
|
1);
|
|
|
globalLightBufferOffset
|
|
globalLightBufferOffset
|
|
|
= pipeline->zGlobalSignature()
|
|
= pipeline->zGlobalSignature()
|
|
@@ -62,16 +63,10 @@ void CustomDX12API::initializePipeline()
|
|
|
globalTLASoffset = pipeline->zGlobalSignature()
|
|
globalTLASoffset = pipeline->zGlobalSignature()
|
|
|
->addRegisterUsageLinkedToShaderBindingTable(
|
|
->addRegisterUsageLinkedToShaderBindingTable(
|
|
|
DX12_SHADER_REGISTER_T_SHADER_RESOURCE, 0);
|
|
DX12_SHADER_REGISTER_T_SHADER_RESOURCE, 0);
|
|
|
- pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(0,
|
|
|
|
|
- DX12_SHADER_REGISTER_U_UNORDERED_ACCESS,
|
|
|
|
|
- 0,
|
|
|
|
|
- 0,
|
|
|
|
|
- TEXTURE_DESCRIPTOR_HEAP);
|
|
|
|
|
- pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(1,
|
|
|
|
|
- DX12_SHADER_REGISTER_U_UNORDERED_ACCESS,
|
|
|
|
|
- 1,
|
|
|
|
|
- 0,
|
|
|
|
|
- TEXTURE_DESCRIPTOR_HEAP);
|
|
|
|
|
|
|
+ pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
|
|
+ 0, DX12_SHADER_REGISTER_U_UNORDERED_ACCESS, 0);
|
|
|
|
|
+ pipeline->zGlobalSignature()->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
|
|
+ 1, DX12_SHADER_REGISTER_U_UNORDERED_ACCESS, 1);
|
|
|
globalRayGenerationSettingsOffset
|
|
globalRayGenerationSettingsOffset
|
|
|
= pipeline->zGlobalSignature()
|
|
= pipeline->zGlobalSignature()
|
|
|
->addRegisterUsageLinkedToShaderBindingTable(
|
|
->addRegisterUsageLinkedToShaderBindingTable(
|
|
@@ -81,12 +76,6 @@ void CustomDX12API::initializePipeline()
|
|
|
CustomCustomRayGenShader, sizeof(CustomCustomRayGenShader));
|
|
CustomCustomRayGenShader, sizeof(CustomCustomRayGenShader));
|
|
|
// RayGen from RayGen.hlsl
|
|
// RayGen from RayGen.hlsl
|
|
|
DX12ShaderSignature* rayGenSignature = new DX12ShaderSignature();
|
|
DX12ShaderSignature* rayGenSignature = new DX12ShaderSignature();
|
|
|
- // rayGenSignature->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
|
|
- // 0, DX12_SHADER_REGISTER_U_UNORDERED_ACCESS, 0);
|
|
|
|
|
- // rayGenSignature->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
|
|
- // 1, DX12_SHADER_REGISTER_U_UNORDERED_ACCESS, 1);
|
|
|
|
|
- // rayGenSignature->addRegisterUsageLinkedToDescriptorHeap(
|
|
|
|
|
- // 2, DX12_SHADER_REGISTER_B_CONST_BUFFER, 0);
|
|
|
|
|
defaultRayGenerationShaderFunction = new DX12ShaderFunction(
|
|
defaultRayGenerationShaderFunction = new DX12ShaderFunction(
|
|
|
"RayGen", rayGenSignature, DX12_SHADER_FUNCTION_TYPE_RAY_GEN);
|
|
"RayGen", rayGenSignature, DX12_SHADER_FUNCTION_TYPE_RAY_GEN);
|
|
|
rayGenShader->addFunction(defaultRayGenerationShaderFunction);
|
|
rayGenShader->addFunction(defaultRayGenerationShaderFunction);
|
|
@@ -135,7 +124,7 @@ void CustomDX12API::initializePipeline()
|
|
|
defaultHitGroup->setPayloadSize(28 * DEFAULT_MAX_TRANSPARENT_HITS + 4);
|
|
defaultHitGroup->setPayloadSize(28 * DEFAULT_MAX_TRANSPARENT_HITS + 4);
|
|
|
defaultHitGroup->setAnyHitShaderFunction(anyHitFunction);
|
|
defaultHitGroup->setAnyHitShaderFunction(anyHitFunction);
|
|
|
defaultHitGroup->setClosestHitShaderFunction(closestHitFunction);
|
|
defaultHitGroup->setClosestHitShaderFunction(closestHitFunction);
|
|
|
- pipeline->addHitGroup(defaultHitGroup);
|
|
|
|
|
|
|
+ pipeline->addHitGroup(defaultHitGroup);
|
|
|
|
|
|
|
|
// Chunk ray traversal shaders
|
|
// Chunk ray traversal shaders
|
|
|
DX12ShaderSignature* chunkHitSignature = new DX12ShaderSignature();
|
|
DX12ShaderSignature* chunkHitSignature = new DX12ShaderSignature();
|
|
@@ -276,12 +265,6 @@ int CustomDX12API::fillGlobalShaderParams(
|
|
|
directCommandQueue->zCommandList()->SetComputeRootConstantBufferView(
|
|
directCommandQueue->zCommandList()->SetComputeRootConstantBufferView(
|
|
|
*globalLightBufferOffset,
|
|
*globalLightBufferOffset,
|
|
|
lightInfoBuffer->zBuffer()->GetGPUVirtualAddress());
|
|
lightInfoBuffer->zBuffer()->GetGPUVirtualAddress());
|
|
|
- directCommandQueue->zCommandList()->SetComputeRootShaderResourceView(
|
|
|
|
|
- *globalTLASoffset,
|
|
|
|
|
- zTLAS->zResultBuffer()->zBuffer()->GetGPUVirtualAddress());
|
|
|
|
|
- directCommandQueue->zCommandList()->SetComputeRootConstantBufferView(
|
|
|
|
|
- *globalRayGenerationSettingsOffset,
|
|
|
|
|
- rayGenSettingsBuffer->zBuffer()->GetGPUVirtualAddress());
|
|
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -290,7 +273,7 @@ void CustomDX12API::renderWorld(Framework::World3D* zWorld,
|
|
|
DX12ShaderBindingTable* zSBT,
|
|
DX12ShaderBindingTable* zSBT,
|
|
|
int& objectIndex)
|
|
int& objectIndex)
|
|
|
{
|
|
{
|
|
|
- Mat4<float> identity = Mat4<float>::identity();
|
|
|
|
|
|
|
+ Mat4<float> identity = Mat4<float>::identity();
|
|
|
for (const Model3DCollection* collection : zWorld->getCollections())
|
|
for (const Model3DCollection* collection : zWorld->getCollections())
|
|
|
{
|
|
{
|
|
|
const Dimension* dim = dynamic_cast<const Dimension*>(collection);
|
|
const Dimension* dim = dynamic_cast<const Dimension*>(collection);
|
|
@@ -414,12 +397,3 @@ void CustomDX12API::renderWorld(Framework::World3D* zWorld,
|
|
|
}
|
|
}
|
|
|
DirectX12::renderWorld(zWorld, zTLAS, zSBT, objectIndex);
|
|
DirectX12::renderWorld(zWorld, zTLAS, zSBT, objectIndex);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-void CustomDX12API::initializeTextureDescriptorHeap()
|
|
|
|
|
-{
|
|
|
|
|
- textureDescriptorHeap->addTextureInput(
|
|
|
|
|
- DX12_SHADER_REGISTER_U_UNORDERED_ACCESS, defaultRenderTarget);
|
|
|
|
|
- textureDescriptorHeap->addTextureInput(
|
|
|
|
|
- DX12_SHADER_REGISTER_U_UNORDERED_ACCESS, uiTexture);
|
|
|
|
|
- DirectX12::initializeTextureDescriptorHeap();
|
|
|
|
|
-}
|
|
|