quakeforge/include/QF/Vulkan/qf_scene.h
Bill Currie 743b06d5c1 [vulkan] Script render graph initialization sequence
While every possible subsystem needs an initialization call, all that
does is add the actual initialization task to the render graph system.
This allows the render graph to be fully configurable, initializing only
those subsystems that the graph needs.

Scripted initialization is still separated from startup as render graph
creation needs various resources (eg, attachments) defined before
creating render and compute passes, but all those need to be created
before the subsystems can actually start up.
2024-01-30 23:13:16 +09:00

81 lines
2.2 KiB
C

/*
qf_scene.h
Vulkan specific scene stuff
Copyright (C) 2022 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2022/5/24
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifndef __QF_Vulkan_qf_scene_h
#define __QF_Vulkan_qf_scene_h
#ifndef VK_NO_PROTOTYPES
#define VK_NO_PROTOTYPES
#endif
#include <vulkan/vulkan.h>
#include "QF/darray.h"
#include "QF/simd/types.h"
typedef struct entdata_s {
// transpose of entity transform matrix without row 4
vec4f_t xform[3];
vec4f_t color;
} entdata_t;
typedef struct entdataset_s
DARRAY_TYPE (entdata_t) entdataset_t;
typedef struct scnframe_s {
// used to check if the entity has been pooled this frame (cleared
// every frame)
struct set_s *pooled_entities;
// data for entities pooled this frame (cleared every frame). transfered
// to gpu
entdataset_t entity_pool;
VkDescriptorSet descriptors;
} scnframe_t;
typedef struct scnframeset_s
DARRAY_TYPE (scnframe_t) scnframeset_t;
typedef struct scenectx_s {
struct qfv_resource_s *entities;
scnframeset_t frames;
int max_entities;
struct scene_s *scene;
} scenectx_t;
struct vulkan_ctx_s;
struct entity_s;
void Vulkan_Scene_Init (struct vulkan_ctx_s *ctx);
int Vulkan_Scene_MaxEntities (struct vulkan_ctx_s *ctx) __attribute__((pure));
VkDescriptorSet Vulkan_Scene_Descriptors (struct vulkan_ctx_s *ctx) __attribute__((pure));
int Vulkan_Scene_AddEntity (struct vulkan_ctx_s *ctx, struct entity_s entity);
void Vulkan_Scene_Flush (struct vulkan_ctx_s *ctx);
void Vulkan_NewScene (struct scene_s *scene, struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_scene_h