Fix using wrong surface for the extra BLAS structures for trace hits

Add gl_raytrace for ray tracing the level mesh
This commit is contained in:
Magnus Norddahl 2024-09-05 00:15:59 +02:00
commit 4655b02f06
10 changed files with 464 additions and 2 deletions

View file

@ -829,6 +829,24 @@ void VkRenderState::BeginRenderPass(VulkanCommandBuffer *cmdbuffer)
mClearTargets = 0;
}
void VkRenderState::RaytraceScene(const FVector3& cameraPos, const VSMatrix& viewToWorld, float fovy, float aspect)
{
ApplyMatrices();
ApplyRenderPass(DT_Triangles);
ApplyScissor();
ApplyViewport();
ApplyStencilRef();
ApplyDepthBias();
mNeedApply = true;
VkRenderPassKey key = {};
key.DrawBufferFormat = mRenderTarget.Format;
key.Samples = mRenderTarget.Samples;
key.DrawBuffers = mRenderTarget.DrawBuffers;
key.DepthStencil = !!mRenderTarget.DepthStencil;
fb->GetLevelMesh()->RaytraceScene(key, mCommandBuffer, cameraPos, viewToWorld, fovy, aspect);
}
void VkRenderState::ApplyLevelMesh()
{
ApplyMatrices();