2021-02-27 22:43:49 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-05-22 19:39:48 +02:00
|
|
|
#include "vk_geometry.h"
|
2021-02-27 22:43:49 +01:00
|
|
|
#include "vk_core.h"
|
|
|
|
|
2021-04-09 23:59:04 +02:00
|
|
|
void VK_RayFrameBegin( void );
|
2021-06-05 21:48:16 +02:00
|
|
|
|
2021-03-03 20:58:40 +01:00
|
|
|
typedef struct {
|
2023-04-01 06:01:17 +02:00
|
|
|
struct vk_combuf_s *combuf;
|
2021-03-03 20:58:40 +01:00
|
|
|
|
|
|
|
struct {
|
|
|
|
VkImageView image_view;
|
|
|
|
VkImage image;
|
|
|
|
uint32_t width, height;
|
|
|
|
} dst;
|
|
|
|
|
2022-01-08 22:44:02 +01:00
|
|
|
const matrix4x4 *projection, *view;
|
2021-03-08 21:09:11 +01:00
|
|
|
|
|
|
|
// Buffer holding vertex and index data
|
2023-06-01 18:25:55 +02:00
|
|
|
// TODO remove
|
2021-03-08 21:09:11 +01:00
|
|
|
struct {
|
|
|
|
VkBuffer buffer; // must be the same as in vk_ray_model_create_t TODO: validate or make impossible to specify incorrectly
|
2021-09-14 20:44:19 +02:00
|
|
|
uint64_t size;
|
2021-03-08 21:09:11 +01:00
|
|
|
} geometry_data;
|
2021-08-05 03:36:53 +02:00
|
|
|
|
|
|
|
float fov_angle_y;
|
2021-04-09 23:59:04 +02:00
|
|
|
} vk_ray_frame_render_args_t;
|
|
|
|
void VK_RayFrameEnd(const vk_ray_frame_render_args_t* args);
|
|
|
|
|
2023-12-14 16:33:26 +01:00
|
|
|
void VK_RayNewMapBegin( void );
|
|
|
|
void VK_RayNewMapEnd( void );
|
2021-02-27 22:43:49 +01:00
|
|
|
|
|
|
|
qboolean VK_RayInit( void );
|
|
|
|
void VK_RayShutdown( void );
|
|
|
|
|
2023-05-22 19:39:48 +02:00
|
|
|
struct vk_render_geometry_s;
|
2023-06-01 18:25:55 +02:00
|
|
|
struct rt_model_s;
|
2023-09-19 19:05:12 +02:00
|
|
|
struct r_vk_material_s;
|
2023-06-01 18:25:55 +02:00
|
|
|
|
2023-05-22 19:39:48 +02:00
|
|
|
typedef enum {
|
|
|
|
kBlasBuildStatic, // builds slow for fast trace
|
|
|
|
kBlasBuildDynamicUpdate, // builds if not built, updates if built
|
|
|
|
kBlasBuildDynamicFast, // builds fast from scratch (no correlation with previous frame guaranteed, e.g. triapi)
|
|
|
|
} rt_blas_usage_e;
|
|
|
|
|
2023-05-30 21:14:44 +02:00
|
|
|
typedef struct {
|
2023-05-31 19:13:40 +02:00
|
|
|
const char *debug_name; // Must remain alive until RT_ModelDestroy
|
2023-05-30 21:14:44 +02:00
|
|
|
const struct vk_render_geometry_s *geometries;
|
|
|
|
int geometries_count;
|
|
|
|
rt_blas_usage_e usage;
|
|
|
|
} rt_model_create_t;
|
|
|
|
struct rt_model_s *RT_ModelCreate(rt_model_create_t args);
|
|
|
|
void RT_ModelDestroy(struct rt_model_s *model);
|
|
|
|
|
2023-06-09 19:03:00 +02:00
|
|
|
qboolean RT_ModelUpdate(struct rt_model_s *model, const struct vk_render_geometry_s *geometries, int geometries_count);
|
|
|
|
|
2023-08-31 17:45:51 +02:00
|
|
|
qboolean RT_ModelUpdateMaterials(struct rt_model_s *model, const struct vk_render_geometry_s *geometries, int geometries_count, const int *geom_indices, int geom_indices_count);
|
|
|
|
|
2023-05-30 21:14:44 +02:00
|
|
|
typedef struct {
|
2023-09-26 19:14:28 +02:00
|
|
|
int material_mode;
|
2023-12-22 21:14:27 +01:00
|
|
|
uint32_t material_flags;
|
|
|
|
|
2023-05-30 21:14:44 +02:00
|
|
|
const matrix3x4 *transform, *prev_transform;
|
2023-10-10 17:56:42 +02:00
|
|
|
const vec4_t *color_srgb;
|
2023-06-01 19:15:30 +02:00
|
|
|
|
|
|
|
struct {
|
2023-09-19 19:05:12 +02:00
|
|
|
const struct r_vk_material_s *material;
|
2023-06-06 18:29:05 +02:00
|
|
|
|
|
|
|
// These are needed in order to recreate kusochki geometry data
|
|
|
|
// TODO remove when material data is split from kusochki
|
2023-06-01 19:15:30 +02:00
|
|
|
int geoms_count;
|
|
|
|
const struct vk_render_geometry_s *geoms;
|
|
|
|
} override;
|
2023-05-30 21:14:44 +02:00
|
|
|
} rt_frame_add_model_t;
|
|
|
|
|
|
|
|
void RT_FrameAddModel( struct rt_model_s *model, rt_frame_add_model_t args );
|
2023-06-07 19:24:29 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char *debug_name;
|
|
|
|
const struct vk_render_geometry_s *geometries;
|
2023-12-28 17:21:32 +01:00
|
|
|
const vec4_t *color_srgb;
|
2023-06-07 19:24:29 +02:00
|
|
|
int geometries_count;
|
|
|
|
int render_type;
|
|
|
|
} rt_frame_add_once_t;
|
|
|
|
|
|
|
|
void RT_FrameAddOnce( rt_frame_add_once_t args );
|
2023-11-30 16:27:47 +01:00
|
|
|
|
|
|
|
// Signal that the next frame is discontinuous, and all accumulated screen-space
|
|
|
|
// statistics should be reset. Should help with newmap/saveload/teleport denoiser artifacts.
|
|
|
|
void RT_FrameDiscontinuity( void );
|