@@ -630,7 +630,7 @@ void Renderer::init(const SAssetBundle& meshes,
630
630
631
631
// set up raycount buffer for RR
632
632
{
633
- m_rayCountBuffer.buffer = m_driver->createFilledDeviceLocalGPUBufferOnDedMem (sizeof (uint32_t ),&raygenBufferSize );
633
+ m_rayCountBuffer.buffer = m_driver->createFilledDeviceLocalGPUBufferOnDedMem (sizeof (uint32_t ),&m_maxRaysPerDispatch );
634
634
m_rayCountBuffer.asRRBuffer = m_rrManager->linkBuffer (m_rayCountBuffer.buffer .get (), CL_MEM_READ_ONLY);
635
635
636
636
ocl::COpenCLHandler::ocl.pclEnqueueAcquireGLObjects (m_rrManager->getCLCommandQueue (), 1u , &m_rayCountBuffer.asRRBuffer .second , 0u , nullptr , nullptr );
@@ -1028,17 +1028,17 @@ void Renderer::render(nbl::ITimer* timer)
1028
1028
m_cullPushConstants.currentCommandBufferIx ^= 0x01u ;
1029
1029
}
1030
1030
1031
- // generate rays
1031
+ // generate rays ( TODO: move the camera part)
1032
1032
{
1033
1033
const auto cameraPosition = core::vectorSIMDf ().set (camera->getAbsolutePosition ());
1034
1034
{
1035
1035
auto frustum = camera->getViewFrustum ();
1036
- m_raytraceCommonData. frustumCorners . rows [ 1 ] = frustum-> getFarLeftDown () ;
1037
- m_raytraceCommonData. frustumCorners . rows [0 ] = frustum->getFarRightDown ()-m_raytraceCommonData. frustumCorners . rows [ 1 ] ;
1038
- m_raytraceCommonData. frustumCorners . rows [1 ] -= cameraPosition;
1039
- m_raytraceCommonData. frustumCorners . rows [ 3 ] = frustum->getFarLeftUp ();
1040
- m_raytraceCommonData. frustumCorners . rows [ 2 ] = frustum->getFarRightUp ()-m_raytraceCommonData. frustumCorners . rows [ 3 ];
1041
- m_raytraceCommonData.frustumCorners . rows [ 3 ] -= cameraPosition ;
1036
+ core::matrix4SIMD corners ;
1037
+ corners [0 ] = frustum->getFarLeftDown ()-cameraPosition ;
1038
+ corners [1 ] = frustum-> getFarRightDown ()- cameraPosition-corners[ 0 ] ;
1039
+ corners[ 2 ] = frustum->getFarLeftUp ()-cameraPosition ;
1040
+ corners[ 3 ] = frustum->getFarRightUp ()-cameraPosition-corners[ 2 ];
1041
+ m_raytraceCommonData.frustumCorners = core::transpose (corners). extractSub3x4 () ;
1042
1042
}
1043
1043
camera->getViewMatrix ().getSub3x3InverseTranspose (m_raytraceCommonData.normalMatrixAndCameraPos );
1044
1044
m_raytraceCommonData.normalMatrixAndCameraPos .setTranslation (cameraPosition);
@@ -1066,7 +1066,7 @@ void Renderer::render(nbl::ITimer* timer)
1066
1066
else
1067
1067
glFinish ();
1068
1068
1069
- if (false ) // TODO
1069
+ if (true )
1070
1070
{
1071
1071
auto commandQueue = m_rrManager->getCLCommandQueue ();
1072
1072
0 commit comments