mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-24 04:41:44 +00:00
Hook up the raytracing
This commit is contained in:
parent
7c1acb5075
commit
156ef319af
2 changed files with 25 additions and 3 deletions
|
@ -49,8 +49,28 @@ void GPURaytracer::Raytrace(DoomLevelMesh* mesh)
|
|||
raytrace->BeginFrame();
|
||||
lightmap->BeginFrame();
|
||||
|
||||
printf(".");
|
||||
//lightmap->Raytrace(surfaces);
|
||||
// Keep baking until all surfaces have been processed
|
||||
while (true)
|
||||
{
|
||||
printf(".");
|
||||
|
||||
TArray<LevelMeshSurface*> surfaces;
|
||||
for (int i = 0, count = submesh->GetSurfaceCount(); i < count; i++)
|
||||
{
|
||||
LevelMeshSurface* surface = submesh->GetSurface(i);
|
||||
if (surface->needsUpdate)
|
||||
{
|
||||
surfaces.Push(surface);
|
||||
}
|
||||
}
|
||||
|
||||
if (surfaces.Size() == 0)
|
||||
break;
|
||||
|
||||
lightmap->Raytrace(surfaces);
|
||||
|
||||
mDevice->GetCommands()->SubmitAndWait();
|
||||
}
|
||||
|
||||
printf(".");
|
||||
|
||||
|
|
|
@ -66,6 +66,8 @@ void VkCommandBufferManager::SubmitAndWait()
|
|||
.AddCommandBuffer(mTransferCommands.get())
|
||||
.Execute(fb->GetDevice(), fb->GetDevice()->GraphicsQueue);
|
||||
|
||||
TransferDeleteList->Add(std::move(mTransferCommands));
|
||||
|
||||
vkDeviceWaitIdle(fb->GetDevice()->device);
|
||||
}
|
||||
|
||||
|
@ -113,7 +115,7 @@ void VkTextureManager::CreateLightmap(int newLMTextureSize, int newLMTextureCoun
|
|||
|
||||
PipelineBarrier()
|
||||
.AddImage(Lightmap.Image.get(), VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 0, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, LMTextureCount)
|
||||
.Execute(fb->GetCommands()->GetTransferCommands(), 0, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
.Execute(fb->GetCommands()->GetTransferCommands(), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
}
|
||||
|
||||
void VkTextureManager::DownloadLightmap(int arrayIndex, uint16_t* buffer)
|
||||
|
|
Loading…
Reference in a new issue