69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
#include "vulkan_state.h"
|
|
#include "rtlinker.h"
|
|
#include "materialsystem/compiledshadermgr.h"
|
|
|
|
uint32_t CVkRayTracingShader::GetMissShaderBinding( const char *szName )
|
|
{
|
|
|
|
}
|
|
|
|
uint32_t CVkRayTracingShader::GetClosestHitShaderBinding( const char *szName )
|
|
{
|
|
|
|
}
|
|
|
|
uint32_t CVkRayTracingShader::GetCallableShaderBinding( const char *szName )
|
|
{
|
|
|
|
}
|
|
|
|
void CVkRayTracingShader::AddShader( const char *szName, const char *szPath )
|
|
{
|
|
ICompiledShaderManager *pCompiledShaderManager = (ICompiledShaderManager*)CreateInterface(COMPILED_SHADER_MANAGER_INTERFACE_VERSION, NULL);
|
|
CCompiledShader shader = {};
|
|
pCompiledShaderManager->ReadFromFile(&shader, szPath);
|
|
m_callableShaders.AppendTail( {szName, shader} );
|
|
}
|
|
|
|
void CVkRayTracingShader::RemoveShader( const char *szName )
|
|
{
|
|
|
|
}
|
|
|
|
void CVkRayTracingShader::Build()
|
|
{
|
|
if (g_vkAvailableExtensions.bIsSupported_VK_KHR_RAY_TRACING_PIPELINE)
|
|
BuildTrace();
|
|
else
|
|
BuildCompute();
|
|
|
|
}
|
|
|
|
void CVkRayTracingShader::BuildCompute()
|
|
{
|
|
CVkShaderLinker linker = {};
|
|
ShaderObject_t *pShader;
|
|
|
|
pShader = m_shader.FindShaderObject(SHADER_BACKEND_SPIRV_VULKAN, SHADER_STAGE_RAYGEN_SOFTWARE);
|
|
if (!pShader)
|
|
return;
|
|
|
|
linker.SetMainSpirv(m_shader.GetLumpSize(pShader->m_nDataLump)/4,
|
|
(uint32_t*)m_shader.GetLumpPtr(pShader->m_nDataLump));
|
|
for ( auto s: m_callableShaders )
|
|
{
|
|
pShader = s.m_shader.FindShaderObject(SHADER_BACKEND_SPIRV_VULKAN, SHADER_STAGE_CALLABLE_SOFTWARE);
|
|
if (!pShader)
|
|
continue;
|
|
linker.AddSpirv(s.m_shader.GetLumpSize(pShader->m_nDataLump)/4,
|
|
(uint32_t*)s.m_shader.GetLumpPtr(pShader->m_nDataLump));
|
|
}
|
|
linker.Build();
|
|
|
|
}
|
|
|
|
void CVkRayTracingShader::BuildTrace()
|
|
{
|
|
|
|
}
|