@@ -20,11 +20,14 @@ RefPtr<BufferResource> ShaderTableImpl::createDeviceBuffer(
20
20
uint32_t raygenTableSize = m_rayGenShaderCount * kRayGenRecordSize ;
21
21
uint32_t missTableSize = m_missShaderCount * D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES;
22
22
uint32_t hitgroupTableSize = m_hitGroupCount * D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES;
23
+ uint32_t callableTableSize = m_callableShaderCount * D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES;
23
24
m_rayGenTableOffset = 0 ;
24
25
m_missTableOffset = raygenTableSize;
25
26
m_hitGroupTableOffset = (uint32_t )D3DUtil::calcAligned (
26
27
m_missTableOffset + missTableSize, D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT);
27
- uint32_t tableSize = m_hitGroupTableOffset + hitgroupTableSize;
28
+ m_callableTableOffset = (uint32_t )D3DUtil::calcAligned (
29
+ m_hitGroupTableOffset + hitgroupTableSize, D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT);
30
+ uint32_t tableSize = m_callableTableOffset + callableTableSize;
28
31
29
32
auto pipelineImpl = static_cast <RayTracingPipelineStateImpl*>(pipeline);
30
33
ComPtr<IBufferResource> bufferResource;
@@ -88,6 +91,13 @@ RefPtr<BufferResource> ShaderTableImpl::createDeviceBuffer(
88
91
m_shaderGroupNames[m_rayGenShaderCount + m_missShaderCount + i],
89
92
m_recordOverwrites[m_rayGenShaderCount + m_missShaderCount + i]);
90
93
}
94
+ for (uint32_t i = 0 ; i < m_callableShaderCount; i++)
95
+ {
96
+ copyShaderIdInto (
97
+ stagingBufferPtr + m_callableTableOffset + D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES * i,
98
+ m_shaderGroupNames[m_rayGenShaderCount + m_missShaderCount + m_hitGroupCount + i],
99
+ m_recordOverwrites[m_rayGenShaderCount + m_missShaderCount + m_hitGroupCount + i]);
100
+ }
91
101
92
102
stagingBuffer->unmap (nullptr );
93
103
encoder->copyBuffer (bufferResource, 0 , stagingBuffer, stagingBufferOffset, tableSize);
0 commit comments