mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-04 16:31:30 +00:00
[vulkan] Add gpu profiling zones
This relies on my fork of tracy: https://github.com/taniwha/tracy on the wip-c-vulkan branch. Everything is still rather flaky though. This necessitated the jump to vulkan 1.2 as a requirement.
This commit is contained in:
parent
57282702ba
commit
fccd06c5bf
30 changed files with 195 additions and 48 deletions
|
@ -63,8 +63,10 @@ PTHREAD_CFLAGS=@PTHREAD_CFLAGS@
|
|||
|
||||
if HAVE_TRACY
|
||||
tracy_src=tracy/public/TracyClient.cpp
|
||||
tracyvk_src=tracy/public/client/TracyVkProfiler.cpp
|
||||
else
|
||||
tracy_src=
|
||||
tracyvk_src=
|
||||
endif
|
||||
|
||||
lib_ldflags=-version-info $(QUAKE_LIBRARY_VERSION_INFO) \
|
||||
|
|
|
@ -419,6 +419,9 @@ typedef struct qfv_renderframe_s {
|
|||
VkSemaphore imageAvailableSemaphore;
|
||||
VkSemaphore renderDoneSemaphore;
|
||||
qfv_cmdpoolmgr_t cmdpool;
|
||||
#ifdef TRACY_ENABLE
|
||||
qftVkCtx_t *qftVkCtx;
|
||||
#endif
|
||||
} qfv_renderframe_t;
|
||||
|
||||
typedef struct qfv_renderframeset_s
|
||||
|
@ -440,6 +443,7 @@ typedef struct qfv_renderctx_s {
|
|||
|
||||
typedef struct qfv_taskctx_s {
|
||||
struct vulkan_ctx_s *ctx;
|
||||
qfv_renderframe_t *frame;
|
||||
qfv_pipeline_t *pipeline;
|
||||
qfv_renderpass_t *renderpass;
|
||||
VkCommandBuffer cmd;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
// enable tracy
|
||||
#define TRACY_ENABLE
|
||||
#define TRACY_VK_USE_SYMBOL_TABLE
|
||||
#include "tracy/TracyC.h"
|
||||
|
||||
static inline void __qfZoneEnd (TracyCZoneCtx **ctxptr)
|
||||
|
@ -14,6 +15,8 @@ static inline void __qfZoneEnd (TracyCZoneCtx **ctxptr)
|
|||
TracyCZoneEnd (**ctxptr);
|
||||
}
|
||||
|
||||
#define qftVkCtx_t struct ___tracy_vkctx
|
||||
|
||||
#define qfConcatInternal(a,b) a##b
|
||||
#define qfConcat(a,b) qfConcatInternal(a, b)
|
||||
|
||||
|
@ -50,4 +53,6 @@ static inline void __qfZoneEnd (TracyCZoneCtx **ctxptr)
|
|||
#define qfZoneNamedN(varname, name, active)
|
||||
#define qfMessageL(msg)
|
||||
|
||||
#define qftVkCtx_t void
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,43 @@
|
|||
#include "QF/qtypes.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
#ifdef HAVE_TRACY
|
||||
#include "tracy/TracyCVulkan.h"
|
||||
|
||||
#define qftCVkContextHostCalibrated(instance, physdev, device, instanceProcAddr, deviceProcAddr) TracyCVkContextHostCalibrated(instance, physdev, device, instanceProcAddr, deviceProcAddr)
|
||||
#define qftCVkContextDestroy(ctx) TracyCVkDestroy( ctx )
|
||||
#define qftCVkContextName(ctx, name, size) TracyCVkContextName(ctx, name, size)
|
||||
#define qftCVkCollect(ctx, cmdbuf) TracyCVkCollect (ctx, cmdbuf)
|
||||
|
||||
static inline void __qftVkZoneEnd (___tracy_vkctx_scope ***zone)
|
||||
{
|
||||
TracyCVkZoneEnd (**zone);
|
||||
}
|
||||
|
||||
#define qftVkZone(ctx, cmdbuf, name) TracyCVkZone (ctx, cmdbuf, name)
|
||||
#define qftVkScopedZone(ctx, cmdbuf, name) \
|
||||
qftVkZone (ctx, cmdbuf, name) \
|
||||
__attribute__((cleanup(__qftVkZoneEnd))) \
|
||||
___tracy_vkctx_scope **qfConcat(__qfScoped##varname, __COUNTER__) = &___tracy_gpu_zone
|
||||
#define qftVkZoneC(ctx, cmdbuf, name, color) TracyCVkZone (ctx, cmdbuf, name, color)
|
||||
#define qftVkZoneEnd(varname) TracyCVkZoneEnd (varname)
|
||||
|
||||
#else
|
||||
|
||||
#define qftVkContext(instance, physdev, device, queue, cmdbuf, instanceProcAddr, deviceProcAddr)
|
||||
#define qftVkContextCalibrated(instance, physdev, device, queue, cmdbuf, instanceProcAddr, deviceProcAddr)
|
||||
#define qftCVkContextHostCalibrated(instance, physdev, device, instanceProcAddr, deviceProcAddr)
|
||||
#define qftCVkContextDestroy(ctx)
|
||||
#define qftCVkContextName(ctx, name, size)
|
||||
#define qftCVkContextCollect(ctx, cmdbuf)
|
||||
|
||||
#define qftVkZone(ctx, cmdbuf, name)
|
||||
#define qftVkScopedZone(ctx, cmdbuf, name)
|
||||
#define qftVkZoneC(ctx, cmdbuf, name, color)
|
||||
#define qftVkZoneEnd(varname)
|
||||
|
||||
#endif
|
||||
|
||||
#define VA_CTX_COUNT 64
|
||||
|
||||
typedef struct qfv_renderpassset_s
|
||||
|
|
|
@ -113,6 +113,7 @@ static vec4f_t beam_rolls[360];
|
|||
void
|
||||
CL_TEnts_Precache (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav");
|
||||
cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav");
|
||||
cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav");
|
||||
|
@ -558,6 +559,7 @@ static const TE_Effect nqEffects[256] = {
|
|||
void
|
||||
CL_ParseTEnt_nq (qmsg_t *net_message, double time, TEntContext_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
byte type = MSG_ReadByte (net_message);
|
||||
parse_tent (net_message, time, ctx, nqEffects[type]);
|
||||
}
|
||||
|
@ -680,6 +682,7 @@ CL_UpdateTEnts (double time, TEntContext_t *ctx)
|
|||
void
|
||||
CL_ParseParticleEffect (qmsg_t *net_message)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i, count, color;
|
||||
vec4f_t org = {0, 0, 0, 1}, dir = {};
|
||||
|
||||
|
|
|
@ -470,6 +470,7 @@ V_DriftPitch (viewstate_t *vs)
|
|||
void
|
||||
V_ParseDamage (qmsg_t *net_message, viewstate_t *vs)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
float count, side;
|
||||
int armor, blood;
|
||||
vec4f_t origin = vs->player_origin;
|
||||
|
|
|
@ -73,6 +73,7 @@ CL_World_Init (void)
|
|||
void
|
||||
CL_ParseBaseline (qmsg_t *msg, entity_state_t *baseline, int version)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int bits = 0;
|
||||
|
||||
if (version == 2)
|
||||
|
@ -107,6 +108,7 @@ CL_ParseBaseline (qmsg_t *msg, entity_state_t *baseline, int version)
|
|||
void
|
||||
CL_ParseStatic (qmsg_t *msg, int version)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
entity_t ent;
|
||||
entity_state_t es;
|
||||
|
||||
|
@ -240,6 +242,7 @@ CL_World_NewMap (const char *mapname, const char *skyname)
|
|||
void
|
||||
CL_World_Clear (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Scene_FreeAllEntities (cl_world.scene);
|
||||
CL_ClearTEnts ();
|
||||
}
|
||||
|
|
|
@ -174,6 +174,7 @@ mod_unload_model (size_t ind)
|
|||
VISIBLE void
|
||||
Mod_ClearAll (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < mod_numknown; i++) {
|
||||
|
@ -338,6 +339,7 @@ Mod_ForName (const char *name, bool crash)
|
|||
VISIBLE void
|
||||
Mod_TouchModel (const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
model_t *mod;
|
||||
|
||||
mod = Mod_FindName (name);
|
||||
|
|
|
@ -305,6 +305,7 @@ Scene_CreateEntity (scene_t *scene)
|
|||
void
|
||||
Scene_DestroyEntity (scene_t *scene, entity_t ent)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
ECS_DelEntity (scene->reg, ent.id);
|
||||
}
|
||||
|
||||
|
|
|
@ -497,6 +497,7 @@ SCR_Shutdown (void)
|
|||
void
|
||||
SCR_NewScene (scene_t *scene)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
scr_scene = scene;
|
||||
if (scene) {
|
||||
mod_brush_t *brush = &scr_scene->worldmodel->brush;
|
||||
|
|
|
@ -143,6 +143,7 @@ vulkan_R_Init (void)
|
|||
static void
|
||||
vulkan_R_ClearState (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_DeviceWaitIdle (vulkan_ctx->device);
|
||||
//FIXME clear scene correctly
|
||||
r_refdef.worldmodel = 0;
|
||||
|
@ -160,6 +161,7 @@ vulkan_R_LoadSkys (const char *skyname)
|
|||
static void
|
||||
vulkan_R_NewScene (scene_t *scene)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Vulkan_NewScene (scene, vulkan_ctx);
|
||||
}
|
||||
|
||||
|
|
|
@ -154,20 +154,29 @@ QFV_CreateDevice (vulkan_ctx_t *ctx, const char **extensions)
|
|||
.multiview = 1,
|
||||
.multiviewGeometryShader = 1,
|
||||
};
|
||||
VkPhysicalDeviceFeatures features = {
|
||||
.imageCubeArray = 1,
|
||||
.independentBlend = 1,
|
||||
.geometryShader = 1,
|
||||
.multiViewport = 1,
|
||||
.fragmentStoresAndAtomics = 1,
|
||||
.fillModeNonSolid = 1,
|
||||
VkPhysicalDeviceVulkan12Features features12 = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
|
||||
.pNext = &multiview_features,
|
||||
.hostQueryReset = 1,
|
||||
};
|
||||
VkPhysicalDeviceFeatures2 features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
|
||||
.pNext = &features12,
|
||||
.features = {
|
||||
.imageCubeArray = 1,
|
||||
.independentBlend = 1,
|
||||
.geometryShader = 1,
|
||||
.multiViewport = 1,
|
||||
.fragmentStoresAndAtomics = 1,
|
||||
.fillModeNonSolid = 1,
|
||||
},
|
||||
};
|
||||
VkDeviceCreateInfo dCreateInfo = {
|
||||
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, &multiview_features, 0,
|
||||
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, &features, 0,
|
||||
1, &qCreateInfo,
|
||||
nlay, lay,
|
||||
next, ext,
|
||||
&features
|
||||
0
|
||||
};
|
||||
qfv_device_t *device = calloc (1, sizeof (qfv_device_t)
|
||||
+ sizeof (qfv_devfuncs_t));
|
||||
|
@ -203,6 +212,7 @@ QFV_DestroyDevice (qfv_device_t *device)
|
|||
int
|
||||
QFV_DeviceWaitIdle (qfv_device_t *device)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
return dfunc->vkDeviceWaitIdle (device->dev) == VK_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ QFV_CreateInstance (vulkan_ctx_t *ctx,
|
|||
VK_STRUCTURE_TYPE_APPLICATION_INFO, 0,
|
||||
appName, appVersion,
|
||||
PACKAGE_STRING, 0x000702ff, //FIXME version
|
||||
VK_API_VERSION_1_1,
|
||||
VK_API_VERSION_1_2,
|
||||
};
|
||||
VkInstanceCreateInfo createInfo = {
|
||||
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, 0, 0,
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/dsmanager.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/pipeline.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
|
@ -141,9 +142,13 @@ run_subpass (qfv_subpass_t *sp, qfv_taskctx_t *taskctx)
|
|||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
dfunc->vkBeginCommandBuffer (taskctx->cmd, &sp->beginInfo);
|
||||
|
||||
for (uint32_t i = 0; i < sp->pipeline_count; i++) {
|
||||
__auto_type pipeline = &sp->pipelines[i];
|
||||
run_pipeline (pipeline, taskctx);
|
||||
{
|
||||
qftVkScopedZone (taskctx->frame->qftVkCtx, taskctx->cmd, "subpass");
|
||||
|
||||
for (uint32_t i = 0; i < sp->pipeline_count; i++) {
|
||||
__auto_type pipeline = &sp->pipelines[i];
|
||||
run_pipeline (pipeline, taskctx);
|
||||
}
|
||||
}
|
||||
|
||||
dfunc->vkEndCommandBuffer (taskctx->cmd);
|
||||
|
@ -158,6 +163,7 @@ run_renderpass (qfv_renderpass_t *rp, vulkan_ctx_t *ctx, void *data)
|
|||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
__auto_type rctx = ctx->render_context;
|
||||
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||
__auto_type job = rctx->job;
|
||||
|
||||
VkCommandBuffer cmd = QFV_GetCmdBuffer (ctx, false);
|
||||
|
@ -167,30 +173,34 @@ run_renderpass (qfv_renderpass_t *rp, vulkan_ctx_t *ctx, void *data)
|
|||
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
};
|
||||
dfunc->vkBeginCommandBuffer (cmd, &beginInfo);
|
||||
QFV_duCmdBeginLabel (device, cmd, rp->label.name,
|
||||
{VEC4_EXP (rp->label.color)});
|
||||
dfunc->vkCmdBeginRenderPass (cmd, &rp->beginInfo, rp->subpassContents);
|
||||
for (uint32_t i = 0; i < rp->subpass_count; i++) {
|
||||
__auto_type sp = &rp->subpasses[i];
|
||||
QFV_duCmdBeginLabel (device, cmd, sp->label.name,
|
||||
{VEC4_EXP (sp->label.color)});
|
||||
qfv_taskctx_t taskctx = {
|
||||
.ctx = ctx,
|
||||
.renderpass = rp,
|
||||
.cmd = QFV_GetCmdBuffer (ctx, true),
|
||||
.data = data,
|
||||
};
|
||||
run_subpass (sp, &taskctx);
|
||||
dfunc->vkCmdExecuteCommands (cmd, 1, &taskctx.cmd);
|
||||
QFV_duCmdEndLabel (device, cmd);
|
||||
//FIXME comment is a bit off as exactly one buffer is always submitted
|
||||
//
|
||||
//Regardless of whether any commands were submitted for this
|
||||
//subpass, must step through each and every subpass, otherwise
|
||||
//the attachments won't be transitioned correctly.
|
||||
//However, only if not the last (or only) subpass.
|
||||
if (i < rp->subpass_count - 1) {
|
||||
dfunc->vkCmdNextSubpass (cmd, rp->subpassContents);
|
||||
{
|
||||
qftVkScopedZone (frame->qftVkCtx, cmd, "renderpass");
|
||||
QFV_duCmdBeginLabel (device, cmd, rp->label.name,
|
||||
{VEC4_EXP (rp->label.color)});
|
||||
dfunc->vkCmdBeginRenderPass (cmd, &rp->beginInfo, rp->subpassContents);
|
||||
for (uint32_t i = 0; i < rp->subpass_count; i++) {
|
||||
__auto_type sp = &rp->subpasses[i];
|
||||
QFV_duCmdBeginLabel (device, cmd, sp->label.name,
|
||||
{VEC4_EXP (sp->label.color)});
|
||||
qfv_taskctx_t taskctx = {
|
||||
.ctx = ctx,
|
||||
.frame = frame,
|
||||
.renderpass = rp,
|
||||
.cmd = QFV_GetCmdBuffer (ctx, true),
|
||||
.data = data,
|
||||
};
|
||||
run_subpass (sp, &taskctx);
|
||||
dfunc->vkCmdExecuteCommands (cmd, 1, &taskctx.cmd);
|
||||
QFV_duCmdEndLabel (device, cmd);
|
||||
//FIXME comment is a bit off as exactly one buffer is always submitted
|
||||
//
|
||||
//Regardless of whether any commands were submitted for this
|
||||
//subpass, must step through each and every subpass, otherwise
|
||||
//the attachments won't be transitioned correctly.
|
||||
//However, only if not the last (or only) subpass.
|
||||
if (i < rp->subpass_count - 1) {
|
||||
dfunc->vkCmdNextSubpass (cmd, rp->subpassContents);
|
||||
}
|
||||
}
|
||||
}
|
||||
dfunc->vkCmdEndRenderPass (cmd);
|
||||
|
@ -208,10 +218,14 @@ run_compute_pipeline (qfv_pipeline_t *pipeline, VkCommandBuffer cmd,
|
|||
}
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
auto rctx = ctx->render_context;
|
||||
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||
qftVkScopedZone (frame->qftVkCtx, cmd, "compute");
|
||||
dfunc->vkCmdBindPipeline (cmd, pipeline->bindPoint, pipeline->pipeline);
|
||||
|
||||
qfv_taskctx_t taskctx = {
|
||||
.ctx = ctx,
|
||||
.frame = frame,
|
||||
.pipeline = pipeline,
|
||||
.cmd = cmd,
|
||||
};
|
||||
|
@ -257,15 +271,40 @@ run_compute (qfv_compute_t *comp, vulkan_ctx_t *ctx, qfv_step_t *step)
|
|||
static void
|
||||
run_process (qfv_process_t *proc, vulkan_ctx_t *ctx)
|
||||
{
|
||||
auto rctx = ctx->render_context;
|
||||
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||
qfZoneNamed (zone, true);
|
||||
qfZoneName (zone, proc->label.name, proc->label.name_len);
|
||||
qfZoneColor (zone, proc->label.color32);
|
||||
qfv_taskctx_t taskctx = {
|
||||
.ctx = ctx,
|
||||
.frame = frame,
|
||||
};
|
||||
run_tasks (proc->task_count, proc->tasks, &taskctx);
|
||||
}
|
||||
|
||||
static void
|
||||
run_collect (vulkan_ctx_t *ctx)
|
||||
{
|
||||
#ifdef TRACY_ENABLE
|
||||
auto device = ctx->device;
|
||||
auto dfunc = device->funcs;
|
||||
auto rctx = ctx->render_context;
|
||||
auto frame = &rctx->frames.a[ctx->curFrame];
|
||||
|
||||
VkCommandBuffer cmd = QFV_GetCmdBuffer (ctx, false);
|
||||
QFV_duSetObjectName (device, VK_OBJECT_TYPE_COMMAND_BUFFER, cmd,
|
||||
va (ctx->va_ctx, "cmd:render:%s", "tracy"));
|
||||
VkCommandBufferBeginInfo beginInfo = {
|
||||
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
};
|
||||
dfunc->vkBeginCommandBuffer (cmd, &beginInfo);
|
||||
qftCVkCollect (frame->qftVkCtx, cmd);
|
||||
dfunc->vkEndCommandBuffer (cmd);
|
||||
QFV_AppendCmdBuffer (ctx, cmd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RunRenderPass (vulkan_ctx_t *ctx, qfv_renderpass_t *renderpass,
|
||||
uint32_t width, uint32_t height, void *data)
|
||||
|
@ -309,6 +348,7 @@ QFV_RunRenderJob (vulkan_ctx_t *ctx)
|
|||
update_time (&step->time, step_start, Sys_LongTime ());
|
||||
}
|
||||
|
||||
qfMessageL ("submit");
|
||||
auto device = ctx->device;
|
||||
auto dfunc = device->funcs;
|
||||
auto queue = &device->queue;
|
||||
|
@ -324,6 +364,7 @@ QFV_RunRenderJob (vulkan_ctx_t *ctx)
|
|||
dfunc->vkResetFences (device->dev, 1, &frame->fence);
|
||||
dfunc->vkQueueSubmit (queue->queue, 1, &submitInfo, frame->fence);
|
||||
|
||||
qfMessageL ("present");
|
||||
VkPresentInfoKHR presentInfo = {
|
||||
VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, 0,
|
||||
1, &frame->renderDoneSemaphore,
|
||||
|
@ -332,6 +373,7 @@ QFV_RunRenderJob (vulkan_ctx_t *ctx)
|
|||
};
|
||||
dfunc->vkQueuePresentKHR (queue->queue, &presentInfo);
|
||||
|
||||
qfMessageL ("update_time");
|
||||
if (++ctx->curFrame >= rctx->frames.size) {
|
||||
ctx->curFrame = 0;
|
||||
}
|
||||
|
@ -451,6 +493,7 @@ wait_on_fence (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
QFV_CmdPoolManager_Reset (&frame->cmdpool);
|
||||
auto job = ctx->render_context->job;
|
||||
DARRAY_RESIZE (&job->commands, 0);
|
||||
run_collect (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -530,6 +573,14 @@ QFV_Render_Init (vulkan_ctx_t *ctx)
|
|||
frame->renderDoneSemaphore = QFV_CreateSemaphore (device);
|
||||
QFV_CmdPoolManager_Init (&frame->cmdpool, device,
|
||||
va (ctx->va_ctx, "render pool:%zd", i));
|
||||
#ifdef TRACY_ENABLE
|
||||
auto instance = ctx->instance->instance;
|
||||
auto physdev = ctx->device->physDev->dev;
|
||||
auto gipa = ctx->vkGetInstanceProcAddr;
|
||||
auto gdpa = ctx->instance->funcs->vkGetDeviceProcAddr;
|
||||
frame->qftVkCtx = qftCVkContextHostCalibrated (instance, physdev,
|
||||
device->dev, gipa, gdpa);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -281,6 +281,7 @@ QFV_CreateResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
void
|
||||
QFV_DestroyResource (qfv_device_t *device, qfv_resource_t *resource)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
for (unsigned i = 0; i < resource->num_objects; i++) {
|
||||
|
@ -291,6 +292,7 @@ QFV_DestroyResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
break;
|
||||
case qfv_res_buffer_view:
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type buffview = &obj->buffer_view;
|
||||
dfunc->vkDestroyBufferView (device->dev, buffview->view, 0);
|
||||
buffview->view = 0;
|
||||
|
@ -298,6 +300,7 @@ QFV_DestroyResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
break;
|
||||
case qfv_res_image_view:
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type imgview = &obj->image_view;
|
||||
dfunc->vkDestroyImageView (device->dev, imgview->view, 0);
|
||||
imgview->view = 0;
|
||||
|
@ -310,6 +313,7 @@ QFV_DestroyResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
switch (obj->type) {
|
||||
case qfv_res_buffer:
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type buffer = &obj->buffer;
|
||||
dfunc->vkDestroyBuffer (device->dev, buffer->buffer, 0);
|
||||
buffer->buffer = 0;
|
||||
|
@ -317,6 +321,7 @@ QFV_DestroyResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
break;
|
||||
case qfv_res_image:
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type image = &obj->image;
|
||||
dfunc->vkDestroyImage (device->dev, image->image, 0);
|
||||
image->image = 0;
|
||||
|
@ -327,7 +332,9 @@ QFV_DestroyResource (qfv_device_t *device, qfv_resource_t *resource)
|
|||
break;
|
||||
}
|
||||
}
|
||||
qfMessageL("free memory");
|
||||
dfunc->vkFreeMemory (device->dev, resource->memory, 0);
|
||||
qfMessageL("memory freed");
|
||||
resource->memory = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -939,6 +939,7 @@ slice_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
return;
|
||||
}
|
||||
|
||||
qftVkScopedZone (taskctx->frame->qftVkCtx, taskctx->cmd, "slice_draw");
|
||||
VkDeviceMemory memory = dctx->draw_resource[1].memory;
|
||||
size_t atom = device->physDev->properties->limits.nonCoherentAtomSize;
|
||||
size_t atom_mask = atom - 1;
|
||||
|
|
|
@ -1313,6 +1313,7 @@ Vulkan_Lighting_Setup (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
clear_shadows (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_device_t *device = ctx->device;
|
||||
lightingctx_t *lctx = ctx->lighting_context;
|
||||
|
||||
|
@ -2040,6 +2041,7 @@ scene_lightleaf_ui (void *comp, imui_ctx_t *imui_ctx,
|
|||
void
|
||||
Vulkan_LoadLights (scene_t *scene, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
lightingctx_t *lctx = ctx->lighting_context;
|
||||
|
||||
lctx->scene = scene;
|
||||
|
|
|
@ -221,6 +221,7 @@ output_draw (qfv_taskctx_t *taskctx,
|
|||
auto layout = taskctx->pipeline->layout;
|
||||
auto cmd = taskctx->cmd;
|
||||
|
||||
qftVkScopedZone (taskctx->frame->qftVkCtx, taskctx->cmd, "flat");
|
||||
VkDescriptorSet set[] = {
|
||||
Vulkan_Matrix_Descriptors (ctx, ctx->curFrame),
|
||||
oframe->set,
|
||||
|
|
|
@ -98,6 +98,9 @@ static const char *instance_extensions[] = {
|
|||
|
||||
static const char *device_extensions[] = {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
#ifdef TRACY_ENABLE
|
||||
VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME,
|
||||
#endif
|
||||
0,
|
||||
};
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ js_libs = libs/util/libQFutil.la
|
|||
|
||||
libs_video_targets_libvid_common_la_SOURCES = \
|
||||
libs/video/targets/vid.c
|
||||
libs_video_targets_libvid_common_la_CFLAGS= @PREFER_NON_PIC@
|
||||
libs_video_targets_libvid_common_la_CFLAGS= $(AM_CFLAGS) @PREFER_NON_PIC@
|
||||
libs_video_targets_libvid_common_la_LDFLAGS= @STATIC@
|
||||
|
||||
libs_video_targets_libvid_x11_la_SOURCES = \
|
||||
|
@ -39,7 +39,7 @@ libs_video_targets_libvid_x11_la_SOURCES = \
|
|||
libs/video/targets/context_x11.c \
|
||||
libs/video/targets/dga_check.c \
|
||||
$(x11_src)
|
||||
libs_video_targets_libvid_x11_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libvid_x11_la_CFLAGS= $(AM_CFLAGS) @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libvid_x11_la_LDFLAGS= @STATIC@
|
||||
EXTRA_libs_video_targets_libvid_x11_la_SOURCES= $(x11_vulkan_src)
|
||||
|
||||
|
@ -47,7 +47,7 @@ libs_video_targets_libvid_win_la_SOURCES = \
|
|||
libs/video/targets/in_win.c \
|
||||
libs/video/targets/context_win.c \
|
||||
$(win_src)
|
||||
libs_video_targets_libvid_win_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libvid_win_la_CFLAGS= $(AM_CFLAGS) @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libvid_win_la_LDFLAGS= @STATIC@
|
||||
EXTRA_libs_video_targets_libvid_win_la_SOURCES= $(win_vulkan_src)
|
||||
|
||||
|
|
|
@ -296,6 +296,7 @@ VID_InitGamma (const byte *pal)
|
|||
void
|
||||
VID_ClearMemory (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (vi->flush_caches) {
|
||||
vi->flush_caches (vi->ctx);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ nq_x11_libs= \
|
|||
libs/models/libQFmodels.la \
|
||||
libs/video/targets/libQFx11.la \
|
||||
$(nq_client_LIBS)
|
||||
nq_x11_SOURCES= nq/source/sys_unix.c $(tracy_src)
|
||||
nq_x11_SOURCES= nq/source/sys_unix.c $(tracy_src) $(tracyvk_src)
|
||||
nq_x11_LDADD= $(nq_x11_libs) \
|
||||
$(VIDMODE_LIBS) $(DGA_LIBS) ${XFIXES_LIBS} $(XI2_LIBS) $(X_LIBS) \
|
||||
-lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB) $(NET_LIBS) $(DL_LIBS)
|
||||
|
@ -106,7 +106,7 @@ nq_win_libs= \
|
|||
libs/models/libQFmodels.la \
|
||||
libs/video/targets/libQFwin.la \
|
||||
$(nq_client_LIBS)
|
||||
nq_win_SOURCES= nq/source/sys_win.c $(tracy_src)
|
||||
nq_win_SOURCES= nq/source/sys_win.c $(tracy_src) $(tracyvk_src)
|
||||
nq_win_LDADD= $(nq_win_libs) -lgdi32 -lcomctl32 -lwinmm $(NET_LIBS)
|
||||
nq_win_LDFLAGS= $(common_ldflags)
|
||||
nq_win_DEPENDENCIES= $(nq_win_libs)
|
||||
|
|
|
@ -69,6 +69,7 @@ set_t cl_forcelink = SET_STATIC_INIT (MAX_EDICTS, alloc_forcelink);
|
|||
void
|
||||
CL_ClearEnts (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < MAX_EDICTS; i++) {
|
||||
|
|
|
@ -224,6 +224,7 @@ CL_Shutdown (void *data)
|
|||
void
|
||||
CL_ClearMemory (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
VID_ClearMemory ();
|
||||
SCR_SetFullscreen (0);
|
||||
|
||||
|
@ -280,6 +281,7 @@ CL_InitCvars (void)
|
|||
void
|
||||
CL_ClearState (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
CL_ClearMemory ();
|
||||
if (!sv.active)
|
||||
Host_ClearMemory ();
|
||||
|
|
|
@ -146,6 +146,7 @@ CL_EntityNum (int num)
|
|||
static void
|
||||
CL_ParseStartSoundPacket (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
float attenuation;
|
||||
int channel, ent, field_mask, sound_num, volume;
|
||||
|
||||
|
@ -250,6 +251,7 @@ CL_KeepaliveMessage (void)
|
|||
static void
|
||||
CL_NewMap (const char *mapname)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
CL_World_NewMap (mapname, 0);
|
||||
V_NewScene (&cl.viewstate, cl_world.scene);
|
||||
|
||||
|
@ -264,6 +266,7 @@ CL_NewMap (const char *mapname)
|
|||
static void
|
||||
CL_ParseServerInfo (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
char model_precache[MAX_MODELS][MAX_QPATH];
|
||||
char sound_precache[MAX_SOUNDS][MAX_QPATH];
|
||||
const char *str;
|
||||
|
@ -540,6 +543,7 @@ CL_ParseUpdate (int bits)
|
|||
static void
|
||||
CL_ParseClientdata (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i, j;
|
||||
int bits;
|
||||
|
||||
|
@ -687,6 +691,7 @@ CL_ParseClientdata (void)
|
|||
static void
|
||||
CL_ParseStaticSound (int version)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int sound_num;
|
||||
float vol, atten;
|
||||
vec4f_t org = { 0, 0, 0, 1 };
|
||||
|
@ -718,7 +723,7 @@ CL_SetStat (int stat, int value)
|
|||
void
|
||||
CL_ParseServerMessage (void)
|
||||
{
|
||||
qfZoneNamedN (psm_zone, "CL_ParseServerMessage", true);
|
||||
qfZoneScoped (true);
|
||||
int cmd = 0, i, j;
|
||||
const char *str;
|
||||
static dstring_t *stuffbuf;
|
||||
|
|
|
@ -609,6 +609,7 @@ Host_ShutdownServer (bool crash)
|
|||
void
|
||||
Host_ClearMemory (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_MaskPrintf (SYS_dev, "Clearing memory\n");
|
||||
Mod_ClearAll ();
|
||||
if (host_hunklevel)
|
||||
|
|
|
@ -217,6 +217,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
|
||||
oldtime = Sys_DoubleTime () - 0.1;
|
||||
while (1) { // Main message loop
|
||||
qfFrameMark;
|
||||
if (!isDedicated) {
|
||||
// yield the CPU for a little while when paused, minimized, or
|
||||
// not the focus
|
||||
|
|
|
@ -40,7 +40,7 @@ qtv_LIBS= \
|
|||
libs/ui/libQFui.la \
|
||||
libs/util/libQFutil.la
|
||||
|
||||
qtv_server_SOURCES= qtv/source/client.c qtv/source/connection.c qtv/source/qtv.c qtv/source/sbar.c qtv/source/server.c qtv/source/sv_parse.c
|
||||
qtv_server_SOURCES= qtv/source/client.c qtv/source/connection.c qtv/source/qtv.c qtv/source/sbar.c qtv/source/server.c qtv/source/sv_parse.c $(tracy_src)
|
||||
qtv_server_LDADD= $(qtv_LIBS) $(NET_LIBS) $(DL_LIBS) $(CURSES_LIBS)
|
||||
qtv_server_LDFLAGS= $(common_ldflags)
|
||||
qtv_server_DEPENDENCIES= $(qtv_LIBS)
|
||||
|
|
|
@ -71,7 +71,7 @@ qw_server_LIBS= \
|
|||
libs/util/libQFutil.la
|
||||
|
||||
qw_server_deps=qw/source/libqw_server.a qw/source/libqw_common.a $(qw_server_LIBS)
|
||||
qw_server_SOURCES= $(syssv_SRC)
|
||||
qw_server_SOURCES= $(syssv_SRC) $(tracy_src)
|
||||
qw_server_LDADD= $(qw_server_deps) $(NET_LIBS) $(DL_LIBS) $(CURSES_LIBS)
|
||||
qw_server_LDFLAGS= $(common_ldflags)
|
||||
qw_server_DEPENDENCIES= $(qw_server_deps)
|
||||
|
@ -117,7 +117,7 @@ qw_client_x11_libs= \
|
|||
libs/models/libQFmodels.la \
|
||||
libs/video/targets/libQFx11.la \
|
||||
$(qw_client_LIBS)
|
||||
qw_client_x11_SOURCES= qw/source/cl_sys_unix.c $(tracy_src)
|
||||
qw_client_x11_SOURCES= qw/source/cl_sys_unix.c $(tracy_src) $(tracyvk_src)
|
||||
qw_client_x11_LDADD= $(qw_client_x11_libs) \
|
||||
$(VIDMODE_LIBS) $(DGA_LIBS) ${XFIXES_LIBS} $(XI2_LIBS) $(X_LIBS) \
|
||||
-lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB) $(NET_LIBS) $(LIBCURL_LIBS) \
|
||||
|
@ -133,7 +133,7 @@ qw_client_win_libs= \
|
|||
libs/models/libQFmodels.la \
|
||||
libs/video/targets/libQFwin.la \
|
||||
$(qw_client_LIBS)
|
||||
qw_client_win_SOURCES= qw/source/cl_sys_win.c $(tracy_src)
|
||||
qw_client_win_SOURCES= qw/source/cl_sys_win.c $(tracy_src) $(tracyvk_src)
|
||||
qw_client_win_LDADD= $(qw_client_win_libs) -lgdi32 -lwinmm $(NET_LIBS) $(LIBCURL_LIBS)
|
||||
qw_client_win_LDFLAGS= $(common_ldflags)
|
||||
qw_client_win_DEPENDENCIES= $(qw_client_win_libs)
|
||||
|
|
|
@ -120,7 +120,7 @@ qwaq_x11_libs= \
|
|||
ruamoko_qwaq_qwaq_x11_SOURCES= \
|
||||
ruamoko/qwaq/builtins/main.c \
|
||||
ruamoko/qwaq/builtins/qwaq-graphics.c \
|
||||
ruamoko/qwaq/builtins/graphics.c $(tracy_src)
|
||||
ruamoko/qwaq/builtins/graphics.c $(tracy_src) $(tracyvk_src)
|
||||
ruamoko_qwaq_qwaq_x11_LDADD= $(qwaq_x11_libs) $(QWAQ_LIBS) \
|
||||
$(VIDMODE_LIBS) $(DGA_LIBS) ${XFIXES_LIBS} $(XI2_LIBS) $(X_LIBS) \
|
||||
-lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB) $(PTHREAD_LDFLAGS) $(DL_LIBS)
|
||||
|
|
Loading…
Reference in a new issue