VenomEngine
Cross-Platform Modern Graphics Engine
Loading...
Searching...
No Matches
ShaderResourceTable.h
Go to the documentation of this file.
1
8#pragma once
13
14
15// @brief Means that all model matrices will be located in a packed buffer
16#define VENOM_EXTERNAL_PACKED_MODEL_MATRIX
17
18// @brief Means that all textures will be bindless, MoltenVk only allows for small amounts of bindless textures
19#ifndef __APPLE__
20#define VENOM_BINDLESS_TEXTURES
21#endif
22
23namespace venom
24{
25namespace common
26{
27class Texture;
28
29
30class ShaderResourceTable : public GraphicsPluginObject
31{
32public:
33 ShaderResourceTable();
34 ~ShaderResourceTable() override;
35
36 enum SetsIndex
37 {
38 SetsIndex_ModelMatrices = 0,
39 SetsIndex_Camera = 1,
40 SetsIndex_Textures = 2,
41 SetsIndex_LightIndividual = 3,
42 SetsIndex_Material = 4,
43 SetsIndex_Scene = 5,
44 SetsIndex_Panorama = 6,
45 SetsIndex_Light = 7
46 };
47
48// Descriptor Sets Indices
49#define DSETS_INDEX_MODEL_MATRICES venom::common::ShaderResourceTable::SetsIndex::SetsIndex_ModelMatrices
50#define DSETS_INDEX_CAMERA venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Camera
51#define DSETS_INDEX_TEXTURES venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Textures
52#define DSETS_INDEX_SAMPLER venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Sampler
53#define DSETS_INDEX_MATERIAL venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Material
54#define DSETS_INDEX_SCENE venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Scene
55#define DSETS_INDEX_PANORAMA venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Panorama
56#define DSETS_INDEX_LIGHT venom::common::ShaderResourceTable::SetsIndex::SetsIndex_Light
57#define DSETS_INDEX_LIGHT_INDIVIDUAL venom::common::ShaderResourceTable::SetsIndex::SetsIndex_LightIndividual
58
59 class Descriptor
60 {
61 public:
62 Descriptor();
63 ~Descriptor();
64 };
65
66 static void UpdateDescriptor(const SetsIndex index, const int binding, const void * data, const size_t size, const size_t offset = 0);
67 static void UpdateDescriptor(const SetsIndex index, const int binding, vc::Texture * texture);
68
69#ifdef VENOM_EXTERNAL_PACKED_MODEL_MATRIX
70 static vcm::Mat4 * GetAllModelMatrixBuffer();
71 static vcm::Mat4 * GetModelMatrixBuffer();
72 static inline size_t GetAllModelMatrixBytesSize() { return VENOM_MAX_ENTITIES * sizeof(vcm::Mat4); }
73 static void ReleaseModelMatrixBuffer(const vcm::Mat4 * mat);
74 static int GetModelMatrixBufferId(const vcm::Mat4 * mat);
75#endif
76
77 static int BindTexture();
78 static void UnbindTexture(int id);
79 static void SetMaxTextures(uint32_t maxTextures);
80 static inline int GetMaxTextures() { return __maxTextures; }
81 static bool UsingLargeBindlessTextures() { return __maxTextures == VENOM_MAX_BINDLESS_TEXTURES; }
82
83private:
84 virtual void __UpdateDescriptor(const SetsIndex index, const int binding, const void * data, const size_t size, const size_t offset = 0) = 0;
85 virtual void __UpdateDescriptor(const SetsIndex index, const int binding, vc::Texture * texture) = 0;
86
87private:
88 static int __maxTextures;
89};
90}
91}
Definition Texture.h:179
High-Level Frontend of the VenomEngine project. It also contains all the code shared between every AP...
Definition Callback.h:15
Contains the entirety of the code of the VenomEngine project.
Definition Callback.h:13