rtx: fix tlas rebuild

This commit is contained in:
Ivan 'provod' Avdeev 2021-04-10 10:58:46 -07:00
parent 3a8f2ebc45
commit 573c291cef
3 changed files with 21 additions and 12 deletions

View File

@ -1,12 +1,9 @@
## 2021-04-06..07
- [ ] persistent models
- [x] load brushes into render model
- [x] destroy brushes when time comes (when?)
- [x] rasterize models in renderer
- [ ] rtx: build AS for model
- [ ] rtx: include pre-built models in TLAS
## 2021-04-10
- [x] rtx: fix tlas rebuild
- [ ] rtx: upload kusochki metadata w/ leaves
# Next
- [ ] rtx: fix blas destruction on exit
- [ ] rtx: use light visibility data
- [ ] rtx: read rad file data
- [ ] rtx: hack: interpret textures with '~' or '{' as emissive
@ -159,3 +156,13 @@
## 2021-03-28
- [x] bake s/d-lights visibility data into bsp leaves
## 2021-04-06..08
- [x] persistent models
- [x] load brushes into render model
- [x] destroy brushes when time comes (when?)
- [x] rasterize models in renderer
## 2021-04-09
- [x] rtx: build AS for model
- [x] rtx: include pre-built models in TLAS

View File

@ -126,7 +126,10 @@ typedef struct {
} as_build_args_t;
static qboolean createOrUpdateAccelerationStructure(VkCommandBuffer cmdbuf, const as_build_args_t *args) {
const qboolean is_update = *args->accel != VK_NULL_HANDLE;
const qboolean should_create = *args->accel == VK_NULL_HANDLE;
const qboolean is_update = false; // TODO: can allow updates only if we know that we only touch vertex positions essentially
// (no geometry/instance count, flags, etc changes are allowed by the spec)
VkAccelerationStructureBuildGeometryInfoKHR build_info = {
.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR,
.type = args->type,
@ -163,7 +166,7 @@ static qboolean createOrUpdateAccelerationStructure(VkCommandBuffer cmdbuf, cons
return false;
}
if (*args->accel == VK_NULL_HANDLE) {
if (should_create) {
VkAccelerationStructureCreateInfoKHR asci = {
.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR,
.buffer = g_rtx.accels_buffer.buffer,
@ -360,8 +363,7 @@ void VK_RayFrameEnd(const vk_ray_frame_render_args_t* args)
}
// 2. Create TLAS
/* FIXME once*/
if (!g_rtx.tlas && g_rtx.frame.num_models > 0)
if (g_rtx.frame.num_models > 0)
{
const VkAccelerationStructureGeometryKHR tl_geom[] = {
{

View File

@ -648,7 +648,7 @@ void VK_SceneRender( const ref_viewpass_t *rvp )
cl_entity_t *world = gEngine.GetEntityByIndex( 0 );
if( world && world->model )
{
VK_LightsBakePVL( 0 /* FIXME frame number */);
//VK_LightsBakePVL( 0 /* FIXME frame number */);
VK_RenderStateSetColor( 1.f, 1.f, 1.f, 1.f);
VK_BrushModelDraw( world, kRenderNormal );