Quake II RTX doxygen
1.0 dev
|
|
#include "shared/shared.h"
#include "common/bsp.h"
#include "common/cmd.h"
#include "common/common.h"
#include "common/cvar.h"
#include "common/files.h"
#include "common/math.h"
#include "client/video.h"
#include "client/client.h"
#include "refresh/refresh.h"
#include "refresh/images.h"
#include "refresh/models.h"
#include "system/hunk.h"
#include "vkpt.h"
#include "material.h"
#include "physical_sky.h"
#include "../../client/ui/ui.h"
#include "shader/vertex_buffer.h"
#include <vulkan/vulkan.h>
#include <SDL.h>
#include <SDL_vulkan.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <windows.h>
Go to the source code of this file.
|
void | debug_output (const char *format,...) |
|
static void | recreate_swapchain () |
|
static void | viewsize_changed (cvar_t *self) |
|
static void | drs_target_changed (cvar_t *self) |
|
static void | drs_minscale_changed (cvar_t *self) |
|
static void | drs_maxscale_changed (cvar_t *self) |
|
static void | accumulation_cvar_changed (cvar_t *self) |
|
static qboolean | extents_equal (VkExtent2D a, VkExtent2D b) |
|
static VkExtent2D | get_render_extent () |
|
static VkExtent2D | get_screen_image_extent () |
|
void | vkpt_reset_accumulation () |
|
VkResult | vkpt_initialize_all (VkptInitFlags_t init_flags) |
|
VkResult | vkpt_destroy_all (VkptInitFlags_t destroy_flags) |
|
void | vkpt_reload_shader () |
|
void | vkpt_reload_textures () |
|
void | vkpt_reload_materials () |
|
void | vkpt_save_materials () |
|
void | vkpt_set_material () |
|
void | vkpt_print_material () |
|
void | get_vk_extension_list (const char *layer, uint32_t *num_extensions, VkExtensionProperties **ext) |
|
void | get_vk_layer_list (uint32_t *num_layers, VkLayerProperties **ext) |
|
int | layer_requested (const char *name) |
|
static VKAPI_ATTR VkBool32 VKAPI_CALL | vk_debug_callback (VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT type, const VkDebugUtilsMessengerCallbackDataEXT *callback_data, void *user_data) |
|
VkResult | qvkCreateDebugUtilsMessengerEXT (VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pCallback) |
|
VkResult | qvkDestroyDebugUtilsMessengerEXT (VkInstance instance, VkDebugUtilsMessengerEXT callback, const VkAllocationCallbacks *pAllocator) |
|
VkResult | create_swapchain () |
|
VkResult | create_command_pool_and_fences () |
|
qboolean | init_vulkan () |
|
static VkShaderModule | create_shader_module_from_file (const char *name, const char *enum_name) |
|
VkResult | vkpt_load_shader_modules () |
|
VkResult | vkpt_destroy_shader_modules () |
|
VkResult | destroy_swapchain () |
|
int | destroy_vulkan () |
|
static const pbr_material_t * | get_mesh_material (const entity_t *entity, const maliasmesh_t *mesh) |
|
static uint32_t | fill_model_instance (const entity_t *entity, const model_t *model, const maliasmesh_t *mesh, const float *transform, int model_instance_index, qboolean is_viewer_weapon, qboolean is_double_sided) |
|
static void | add_dlights (const dlight_t *lights, int num_lights, QVKUniformBuffer_t *ubo) |
|
static void | transform_point (const float *p, const float *matrix, float *result) |
|
static void | process_bsp_entity (const entity_t *entity, int *bsp_mesh_idx, int *instance_idx, int *num_instanced_vert) |
|
static qboolean | is_transparent_material (uint32_t material) |
|
static void | process_regular_entity (const entity_t *entity, const model_t *model, qboolean is_viewer_weapon, qboolean is_double_sided, int *model_instance_idx, int *instance_idx, int *num_instanced_vert, int mesh_filter, qboolean *contains_transparent) |
|
static void | prepare_entities (EntityUploadInfo *upload_info) |
|
VkDescriptorSet | qvk_get_current_desc_set_textures () |
|
static void | process_render_feedback (ref_feedback_t *feedback, mleaf_t *viewleaf, qboolean *sun_visible, float *adapted_luminance) |
|
static int | get_accumulation_rendering_framenum () |
|
static qboolean | is_accumulation_rendering_active () |
|
static void | draw_shadowed_string (int x, int y, int flags, size_t maxlen, const char *s) |
|
static void | evaluate_reference_mode (reference_mode_t *ref_mode) |
|
static void | prepare_sky_matrix (float time, vec3_t sky_matrix[3]) |
|
static void | prepare_camera (const vec3_t position, const vec3_t direction, mat4_t data) |
|
static void | prepare_ubo (refdef_t *fd, mleaf_t *viewleaf, const reference_mode_t *ref_mode, const vec3_t sky_matrix[3], qboolean render_world) |
|
void | R_RenderFrame_RTX (refdef_t *fd) |
|
static void | temporal_cvar_changed (cvar_t *self) |
|
static int | compare_doubles (const void *pa, const void *pb) |
|
static void | drs_init () |
|
static void | drs_process () |
|
void | R_BeginFrame_RTX (void) |
|
void | R_EndFrame_RTX (void) |
|
void | R_ModeChanged_RTX (int width, int height, int flags, int rowbytes, void *pixels) |
|
static void | vkpt_show_pvs (void) |
|
qboolean | R_Init_RTX (qboolean total) |
|
void | R_Shutdown_RTX (qboolean total) |
|
byte * | IMG_ReadPixels_RTX (int *width, int *height, int *rowbytes) |
|
void | R_SetSky_RTX (const char *name, float rotate, vec3_t axis) |
|
void | R_AddDecal_RTX (decal_t *d) |
|
void | R_BeginRegistration_RTX (const char *name) |
|
void | R_EndRegistration_RTX (void) |
|
VkCommandBuffer | vkpt_begin_command_buffer (cmd_buf_group_t *group) |
|
void | vkpt_free_command_buffers (cmd_buf_group_t *group) |
|
void | vkpt_reset_command_buffers (cmd_buf_group_t *group) |
|
void | vkpt_wait_idle (VkQueue queue, cmd_buf_group_t *group) |
|
void | vkpt_submit_command_buffer (VkCommandBuffer cmd_buf, VkQueue queue, uint32_t execute_device_mask, int wait_semaphore_count, VkSemaphore *wait_semaphores, VkPipelineStageFlags *wait_stages, uint32_t *wait_device_indices, int signal_semaphore_count, VkSemaphore *signal_semaphores, uint32_t *signal_device_indices, VkFence fence) |
|
void | vkpt_submit_command_buffer_simple (VkCommandBuffer cmd_buf, VkQueue queue, qboolean all_gpus) |
|
void | R_RegisterFunctionsRTX () |
|
◆ _VK_EXTENSION_DO [1/2]
#define _VK_EXTENSION_DO |
( |
|
a | ) |
PFN_##a q##a; |
◆ _VK_EXTENSION_DO [2/2]
#define _VK_EXTENSION_DO |
( |
|
a | ) |
|
Value: q##a = (PFN_##a) vkGetDeviceProcAddr(
qvk.
device, #a); \
if(!q##a) { Com_EPrintf("warning: could not load function %s\n", #a); }
Definition at line 387 of file main.c.
◆ _VK_INST_EXTENSION_DO [1/2]
#define _VK_INST_EXTENSION_DO |
( |
|
a | ) |
PFN_##a q##a; |
◆ _VK_INST_EXTENSION_DO [2/2]
#define _VK_INST_EXTENSION_DO |
( |
|
a | ) |
|
Value: q##a = (PFN_##a) vkGetInstanceProcAddr(
qvk.
instance, #a); \
if (!q##a) { Com_EPrintf("warning: could not load instance function %s\n", #a); }
Definition at line 383 of file main.c.
◆ MAX_MODEL_LIGHTS
#define MAX_MODEL_LIGHTS 1024 |
◆ MESH_FILTER_ALL
#define MESH_FILTER_ALL 3 |
◆ MESH_FILTER_OPAQUE
#define MESH_FILTER_OPAQUE 2 |
◆ MESH_FILTER_TRANSPARENT
#define MESH_FILTER_TRANSPARENT 1 |
◆ SCALING_FRAMES
◆ SHADER_MODULE_DO [1/2]
#define SHADER_MODULE_DO |
( |
|
a | ) |
|
Value: do { \
ret = (ret == VK_SUCCESS &&
qvk.
shader_modules[a]) ? VK_SUCCESS : VK_ERROR_INITIALIZATION_FAILED; \
}\
} while(0);
◆ SHADER_MODULE_DO [2/2]
#define SHADER_MODULE_DO |
( |
|
a | ) |
|
Value:
qvk.shader_modules[a] = VK_NULL_HANDLE;
◆ UBO_CVAR_DO [1/3]
#define UBO_CVAR_DO |
( |
|
name, |
|
|
|
default_value |
|
) |
| cvar_t *cvar_##name; |
◆ UBO_CVAR_DO [2/3]
#define UBO_CVAR_DO |
( |
|
name, |
|
|
|
default_value |
|
) |
| ubo->name = cvar_##name->value; |
◆ UBO_CVAR_DO [3/3]
#define UBO_CVAR_DO |
( |
|
name, |
|
|
|
default_value |
|
) |
| cvar_##name = Cvar_Get(#name, #default_value, 0); |
◆ entity_hash_t
◆ reference_mode_t
◆ VkptInit_t
◆ VkptInitFlags_t
Enumerator |
---|
VKPT_INIT_DEFAULT | |
VKPT_INIT_SWAPCHAIN_RECREATE | |
VKPT_INIT_RELOAD_SHADER | |
Definition at line 107 of file main.c.
◆ accumulation_cvar_changed()
static void accumulation_cvar_changed |
( |
cvar_t * |
self | ) |
|
|
static |
◆ add_dlights()
Definition at line 1342 of file main.c.
1344 ubo->num_sphere_lights = 0;
1346 for (
int i = 0; i < num_lights; i++)
1348 const dlight_t* light = lights + i;
1350 float* dynlight_data = (
float*)(ubo->sphere_light_data + ubo->num_sphere_lights * 2);
1351 float* center = dynlight_data;
1352 float* radius = dynlight_data + 3;
1353 float*
color = dynlight_data + 4;
1354 dynlight_data[7] = 0.f;
1356 VectorCopy(light->origin, center);
1357 VectorScale(light->color, light->intensity / 25.f,
color);
1358 *radius = light->radius;
1360 ubo->num_sphere_lights++;
Referenced by prepare_ubo().
◆ compare_doubles()
static int compare_doubles |
( |
const void * |
pa, |
|
|
const void * |
pb |
|
) |
| |
|
static |
Definition at line 2553 of file main.c.
2555 double a = *(
double*)pa;
2556 double b = *(
double*)pb;
2558 if (a < b)
return -1;
2559 if (a > b)
return 1;
Referenced by drs_process().
◆ create_command_pool_and_fences()
VkResult create_command_pool_and_fences |
( |
| ) |
|
Definition at line 689 of file main.c.
691 VkCommandPoolCreateInfo cmd_pool_create_info = {
692 .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
694 .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
713 VkSemaphoreCreateInfo semaphore_info = { .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO };
729 VkFenceCreateInfo fence_info = {
730 .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
731 .flags = VK_FENCE_CREATE_SIGNALED_BIT,
Referenced by R_Init_RTX().
◆ create_shader_module_from_file()
static VkShaderModule create_shader_module_from_file |
( |
const char * |
name, |
|
|
const char * |
enum_name |
|
) |
| |
|
static |
Definition at line 1121 of file main.c.
1127 for(len = 0; path[len]; len++)
1128 path[len] = tolower(path[len]);
1130 if(path[len] ==
'_') {
1140 size = FS_LoadFile(path, &data);
1142 Com_EPrintf(
"Couldn't find shader module %s!\n", path);
1143 return VK_NULL_HANDLE;
1146 VkShaderModule module;
1148 VkShaderModuleCreateInfo create_info = {
1149 .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
1151 .pCode = (uint32_t *) data,
1154 _VK(vkCreateShaderModule(
qvk.
device, &create_info, NULL, &module));
◆ create_swapchain()
VkResult create_swapchain |
( |
| ) |
|
Definition at line 529 of file main.c.
532 VkSurfaceCapabilitiesKHR surf_capabilities;
535 uint32_t num_formats = 0;
537 VkSurfaceFormatKHR *avail_surface_formats = alloca(
sizeof(VkSurfaceFormatKHR) * num_formats);
546 VkFormat acceptable_formats[] = {
547 VK_FORMAT_R8G8B8A8_SRGB, VK_FORMAT_B8G8R8A8_SRGB,
552 for(
int i = 0; i <
LENGTH(acceptable_formats); i++) {
553 for(
int j = 0; j < num_formats; j++)
554 if(acceptable_formats[i] == avail_surface_formats[j].format) {
561 uint32_t num_present_modes = 0;
563 VkPresentModeKHR *avail_present_modes = alloca(
sizeof(VkPresentModeKHR) * num_present_modes);
565 qboolean immediate_mode_available = qfalse;
567 for (
int i = 0; i < num_present_modes; i++) {
568 if (avail_present_modes[i] == VK_PRESENT_MODE_IMMEDIATE_KHR) {
569 immediate_mode_available = qtrue;
576 }
else if (immediate_mode_available) {
582 if(surf_capabilities.currentExtent.width != ~0u) {
593 uint32_t num_images = 2;
595 if(surf_capabilities.maxImageCount > 0)
596 num_images =
MIN(num_images, surf_capabilities.maxImageCount);
598 VkSwapchainCreateInfoKHR swpch_create_info = {
599 .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
601 .minImageCount = num_images,
605 .imageArrayLayers = 1,
606 .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
607 | VK_IMAGE_USAGE_TRANSFER_SRC_BIT
608 | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
609 .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
610 .queueFamilyIndexCount = 0,
611 .pQueueFamilyIndices = NULL,
612 .preTransform = surf_capabilities.currentTransform,
613 .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
617 .oldSwapchain = VK_NULL_HANDLE,
621 Com_EPrintf(
"error creating swapchain\n");
632 VkImageViewCreateInfo img_create_info = {
633 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
635 .viewType = VK_IMAGE_VIEW_TYPE_2D,
639 VK_COMPONENT_SWIZZLE_R,
640 VK_COMPONENT_SWIZZLE_G,
641 VK_COMPONENT_SWIZZLE_B,
642 VK_COMPONENT_SWIZZLE_A
645 .subresourceRange = {
646 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
655 Com_EPrintf(
"error creating image view!");
666 .subresourceRange = {
667 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
675 .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
676 .newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
Referenced by R_Init_RTX(), and recreate_swapchain().
◆ debug_output()
void debug_output |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
Definition at line 3487 of file main.c.
3492 va_start(args, format);
3493 vsnprintf(buffer,
sizeof(buffer), format, args);
3497 OutputDebugStringA(buffer);
3499 fprintf(stderr,
"%s", buffer);
Referenced by vk_debug_callback().
◆ destroy_swapchain()
VkResult destroy_swapchain |
( |
| ) |
|
◆ destroy_vulkan()
◆ draw_shadowed_string()
static void draw_shadowed_string |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
flags, |
|
|
size_t |
maxlen, |
|
|
const char * |
s |
|
) |
| |
|
static |
◆ drs_init()
◆ drs_maxscale_changed()
static void drs_maxscale_changed |
( |
cvar_t * |
self | ) |
|
|
static |
◆ drs_minscale_changed()
static void drs_minscale_changed |
( |
cvar_t * |
self | ) |
|
|
static |
◆ drs_process()
static void drs_process |
( |
| ) |
|
|
static |
Definition at line 2583 of file main.c.
2585 #define SCALING_FRAMES 5
2586 static int num_valid_frames = 0;
2591 num_valid_frames = 0;
2598 num_valid_frames = 0;
2607 if (ms < 0 || ms > 1000)
2610 valid_frame_times[num_valid_frames] = ms;
2616 num_valid_frames = 0;
2620 double representative_time = 0;
2622 representative_time += valid_frame_times[i];
2626 double f =
cvar_drs_gain->value * (1.0 - representative_time / target_time) - 1.0;
2629 if (representative_time < target_time * cvar_drs_adjust_up->value)
Referenced by R_BeginFrame_RTX().
◆ drs_target_changed()
static void drs_target_changed |
( |
cvar_t * |
self | ) |
|
|
static |
◆ evaluate_reference_mode()
Definition at line 1928 of file main.c.
1934 const int num_warmup_frames = 5;
1946 char text[MAX_QPATH];
1947 float percentage = powf(max(0.f, (
num_accumulated_frames - num_warmup_frames) / (
float)num_frames_to_accumulate), 0.5f);
1948 Q_snprintf(text,
sizeof(text),
"Photo mode: accumulating samples... %d%%", (
int)(min(1.f, percentage) * 100.f));
1950 int frames_after_accumulation_finished =
num_accumulated_frames - num_warmup_frames - num_frames_to_accumulate;
1951 float hud_alpha = max(0.f, min(1.f, (50 - frames_after_accumulation_finished) * 0.02f));
1990 if (cvar_pt_num_bounce_rays->value == 0.5f)
1993 ref_mode->
num_bounce_rays = max(0, min(2, round(cvar_pt_num_bounce_rays->value)));
Referenced by R_RenderFrame_RTX().
◆ extents_equal()
static qboolean extents_equal |
( |
VkExtent2D |
a, |
|
|
VkExtent2D |
b |
|
) |
| |
|
inlinestatic |
◆ fill_model_instance()
static uint32_t fill_model_instance |
( |
const entity_t * |
entity, |
|
|
const model_t * |
model, |
|
|
const maliasmesh_t * |
mesh, |
|
|
const float * |
transform, |
|
|
int |
model_instance_index, |
|
|
qboolean |
is_viewer_weapon, |
|
|
qboolean |
is_double_sided |
|
) |
| |
|
inlinestatic |
Definition at line 1283 of file main.c.
1290 Com_EPrintf(
"Cannot find material for model '%s'\n", model->name);
1294 int material_id = material->
flags;
1302 if (model->model_class == MCLASS_EXPLOSION)
1308 if (is_viewer_weapon)
1311 if (is_double_sided)
1316 if (entity->flags & RF_SHELL_RED)
1318 if (entity->flags & RF_SHELL_GREEN)
1320 if (entity->flags & RF_SHELL_BLUE)
1326 int frame = entity->frame;
1327 int oldframe = entity->oldframe;
1328 if (frame >= model->numframes) frame = 0;
1329 if (oldframe >= model->numframes) oldframe = 0;
1331 memcpy(instance->
M, transform,
sizeof(
float) * 16);
1334 instance->
backlerp = entity->backlerp;
1336 instance->
alpha = (entity->flags & RF_TRANSLUCENT) ? entity->alpha : 1.0f;
Referenced by process_regular_entity().
◆ get_accumulation_rendering_framenum()
static int get_accumulation_rendering_framenum |
( |
| ) |
|
|
static |
◆ get_mesh_material()
◆ get_render_extent()
static VkExtent2D get_render_extent |
( |
| ) |
|
|
static |
◆ get_screen_image_extent()
static VkExtent2D get_screen_image_extent |
( |
| ) |
|
|
static |
◆ get_vk_extension_list()
void get_vk_extension_list |
( |
const char * |
layer, |
|
|
uint32_t * |
num_extensions, |
|
|
VkExtensionProperties ** |
ext |
|
) |
| |
Definition at line 434 of file main.c.
439 _VK(vkEnumerateInstanceExtensionProperties(layer, num_extensions, NULL));
440 *
ext = malloc(
sizeof(**
ext) * *num_extensions);
441 _VK(vkEnumerateInstanceExtensionProperties(layer, num_extensions, *
ext));
Referenced by init_vulkan().
◆ get_vk_layer_list()
void get_vk_layer_list |
( |
uint32_t * |
num_layers, |
|
|
VkLayerProperties ** |
ext |
|
) |
| |
Definition at line 445 of file main.c.
449 _VK(vkEnumerateInstanceLayerProperties(num_layers, NULL));
450 *
ext = malloc(
sizeof(**
ext) * *num_layers);
451 _VK(vkEnumerateInstanceLayerProperties(num_layers, *
ext));
Referenced by init_vulkan().
◆ IMG_ReadPixels_RTX()
byte* IMG_ReadPixels_RTX |
( |
int * |
width, |
|
|
int * |
height, |
|
|
int * |
rowbytes |
|
) |
| |
Definition at line 3028 of file main.c.
3033 Com_EPrintf(
"IMG_ReadPixels: unsupported swap chain format (%d)!\n",
qvk.
surf_format.format);
3041 VkImageSubresourceRange subresource_range = {
3042 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
3045 .baseArrayLayer = 0,
3050 .image = swap_chain_image,
3051 .subresourceRange = subresource_range,
3053 .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
3054 .oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
3055 .newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
3060 .subresourceRange = subresource_range,
3061 .srcAccessMask = VK_ACCESS_HOST_READ_BIT,
3062 .dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
3063 .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
3064 .newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
3067 VkImageCopy img_copy_region = {
3068 .srcSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 },
3069 .dstSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 },
3073 vkCmdCopyImage(cmd_buf,
3074 swap_chain_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
3076 1, &img_copy_region);
3079 .image = swap_chain_image,
3080 .subresourceRange = subresource_range,
3081 .srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
3083 .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
3084 .newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
3089 .subresourceRange = subresource_range,
3090 .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
3091 .dstAccessMask = VK_ACCESS_HOST_READ_BIT,
3092 .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
3093 .newLayout = VK_IMAGE_LAYOUT_GENERAL
3099 VkImageSubresource subresource = {
3100 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
3105 VkSubresourceLayout subresource_layout;
3116 byte* src_row = (
byte*)device_data + subresource_layout.rowPitch * row;
3123 dst_row[0] = src_row[2];
3124 dst_row[1] = src_row[1];
3125 dst_row[2] = src_row[0];
3135 dst_row[0] = src_row[0];
3136 dst_row[1] = src_row[1];
3137 dst_row[2] = src_row[2];
Referenced by R_RegisterFunctionsRTX().
◆ init_vulkan()
Definition at line 745 of file main.c.
747 Com_Printf(
"----- init_vulkan -----\n");
751 Com_Printf(
"Available Vulkan layers: \n");
754 Com_Printf(
" %s%s\n",
qvk.
layers[i].layerName, requested ?
" (requested)" :
"");
760 Com_EPrintf(
"Couldn't get SDL2 Vulkan extension count\n");
766 Com_EPrintf(
"Couldn't get SDL2 Vulkan extensions\n");
770 Com_Printf(
"Vulkan instance extensions required by SDL2: \n");
776 char **
ext = alloca(
sizeof(
char *) * num_inst_ext_combined);
781 Com_Printf(
"Supported Vulkan instance extensions: \n");
784 for(
int j = 0; j < num_inst_ext_combined; j++) {
790 Com_Printf(
" %s%s\n",
qvk.
extensions[i].extensionName, requested ?
" (requested)" :
"");
794 VkInstanceCreateInfo inst_create_info = {
795 .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
797 #ifdef VKPT_ENABLE_VALIDATION
798 .enabledLayerCount =
LENGTH(vk_requested_layers),
799 .ppEnabledLayerNames = vk_requested_layers,
801 .enabledExtensionCount = num_inst_ext_combined,
802 .ppEnabledExtensionNames = (
const char *
const*)
ext,
805 VkResult result = vkCreateInstance(&inst_create_info, NULL, &
qvk.
instance);
806 if (result != VK_SUCCESS)
812 #define _VK_INST_EXTENSION_DO(a) \
813 q##a = (PFN_##a) vkGetInstanceProcAddr(qvk.instance, #a); \
814 if (!q##a) { Com_EPrintf("warning: could not load instance function %s\n", #a); }
816 #undef _VK_INST_EXTENSION_DO
819 VkDebugUtilsMessengerCreateInfoEXT dbg_create_info = {
820 .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
822 VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT
823 | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
825 VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT
826 | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT,
835 Com_EPrintf(
"SDL2 could not create a surface!\n");
840 uint32_t num_devices = 0;
841 _VK(vkEnumeratePhysicalDevices(
qvk.
instance, &num_devices, NULL));
844 VkPhysicalDevice *devices = alloca(
sizeof(VkPhysicalDevice) *num_devices);
845 _VK(vkEnumeratePhysicalDevices(
qvk.
instance, &num_devices, devices));
847 #ifdef VKPT_DEVICE_GROUPS
848 uint32_t num_device_groups = 0;
850 if (cvar_sli->integer)
851 _VK(qvkEnumeratePhysicalDeviceGroupsKHR(
qvk.
instance, &num_device_groups, NULL));
853 VkDeviceGroupDeviceCreateInfoKHR device_group_create_info;
854 VkPhysicalDeviceGroupPropertiesKHR device_group_info;
856 if(num_device_groups > 0) {
858 num_device_groups = 1;
859 _VK(qvkEnumeratePhysicalDeviceGroupsKHR(
qvk.
instance, &num_device_groups, &device_group_info));
865 device_group_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR;
866 device_group_create_info.pNext = NULL;
867 device_group_create_info.physicalDeviceCount = device_group_info.physicalDeviceCount;
868 device_group_create_info.pPhysicalDevices = device_group_info.physicalDevices;
872 qvk.device_group_physical_devices[i] = device_group_create_info.pPhysicalDevices[i];
878 int picked_device = -1;
879 for(
int i = 0; i < num_devices; i++) {
880 VkPhysicalDeviceProperties dev_properties;
881 VkPhysicalDeviceFeatures dev_features;
882 vkGetPhysicalDeviceProperties(devices[i], &dev_properties);
883 vkGetPhysicalDeviceFeatures (devices[i], &dev_features);
885 Com_Printf(
"Physical device %d: %s\n", i, dev_properties.deviceName);
886 Com_Printf(
"Max number of allocations: %d\n", dev_properties.limits.maxMemoryAllocationCount);
888 vkEnumerateDeviceExtensionProperties(devices[i], NULL, &num_ext, NULL);
890 VkExtensionProperties *ext_properties = alloca(
sizeof(VkExtensionProperties) * num_ext);
891 vkEnumerateDeviceExtensionProperties(devices[i], NULL, &num_ext, ext_properties);
893 Com_Printf(
"Supported Vulkan device extensions:\n");
894 for(
int j = 0; j < num_ext; j++) {
895 Com_Printf(
" %s\n", ext_properties[j].extensionName);
896 if(!strcmp(ext_properties[j].extensionName, VK_NV_RAY_TRACING_EXTENSION_NAME)) {
897 if(picked_device < 0)
903 if(picked_device < 0) {
904 Com_Error(ERR_FATAL,
"No ray tracing capable GPU found.");
910 VkPhysicalDeviceProperties dev_properties;
911 vkGetPhysicalDeviceProperties(devices[picked_device], &dev_properties);
913 Com_Printf(
"Picked physical device %d: %s\n", picked_device, dev_properties.deviceName);
916 if (dev_properties.vendorID == 0x10de)
918 uint32_t driver_major = (dev_properties.driverVersion >> 22) & 0x3ff;
919 uint32_t driver_minor = (dev_properties.driverVersion >> 14) & 0xff;
921 Com_Printf(
"NVIDIA GPU detected. Driver version: %u.%02u\n", driver_major, driver_minor);
923 uint32_t required_major = 0;
924 uint32_t required_minor = 0;
928 if (driver_major < required_major || driver_major == required_major && driver_minor < required_minor)
930 Com_Error(ERR_FATAL,
"This game requires NVIDIA Graphics Driver version to be at least %u.%02u, while the installed version is %u.%02u.\nPlease update the NVIDIA Graphics Driver.",
931 required_major, required_minor, driver_major, driver_minor);
941 uint32_t num_queue_families = 0;
942 vkGetPhysicalDeviceQueueFamilyProperties(
qvk.
physical_device, &num_queue_families, NULL);
943 VkQueueFamilyProperties *queue_families = alloca(
sizeof(VkQueueFamilyProperties) * num_queue_families);
944 vkGetPhysicalDeviceQueueFamilyProperties(
qvk.
physical_device, &num_queue_families, queue_families);
952 for(
int i = 0; i < num_queue_families; i++) {
953 if(!queue_families[i].queueCount)
955 VkBool32 present_support = 0;
958 const int supports_graphics = queue_families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT;
959 const int supports_compute = queue_families[i].queueFlags & VK_QUEUE_COMPUTE_BIT;
960 const int supports_transfer = queue_families[i].queueFlags & VK_QUEUE_TRANSFER_BIT;
976 Com_Error(ERR_FATAL,
"Could not find a suitable Vulkan queue family!\n");
980 float queue_priorities = 1.0f;
981 int num_create_queues = 0;
982 VkDeviceQueueCreateInfo queue_create_info[3];
985 VkDeviceQueueCreateInfo q = {
986 .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
988 .pQueuePriorities = &queue_priorities,
992 queue_create_info[num_create_queues++] = q;
995 VkDeviceQueueCreateInfo q = {
996 .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
998 .pQueuePriorities = &queue_priorities,
1001 queue_create_info[num_create_queues++] = q;
1004 VkDeviceQueueCreateInfo q = {
1005 .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
1007 .pQueuePriorities = &queue_priorities,
1010 queue_create_info[num_create_queues++] = q;
1013 VkPhysicalDeviceDescriptorIndexingFeaturesEXT idx_features = {
1014 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT,
1015 .runtimeDescriptorArray = 1,
1016 .shaderSampledImageArrayNonUniformIndexing = 1,
1019 #ifdef VKPT_DEVICE_GROUPS
1021 Com_Printf(
"Enabling multi-GPU support\n");
1022 idx_features.pNext = &device_group_create_info;
1026 VkPhysicalDeviceFeatures2 device_features = {
1027 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR,
1028 .pNext = &idx_features,
1031 .robustBufferAccess = 1,
1032 .fullDrawIndexUint32 = 1,
1033 .imageCubeArray = 1,
1034 .independentBlend = 1,
1035 .geometryShader = 1,
1036 .tessellationShader = 1,
1037 .sampleRateShading = 0,
1040 .multiDrawIndirect = 1,
1041 .drawIndirectFirstInstance = 1,
1043 .depthBiasClamp = 1,
1044 .fillModeNonSolid = 0,
1050 .samplerAnisotropy = 1,
1051 .textureCompressionETC2 = 0,
1052 .textureCompressionASTC_LDR = 0,
1053 .textureCompressionBC = 0,
1054 .occlusionQueryPrecise = 0,
1055 .pipelineStatisticsQuery = 1,
1056 .vertexPipelineStoresAndAtomics = 1,
1057 .fragmentStoresAndAtomics = 1,
1058 .shaderTessellationAndGeometryPointSize = 1,
1059 .shaderImageGatherExtended = 1,
1060 .shaderStorageImageExtendedFormats = 1,
1061 .shaderStorageImageMultisample = 1,
1062 .shaderStorageImageReadWithoutFormat = 1,
1063 .shaderStorageImageWriteWithoutFormat = 1,
1064 .shaderUniformBufferArrayDynamicIndexing = 1,
1065 .shaderSampledImageArrayDynamicIndexing = 1,
1066 .shaderStorageBufferArrayDynamicIndexing = 1,
1067 .shaderStorageImageArrayDynamicIndexing = 1,
1068 .shaderClipDistance = 1,
1069 .shaderCullDistance = 1,
1073 .shaderResourceResidency = 1,
1074 .shaderResourceMinLod = 1,
1076 .sparseResidencyBuffer = 1,
1077 .sparseResidencyImage2D = 1,
1078 .sparseResidencyImage3D = 1,
1079 .sparseResidency2Samples = 1,
1080 .sparseResidency4Samples = 1,
1081 .sparseResidency8Samples = 1,
1082 .sparseResidency16Samples = 1,
1083 .sparseResidencyAliased = 1,
1084 .variableMultisampleRate = 0,
1085 .inheritedQueries = 1,
1088 VkDeviceCreateInfo dev_create_info = {
1089 .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
1090 .pNext = &device_features,
1091 .pQueueCreateInfos = queue_create_info,
1092 .queueCreateInfoCount = num_create_queues,
1099 if (result != VK_SUCCESS)
1109 #define _VK_EXTENSION_DO(a) \
1110 q##a = (PFN_##a) vkGetDeviceProcAddr(qvk.device, #a); \
1111 if(!q##a) { Com_EPrintf("warning: could not load function %s\n", #a); }
1113 #undef _VK_EXTENSION_DO
1115 Com_Printf(
"-----------------------\n");
Referenced by R_Init_RTX().
◆ is_accumulation_rendering_active()
static qboolean is_accumulation_rendering_active |
( |
| ) |
|
|
static |
◆ is_transparent_material()
static qboolean is_transparent_material |
( |
uint32_t |
material | ) |
|
|
inlinestatic |
◆ layer_requested()
int layer_requested |
( |
const char * |
name | ) |
|
Definition at line 455 of file main.c.
457 #ifdef VKPT_ENABLE_VALIDATION
458 for (
int i = 0; i <
LENGTH(vk_requested_layers); i++)
459 if(!strcmp(name, vk_requested_layers[i]))
Referenced by init_vulkan().
◆ prepare_camera()
static void prepare_camera |
( |
const vec3_t |
position, |
|
|
const vec3_t |
direction, |
|
|
mat4_t |
data |
|
) |
| |
|
static |
Definition at line 2017 of file main.c.
2020 VectorCopy(direction,
forward);
2024 VectorSet(
up, 0.f, 0.f, 1.f);
2026 VectorSet(
up, 0.f, 1.f, 0.f);
2033 float aspect = 1.75f;
2034 float tan_half_fov_x = 1.f;
2035 float tan_half_fov_y = tan_half_fov_x / aspect;
2037 VectorCopy(position, data + 0);
2038 VectorCopy(
forward, data + 4);
2039 VectorMA(data + 4, -tan_half_fov_x,
right, data + 4);
2040 VectorMA(data + 4, tan_half_fov_y,
up, data + 4);
2041 VectorScale(
right, 2.f * tan_half_fov_x, data + 8);
2042 VectorScale(
up, -2.f * tan_half_fov_y, data + 12);
Referenced by prepare_ubo().
◆ prepare_entities()
Definition at line 1607 of file main.c.
1613 memcpy(instance_buffer->bsp_mesh_instances_prev, instance_buffer->bsp_mesh_instances,
1614 sizeof(instance_buffer->bsp_mesh_instances_prev));
1615 memcpy(instance_buffer->model_instances_prev, instance_buffer->model_instances,
1616 sizeof(instance_buffer->model_instances_prev));
1618 memcpy(instance_buffer->bsp_cluster_id_prev, instance_buffer->bsp_cluster_id,
sizeof(instance_buffer->bsp_cluster_id));
1619 memcpy(instance_buffer->model_cluster_id_prev, instance_buffer->model_cluster_id,
sizeof(instance_buffer->model_cluster_id));
1621 static int transparent_model_indices[MAX_ENTITIES];
1622 static int viewer_model_indices[MAX_ENTITIES];
1623 static int viewer_weapon_indices[MAX_ENTITIES];
1624 static int explosion_indices[MAX_ENTITIES];
1625 int transparent_model_num = 0;
1626 int viewer_model_num = 0;
1627 int viewer_weapon_num = 0;
1628 int explosion_num = 0;
1630 int model_instance_idx = 0;
1631 int bsp_mesh_idx = 0;
1632 int num_instanced_vert = 0;
1633 int instance_idx = 0;
1641 if (entity->model & 0x80000000)
1645 transparent_model_indices[transparent_model_num++] = i;
1652 if (model == NULL || model->meshes == NULL)
1655 if (entity->flags & RF_VIEWERMODEL)
1656 viewer_model_indices[viewer_model_num++] = i;
1657 else if (first_person_model && entity->flags & RF_WEAPONMODEL)
1658 viewer_weapon_indices[viewer_weapon_num++] = i;
1659 else if (model->model_class == MCLASS_EXPLOSION || model->model_class == MCLASS_SMOKE)
1660 explosion_indices[explosion_num++] = i;
1663 qboolean contains_transparent = qfalse;
1666 if(contains_transparent)
1667 transparent_model_indices[transparent_model_num++] = i;
1674 const uint32_t transparent_model_base_vertex_num = num_instanced_vert;
1675 for (
int i = 0; i < transparent_model_num; i++)
1677 const entity_t* entity =
vkpt_refdef.
fd->entities + transparent_model_indices[i];
1679 if (entity->model & 0x80000000)
1693 const uint32_t viewer_model_base_vertex_num = num_instanced_vert;
1694 if (first_person_model)
1696 for (
int i = 0; i < viewer_model_num; i++)
1698 const entity_t* entity =
vkpt_refdef.
fd->entities + viewer_model_indices[i];
1709 const uint32_t viewer_weapon_base_vertex_num = num_instanced_vert;
1710 for (
int i = 0; i < viewer_weapon_num; i++)
1712 const entity_t* entity =
vkpt_refdef.
fd->entities + viewer_weapon_indices[i];
1716 if (entity->flags & RF_LEFTHAND)
1723 const uint32_t explosion_base_vertex_num = num_instanced_vert;
1724 for (
int i = 0; i < explosion_num; i++)
1726 const entity_t* entity =
vkpt_refdef.
fd->entities + explosion_indices[i];
1737 memset(instance_buffer->world_current_to_prev, ~0u,
sizeof(instance_buffer->world_current_to_prev));
1738 memset(instance_buffer->world_prev_to_current, ~0u,
sizeof(instance_buffer->world_prev_to_current));
1739 memset(instance_buffer->model_current_to_prev, ~0u,
sizeof(instance_buffer->model_current_to_prev));
1740 memset(instance_buffer->model_prev_to_current, ~0u,
sizeof(instance_buffer->model_prev_to_current));
1746 instance_buffer->world_current_to_prev[i] = j;
1747 instance_buffer->world_prev_to_current[j] = i;
1758 instance_buffer->model_current_to_prev[i] = j;
1759 instance_buffer->model_prev_to_current[j] = i;
Referenced by R_RenderFrame_RTX().
◆ prepare_sky_matrix()
static void prepare_sky_matrix |
( |
float |
time, |
|
|
vec3_t |
sky_matrix[3] |
|
) |
| |
|
static |
Definition at line 2002 of file main.c.
2010 VectorSet(sky_matrix[0], 1.f, 0.f, 0.f);
2011 VectorSet(sky_matrix[1], 0.f, 1.f, 0.f);
2012 VectorSet(sky_matrix[2], 0.f, 0.f, 1.f);
Referenced by R_RenderFrame_RTX().
◆ prepare_ubo()
static void prepare_ubo |
( |
refdef_t * |
fd, |
|
|
mleaf_t * |
viewleaf, |
|
|
const reference_mode_t * |
ref_mode, |
|
|
const vec3_t |
sky_matrix[3], |
|
|
qboolean |
render_world |
|
) |
| |
|
static |
Definition at line 2046 of file main.c.
2052 memcpy(ubo->V_prev, ubo->V,
sizeof(
float) * 16);
2053 memcpy(ubo->P_prev, ubo->P,
sizeof(
float) * 16);
2054 memcpy(ubo->invP_prev, ubo->invP,
sizeof(
float) * 16);
2055 ubo->cylindrical_hfov_prev = ubo->cylindrical_hfov;
2064 float viewport_proj[16] = {
2076 memcpy(ubo->V,
V,
sizeof(
float) * 16);
2077 memcpy(ubo->P,
P,
sizeof(
float) * 16);
2083 float rad_per_pixel = atanf(tanf(fd->fov_y * M_PI / 360.0f) / ((
float)
qvk.
extent_unscaled.height * 0.5f));
2088 ubo->cylindrical_hfov = 0.f;
2103 ubo->pt_swap_checkerboard = 0;
2107 int camera_cluster_contents = viewleaf ? viewleaf->contents : 0;
2109 if (camera_cluster_contents & CONTENTS_WATER)
2111 else if (camera_cluster_contents & CONTENTS_SLIME)
2113 else if (camera_cluster_contents & CONTENTS_LAVA)
2118 ubo->time = fd->time;
2122 #define UBO_CVAR_DO(name, default_value) ubo->name = cvar_##name->value;
2130 ubo->pt_fake_roughness_threshold = 1.f;
2141 ubo->pt_specular_anti_flicker = 0.f;
2142 ubo->pt_sun_bounce_range = 10000.f;
2143 ubo->pt_ndf_trim = 1.f;
2150 qboolean enable_dof = qtrue;
2154 case 0: enable_dof = qfalse;
break;
2157 default: enable_dof = qtrue;
break;
2163 enable_dof = qfalse;
2169 ubo->pt_aperture = 0.f;
2174 ubo->pt_aperture_type = roundf(ubo->pt_aperture_type);
2183 ubo->pt_direct_area_threshold = 10.f;
2185 ubo->pt_min_log_sky_luminance = exp2f(ubo->pt_min_log_sky_luminance);
2186 ubo->pt_max_log_sky_luminance = exp2f(ubo->pt_max_log_sky_luminance);
2188 memcpy(ubo->cam_pos, fd->vieworg,
sizeof(
float) * 3);
2193 ubo->flt_temporal_lf = 0;
2194 ubo->flt_temporal_hf = 0;
2195 ubo->flt_temporal_spec = 0;
2201 memset(ubo->environment_rotation_matrix, 0,
sizeof(ubo->environment_rotation_matrix));
2202 VectorCopy(sky_matrix[0], ubo->environment_rotation_matrix + 0);
2203 VectorCopy(sky_matrix[1], ubo->environment_rotation_matrix + 4);
2204 VectorCopy(sky_matrix[2], ubo->environment_rotation_matrix + 8);
2218 ubo->pt_cameras = 0;
Referenced by R_RenderFrame_RTX().
◆ process_bsp_entity()
static void process_bsp_entity |
( |
const entity_t * |
entity, |
|
|
int * |
bsp_mesh_idx, |
|
|
int * |
instance_idx, |
|
|
int * |
num_instanced_vert |
|
) |
| |
|
static |
Definition at line 1372 of file main.c.
1375 uint32_t* ubo_bsp_cluster_id = (uint32_t*)uniform_instance_buffer->bsp_cluster_id;
1376 uint32_t* ubo_bsp_prim_offset = (uint32_t*)uniform_instance_buffer->bsp_prim_offset;
1377 uint32_t* ubo_instance_buf_offset = (uint32_t*)uniform_instance_buffer->bsp_instance_buf_offset;
1378 uint32_t* ubo_instance_buf_size = (uint32_t*)uniform_instance_buffer->bsp_instance_buf_size;
1380 const int current_bsp_mesh_index = *bsp_mesh_idx;
1383 assert(!
"BSP entity count overflow");
1389 assert(!
"Total entity count overflow");
1395 float transform[16];
1397 BspMeshInstance* ubo_instance_info = uniform_instance_buffer->bsp_mesh_instances + current_bsp_mesh_index;
1398 memcpy(&ubo_instance_info->
M, transform,
sizeof(transform));
1399 ubo_instance_info->
frame = entity->frame;
1400 memset(ubo_instance_info->
padding, 0,
sizeof(ubo_instance_info->
padding));
1414 for (
int corner = 0; corner < 8; corner++)
1416 vec3_t corner_pt = {
1422 vec3_t corner_pt_world;
1431 ubo_bsp_cluster_id[current_bsp_mesh_index] = cluster;
1433 ubo_bsp_prim_offset[current_bsp_mesh_index] = model->
idx_offset / 3;
1435 const int mesh_vertex_num = model->
idx_count;
1437 ubo_instance_buf_offset[current_bsp_mesh_index] = *num_instanced_vert / 3;
1438 ubo_instance_buf_size[current_bsp_mesh_index] = mesh_vertex_num / 3;
1440 ((
int*)uniform_instance_buffer->model_indices)[*instance_idx] = ~current_bsp_mesh_index;
1442 *num_instanced_vert += mesh_vertex_num;
1448 assert(!
"Model light count overflow");
1469 VectorCopy(src_light->
color, dst_light->
color);
Referenced by prepare_entities().
◆ process_regular_entity()
static void process_regular_entity |
( |
const entity_t * |
entity, |
|
|
const model_t * |
model, |
|
|
qboolean |
is_viewer_weapon, |
|
|
qboolean |
is_double_sided, |
|
|
int * |
model_instance_idx, |
|
|
int * |
instance_idx, |
|
|
int * |
num_instanced_vert, |
|
|
int |
mesh_filter, |
|
|
qboolean * |
contains_transparent |
|
) |
| |
|
static |
Definition at line 1491 of file main.c.
1503 uint32_t* ubo_instance_buf_offset = (uint32_t*)uniform_instance_buffer->model_instance_buf_offset;
1504 uint32_t* ubo_instance_buf_size = (uint32_t*)uniform_instance_buffer->model_instance_buf_size;
1505 uint32_t* ubo_model_idx_offset = (uint32_t*)uniform_instance_buffer->model_idx_offset;
1506 uint32_t* ubo_model_cluster_id = (uint32_t*)uniform_instance_buffer->model_cluster_id;
1508 float transform[16];
1511 int current_model_instance_index = *model_instance_idx;
1512 int current_instance_index = *instance_idx;
1513 int current_num_instanced_vert = *num_instanced_vert;
1515 if (contains_transparent)
1516 *contains_transparent = qfalse;
1518 for (
int i = 0; i < model->nummeshes; i++)
1524 assert(!
"Model entity count overflow");
1530 assert(!
"Total entity count overflow");
1534 uint32_t material_id =
fill_model_instance(entity, model, mesh, transform, current_model_instance_index, is_viewer_weapon, is_double_sided);
1540 if(contains_transparent)
1541 *contains_transparent = qtrue;
1553 hash.
entity = entity->id;
1554 hash.
model = entity->model;
1559 uint32_t cluster_id = ~0u;
1562 ubo_model_cluster_id[current_model_instance_index] = cluster_id;
1564 ubo_model_idx_offset[current_model_instance_index] = mesh->
idx_offset;
1566 ubo_instance_buf_offset[current_model_instance_index] = current_num_instanced_vert / 3;
1567 ubo_instance_buf_size[current_model_instance_index] = mesh->
numtris;
1569 ((
int*)uniform_instance_buffer->model_indices)[current_instance_index] = current_model_instance_index;
1571 current_model_instance_index++;
1572 current_instance_index++;
1573 current_num_instanced_vert += mesh->
numtris * 3;
1577 if (model->model_class == MCLASS_STATIC_LIGHT)
1579 vec4_t begin, end,
color;
1580 vec4_t offset1 = { 0.f, 0.5f, -10.f, 1.f };
1581 vec4_t offset2 = { 0.f, 0.5f, 10.f, 1.f };
1585 VectorSet(
color, 0.25f, 0.5f, 0.07f);
1590 *model_instance_idx = current_model_instance_index;
1591 *instance_idx = current_instance_index;
1592 *num_instanced_vert = current_num_instanced_vert;
Referenced by prepare_entities().
◆ process_render_feedback()
static void process_render_feedback |
( |
ref_feedback_t * |
feedback, |
|
|
mleaf_t * |
viewleaf, |
|
|
qboolean * |
sun_visible, |
|
|
float * |
adapted_luminance |
|
) |
| |
|
static |
Definition at line 1853 of file main.c.
1856 feedback->viewcluster = viewleaf->cluster;
1858 feedback->viewcluster = -1;
1861 static char const * unknown =
"<unknown>";
1862 char const * view_material = unknown;
1863 char const * view_material_override = unknown;
1875 view_material = image->name;
1876 view_material_override = image->filepath;
1880 strcpy(feedback->view_material, view_material);
1881 strcpy(feedback->view_material_override, view_material_override);
1883 feedback->lookatcluster = readback.
cluster;
1884 feedback->num_light_polys = 0;
1889 feedback->num_light_polys = light_offsets[1] - light_offsets[0];
1892 VectorCopy(readback.
hdr_color, feedback->hdr_color);
Referenced by R_RenderFrame_RTX().
◆ qvk_get_current_desc_set_textures()
VkDescriptorSet qvk_get_current_desc_set_textures |
( |
| ) |
|
Definition at line 1847 of file main.c.
Referenced by setup_rt_pipeline(), vkpt_asvgf_create_gradient_samples(), vkpt_asvgf_filter(), vkpt_bloom_record_cmd_buffer(), vkpt_compositing(), vkpt_draw_submit_stretch_pics(), vkpt_final_blit_filtered(), vkpt_interleave(), vkpt_physical_sky_record_cmd_buffer(), vkpt_record_god_rays_filter_command_buffer(), vkpt_record_god_rays_trace_command_buffer(), vkpt_taa(), vkpt_textures_update_descriptor_set(), and vkpt_tone_mapping_record_cmd_buffer().
◆ qvkCreateDebugUtilsMessengerEXT()
VkResult qvkCreateDebugUtilsMessengerEXT |
( |
VkInstance |
instance, |
|
|
const VkDebugUtilsMessengerCreateInfoEXT * |
pCreateInfo, |
|
|
const VkAllocationCallbacks * |
pAllocator, |
|
|
VkDebugUtilsMessengerEXT * |
pCallback |
|
) |
| |
Definition at line 500 of file main.c.
506 PFN_vkCreateDebugUtilsMessengerEXT func = (PFN_vkCreateDebugUtilsMessengerEXT)
507 vkGetInstanceProcAddr(instance,
"vkCreateDebugUtilsMessengerEXT");
509 return func(instance, pCreateInfo, pAllocator, pCallback);
510 return VK_ERROR_EXTENSION_NOT_PRESENT;
Referenced by init_vulkan().
◆ qvkDestroyDebugUtilsMessengerEXT()
VkResult qvkDestroyDebugUtilsMessengerEXT |
( |
VkInstance |
instance, |
|
|
VkDebugUtilsMessengerEXT |
callback, |
|
|
const VkAllocationCallbacks * |
pAllocator |
|
) |
| |
Definition at line 514 of file main.c.
519 PFN_vkDestroyDebugUtilsMessengerEXT func = (PFN_vkDestroyDebugUtilsMessengerEXT)
520 vkGetInstanceProcAddr(instance,
"vkDestroyDebugUtilsMessengerEXT");
522 func(instance, callback, pAllocator);
525 return VK_ERROR_EXTENSION_NOT_PRESENT;
Referenced by destroy_vulkan().
◆ R_AddDecal_RTX()
void R_AddDecal_RTX |
( |
decal_t * |
d | ) |
|
◆ R_BeginFrame_RTX()
Definition at line 2647 of file main.c.
2655 if (res_fence == VK_ERROR_DEVICE_LOST)
2658 Com_EPrintf(
"Device lost!\n");
2680 #ifdef VKPT_DEVICE_GROUPS
2681 VkAcquireNextImageInfoKHR acquire_info = {
2682 .sType = VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR,
2684 .timeout = (~((uint64_t) 0)),
2686 .fence = VK_NULL_HANDLE,
2695 if(res_swapchain == VK_ERROR_OUT_OF_DATE_KHR || res_swapchain == VK_SUBOPTIMAL_KHR) {
2699 else if(res_swapchain != VK_SUCCESS) {
Referenced by R_RegisterFunctionsRTX().
◆ R_BeginRegistration_RTX()
void R_BeginRegistration_RTX |
( |
const char * |
name | ) |
|
Definition at line 3227 of file main.c.
3231 Com_Printf(
"loading %s\n", name);
3247 char bsp_path[MAX_QPATH];
3248 Q_concat(bsp_path,
sizeof(bsp_path),
"maps/", name,
".bsp", NULL);
3250 qerror_t ret =
BSP_Load(bsp_path, &bsp);
3281 m->world_transparent_count,
3283 m->world_custom_sky_count));
Referenced by R_RegisterFunctionsRTX().
◆ R_EndFrame_RTX()
Definition at line 2739 of file main.c.
2750 VkExtent2D extent_render_double;
2766 VkPipelineStageFlags wait_stages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
2767 uint32_t wait_device_indices[] = { 0 };
2774 signal_device_indices[gpu] = gpu;
2781 LENGTH(wait_semaphores), wait_semaphores, wait_stages, wait_device_indices,
2786 #ifdef VKPT_IMAGE_DUMPS
2787 if (cvar_dump_image->integer) {
2790 VkImageSubresource subresource = {
2791 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
2796 VkSubresourceLayout subresource_layout;
2797 vkGetImageSubresourceLayout(
qvk.
device,
qvk.dump_image, &subresource, &subresource_layout);
2800 _VK(vkMapMemory(
qvk.
device,
qvk.dump_image_memory, 0,
qvk.dump_image_memory_size, 0, &data));
2808 VkPresentInfoKHR present_info = {
2809 .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
2811 .pWaitSemaphores = signal_semaphores,
2812 .swapchainCount = 1,
2818 #ifdef VKPT_DEVICE_GROUPS
2819 uint32_t present_device_mask = 1;
2820 VkDeviceGroupPresentInfoKHR group_present_info = {
2821 .sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR,
2822 .swapchainCount = 1,
2823 .pDeviceMasks = &present_device_mask,
2824 .mode = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR,
2828 present_info.pNext = &group_present_info;
2833 if(res_present == VK_ERROR_OUT_OF_DATE_KHR || res_present == VK_SUBOPTIMAL_KHR) {
Referenced by R_RegisterFunctionsRTX().
◆ R_EndRegistration_RTX()
◆ R_Init_RTX()
qboolean R_Init_RTX |
( |
qboolean |
total | ) |
|
Definition at line 2870 of file main.c.
2875 Com_Error(ERR_FATAL,
"VID_Init failed\n");
2879 extern SDL_Window *sdl_window;
2907 #ifdef VKPT_DEVICE_GROUPS
2908 cvar_sli =
Cvar_Get(
"sli",
"1", CVAR_REFRESH | CVAR_ARCHIVE);
2911 #ifdef VKPT_IMAGE_DUMPS
2912 cvar_dump_image =
Cvar_Get(
"dump_image",
"0", 0);
2928 Com_Error(ERR_FATAL,
"Couldn't initialize the material system.\n");
2931 #define UBO_CVAR_DO(name, default_value) cvar_##name = Cvar_Get(#name, #default_value, 0);
2933 #undef UBO_CVAR_LIST
2949 cvar_pt_num_bounce_rays->flags |= CVAR_ARCHIVE;
2959 Com_Error(ERR_FATAL,
"Couldn't initialize Vulkan.\n");
2980 #if CL_RTX_SHADERBALLS
2981 Cmd_AddCommand(
"drop_balls", (xcommand_t)&vkpt_drop_shaderballs);
2984 for (
int i = 0; i < 256; i++) {
2985 qvk.
sintab[i] = sinf(i * (2 * M_PI / 255));
Referenced by R_RegisterFunctionsRTX().
◆ R_ModeChanged_RTX()
◆ R_RegisterFunctionsRTX()
void R_RegisterFunctionsRTX |
( |
| ) |
|
◆ R_RenderFrame_RTX()
void R_RenderFrame_RTX |
( |
refdef_t * |
fd | ) |
|
Definition at line 2227 of file main.c.
2230 qboolean render_world = (fd->rdflags & RDF_NOWORLDMODEL) == 0;
2232 static float previous_time = -1.f;
2233 float frame_time = min(1.f, max(0.f, fd->time - previous_time));
2234 previous_time = fd->time;
2238 static unsigned previous_wallclock_time = 0;
2240 float frame_wallclock_time = (previous_wallclock_time != 0) ? (
float)(current_wallclock_time - previous_wallclock_time) * 1e-3f : 0.f;
2241 previous_wallclock_time = current_wallclock_time;
2253 qboolean sun_visible_prev = qfalse;
2254 static float prev_adapted_luminance = 0.f;
2255 float adapted_luminance = 0.f;
2260 if (adapted_luminance != 1.0f)
2261 prev_adapted_luminance = adapted_luminance;
2263 if (prev_adapted_luminance <= 0.f)
2264 prev_adapted_luminance = 0.005f;
2270 vec3_t sky_matrix[3];
2285 qboolean menu_mode = cl_paused->integer == 1 &&
uis.
menuDepth > 0 && render_world;
2296 prepare_ubo(fd, viewleaf, &ref_mode, sky_matrix, render_world);
2297 ubo->prev_adapted_luminance = prev_adapted_luminance;
2302 vec3_t sky_radiance;
2306 float shadowmap_view_proj[16];
2307 float shadowmap_depth_scale;
2312 shadowmap_view_proj,
2313 &shadowmap_depth_scale,
2321 shadowmap_view_proj,
2322 shadowmap_depth_scale);
2345 device_indices[gpu] = gpu;
2349 wait_stages[gpu] = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
2356 (*prev_trace_signaled) ?
qvk.
device_count : 0, prev_trace_semaphores, wait_stages, device_indices,
2360 *prev_trace_signaled = qfalse;
2366 update_transparency(trace_cmd_buf, ubo->V, fd->particles, fd->num_particles, fd->entities, fd->num_entities);
2381 int new_world_anim_frame = (
int)(fd->time * 2);
2382 qboolean update_world_animations = (new_world_anim_frame !=
world_anim_frame);
2402 if (god_rays_enabled)
2426 if (god_rays_enabled)
2440 if (god_rays_enabled)
2474 *curr_trace_signaled = qtrue;
2502 #ifdef VKPT_IMAGE_DUMPS
2503 if (cvar_dump_image->integer)
2505 copy_to_dump_texture(post_cmd_buf, VKPT_IMG_TAA_OUTPUT);
2510 if (cvar_tm_enable->integer != 0)
Referenced by R_RegisterFunctionsRTX().
◆ R_SetSky_RTX()
void R_SetSky_RTX |
( |
const char * |
name, |
|
|
float |
rotate, |
|
|
vec3_t |
axis |
|
) |
| |
Definition at line 3154 of file main.c.
3157 char pathname[MAX_QPATH];
3159 const char *suf[6] = {
"ft",
"bk",
"up",
"dn",
"rt",
"lf" };
3166 int avg_color[3] = { 0 };
3168 for (i = 0; i < 6; i++) {
3169 Q_concat(pathname,
sizeof(pathname),
"env/", name, suf[i],
".tga", NULL);
3173 if(img == R_NOTEXTURE) {
3177 data = Z_Malloc(6 *
sizeof(uint32_t));
3178 for(
int j = 0; j < 6; j++)
3179 ((uint32_t *)data)[j] = 0xff00ffffu;
3180 w_prev = h_prev = 1;
3184 size_t s = img->upload_width * img->upload_height * 4;
3186 data = Z_Malloc(s * 6);
3187 w_prev = img->upload_width;
3188 h_prev = img->upload_height;
3191 memcpy(data + s * i, img->pix_data, s);
3193 for (
int p = 0; p < img->upload_width * img->upload_height; p++)
3195 uint32_t pix = *((uint32_t*)img->pix_data + p);
3196 avg_color[0] += pix & 0xff;
3197 avg_color[1] += (pix >> 8) & 0xff;
3198 avg_color[2] += (pix >> 16) & 0xff;
3201 assert(w_prev == img->upload_width);
3202 assert(h_prev == img->upload_height);
3204 List_Remove(&img->entry);
3208 memset(img, 0,
sizeof(*img));
3211 float inv_num_pixels = 1.0f / (w_prev * h_prev * 6);
3214 (
float)avg_color[0] * inv_num_pixels / 255.f,
3215 (
float)avg_color[1] * inv_num_pixels / 255.f,
3216 (
float)avg_color[2] * inv_num_pixels / 255.f
Referenced by R_RegisterFunctionsRTX().
◆ R_Shutdown_RTX()
void R_Shutdown_RTX |
( |
qboolean |
total | ) |
|
◆ recreate_swapchain()
static void recreate_swapchain |
( |
| ) |
|
|
static |
◆ temporal_cvar_changed()
static void temporal_cvar_changed |
( |
cvar_t * |
self | ) |
|
|
static |
◆ transform_point()
static void transform_point |
( |
const float * |
p, |
|
|
const float * |
matrix, |
|
|
float * |
result |
|
) |
| |
|
inlinestatic |
Definition at line 1364 of file main.c.
1366 vec4_t point = { p[0], p[1], p[2], 1.f };
1369 VectorCopy(transformed, result);
Referenced by process_bsp_entity().
◆ viewsize_changed()
static void viewsize_changed |
( |
cvar_t * |
self | ) |
|
|
static |
◆ vk_debug_callback()
static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debug_callback |
( |
VkDebugUtilsMessageSeverityFlagBitsEXT |
severity, |
|
|
VkDebugUtilsMessageTypeFlagsEXT |
type, |
|
|
const VkDebugUtilsMessengerCallbackDataEXT * |
callback_data, |
|
|
void * |
user_data |
|
) |
| |
|
static |
Definition at line 466 of file main.c.
472 Com_EPrintf(
"validation layer %i %i: %s\n", (int32_t)type, (int32_t)severity, callback_data->pMessage);
473 debug_output(
"Vulkan error: %s\n", callback_data->pMessage);
475 if (callback_data->cmdBufLabelCount)
478 for (uint32_t i = 0; i < callback_data->cmdBufLabelCount; ++i)
480 VkDebugUtilsLabelEXT* label = &callback_data->pCmdBufLabels[i];
481 Com_EPrintf(
"%s ~ ", label->pLabelName);
486 if (callback_data->objectCount)
488 for (uint32_t i = 0; i < callback_data->objectCount; ++i)
490 VkDebugUtilsObjectNameInfoEXT* obj = &callback_data->pObjects[i];
491 Com_EPrintf(
"--- %s %i\n", obj->pObjectName, (int32_t)obj->objectType);
Referenced by init_vulkan().
◆ vkpt_begin_command_buffer()
Definition at line 3301 of file main.c.
3306 VkCommandBuffer* new_buffers = Z_Mallocz(new_count *
MAX_FRAMES_IN_FLIGHT *
sizeof(VkCommandBuffer));
3315 VkCommandBufferAllocateInfo cmd_buf_alloc_info = {
3316 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
3318 .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
3336 Z_Free(group->buffer_begin_addrs);
3337 group->buffer_begin_addrs = new_addrs;
3347 VkCommandBufferBeginInfo begin_info = {
3348 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
3349 .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
3350 .pInheritanceInfo = NULL,
3352 _VK(vkResetCommandBuffer(cmd_buf, 0));
3353 _VK(vkBeginCommandBuffer(cmd_buf, &begin_info));
3359 #if (defined __GNUC__)
3360 *begin_addr = __builtin_return_address(0);
3361 #elif (defined _MSC_VER)
3362 *begin_addr = _ReturnAddress();
Referenced by change_image_layouts(), create_invalid_texture(), create_swapchain(), fill_index_buffer(), FillVertexAndIndexBuffers(), IMG_ReadPixels_RTX(), load_blue_noise(), R_BeginFrame_RTX(), R_EndFrame_RTX(), R_RenderFrame_RTX(), UploadImage(), vkpt_create_images(), vkpt_pt_create_static(), vkpt_shadow_map_initialize(), vkpt_textures_end_registration(), vkpt_textures_upload_envmap(), and vkpt_vertex_buffer_upload_staging().
◆ vkpt_destroy_all()
◆ vkpt_destroy_shader_modules()
VkResult vkpt_destroy_shader_modules |
( |
| ) |
|
Definition at line 1180 of file main.c.
1182 #define SHADER_MODULE_DO(a) \
1183 vkDestroyShaderModule(qvk.device, qvk.shader_modules[a], NULL); \
1184 qvk.shader_modules[a] = VK_NULL_HANDLE;
1188 #undef SHADER_MODULE_DO
Referenced by R_Shutdown_RTX(), and vkpt_reload_shader().
◆ vkpt_free_command_buffers()
◆ vkpt_initialize_all()
◆ vkpt_load_shader_modules()
VkResult vkpt_load_shader_modules |
( |
| ) |
|
Definition at line 1162 of file main.c.
1164 VkResult ret = VK_SUCCESS;
1165 #define SHADER_MODULE_DO(a) do { \
1166 qvk.shader_modules[a] = create_shader_module_from_file(shader_module_file_names[a], #a); \
1167 ret = (ret == VK_SUCCESS && qvk.shader_modules[a]) ? VK_SUCCESS : VK_ERROR_INITIALIZATION_FAILED; \
1168 if(qvk.shader_modules[a]) { \
1169 ATTACH_LABEL_VARIABLE_NAME((uint64_t)qvk.shader_modules[a], SHADER_MODULE, #a); \
1175 #undef SHADER_MODULE_DO
Referenced by R_Init_RTX(), and vkpt_reload_shader().
◆ vkpt_print_material()
void vkpt_print_material |
( |
| ) |
|
Definition at line 356 of file main.c.
361 Com_EPrintf(
"Cannot find material '%s' in table\n");
Referenced by R_Init_RTX().
◆ vkpt_reload_materials()
void vkpt_reload_materials |
( |
| ) |
|
◆ vkpt_reload_shader()
void vkpt_reload_shader |
( |
| ) |
|
Definition at line 291 of file main.c.
295 FILE *f = _popen(
"compile_shaders.bat",
"r");
297 FILE *f = popen(
"make -j compile_shaders",
"r");
300 while(fgets(buf,
sizeof buf, f)) {
301 Com_Printf(
"%s", buf);
Referenced by R_Init_RTX().
◆ vkpt_reload_textures()
void vkpt_reload_textures |
( |
| ) |
|
◆ vkpt_reset_accumulation()
void vkpt_reset_accumulation |
( |
| ) |
|
◆ vkpt_reset_command_buffers()
◆ vkpt_save_materials()
void vkpt_save_materials |
( |
| ) |
|
◆ vkpt_set_material()
void vkpt_set_material |
( |
| ) |
|
Definition at line 340 of file main.c.
345 Com_EPrintf(
"Cannot find material '%s' in table\n");
Referenced by R_Init_RTX().
◆ vkpt_show_pvs()
◆ vkpt_submit_command_buffer()
void vkpt_submit_command_buffer |
( |
VkCommandBuffer |
cmd_buf, |
|
|
VkQueue |
queue, |
|
|
uint32_t |
execute_device_mask, |
|
|
int |
wait_semaphore_count, |
|
|
VkSemaphore * |
wait_semaphores, |
|
|
VkPipelineStageFlags * |
wait_stages, |
|
|
uint32_t * |
wait_device_indices, |
|
|
int |
signal_semaphore_count, |
|
|
VkSemaphore * |
signal_semaphores, |
|
|
uint32_t * |
signal_device_indices, |
|
|
VkFence |
fence |
|
) |
| |
Definition at line 3411 of file main.c.
3424 _VK(vkEndCommandBuffer(cmd_buf));
3426 VkSubmitInfo submit_info = {
3427 .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
3428 .waitSemaphoreCount = wait_semaphore_count,
3429 .pWaitSemaphores = wait_semaphores,
3430 .pWaitDstStageMask = wait_stages,
3431 .signalSemaphoreCount = signal_semaphore_count,
3432 .pSignalSemaphores = signal_semaphores,
3433 .commandBufferCount = 1,
3434 .pCommandBuffers = &cmd_buf,
3437 #ifdef VKPT_DEVICE_GROUPS
3438 VkDeviceGroupSubmitInfoKHR device_group_submit_info = {
3439 .sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR,
3441 .waitSemaphoreCount = wait_semaphore_count,
3442 .pWaitSemaphoreDeviceIndices = wait_device_indices,
3443 .commandBufferCount = 1,
3444 .pCommandBufferDeviceMasks = &execute_device_mask,
3445 .signalSemaphoreCount = signal_semaphore_count,
3446 .pSignalSemaphoreDeviceIndices = signal_device_indices,
3450 submit_info.pNext = &device_group_submit_info;
3454 _VK(vkQueueSubmit(queue, 1, &submit_info, fence));
3458 for (
int ngroup = 0; ngroup <
LENGTH(groups); ngroup++)
3463 if (group->
buffers[i] == cmd_buf)
3465 group->buffer_begin_addrs[i] = NULL;
Referenced by R_EndFrame_RTX(), R_RenderFrame_RTX(), vkpt_submit_command_buffer_simple(), and vkpt_vertex_buffer_upload_staging().
◆ vkpt_submit_command_buffer_simple()
void vkpt_submit_command_buffer_simple |
( |
VkCommandBuffer |
cmd_buf, |
|
|
VkQueue |
queue, |
|
|
qboolean |
all_gpus |
|
) |
| |
Definition at line 3473 of file main.c.
3478 vkpt_submit_command_buffer(cmd_buf, queue, all_gpus ? (1 <<
qvk.
device_count) - 1 : 1, 0, NULL, NULL, NULL, 0, NULL, NULL, 0);
Referenced by change_image_layouts(), create_invalid_texture(), create_swapchain(), fill_index_buffer(), FillVertexAndIndexBuffers(), IMG_ReadPixels_RTX(), load_blue_noise(), R_BeginFrame_RTX(), R_RenderFrame_RTX(), UploadImage(), vkpt_create_images(), vkpt_pt_create_static(), vkpt_shadow_map_initialize(), vkpt_textures_end_registration(), and vkpt_textures_upload_envmap().
◆ vkpt_wait_idle()
◆ avg_envmap_color
vec3_t avg_envmap_color = { 0.f } |
|
static |
◆ bsp_world_model
◆ cluster_debug_index
◆ cluster_debug_mask
char cluster_debug_mask[VIS_MAX_BYTES] |
◆ cvar_bloom_enable
cvar_t* cvar_bloom_enable |
◆ cvar_drs_adjust_down
cvar_t* cvar_drs_adjust_down = NULL |
◆ cvar_drs_adjust_up
cvar_t* cvar_drs_adjust_up = NULL |
◆ cvar_drs_enable
cvar_t* cvar_drs_enable = NULL |
◆ cvar_drs_gain
cvar_t* cvar_drs_gain = NULL |
◆ cvar_drs_maxscale
cvar_t* cvar_drs_maxscale = NULL |
◆ cvar_drs_minscale
cvar_t* cvar_drs_minscale = NULL |
◆ cvar_drs_target
cvar_t* cvar_drs_target = NULL |
◆ cvar_min_driver_version
cvar_t* cvar_min_driver_version = NULL |
◆ cvar_profiler
cvar_t* cvar_profiler = NULL |
◆ cvar_pt_accumulation_rendering
cvar_t* cvar_pt_accumulation_rendering = NULL |
◆ cvar_pt_accumulation_rendering_framenum
cvar_t* cvar_pt_accumulation_rendering_framenum = NULL |
◆ cvar_pt_caustics
cvar_t* cvar_pt_caustics = NULL |
◆ cvar_pt_dof
cvar_t* cvar_pt_dof = NULL |
◆ cvar_pt_enable_nodraw
cvar_t* cvar_pt_enable_nodraw = NULL |
◆ cvar_pt_freecam
cvar_t* cvar_pt_freecam = NULL |
◆ cvar_pt_projection
cvar_t* cvar_pt_projection = NULL |
◆ cvar_vsync
cvar_t* cvar_vsync = NULL |
◆ drs_current_scale
int drs_current_scale = 0 |
|
static |
◆ drs_effective_scale
int drs_effective_scale = 0 |
|
static |
◆ entity_frame_num
◆ frame_ready
qboolean frame_ready = qfalse |
|
static |
◆ model_entity_id_count
int model_entity_id_count[2] |
|
static |
◆ model_entity_ids
int model_entity_ids[2][MAX_ENTITIES] |
|
static |
◆ model_lights
◆ num_accumulated_frames
int num_accumulated_frames = 0 |
◆ num_model_lights
◆ qvk
Initial value:= {
.win_width = 1920,
.win_height = 1080,
.frame_counter = 0,
}
Definition at line 377 of file main.c.
Referenced by allocate_and_bind_memory_to_blas(), allocate_and_bind_memory_to_buffers(), allocate_gpu_memory(), append_blas(), buffer_create(), buffer_destroy(), buffer_map(), buffer_unmap(), calculate_scratch_buffer_size(), change_image_layouts(), compute_push_constants(), create_blas(), create_buffer_views(), create_buffers(), create_command_pool_and_fences(), create_descriptor_set(), create_image_views(), create_invalid_texture(), create_pipeline_layout(), create_pipelines(), create_readback_image(), create_render_pass(), create_shader_module_from_file(), create_sub_allocator(), create_swapchain(), CreateShadowMap(), destroy_invalid_texture(), destroy_readback_image(), destroy_swapchain(), destroy_tex_images(), destroy_transparency(), destroy_vulkan(), destroyEnvTexture(), draw_profiler(), fill_index_buffer(), FillVertexAndIndexBuffers(), get_memory_type(), get_render_extent(), get_scratch_buffer_size(), get_screen_image_extent(), IMG_ReadPixels_RTX(), IMG_ReloadAll(), IMG_Unload_RTX(), init_vulkan(), initializeEnvTexture(), load_blue_noise(), prepare_ubo(), qvk_get_current_desc_set_textures(), R_BeginFrame_RTX(), R_BeginRegistration_RTX(), R_EndFrame_RTX(), R_Init_RTX(), R_ModeChanged_RTX(), R_RenderFrame_RTX(), R_Shutdown_RTX(), recreate_swapchain(), ReleaseInfo(), ReleaseShadowmap(), reset_sun_color_buffer(), set_current_gpu(), setup_rt_pipeline(), textures_destroy_unused_set(), update_descriptor_set(), UploadImage(), vkpt_asvgf_create_gradient_samples(), vkpt_asvgf_create_pipelines(), vkpt_asvgf_destroy(), vkpt_asvgf_destroy_pipelines(), vkpt_asvgf_filter(), vkpt_asvgf_initialize(), vkpt_begin_command_buffer(), vkpt_bloom_create_pipelines(), vkpt_bloom_destroy(), vkpt_bloom_destroy_pipelines(), vkpt_bloom_initialize(), vkpt_bloom_record_cmd_buffer(), vkpt_compositing(), vkpt_create_images(), vkpt_destroy_all(), vkpt_destroy_god_rays(), vkpt_destroy_images(), vkpt_draw_create_pipelines(), vkpt_draw_destroy(), vkpt_draw_destroy_pipelines(), vkpt_draw_get_extent(), vkpt_draw_initialize(), vkpt_draw_submit_stretch_pics(), vkpt_evaluate_sun_light(), vkpt_final_blit_filtered(), vkpt_final_blit_simple(), vkpt_free_command_buffers(), vkpt_god_rays_destroy_pipelines(), vkpt_image_copy(), vkpt_initialize_all(), vkpt_initialize_god_rays(), vkpt_interleave(), vkpt_light_buffer_upload_staging(), vkpt_light_buffer_upload_to_staging(), vkpt_light_stats_create(), vkpt_light_stats_destroy(), vkpt_physical_sky_create_pipelines(), vkpt_physical_sky_destroy(), vkpt_physical_sky_destroy_pipelines(), vkpt_physical_sky_initialize(), vkpt_physical_sky_record_cmd_buffer(), vkpt_profiler_destroy(), vkpt_profiler_initialize(), vkpt_profiler_next_frame(), vkpt_profiler_query(), vkpt_pt_create_accel_bottom(), vkpt_pt_create_all_dynamic(), vkpt_pt_create_pipelines(), vkpt_pt_create_static(), vkpt_pt_create_toplevel(), vkpt_pt_destroy(), vkpt_pt_destroy_dynamic(), vkpt_pt_destroy_explosions(), vkpt_pt_destroy_pipelines(), vkpt_pt_destroy_static(), vkpt_pt_destroy_toplevel(), vkpt_pt_destroy_transparent_models(), vkpt_pt_destroy_viewer_models(), vkpt_pt_destroy_viewer_weapon(), vkpt_pt_init(), vkpt_pt_trace_lighting(), vkpt_pt_trace_primary_rays(), vkpt_pt_trace_reflections(), vkpt_pt_update_descripter_set_bindings(), vkpt_readback(), vkpt_record_god_rays_filter_command_buffer(), vkpt_record_god_rays_trace_command_buffer(), vkpt_reset_command_buffers(), vkpt_shadow_map_create_pipelines(), vkpt_shadow_map_destroy(), vkpt_shadow_map_destroy_pipelines(), vkpt_shadow_map_initialize(), vkpt_shadow_map_render(), vkpt_submit_command_buffer(), vkpt_submit_command_buffer_simple(), vkpt_taa(), vkpt_textures_destroy(), vkpt_textures_destroy_unused(), vkpt_textures_end_registration(), vkpt_textures_initialize(), vkpt_textures_update_descriptor_set(), vkpt_textures_upload_envmap(), vkpt_tone_mapping_create_pipelines(), vkpt_tone_mapping_destroy(), vkpt_tone_mapping_destroy_pipelines(), vkpt_tone_mapping_initialize(), vkpt_tone_mapping_record_cmd_buffer(), vkpt_tone_mapping_reset(), vkpt_uniform_buffer_create(), vkpt_uniform_buffer_destroy(), vkpt_uniform_buffer_update(), vkpt_uniform_precomputed_buffer_create(), vkpt_uniform_precomputed_buffer_destroy(), vkpt_uniform_precomputed_buffer_update(), vkpt_vertex_buffer_create(), vkpt_vertex_buffer_create_instance(), vkpt_vertex_buffer_create_pipelines(), vkpt_vertex_buffer_destroy(), vkpt_vertex_buffer_destroy_pipelines(), vkpt_vertex_buffer_upload_bsp_mesh_to_staging(), vkpt_vertex_buffer_upload_models_to_staging(), and vkpt_vertex_buffer_upload_staging().
◆ register_model_dirty
◆ registration_sequence
int registration_sequence |
◆ scr_viewsize
◆ shader_module_file_names
◆ sky_axis
vec3_t sky_axis = { 0.f } |
|
static |
◆ sky_rotation
◆ temporal_frame_valid
qboolean temporal_frame_valid = qfalse |
|
static |
◆ uis
Definition at line 24 of file ui.c.
Referenced by Action_Draw(), Bitmap_Draw(), Change(), ColorForStatus(), Draw(), DrawStatus(), Field_Draw(), Keybind_Draw(), M_Menu_Demos(), M_Menu_PlayerConfig(), M_Menu_Servers(), Menu_Draw(), Menu_DrawStatus(), Menu_Init(), Menu_Size(), MenuList_Click(), MenuList_Draw(), MenuList_Key(), MenuList_MouseMove(), Parse_Color(), Parse_File(), PlayerModel_Free(), PlayerModel_Load(), Pop(), Push(), R_RenderFrame_RTX(), ReloadMedia(), RunFrame(), Size(), SizeCompact(), SizeFull(), Slider_Click(), Slider_Draw(), Slider_MouseMove(), SpinControl_Draw(), UI_CharEvent(), UI_CursorInRect(), UI_DoHitTest(), UI_Draw(), UI_DrawChar(), UI_DrawString(), UI_ForceMenuOff(), UI_Init(), UI_IsTransparent(), UI_KeyEvent(), UI_MouseEvent(), UI_OpenMenu(), UI_PopMenu(), UI_PopMenu_f(), UI_PushMenu(), UI_Resize(), UI_Shutdown(), and UpdateSelection().
◆ vk_app_info
const VkApplicationInfo vk_app_info |
|
static |
Initial value:= {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pApplicationName = "quake 2 pathtracing",
.applicationVersion = VK_MAKE_VERSION(1, 0, 0),
.pEngineName = "vkpt",
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
.apiVersion = VK_API_VERSION_1_1,
}
Definition at line 419 of file main.c.
Referenced by init_vulkan().
◆ vk_requested_device_extensions
const char* vk_requested_device_extensions[] |
Initial value:= {
VK_NV_RAY_TRACING_EXTENSION_NAME,
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME,
VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME,
}
Definition at line 405 of file main.c.
Referenced by init_vulkan().
◆ vk_requested_instance_extensions
Initial value:= {
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
}
Definition at line 397 of file main.c.
Referenced by init_vulkan().
◆ vkpt_initialization
◆ vkpt_refdef
Initial value:= {
.z_near = 1.0f,
.z_far = 4096.0f,
}
Definition at line 372 of file main.c.
Referenced by copy_light(), fill_model_instance(), prepare_entities(), prepare_ubo(), process_bsp_entity(), process_regular_entity(), process_render_feedback(), R_BeginFrame_RTX(), R_BeginRegistration_RTX(), R_RenderFrame_RTX(), vkpt_freecam_update(), vkpt_light_buffer_upload_to_staging(), vkpt_print_material(), vkpt_set_material(), vkpt_show_pvs(), vkpt_uniform_buffer_update(), vkpt_vertex_buffer_create_instance(), write_beam_geometry(), write_particle_geometry(), and write_sprite_geometry().
◆ water_normal_texture
image_t* water_normal_texture = NULL |
|
static |
◆ world_anim_frame
◆ world_entity_id_count
int world_entity_id_count[2] |
|
static |
◆ world_entity_ids
int world_entity_ids[2][MAX_ENTITIES] |
|
static |
void R_LightPoint_RTX(vec3_t origin, vec3_t light)
#define MESH_FILTER_TRANSPARENT
VkResult vkpt_destroy_shader_modules()
#define MATERIAL_KIND_TRANSPARENT
void draw_profiler(int enable_asvgf)
byte * IMG_ReadPixels(int *width, int *height, int *rowbytes)
void(* R_TileClear)(int x, int y, int w, int h, qhandle_t pic)
#define MATERIAL_FLAG_SHELL_GREEN
VkResult vkpt_readback(ReadbackBuffer *dst)
void(* MOD_Reference)(model_t *model)
void(* R_EndRegistration)(void)
VkResult vkpt_draw_destroy()
cvar_t * Cvar_Set(const char *var_name, const char *value)
VkResult vkpt_textures_destroy()
void vkpt_shadow_map_setup(const sun_light_t *light, const float *bbox_min, const float *bbox_max, float *VP, float *depth_scale, qboolean random_sampling)
void R_SetClipRect_RTX(const clipRect_t *clip)
void(* R_SetColor)(uint32_t color)
void IMG_GetPalette(void)
qboolean(* R_InterceptKey)(unsigned key, qboolean down)
cvar_t * cvar_drs_adjust_down
VkResult vkpt_draw_destroy_pipelines()
static void evaluate_reference_mode(reference_mode_t *ref_mode)
#define SHADER_PATH_TEMPLATE
static void prepare_sky_matrix(float time, vec3_t sky_matrix[3])
VkResult vkpt_final_blit_filtered(VkCommandBuffer cmd_buf)
void bsp_mesh_register_textures(bsp_t *bsp)
VkResult vkpt_textures_end_registration()
uint32_t num_swap_chain_images
void Com_AddConfigFile(const char *name, unsigned flags)
#define _VK_EXTENSION_LIST
#define MAX_FRAMES_IN_FLIGHT
void(* R_SetSky)(const char *name, float rotate, vec3_t axis)
qerror_t MAT_SavePBRMaterials()
void(* R_SetAlpha)(float clpha)
VkResult vkpt_light_stats_create(bsp_mesh_t *bsp_mesh)
void IMG_Load_RTX(image_t *image, byte *pic)
size_t Q_snprintf(char *dest, size_t size, const char *fmt,...)
VkResult vkpt_pt_destroy_pipelines()
VkResult vkpt_vertex_buffer_create_pipelines()
VkResult vkpt_god_rays_destroy_pipelines()
void MAT_PrintMaterialProperties(pbr_material_t const *mat)
VkResult vkpt_taa(VkCommandBuffer cmd_buf)
void R_BeginFrame_RTX(void)
VkResult vkpt_vertex_buffer_create()
int num_accumulated_frames
VkResult vkpt_final_blit_simple(VkCommandBuffer cmd_buf)
static int drs_effective_scale
VkResult vkpt_vertex_buffer_destroy_pipelines()
static const VkApplicationInfo vk_app_info
uint32_t viewer_model_vertex_num
static qboolean is_accumulation_rendering_active()
model_t * MOD_ForHandle(qhandle_t h)
static void drs_process()
void Cmd_AddCommand(const char *name, xcommand_t function)
void debug_output(const char *format,...)
static VkExtent2D get_render_extent()
void(* IMG_Load)(image_t *image, byte *pic)
static qboolean temporal_frame_valid
cvar_t * cvar_pt_caustics
uint32_t dynamic_vertex_num
vkpt_refdef_t vkpt_refdef
qboolean weapon_left_handed
qerror_t MOD_LoadMD3_RTX(model_t *model, const void *rawdata, size_t length)
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
const char * vk_requested_device_extensions[]
static float sky_rotation
const char * Q_ErrorString(qerror_t error)
light_poly_t * light_polys
byte * BSP_ClusterVis(bsp_t *bsp, byte *mask, int cluster, int vis)
void R_EndFrame_RTX(void)
cmd_buf_group_t cmd_buffers_transfer
void vkpt_free_command_buffers(cmd_buf_group_t *group)
void vkpt_save_materials()
VkResult vkpt_asvgf_destroy()
void(* R_ClearColor)(void)
VkResult vkpt_profiler_next_frame(VkCommandBuffer cmd_buf)
cvar_t * cvar_pt_projection
void(* R_LightPoint)(vec3_t origin, vec3_t light)
cvar_t * cvar_drs_adjust_up
qboolean R_Init_RTX(qboolean total)
BufferResource_t buf_vertex
VkExtensionProperties * extensions
#define MATERIAL_KIND_CHROME_MODEL
void R_SetColor_RTX(uint32_t color)
void R_DrawFill8_RTX(int x, int y, int w, int h, int c)
struct pbr_material_s * material
qerror_t MAT_SetPBRMaterialAttribute(pbr_material_t *mat, char const *token, char const *value)
qboolean vkpt_build_cylinder_light(light_poly_t *light_list, int *num_lights, int max_lights, bsp_t *bsp, vec3_t begin, vec3_t end, vec3_t color, float radius)
static vec3_t avg_envmap_color
uint32_t current_frame_index
static const char * shader_module_file_names[NUM_QVK_SHADER_MODULES]
void R_RenderFrame_RTX(refdef_t *fd)
BufferResource_t buf_readback
void vkpt_textures_destroy_unused()
pbr_material_t * MAT_GetPBRMaterial(int index)
VkResult vkpt_create_images()
const char ** sdl2_extensions
VkResult vkpt_draw_submit_stretch_pics(VkCommandBuffer cmd_buf)
void(* R_DrawFill8)(int x, int y, int w, int h, int c)
void R_Shutdown(qboolean total)
VkFence fence_vertex_sync
void R_SetAlpha_RTX(float alpha)
#define MATERIAL_FLAG_LIGHT
int R_DrawString_RTX(int x, int y, int flags, size_t maxlen, const char *s, qhandle_t font)
void IMG_Unload_RTX(image_t *image)
VkResult vkpt_asvgf_create_pipelines()
VkResult vkpt_initialize_god_rays()
VkResult vkpt_pt_trace_reflections(VkCommandBuffer cmd_buf, int bounce)
void bsp_mesh_create_from_bsp(bsp_mesh_t *wm, bsp_t *bsp, const char *map_name)
VkResult vkpt_light_buffer_upload_staging(VkCommandBuffer cmd_buf)
static int world_anim_frame
cvar_t * cvar_pt_aperture
void vkpt_record_god_rays_trace_command_buffer(VkCommandBuffer command_buffer, int pass)
VkResult vkpt_initialize_all(VkptInitFlags_t init_flags)
VkResult vkpt_physical_sky_destroy_pipelines()
void R_SetScale_RTX(float scale)
const pbr_material_t * MAT_UpdatePBRMaterialSkin(image_t *image_diffuse)
void bsp_mesh_destroy(bsp_mesh_t *wm)
static VkExtent2D get_screen_image_extent()
cmd_buf_group_t cmd_buffers_graphics
VkResult vkpt_shadow_map_destroy_pipelines()
VkShaderModule shader_modules[NUM_QVK_SHADER_MODULES]
static void prepare_camera(const vec3_t position, const vec3_t direction, mat4_t data)
#define SHADER_MAX_BSP_ENTITIES
unsigned Sys_Milliseconds(void)
#define MATERIAL_FLAG_DOUBLE_SIDED
mleaf_t * BSP_PointLeaf(mnode_t *node, vec3_t p)
VkDebugUtilsMessengerEXT dbg_messenger
VkResult vkpt_tone_mapping_create_pipelines()
VkPhysicalDevice physical_device
qerror_t MAT_ReloadPBRMaterials()
#define END_PERF_MARKER(command_buffer, name)
VkResult vkpt_pt_create_pipelines()
#define MATERIAL_FLAG_WEAPON
cvar_t * cvar_pt_enable_nodraw
void vkpt_print_material()
qerror_t MAT_ResetUnused()
VkResult vkpt_compositing(VkCommandBuffer cmd_buf)
void vkpt_reload_shader()
void MOD_FreeUnused(void)
VkDescriptorSet desc_set_textures_even
#define SHADER_MAX_ENTITIES
void vkpt_build_beam_lights(light_poly_t *light_list, int *num_lights, int max_lights, bsp_t *bsp, entity_t *entities, int num_entites, float adapted_luminance)
VkResult vkpt_pt_update_descripter_set_bindings(int idx)
VkDeviceMemory screenshot_image_memory
void(* R_SetAlphaScale)(float alpha)
VkResult vkpt_bloom_initialize()
VkResult vkpt_asvgf_initialize()
void vkpt_next_sun_preset()
qhandle_t SCR_GetFont(void)
VkPhysicalDeviceMemoryProperties mem_properties
qboolean R_Init(qboolean total)
cvar_t * cvar_pt_reflect_refract
VkResult qvkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pCallback)
#define _VK_INST_EXTENSION_LIST
VkResult vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world, qboolean weapon_left_handed)
bsp_mesh_t bsp_mesh_world
VkResult vkpt_physical_sky_initialize()
static void prepare_ubo(refdef_t *fd, mleaf_t *viewleaf, const reference_mode_t *ref_mode, const vec3_t sky_matrix[3], qboolean render_world)
void vkpt_light_buffer_reset_counts()
#define MATERIAL_FLAG_SHELL_BLUE
void Com_Error(error_type_t type, const char *fmt,...)
void BSP_Free(bsp_t *bsp)
semaphore_group_t semaphores[MAX_FRAMES_IN_FLIGHT][VKPT_MAX_GPUS]
static void draw_shadowed_string(int x, int y, int flags, size_t maxlen, const char *s)
int32_t queue_idx_compute
void Cmd_RemoveCommand(const char *name)
VkResult vkpt_profiler_destroy()
VkResult vkpt_physical_sky_endRegistration()
int * cluster_light_offsets
int32_t queue_idx_graphics
VkExtent2D extent_screen_images
@ VKPT_INIT_SWAPCHAIN_RECREATE
VkResult vkpt_god_rays_update_images()
void R_TileClear_RTX(int x, int y, int w, int h, qhandle_t pic)
uint32_t current_swap_chain_image_index
qerror_t(* MOD_LoadMD2)(model_t *model, const void *rawdata, size_t length)
VkResult vkpt_tone_mapping_initialize()
void inverse(const float *m, float *inv)
int32_t queue_idx_transfer
lightstyle_t prev_lightstyles[MAX_LIGHTSTYLES]
static int model_entity_id_count[2]
static int world_entity_ids[2][MAX_ENTITIES]
VkResult vkpt_asvgf_destroy_pipelines()
VkResult vkpt_light_buffer_upload_to_staging(qboolean render_world, bsp_mesh_t *bsp_mesh, bsp_t *bsp, int num_model_lights, light_poly_t *transformed_model_lights, const float *sky_radiance)
struct pbr_material_s * materials[MAX_ALIAS_SKINS]
void create_entity_matrix(float matrix[16], entity_t *e, qboolean enable_left_hand)
char * va(const char *format,...)
void R_AddDecal_RTX(decal_t *d)
VkResult vkpt_bloom_create_pipelines()
@ VKPT_INIT_RELOAD_SHADER
void(* R_DrawPic)(int x, int y, qhandle_t pic)
void vkpt_evaluate_sun_light(sun_light_t *light, const vec3_t sky_matrix[3], float time)
VkSemaphore transfer_finished
double vkpt_get_profiler_result(int idx)
static const pbr_material_t * get_mesh_material(const entity_t *entity, const maliasmesh_t *mesh)
VkImage swap_chain_images[MAX_SWAPCHAIN_IMAGES]
void destroy_transparency()
void R_RenderFrame(refdef_t *fd)
#define CL_PLAYER_MODEL_FIRST_PERSON
VkSwapchainKHR swap_chain
VkResult vkpt_draw_create_pipelines()
VkCommandBuffer * buffers
static qboolean is_transparent_material(uint32_t material)
int(* R_DrawString)(int x, int y, int flags, size_t maxChars, const char *string, qhandle_t font)
void R_DrawStretchPic_RTX(int x, int y, int w, int h, qhandle_t pic)
clientinfo_t baseclientinfo
image_t r_images[MAX_RIMAGES]
VkResult vkpt_destroy_god_rays()
cvar_t * cvar_pt_accumulation_rendering_framenum
static uint32_t fill_model_instance(const entity_t *entity, const model_t *model, const maliasmesh_t *mesh, const float *transform, int model_instance_index, qboolean is_viewer_weapon, qboolean is_double_sided)
void vkpt_god_rays_prepare_ubo(QVKUniformBuffer_t *ubo, const aabb_t *world_aabb, const float *proj, const float *view, const float *shadowmap_viewproj, float shadowmap_depth_scale)
void vkpt_reload_textures()
void mult_matrix_vector(float *p, const float *a, const float *b)
VkResult vkpt_physical_sky_create_pipelines()
void UpdatePhysicalSkyCVars()
VkResult vkpt_physical_sky_beginRegistration()
void build_transparency_blas(VkCommandBuffer cmd_buf)
#define MATERIAL_KIND_CHROME
VkResult vkpt_god_rays_noop()
void R_BeginRegistration_RTX(const char *name)
qerror_t MOD_LoadMD2_RTX(model_t *model, const void *rawdata, size_t length)
void vkpt_reset_command_buffers(cmd_buf_group_t *group)
void vkpt_wait_idle(VkQueue queue, cmd_buf_group_t *group)
void SetupRotationMatrix(vec3_t matrix[3], const vec3_t dir, float degrees)
VkResult vkpt_shadow_map_initialize()
VkPresentModeKHR present_mode
VkCommandPool command_pool
qboolean R_InterceptKey_RTX(unsigned key, qboolean down)
void vkpt_record_god_rays_filter_command_buffer(VkCommandBuffer command_buffer)
#define MATERIAL_FLAG_SHELL_RED
void Cvar_SetInteger(cvar_t *var, int value, from_t from)
VkResult vkpt_load_shader_modules()
#define BEGIN_PERF_MARKER(command_buffer, name)
void R_AddDecal(decal_t *d)
VkResult vkpt_vertex_buffer_upload_bsp_mesh_to_staging(bsp_mesh_t *bsp_mesh)
static int get_accumulation_rendering_framenum()
qboolean MAT_IsKind(uint32_t material, uint32_t kind)
void(* R_DrawFill32)(int x, int y, int w, int h, uint32_t color)
VkResult vkpt_interleave(VkCommandBuffer cmd_buf)
VkResult qvkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT callback, const VkAllocationCallbacks *pAllocator)
float temporal_blend_factor
void vkpt_textures_prefetch()
void(* IMG_Unload)(image_t *image)
VkResult vkpt_pt_create_all_dynamic(VkCommandBuffer cmd_buf, int idx, VkBuffer vertex_buffer, const EntityUploadInfo *upload_info)
VkResult vkpt_pt_trace_lighting(VkCommandBuffer cmd_buf, float num_bounce_rays)
VkSemaphore render_finished
static void process_render_feedback(ref_feedback_t *feedback, mleaf_t *viewleaf, qboolean *sun_visible, float *adapted_luminance)
VkResult vkpt_vertex_buffer_create_instance(VkCommandBuffer cmd_buf, uint32_t num_instances, qboolean update_world_animations)
vec_t VectorNormalize2(vec3_t v, vec3_t out)
VkLayerProperties * layers
#define MATERIAL_KIND_EXPLOSION
VkResult vkpt_shadow_map_render(VkCommandBuffer cmd_buf, float *view_projection_matrix, int num_static_verts, int num_dynamic_verts, int transparent_offset, int num_transparent_verts)
static int entity_frame_num
qboolean vkpt_physical_sky_needs_update()
void SCR_SetHudAlpha(float alpha)
VkDescriptorSet desc_set_textures_odd
image_t * IMG_Find(const char *name, imagetype_t type, imageflags_t flags)
cmd_buf_group_t cmd_buffers_compute
cvar_t * cvar_pt_accumulation_rendering
VkResult vkpt_physical_sky_record_cmd_buffer(VkCommandBuffer cmd_buf)
uint32_t num_sdl2_extensions
static void drs_minscale_changed(cvar_t *self)
VkResult vkpt_tone_mapping_destroy()
VkDeviceSize screenshot_image_memory_size
VkResult vkpt_asvgf_create_gradient_samples(VkCommandBuffer cmd_buf, uint32_t frame_num, int do_gradient_samples)
uint32_t gpu_slice_width_prev
uint32_t world_transparent_count
VkResult vkpt_god_rays_create_pipelines()
static int num_model_lights
void InitialiseSkyCVars()
VkResult create_swapchain()
void R_ModeChanged(int width, int height, int flags, int rowbytes, void *pixels)
#define MATERIAL_KIND_SLIME
VkResult vkpt_draw_initialize()
void vkpt_submit_command_buffer_simple(VkCommandBuffer cmd_buf, VkQueue queue, qboolean all_gpus)
struct ReadbackBuffer ReadbackBuffer
int bsp_mesh_world_loaded
uint32_t wait_for_idle_frames
static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT type, const VkDebugUtilsMessengerCallbackDataEXT *callback_data, void *user_data)
const _VK_EXTENSION_LIST char * vk_requested_instance_extensions[]
VkResult vkpt_profiler_initialize()
int registration_sequence
VkResult vkpt_textures_upload_envmap(int w, int h, byte *data)
VkResult vkpt_pt_destroy_static()
VkResult vkpt_tone_mapping_record_cmd_buffer(VkCommandBuffer cmd_buf, float frame_time)
VkResult vkpt_bloom_record_cmd_buffer(VkCommandBuffer cmd_buf)
int Cvar_ClampInteger(cvar_t *var, int min, int max)
byte * IMG_ReadPixels_RTX(int *width, int *height, int *rowbytes)
static int world_entity_id_count[2]
#define MESH_FILTER_OPAQUE
qboolean initialize_transparency()
void(* R_BeginRegistration)(const char *map)
static qboolean extents_equal(VkExtent2D a, VkExtent2D b)
VkExtent2D extent_unscaled
void mult_matrix_matrix(float *p, const float *a, const float *b)
void R_DrawPic_RTX(int x, int y, qhandle_t pic)
static void process_regular_entity(const entity_t *entity, const model_t *model, qboolean is_viewer_weapon, qboolean is_double_sided, int *model_instance_idx, int *instance_idx, int *num_instanced_vert, int mesh_filter, qboolean *contains_transparent)
VkResult vkpt_bloom_destroy_pipelines()
void(* R_SetClipRect)(const clipRect_t *clip)
static void drs_target_changed(cvar_t *self)
static int compare_doubles(const void *pa, const void *pb)
void(* R_DrawStretchPic)(int x, int y, int w, int h, qhandle_t pic)
static void viewsize_changed(cvar_t *self)
uint32_t explosions_vertex_offset
VkResult vkpt_pt_create_static(VkBuffer vertex_buffer, size_t buffer_offset, int num_vertices, int num_vertices_transparent, int num_vertices_sky, int num_vertices_custom_sky)
uint32_t explosions_vertex_num
void vkpt_reload_materials()
void R_ModeChanged_RTX(int width, int height, int flags, int rowbytes, void *pixels)
void vkpt_tone_mapping_request_reset()
uint32_t transparent_model_vertex_num
QVKInstanceBuffer_t uniform_instance_buffer
void vkpt_textures_update_descriptor_set()
void R_DrawFill32_RTX(int x, int y, int w, int h, uint32_t color)
void(* R_SetScale)(float scale)
void MOD_Reference_RTX(model_t *model)
void R_Shutdown_RTX(qboolean total)
#define LIST_SHADER_MODULES
void create_projection_matrix(float matrix[16], float znear, float zfar, float fov_x, float fov_y)
static int drs_current_scale
VkResult vkpt_vertex_buffer_upload_staging()
VkResult create_command_pool_and_fences()
void get_vk_extension_list(const char *layer, uint32_t *num_extensions, VkExtensionProperties **ext)
static void add_dlights(const dlight_t *lights, int num_lights, QVKUniformBuffer_t *ubo)
VkResult vkpt_destroy_all(VkptInitFlags_t destroy_flags)
cvar_t * cvar_min_driver_version
VkFence fences_frame_sync[MAX_FRAMES_IN_FLIGHT]
VkResult destroy_swapchain()
static void vkpt_show_pvs(void)
void(* R_DrawChar)(int x, int y, int flags, int ch, qhandle_t font)
uint32_t viewer_weapon_vertex_num
void R_ClearColor_RTX(void)
int layer_requested(const char *name)
#define IMAGE_BARRIER(cmd_buf,...)
VkResult vkpt_tone_mapping_destroy_pipelines()
VkResult vkpt_vertex_buffer_upload_models_to_staging()
static void accumulation_cvar_changed(cvar_t *self)
void update_transparency(VkCommandBuffer command_buffer, const float *view_matrix, const particle_t *particles, int particle_num, const entity_t *entities, int entity_num)
qerror_t BSP_Load(const char *name, bsp_t **bsp_p)
VkResult vkpt_pt_trace_primary_rays(VkCommandBuffer cmd_buf)
image_t * IMG_ForHandle(qhandle_t h)
#define ATTACH_LABEL_VARIABLE(a, type)
VkCommandBuffer vkpt_begin_command_buffer(cmd_buf_group_t *group)
void IMG_FreeUnused(void)
void vkpt_freecam_reset()
size_t Q_concat(char *dest, size_t size,...)
uint32_t world_transparent_offset
static int model_entity_ids[2][MAX_ENTITIES]
cvar_t * cvar_drs_minscale
BufferResource_t buf_readback_staging[MAX_FRAMES_IN_FLIGHT]
cvar_t * cvar_drs_maxscale
qerror_t MAT_InitializePBRmaterials()
#define MATERIAL_KIND_INVISIBLE
cvar_t * cvar_bloom_enable
char cluster_debug_mask[VIS_MAX_BYTES]
static VkShaderModule create_shader_module_from_file(const char *name, const char *enum_name)
#define MATERIAL_INDEX_MASK
void vkpt_bloom_update(QVKUniformBuffer_t *ubo, float frame_time, qboolean under_water, qboolean menu_mode)
VkResult vkpt_textures_initialize()
VkResult vkpt_asvgf_filter(VkCommandBuffer cmd_buf, qboolean enable_lf)
void R_DrawChar_RTX(int x, int y, int flags, int c, qhandle_t font)
VkptInit_t vkpt_initialization[]
CONST PIXELFORMATDESCRIPTOR int
VkSurfaceFormatKHR surf_format
VkResult vkpt_destroy_images()
VkSemaphore image_available
#define MATERIAL_KIND_WATER
VkResult vkpt_draw_clear_stretch_pics()
qboolean vkpt_god_rays_enabled(const sun_light_t *sun_light)
VkSemaphore trace_finished
static UBO_CVAR_LIST bsp_t * bsp_world_model
void create_view_matrix(float matrix[16], refdef_t *fd)
VkImageView swap_chain_image_views[MAX_SWAPCHAIN_IMAGES]
VkResult vkpt_shadow_map_create_pipelines()
VkResult vkpt_vertex_buffer_destroy()
VkResult vkpt_profiler_query(VkCommandBuffer cmd_buf, int idx, VKPTProfilerAction action)
VkResult vkpt_bloom_destroy()
static void temporal_cvar_changed(cvar_t *self)
void R_EndRegistration_RTX(void)
VkResult vkpt_physical_sky_update_ubo(QVKUniformBuffer_t *ubo, const sun_light_t *light, qboolean render_world)
VkResult vkpt_shadow_map_destroy()
void vkpt_submit_command_buffer(VkCommandBuffer cmd_buf, VkQueue queue, uint32_t execute_device_mask, int wait_semaphore_count, VkSemaphore *wait_semaphores, VkPipelineStageFlags *wait_stages, uint32_t *wait_device_indices, int signal_semaphore_count, VkSemaphore *signal_semaphores, uint32_t *signal_device_indices, VkFence fence)
static light_poly_t model_lights[MAX_MODEL_LIGHTS]
VkResult vkpt_physical_sky_destroy()
const char * qvk_result_to_string(VkResult result)
uint32_t viewer_model_vertex_offset
VkResult vkpt_light_stats_destroy()
static void process_bsp_entity(const entity_t *entity, int *bsp_mesh_idx, int *instance_idx, int *num_instanced_vert)
VkExtent2D extent_render_prev
void vkpt_freecam_update(float frame_time)
VkResult vkpt_pt_destroy()
QVKUniformBuffer_t uniform_buffer
vec_t VectorNormalize(vec3_t v)
uint32_t MAT_SetKind(uint32_t material, uint32_t kind)
size_t FS_NormalizePath(char *out, const char *in)
uint32_t transparent_model_vertex_offset
pbr_material_t * MAT_FindPBRMaterial(char const *name)
#define MATERIAL_KIND_GLASS
#define MAX_SWAPCHAIN_IMAGES
static void transform_point(const float *p, const float *matrix, float *result)
struct bsp_mesh_s::@19 cameras[MAX_CAMERAS]
qboolean enable_accumulation
static image_t * water_normal_texture
void R_SetAlphaScale_RTX(float alpha)
void R_SetSky_RTX(const char *name, float rotate, vec3_t axis)
void vkpt_physical_sky_latch_local_time()
static void drs_maxscale_changed(cvar_t *self)
static qboolean frame_ready
static void recreate_swapchain()
int SCR_DrawStringEx(int x, int y, int flags, size_t maxlen, const char *s, qhandle_t font)
uint32_t viewer_weapon_vertex_offset
static void prepare_entities(EntityUploadInfo *upload_info)
void get_vk_layer_list(uint32_t *num_layers, VkLayerProperties **ext)