2021-02-27 22:43:49 +01:00
|
|
|
#include "vk_rtx.h"
|
|
|
|
|
2022-02-01 05:50:39 +01:00
|
|
|
#include "ray_resources.h"
|
2022-08-27 21:30:53 +02:00
|
|
|
#include "vk_ray_accel.h"
|
2022-01-31 07:24:55 +01:00
|
|
|
|
2021-02-27 22:43:49 +01:00
|
|
|
#include "vk_buffer.h"
|
2022-10-16 00:09:45 +02:00
|
|
|
#include "vk_common.h"
|
|
|
|
#include "vk_core.h"
|
2021-03-15 17:44:15 +01:00
|
|
|
#include "vk_cvar.h"
|
2022-10-16 00:09:45 +02:00
|
|
|
#include "vk_descriptor.h"
|
|
|
|
#include "vk_light.h"
|
2022-01-08 22:44:02 +01:00
|
|
|
#include "vk_math.h"
|
2022-10-16 00:09:45 +02:00
|
|
|
#include "vk_meatpipe.h"
|
|
|
|
#include "vk_pipeline.h"
|
|
|
|
#include "vk_ray_internal.h"
|
|
|
|
#include "vk_staging.h"
|
|
|
|
#include "vk_textures.h"
|
2023-01-30 05:53:18 +01:00
|
|
|
#include "vk_previous_frame.h"
|
2021-02-27 22:43:49 +01:00
|
|
|
|
2022-07-15 09:35:19 +02:00
|
|
|
#include "alolcator.h"
|
|
|
|
|
2022-01-31 07:24:55 +01:00
|
|
|
|
2021-02-27 22:43:49 +01:00
|
|
|
#include "eiface.h"
|
2021-03-17 17:15:33 +01:00
|
|
|
#include "xash3d_mathlib.h"
|
2021-02-27 22:43:49 +01:00
|
|
|
|
2021-03-21 00:21:26 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
2022-01-08 22:44:02 +01:00
|
|
|
#define MAX_FRAMES_IN_FLIGHT 2
|
2021-02-27 22:43:49 +01:00
|
|
|
|
2021-03-20 19:15:57 +01:00
|
|
|
// TODO settings/realtime modifiable/adaptive
|
2022-07-09 20:40:26 +02:00
|
|
|
#if 1
|
2021-03-20 19:15:57 +01:00
|
|
|
#define FRAME_WIDTH 1280
|
|
|
|
#define FRAME_HEIGHT 720
|
2022-08-20 22:56:29 +02:00
|
|
|
#elif 0
|
2022-07-09 20:40:26 +02:00
|
|
|
#define FRAME_WIDTH 2560
|
|
|
|
#define FRAME_HEIGHT 1440
|
2022-08-20 22:56:29 +02:00
|
|
|
#else
|
|
|
|
#define FRAME_WIDTH 1920
|
|
|
|
#define FRAME_HEIGHT 1080
|
2022-07-09 20:40:26 +02:00
|
|
|
#endif
|
2021-03-20 19:15:57 +01:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
// TODO each of these should be registered by the provider of the resource:
|
|
|
|
#define EXTERNAL_RESOUCES(X) \
|
|
|
|
X(TLAS, tlas) \
|
|
|
|
X(Buffer, ubo) \
|
|
|
|
X(Buffer, kusochki) \
|
|
|
|
X(Buffer, indices) \
|
|
|
|
X(Buffer, vertices) \
|
|
|
|
X(Buffer, lights) \
|
2023-02-06 08:35:08 +01:00
|
|
|
X(Buffer, light_grid) \
|
2023-01-21 20:35:00 +01:00
|
|
|
X(Texture, textures) \
|
|
|
|
X(Texture, skybox)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
#define RES_ENUM(type, name) ExternalResource_##name,
|
|
|
|
EXTERNAL_RESOUCES(RES_ENUM)
|
|
|
|
#undef RES_ENUM
|
|
|
|
ExternalResource_COUNT,
|
|
|
|
};
|
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
#define MAX_RESOURCES 32
|
2021-11-07 21:46:27 +01:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
typedef struct {
|
|
|
|
char name[64];
|
|
|
|
vk_resource_t resource;
|
|
|
|
xvk_image_t image;
|
2023-01-22 22:22:56 +01:00
|
|
|
int refcount;
|
2023-01-30 19:21:18 +01:00
|
|
|
int source_index_plus_1;
|
2023-01-21 20:35:00 +01:00
|
|
|
} rt_resource_t;
|
|
|
|
|
2021-02-27 22:43:49 +01:00
|
|
|
static struct {
|
2022-01-08 22:44:02 +01:00
|
|
|
// Holds UniformBuffer data
|
|
|
|
vk_buffer_t uniform_buffer;
|
2022-01-18 06:12:14 +01:00
|
|
|
uint32_t uniform_unit_size;
|
2022-01-08 22:44:02 +01:00
|
|
|
|
2022-05-29 09:01:43 +02:00
|
|
|
// TODO with proper intra-cmdbuf sync we don't really need 2x images
|
2021-03-20 21:42:15 +01:00
|
|
|
unsigned frame_number;
|
2023-01-16 21:41:37 +01:00
|
|
|
vk_meatpipe_t *mainpipe;
|
2023-01-18 20:06:35 +01:00
|
|
|
vk_resource_p *mainpipe_resources;
|
2023-01-21 20:35:00 +01:00
|
|
|
rt_resource_t *mainpipe_out;
|
2023-01-18 20:06:35 +01:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
rt_resource_t res[MAX_RESOURCES];
|
2022-10-16 00:09:45 +02:00
|
|
|
|
2021-03-13 21:29:17 +01:00
|
|
|
qboolean reload_pipeline;
|
2023-01-30 02:15:41 +01:00
|
|
|
|
|
|
|
matrix4x4 prev_inv_proj, prev_inv_view;
|
2021-05-24 20:14:03 +02:00
|
|
|
} g_rtx = {0};
|
2021-02-27 22:43:49 +01:00
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
static int findResource(const char *name) {
|
|
|
|
// Find the exact match if exists
|
|
|
|
// There might be gaps, so we need to check everything
|
|
|
|
for (int i = 0; i < MAX_RESOURCES; ++i) {
|
|
|
|
if (strcmp(g_rtx.res[i].name, name) == 0)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int getResourceSlotForName(const char *name) {
|
|
|
|
const int index = findResource(name);
|
|
|
|
if (index >= 0)
|
|
|
|
return index;
|
|
|
|
|
|
|
|
// Find first free slot
|
2023-01-21 20:35:00 +01:00
|
|
|
for (int i = ExternalResource_COUNT; i < MAX_RESOURCES; ++i) {
|
2023-01-18 20:06:35 +01:00
|
|
|
if (!g_rtx.res[i].name[0])
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2021-05-26 18:35:36 +02:00
|
|
|
|
2021-04-09 23:59:04 +02:00
|
|
|
void VK_RayNewMap( void ) {
|
2022-08-27 21:30:53 +02:00
|
|
|
RT_VkAccelNewMap();
|
2022-05-29 09:01:43 +02:00
|
|
|
RT_RayModel_Clear();
|
2023-01-21 20:35:00 +01:00
|
|
|
|
|
|
|
g_rtx.res[ExternalResource_skybox].resource = (vk_resource_t){
|
|
|
|
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
2023-03-08 23:16:21 +01:00
|
|
|
// FIXME we should pick tglob.dii_all_textures here directly
|
2023-01-21 20:35:00 +01:00
|
|
|
.value = (vk_descriptor_value_t){
|
|
|
|
.image = {
|
2023-03-08 23:16:21 +01:00
|
|
|
.sampler = tglob.default_sampler_fixme,
|
2023-01-21 20:35:00 +01:00
|
|
|
.imageView = tglob.skybox_cube.vk.image.view ? tglob.skybox_cube.vk.image.view : tglob.cubemap_placeholder.vk.image.view,
|
|
|
|
.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2021-02-27 22:43:49 +01:00
|
|
|
}
|
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
void VK_RayFrameBegin( void ) {
|
2021-03-01 20:22:58 +01:00
|
|
|
ASSERT(vk_core.rtx);
|
|
|
|
|
2022-08-27 21:30:53 +02:00
|
|
|
RT_VkAccelFrameBegin();
|
2021-05-08 23:34:42 +02:00
|
|
|
|
2021-07-05 19:59:14 +02:00
|
|
|
if (g_ray_model_state.freeze_models)
|
|
|
|
return;
|
2021-04-24 21:53:42 +02:00
|
|
|
|
2021-07-05 19:59:14 +02:00
|
|
|
XVK_RayModel_ClearForNextFrame();
|
2021-05-03 20:17:01 +02:00
|
|
|
|
2023-01-30 05:53:18 +01:00
|
|
|
R_PrevFrame_StartFrame();
|
|
|
|
|
2021-07-05 19:59:14 +02:00
|
|
|
// TODO shouldn't we do this in freeze models mode anyway?
|
2022-07-30 20:37:06 +02:00
|
|
|
RT_LightsFrameBegin();
|
2021-03-01 20:22:58 +01:00
|
|
|
}
|
|
|
|
|
2022-01-08 22:44:02 +01:00
|
|
|
static void prepareUniformBuffer( const vk_ray_frame_render_args_t *args, int frame_index, float fov_angle_y ) {
|
2022-01-18 06:12:14 +01:00
|
|
|
struct UniformBuffer *ubo = (struct UniformBuffer*)((char*)g_rtx.uniform_buffer.mapped + frame_index * g_rtx.uniform_unit_size);
|
2022-01-08 22:44:02 +01:00
|
|
|
|
|
|
|
matrix4x4 proj_inv, view_inv;
|
|
|
|
Matrix4x4_Invert_Full(proj_inv, *args->projection);
|
|
|
|
Matrix4x4_ToArrayFloatGL(proj_inv, (float*)ubo->inv_proj);
|
|
|
|
|
|
|
|
// TODO there's a more efficient way to construct an inverse view matrix
|
|
|
|
// from vforward/right/up vectors and origin in g_camera
|
|
|
|
Matrix4x4_Invert_Full(view_inv, *args->view);
|
|
|
|
Matrix4x4_ToArrayFloatGL(view_inv, (float*)ubo->inv_view);
|
|
|
|
|
2023-01-30 02:15:41 +01:00
|
|
|
// previous frame matrices
|
|
|
|
Matrix4x4_ToArrayFloatGL(g_rtx.prev_inv_proj, (float*)ubo->prev_inv_proj);
|
|
|
|
Matrix4x4_ToArrayFloatGL(g_rtx.prev_inv_view, (float*)ubo->prev_inv_view);
|
|
|
|
Matrix4x4_Copy(g_rtx.prev_inv_view, view_inv);
|
|
|
|
Matrix4x4_Copy(g_rtx.prev_inv_proj, proj_inv);
|
2023-01-22 00:45:29 +01:00
|
|
|
|
2022-01-08 22:44:02 +01:00
|
|
|
ubo->ray_cone_width = atanf((2.0f*tanf(DEG2RAD(fov_angle_y) * 0.5f)) / (float)FRAME_HEIGHT);
|
2022-01-16 08:15:29 +01:00
|
|
|
ubo->random_seed = (uint32_t)gEngine.COM_RandomLong(0, INT32_MAX);
|
2022-01-08 22:44:02 +01:00
|
|
|
}
|
|
|
|
|
2022-08-07 18:45:54 +02:00
|
|
|
typedef struct {
|
|
|
|
const vk_ray_frame_render_args_t* render_args;
|
|
|
|
int frame_index;
|
|
|
|
float fov_angle_y;
|
|
|
|
const vk_lights_bindings_t *light_bindings;
|
|
|
|
} perform_tracing_args_t;
|
|
|
|
|
|
|
|
static void performTracing(VkCommandBuffer cmdbuf, const perform_tracing_args_t* args) {
|
2023-01-21 20:35:00 +01:00
|
|
|
// TODO move this to "TLAS producer"
|
|
|
|
g_rtx.res[ExternalResource_tlas].resource = (vk_resource_t){
|
|
|
|
.type = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR,
|
|
|
|
.value = (vk_descriptor_value_t){
|
|
|
|
.accel = (VkWriteDescriptorSetAccelerationStructureKHR) {
|
|
|
|
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,
|
|
|
|
.accelerationStructureCount = 1,
|
|
|
|
.pAccelerationStructures = &g_accel.tlas,
|
|
|
|
.pNext = NULL,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2023-01-16 21:41:37 +01:00
|
|
|
|
2022-02-01 05:40:41 +01:00
|
|
|
#define RES_SET_BUFFER(name, type_, source_, offset_, size_) \
|
2023-01-21 20:35:00 +01:00
|
|
|
g_rtx.res[ExternalResource_##name].resource = (vk_resource_t){ \
|
|
|
|
.type = type_, \
|
|
|
|
.value = (vk_descriptor_value_t) { \
|
|
|
|
.buffer = (VkDescriptorBufferInfo) { \
|
|
|
|
.buffer = (source_), \
|
|
|
|
.offset = (offset_), \
|
|
|
|
.range = (size_), \
|
|
|
|
} \
|
2022-02-01 05:40:41 +01:00
|
|
|
} \
|
2023-01-21 20:35:00 +01:00
|
|
|
}
|
2023-01-16 21:41:37 +01:00
|
|
|
|
|
|
|
RES_SET_BUFFER(ubo, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, g_rtx.uniform_buffer.buffer, args->frame_index * g_rtx.uniform_unit_size, sizeof(struct UniformBuffer));
|
2022-02-01 05:40:41 +01:00
|
|
|
|
|
|
|
#define RES_SET_SBUFFER_FULL(name, source_) \
|
2022-08-07 18:45:54 +02:00
|
|
|
RES_SET_BUFFER(name, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, source_.buffer, 0, source_.size)
|
2022-02-01 05:40:41 +01:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
// TODO move this to ray model producer
|
2023-01-16 21:41:37 +01:00
|
|
|
RES_SET_SBUFFER_FULL(kusochki, g_ray_model_state.kusochki_buffer);
|
2023-01-21 20:35:00 +01:00
|
|
|
|
|
|
|
// TODO move these to vk_geometry
|
2023-01-16 21:41:37 +01:00
|
|
|
RES_SET_SBUFFER_FULL(indices, args->render_args->geometry_data);
|
|
|
|
RES_SET_SBUFFER_FULL(vertices, args->render_args->geometry_data);
|
2022-02-03 06:47:40 +01:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
// TODO move this to lights
|
2023-01-16 21:41:37 +01:00
|
|
|
RES_SET_BUFFER(lights, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, args->light_bindings->buffer, args->light_bindings->metadata.offset, args->light_bindings->metadata.size);
|
2023-02-06 08:35:08 +01:00
|
|
|
RES_SET_BUFFER(light_grid, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, args->light_bindings->buffer, args->light_bindings->grid.offset, args->light_bindings->grid.size);
|
2023-01-16 21:41:37 +01:00
|
|
|
#undef RES_SET_SBUFFER_FULL
|
|
|
|
#undef RES_SET_BUFFER
|
2022-01-22 05:55:43 +01:00
|
|
|
|
2022-08-20 22:56:29 +02:00
|
|
|
// Upload kusochki updates
|
|
|
|
{
|
|
|
|
const VkBufferMemoryBarrier bmb[] = { {
|
|
|
|
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
|
|
|
|
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
|
|
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR,
|
|
|
|
.buffer = g_ray_model_state.kusochki_buffer.buffer,
|
|
|
|
.offset = 0,
|
|
|
|
.size = VK_WHOLE_SIZE,
|
|
|
|
} };
|
|
|
|
|
|
|
|
vkCmdPipelineBarrier(cmdbuf,
|
|
|
|
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
2023-01-23 00:00:01 +01:00
|
|
|
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR | VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
2022-08-20 22:56:29 +02:00
|
|
|
0, 0, NULL, ARRAYSIZE(bmb), bmb, 0, NULL);
|
|
|
|
}
|
2022-01-22 05:55:43 +01:00
|
|
|
|
2023-01-28 23:50:43 +01:00
|
|
|
// Transfer previous frames before they had a chance of their resource-barrier metadata overwritten (as there's no guaranteed order for them)
|
|
|
|
for (int i = ExternalResource_COUNT; i < MAX_RESOURCES; ++i) {
|
|
|
|
rt_resource_t* const res = g_rtx.res + i;
|
2023-01-30 19:21:18 +01:00
|
|
|
if (!res->name[0] || !res->image.image || res->source_index_plus_1 <= 0)
|
2023-01-28 23:50:43 +01:00
|
|
|
continue;
|
|
|
|
|
2023-01-30 19:21:18 +01:00
|
|
|
ASSERT(res->source_index_plus_1 <= COUNTOF(g_rtx.res));
|
|
|
|
rt_resource_t *const src = g_rtx.res + res->source_index_plus_1 - 1;
|
2023-01-28 23:50:43 +01:00
|
|
|
|
|
|
|
// Swap resources
|
|
|
|
const vk_resource_t tmp_res = res->resource;
|
|
|
|
const xvk_image_t tmp_img = res->image;
|
|
|
|
|
|
|
|
res->resource = src->resource;
|
|
|
|
res->image = src->image;
|
|
|
|
|
|
|
|
// TODO this is slightly incorrect, as they technically can have different resource->type values
|
|
|
|
src->resource = tmp_res;
|
|
|
|
src->image = tmp_img;
|
|
|
|
|
|
|
|
// If there was no initial state, prepare it. (this should happen only for the first frame)
|
|
|
|
if (res->resource.write.pipelines == 0) {
|
|
|
|
// TODO is there a better way? Can image be cleared w/o explicit clear op?
|
|
|
|
R_VkImageClear( cmdbuf, res->image.image );
|
|
|
|
res->resource.write.pipelines = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
|
|
|
res->resource.write.image_layout = VK_IMAGE_LAYOUT_GENERAL;
|
|
|
|
res->resource.write.access_mask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-21 22:03:57 +01:00
|
|
|
// Clear intra-frame resources
|
|
|
|
for (int i = ExternalResource_COUNT; i < MAX_RESOURCES; ++i) {
|
|
|
|
rt_resource_t* const res = g_rtx.res + i;
|
2023-01-30 19:21:18 +01:00
|
|
|
if (!res->name[0] || !res->image.image || res->source_index_plus_1 > 0)
|
2023-01-21 22:03:57 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
res->resource.read = res->resource.write = (ray_resource_state_t){0};
|
|
|
|
}
|
|
|
|
|
2022-01-19 07:21:14 +01:00
|
|
|
DEBUG_BEGIN(cmdbuf, "yay tracing");
|
2022-08-27 21:30:53 +02:00
|
|
|
RT_VkAccelPrepareTlas(cmdbuf);
|
2022-08-07 18:45:54 +02:00
|
|
|
prepareUniformBuffer(args->render_args, args->frame_index, args->fov_angle_y);
|
2022-01-08 03:51:59 +01:00
|
|
|
|
2022-08-20 22:56:29 +02:00
|
|
|
// 4. Barrier for TLAS build
|
2022-01-08 03:51:59 +01:00
|
|
|
{
|
2022-08-20 22:56:29 +02:00
|
|
|
const VkBufferMemoryBarrier bmb[] = { {
|
2022-01-08 03:51:59 +01:00
|
|
|
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
|
|
|
|
.srcAccessMask = VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR,
|
|
|
|
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
2022-08-27 21:30:53 +02:00
|
|
|
.buffer = g_accel.accels_buffer.buffer,
|
2022-01-08 03:51:59 +01:00
|
|
|
.offset = 0,
|
|
|
|
.size = VK_WHOLE_SIZE,
|
|
|
|
} };
|
|
|
|
vkCmdPipelineBarrier(cmdbuf,
|
|
|
|
VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
|
2023-01-23 00:00:01 +01:00
|
|
|
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
2022-02-01 05:40:41 +01:00
|
|
|
0, 0, NULL, ARRAYSIZE(bmb), bmb, 0, NULL);
|
2022-01-08 03:51:59 +01:00
|
|
|
}
|
|
|
|
|
2022-10-22 23:43:41 +02:00
|
|
|
{ // FIXME this should be done automatically inside meatpipe, TODO
|
2022-08-15 18:20:42 +02:00
|
|
|
//const uint32_t size = sizeof(struct Lights);
|
|
|
|
//const uint32_t size = sizeof(struct LightsMetadata); // + 8 * sizeof(uint32_t);
|
|
|
|
const VkBufferMemoryBarrier bmb[] = {{
|
|
|
|
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
|
|
|
|
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
|
|
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
|
|
|
.buffer = args->light_bindings->buffer,
|
|
|
|
.offset = 0,
|
|
|
|
.size = VK_WHOLE_SIZE,
|
|
|
|
}};
|
|
|
|
vkCmdPipelineBarrier(cmdbuf,
|
|
|
|
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
2023-01-23 00:00:01 +01:00
|
|
|
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
2022-08-15 18:20:42 +02:00
|
|
|
0, 0, NULL, ARRAYSIZE(bmb), bmb, 0, NULL);
|
|
|
|
}
|
|
|
|
|
2023-01-28 23:50:43 +01:00
|
|
|
// Update image resource links after the prev_-related swap above
|
|
|
|
// TODO Preserve the indexes somewhere to avoid searching
|
2023-01-30 19:21:18 +01:00
|
|
|
// FIXME I don't really get why we need this, the pointers should have been preserved ?!
|
2023-01-28 23:50:43 +01:00
|
|
|
for (int i = 0; i < g_rtx.mainpipe->resources_count; ++i) {
|
|
|
|
const vk_meatpipe_resource_t *mr = g_rtx.mainpipe->resources + i;
|
|
|
|
const int index = findResource(mr->name);
|
|
|
|
ASSERT(index >= 0);
|
|
|
|
ASSERT(index < MAX_RESOURCES);
|
|
|
|
rt_resource_t *const res = g_rtx.res + index;
|
|
|
|
const qboolean create = !!(mr->flags & MEATPIPE_RES_CREATE);
|
|
|
|
if (create && mr->descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)
|
2023-01-30 19:21:18 +01:00
|
|
|
// THIS FAILS WHY?! ASSERT(g_rtx.mainpipe_resources[i]->value.image_object == &res->image);
|
2023-01-28 23:50:43 +01:00
|
|
|
g_rtx.mainpipe_resources[i]->value.image_object = &res->image;
|
|
|
|
}
|
|
|
|
|
2023-01-21 22:03:57 +01:00
|
|
|
R_VkMeatpipePerform(g_rtx.mainpipe, cmdbuf, (vk_meatpipe_perfrom_args_t) {
|
|
|
|
.frame_set_slot = args->frame_index,
|
|
|
|
.width = FRAME_WIDTH,
|
|
|
|
.height = FRAME_HEIGHT,
|
|
|
|
.resources = g_rtx.mainpipe_resources,
|
|
|
|
});
|
2022-01-08 03:51:59 +01:00
|
|
|
|
|
|
|
{
|
2022-08-27 20:39:29 +02:00
|
|
|
const r_vkimage_blit_args blit_args = {
|
2022-01-08 03:51:59 +01:00
|
|
|
.in_stage = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
|
|
|
.src = {
|
2023-01-21 20:35:00 +01:00
|
|
|
.image = g_rtx.mainpipe_out->image.image,
|
2022-01-08 03:51:59 +01:00
|
|
|
.width = FRAME_WIDTH,
|
|
|
|
.height = FRAME_HEIGHT,
|
|
|
|
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
|
|
|
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
|
|
|
|
},
|
|
|
|
.dst = {
|
2022-08-07 18:45:54 +02:00
|
|
|
.image = args->render_args->dst.image,
|
|
|
|
.width = args->render_args->dst.width,
|
|
|
|
.height = args->render_args->dst.height,
|
2022-01-08 03:51:59 +01:00
|
|
|
.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
|
|
|
.srcAccessMask = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-08-27 20:39:29 +02:00
|
|
|
R_VkImageBlit( cmdbuf, &blit_args );
|
2023-01-28 23:50:43 +01:00
|
|
|
|
2023-01-30 19:21:18 +01:00
|
|
|
// TODO this is to make sure we remember image layout after image_blit
|
|
|
|
// The proper way to do this would be to teach R_VkImageBlit to properly track the image metadata (i.e. vk_resource_t state)
|
2023-01-28 23:50:43 +01:00
|
|
|
g_rtx.mainpipe_out->resource.write.image_layout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
2022-01-08 03:51:59 +01:00
|
|
|
}
|
2022-01-19 07:21:14 +01:00
|
|
|
DEBUG_END(cmdbuf);
|
2022-01-08 03:51:59 +01:00
|
|
|
}
|
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
static void cleanupResources(void) {
|
|
|
|
for (int i = 0; i < MAX_RESOURCES; ++i) {
|
|
|
|
rt_resource_t *const res = g_rtx.res + i;
|
|
|
|
if (!res->name[0] || res->refcount || !res->image.image)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
XVK_ImageDestroy(&res->image);
|
|
|
|
res->name[0] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void destroyMainpipe(void) {
|
|
|
|
if (!g_rtx.mainpipe)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ASSERT(g_rtx.mainpipe_resources);
|
|
|
|
|
|
|
|
for (int i = 0; i < g_rtx.mainpipe->resources_count; ++i) {
|
|
|
|
const vk_meatpipe_resource_t *mr = g_rtx.mainpipe->resources + i;
|
|
|
|
const int index = findResource(mr->name);
|
|
|
|
ASSERT(index >= 0);
|
|
|
|
ASSERT(index < MAX_RESOURCES);
|
|
|
|
rt_resource_t *const res = g_rtx.res + index;
|
|
|
|
ASSERT(res->refcount > 0);
|
|
|
|
res->refcount--;
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanupResources();
|
|
|
|
R_VkMeatpipeDestroy(g_rtx.mainpipe);
|
|
|
|
g_rtx.mainpipe = NULL;
|
|
|
|
|
|
|
|
Mem_Free(g_rtx.mainpipe_resources);
|
|
|
|
g_rtx.mainpipe_resources = NULL;
|
|
|
|
g_rtx.mainpipe_out = NULL;
|
|
|
|
}
|
|
|
|
|
2023-01-20 07:51:32 +01:00
|
|
|
static void reloadMainpipe(void) {
|
2023-01-18 20:06:35 +01:00
|
|
|
vk_meatpipe_t *const newpipe = R_VkMeatpipeCreateFromFile("rt.meat");
|
|
|
|
if (!newpipe)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const size_t newpipe_resources_size = sizeof(vk_resource_p) * newpipe->resources_count;
|
|
|
|
vk_resource_p *newpipe_resources = Mem_Calloc(vk_core.pool, newpipe_resources_size);
|
2023-01-21 20:35:00 +01:00
|
|
|
rt_resource_t *newpipe_out = NULL;
|
2023-01-18 20:06:35 +01:00
|
|
|
|
|
|
|
for (int i = 0; i < newpipe->resources_count; ++i) {
|
|
|
|
const vk_meatpipe_resource_t *mr = newpipe->resources + i;
|
|
|
|
gEngine.Con_Reportf("res %d/%d: %s descriptor=%u count=%d flags=[%c%c] image_format=%u\n",
|
|
|
|
i, newpipe->resources_count, mr->name, mr->descriptor_type, mr->count,
|
|
|
|
(mr->flags & MEATPIPE_RES_WRITE) ? 'W' : ' ',
|
|
|
|
(mr->flags & MEATPIPE_RES_CREATE) ? 'C' : ' ',
|
|
|
|
mr->image_format);
|
|
|
|
|
|
|
|
const qboolean create = !!(mr->flags & MEATPIPE_RES_CREATE);
|
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
if (create && mr->descriptor_type != VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) {
|
|
|
|
gEngine.Con_Printf(S_ERROR "Only storage image creation is supported for meatpipes\n");
|
|
|
|
goto fail;
|
|
|
|
}
|
2023-01-21 22:03:57 +01:00
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
// TODO this should be specified as a flag, from rt.json
|
2023-01-21 20:35:00 +01:00
|
|
|
const qboolean output = Q_strcmp("dest", mr->name) == 0;
|
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
const int index = create ? getResourceSlotForName(mr->name) : findResource(mr->name);
|
|
|
|
if (index < 0) {
|
|
|
|
gEngine.Con_Printf(S_ERROR "Couldn't find resource/slot for %s\n", mr->name);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2023-01-21 22:03:57 +01:00
|
|
|
rt_resource_t *const res = g_rtx.res + index;
|
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
if (output)
|
2023-01-21 22:03:57 +01:00
|
|
|
newpipe_out = res;
|
2023-01-21 20:35:00 +01:00
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
if (create) {
|
|
|
|
if (res->image.image == VK_NULL_HANDLE) {
|
|
|
|
const xvk_image_create_t create = {
|
|
|
|
.debug_name = mr->name,
|
|
|
|
.width = FRAME_WIDTH,
|
|
|
|
.height = FRAME_HEIGHT,
|
|
|
|
.mips = 1,
|
|
|
|
.layers = 1,
|
|
|
|
.format = mr->image_format,
|
|
|
|
.tiling = VK_IMAGE_TILING_OPTIMAL,
|
2023-01-28 23:50:43 +01:00
|
|
|
// TODO figure out how to detect this need properly. prev_dest is not defined as "output"
|
|
|
|
//.usage = VK_IMAGE_USAGE_STORAGE_BIT | (output ? VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT : 0),
|
|
|
|
.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
2023-01-22 22:22:56 +01:00
|
|
|
.has_alpha = true,
|
|
|
|
.is_cubemap = false,
|
|
|
|
};
|
|
|
|
res->image = XVK_ImageCreate(&create);
|
|
|
|
Q_strncpy(res->name, mr->name, sizeof(res->name));
|
|
|
|
} else {
|
|
|
|
// TODO if (mr->image_format != res->image.format) { S_ERROR and goto fail }
|
|
|
|
}
|
2023-01-18 20:06:35 +01:00
|
|
|
}
|
|
|
|
|
2023-01-21 22:03:57 +01:00
|
|
|
newpipe_resources[i] = &res->resource;
|
|
|
|
|
|
|
|
if (create) {
|
|
|
|
if (mr->descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)
|
|
|
|
newpipe_resources[i]->value.image_object = &res->image;
|
|
|
|
|
|
|
|
res->resource.type = mr->descriptor_type;
|
|
|
|
} else {
|
|
|
|
// TODO no assert, complain and exit
|
|
|
|
// can't do before all resources are properly registered by their producers and not all this temp crap we have right now
|
|
|
|
// ASSERT(res->resource.type == mr->descriptor_type);
|
|
|
|
}
|
2023-01-21 20:35:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!newpipe_out) {
|
|
|
|
gEngine.Con_Printf(S_ERROR "New rt.json doesn't define an 'dest' output texture\n");
|
|
|
|
goto fail;
|
2023-01-18 20:06:35 +01:00
|
|
|
}
|
|
|
|
|
2023-01-28 23:50:43 +01:00
|
|
|
// Resolve prev_ frame resources
|
|
|
|
for (int i = 0; i < newpipe->resources_count; ++i) {
|
|
|
|
const vk_meatpipe_resource_t *mr = newpipe->resources + i;
|
2023-01-30 19:21:18 +01:00
|
|
|
if (mr->prev_frame_index_plus_1 <= 0)
|
2023-01-28 23:50:43 +01:00
|
|
|
continue;
|
|
|
|
|
2023-01-30 19:21:18 +01:00
|
|
|
ASSERT(mr->prev_frame_index_plus_1 < newpipe->resources_count);
|
2023-01-28 23:50:43 +01:00
|
|
|
|
|
|
|
const int index = findResource(mr->name);
|
|
|
|
ASSERT(index >= 0);
|
|
|
|
|
2023-01-30 19:21:18 +01:00
|
|
|
const vk_meatpipe_resource_t *pr = newpipe->resources + (mr->prev_frame_index_plus_1 - 1);
|
2023-01-28 23:50:43 +01:00
|
|
|
|
|
|
|
const int dest_index = findResource(pr->name);
|
|
|
|
if (dest_index < 0) {
|
|
|
|
gEngine.Con_Printf(S_ERROR "Couldn't find prev_ resource/slot %s for resource %s\n", pr->name, mr->name);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2023-01-30 19:21:18 +01:00
|
|
|
g_rtx.res[index].source_index_plus_1 = dest_index + 1;
|
2023-01-28 23:50:43 +01:00
|
|
|
}
|
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
// Loading successful
|
|
|
|
// Update refcounts
|
|
|
|
for (int i = 0; i < newpipe->resources_count; ++i) {
|
|
|
|
const vk_meatpipe_resource_t *mr = newpipe->resources + i;
|
|
|
|
const int index = findResource(mr->name);
|
|
|
|
ASSERT(index >= 0);
|
|
|
|
ASSERT(index < MAX_RESOURCES);
|
|
|
|
rt_resource_t *const res = g_rtx.res + index;
|
|
|
|
res->refcount++;
|
2023-01-18 20:06:35 +01:00
|
|
|
}
|
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
destroyMainpipe();
|
|
|
|
|
2023-01-22 22:43:33 +01:00
|
|
|
// TODO currently changing texture format is not handled. It will try to reuse existing image with the old format
|
|
|
|
// which will probably fail. To handle it we'd need to refactor this:
|
|
|
|
// 1. xvk_image_t should have a field with its current format? (or we'd also store if with the resource here)
|
|
|
|
// 2. do another loop here to detect format mismatch and recreate.
|
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
g_rtx.mainpipe = newpipe;
|
2023-01-21 20:35:00 +01:00
|
|
|
g_rtx.mainpipe_resources = newpipe_resources;
|
|
|
|
g_rtx.mainpipe_out = newpipe_out;
|
2023-01-18 20:06:35 +01:00
|
|
|
|
2023-01-21 22:03:57 +01:00
|
|
|
return;
|
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
fail:
|
2023-01-22 22:22:56 +01:00
|
|
|
cleanupResources();
|
|
|
|
|
|
|
|
if (newpipe_resources)
|
2023-01-18 20:06:35 +01:00
|
|
|
Mem_Free(newpipe_resources);
|
|
|
|
|
|
|
|
R_VkMeatpipeDestroy(newpipe);
|
|
|
|
}
|
|
|
|
|
2021-07-17 20:45:28 +02:00
|
|
|
void VK_RayFrameEnd(const vk_ray_frame_render_args_t* args)
|
|
|
|
{
|
|
|
|
const VkCommandBuffer cmdbuf = args->cmdbuf;
|
2023-01-18 20:06:35 +01:00
|
|
|
// const xvk_ray_frame_images_t* current_frame = g_rtx.frames + (g_rtx.frame_number % 2);
|
2021-07-17 20:45:28 +02:00
|
|
|
|
|
|
|
ASSERT(vk_core.rtx);
|
|
|
|
// ubo should contain two matrices
|
|
|
|
// FIXME pass these matrices explicitly to let RTX module handle ubo itself
|
|
|
|
|
2022-07-30 20:37:06 +02:00
|
|
|
RT_LightsFrameEnd();
|
2023-02-06 08:35:08 +01:00
|
|
|
const vk_lights_bindings_t light_bindings = VK_LightsUpload();
|
2022-07-30 20:37:06 +02:00
|
|
|
|
2021-07-17 20:45:28 +02:00
|
|
|
g_rtx.frame_number++;
|
|
|
|
|
2021-10-19 19:13:33 +02:00
|
|
|
// if (vk_core.debug)
|
|
|
|
// XVK_RayModel_Validate();
|
2021-07-17 20:45:28 +02:00
|
|
|
|
|
|
|
if (g_rtx.reload_pipeline) {
|
|
|
|
gEngine.Con_Printf(S_WARN "Reloading RTX shaders/pipelines\n");
|
2022-08-12 21:32:52 +02:00
|
|
|
XVK_CHECK(vkDeviceWaitIdle(vk_core.device));
|
2021-11-07 21:46:27 +01:00
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
reloadMainpipe();
|
2022-01-27 08:52:14 +01:00
|
|
|
|
2021-07-17 20:45:28 +02:00
|
|
|
g_rtx.reload_pipeline = false;
|
2021-03-20 19:15:57 +01:00
|
|
|
}
|
2021-07-04 20:18:28 +02:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
ASSERT(g_rtx.mainpipe_out);
|
|
|
|
|
2021-11-07 21:46:27 +01:00
|
|
|
if (g_ray_model_state.frame.num_models == 0) {
|
2022-08-27 20:39:29 +02:00
|
|
|
const r_vkimage_blit_args blit_args = {
|
2021-11-07 21:46:27 +01:00
|
|
|
.in_stage = VK_PIPELINE_STAGE_TRANSFER_BIT,
|
|
|
|
.src = {
|
2023-01-21 20:35:00 +01:00
|
|
|
.image = g_rtx.mainpipe_out->image.image,
|
2021-11-07 21:46:27 +01:00
|
|
|
.width = FRAME_WIDTH,
|
|
|
|
.height = FRAME_HEIGHT,
|
|
|
|
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
|
|
|
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
|
|
|
},
|
|
|
|
.dst = {
|
2021-07-17 21:40:26 +02:00
|
|
|
.image = args->dst.image,
|
2021-11-07 21:46:27 +01:00
|
|
|
.width = args->dst.width,
|
|
|
|
.height = args->dst.height,
|
2021-07-17 21:40:26 +02:00
|
|
|
.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
2021-11-07 21:46:27 +01:00
|
|
|
.srcAccessMask = 0,
|
|
|
|
},
|
|
|
|
};
|
2021-07-17 21:40:26 +02:00
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
R_VkImageClear( cmdbuf, g_rtx.mainpipe_out->image.image );
|
2022-08-27 20:39:29 +02:00
|
|
|
R_VkImageBlit( cmdbuf, &blit_args );
|
2021-07-17 20:45:28 +02:00
|
|
|
} else {
|
2022-08-07 18:45:54 +02:00
|
|
|
const perform_tracing_args_t trace_args = {
|
|
|
|
.render_args = args,
|
|
|
|
.frame_index = (g_rtx.frame_number % 2),
|
|
|
|
.fov_angle_y = args->fov_angle_y,
|
|
|
|
.light_bindings = &light_bindings,
|
|
|
|
};
|
|
|
|
performTracing( cmdbuf, &trace_args );
|
2021-11-07 19:07:01 +01:00
|
|
|
}
|
2021-03-01 19:52:08 +01:00
|
|
|
}
|
|
|
|
|
2021-03-13 21:29:17 +01:00
|
|
|
static void reloadPipeline( void ) {
|
|
|
|
g_rtx.reload_pipeline = true;
|
2021-02-27 22:43:49 +01:00
|
|
|
}
|
|
|
|
|
2021-05-08 23:34:42 +02:00
|
|
|
static void freezeModels( void ) {
|
2021-07-05 19:59:14 +02:00
|
|
|
g_ray_model_state.freeze_models = !g_ray_model_state.freeze_models;
|
2021-05-08 23:34:42 +02:00
|
|
|
}
|
|
|
|
|
2021-02-27 22:43:49 +01:00
|
|
|
qboolean VK_RayInit( void )
|
|
|
|
{
|
|
|
|
ASSERT(vk_core.rtx);
|
|
|
|
// TODO complain and cleanup on failure
|
2021-07-05 22:24:57 +02:00
|
|
|
|
2022-08-27 21:30:53 +02:00
|
|
|
if (!RT_VkAccelInit())
|
|
|
|
return false;
|
|
|
|
|
2023-01-21 20:35:00 +01:00
|
|
|
#define REGISTER_EXTERNAL(type, name_) \
|
2023-01-22 22:22:56 +01:00
|
|
|
Q_strncpy(g_rtx.res[ExternalResource_##name_].name, #name_, sizeof(g_rtx.res[0].name)); \
|
|
|
|
g_rtx.res[ExternalResource_##name_].refcount = 1;
|
2023-01-21 20:35:00 +01:00
|
|
|
EXTERNAL_RESOUCES(REGISTER_EXTERNAL)
|
|
|
|
#undef REGISTER_EXTERNAL
|
|
|
|
|
|
|
|
g_rtx.res[ExternalResource_textures].resource = (vk_resource_t){
|
|
|
|
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
|
|
|
.value = (vk_descriptor_value_t){
|
|
|
|
.image_array = tglob.dii_all_textures,
|
|
|
|
}
|
|
|
|
};
|
2023-01-22 22:22:56 +01:00
|
|
|
g_rtx.res[ExternalResource_textures].refcount = 1;
|
2023-01-21 20:35:00 +01:00
|
|
|
|
2023-01-18 20:06:35 +01:00
|
|
|
reloadMainpipe();
|
|
|
|
if (!g_rtx.mainpipe)
|
|
|
|
return false;
|
2022-10-16 00:09:45 +02:00
|
|
|
|
2022-01-18 06:12:14 +01:00
|
|
|
g_rtx.uniform_unit_size = ALIGN_UP(sizeof(struct UniformBuffer), vk_core.physical_device.properties.limits.minUniformBufferOffsetAlignment);
|
2021-07-05 22:24:57 +02:00
|
|
|
|
2022-01-18 08:04:06 +01:00
|
|
|
if (!VK_BufferCreate("ray uniform_buffer", &g_rtx.uniform_buffer, g_rtx.uniform_unit_size * MAX_FRAMES_IN_FLIGHT,
|
2022-01-08 22:44:02 +01:00
|
|
|
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
|
|
|
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-01-09 20:14:44 +01:00
|
|
|
if (!VK_BufferCreate("ray kusochki_buffer", &g_ray_model_state.kusochki_buffer, sizeof(vk_kusok_data_t) * MAX_KUSOCHKI,
|
2022-08-20 21:13:03 +02:00
|
|
|
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
|
|
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
|
2021-03-08 21:09:11 +01:00
|
|
|
// FIXME complain, handle
|
|
|
|
return false;
|
|
|
|
}
|
2022-05-29 09:01:43 +02:00
|
|
|
RT_RayModel_Clear();
|
2021-05-03 20:17:01 +02:00
|
|
|
|
2021-11-30 16:53:12 +01:00
|
|
|
gEngine.Cmd_AddCommand("vk_rtx_reload", reloadPipeline, "Reload RTX shader");
|
|
|
|
gEngine.Cmd_AddCommand("vk_rtx_freeze", freezeModels, "Freeze models, do not update/add/delete models from to-draw list");
|
2021-03-13 21:29:17 +01:00
|
|
|
|
2021-02-27 22:43:49 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-11-07 21:46:27 +01:00
|
|
|
void VK_RayShutdown( void ) {
|
2021-02-27 22:43:49 +01:00
|
|
|
ASSERT(vk_core.rtx);
|
2021-02-28 00:40:57 +01:00
|
|
|
|
2023-01-22 22:22:56 +01:00
|
|
|
destroyMainpipe();
|
2021-03-01 19:52:08 +01:00
|
|
|
|
2022-01-09 20:14:44 +01:00
|
|
|
VK_BufferDestroy(&g_ray_model_state.kusochki_buffer);
|
2022-01-18 08:04:06 +01:00
|
|
|
VK_BufferDestroy(&g_rtx.uniform_buffer);
|
2022-07-15 09:35:19 +02:00
|
|
|
|
2022-08-27 21:30:53 +02:00
|
|
|
RT_VkAccelShutdown();
|
2021-02-27 22:43:49 +01:00
|
|
|
}
|