Cogs.Core
EffectCache.h
1#pragma once
2
3#include "Rendering/Common.h"
4#include "Rendering/IEffects.h"
5#include "Rendering/IBindGroups.h"
6
7#include "Foundation/StringView.h"
8
9#include "Base.h"
10
11#include <unordered_map>
12
13namespace Cogs
14{
15 namespace Core
16 {
18 {
19 std::string vs;
20 std::string ps;
21 std::string cs;
22
23 PreprocessorDefinitions definitions;
26
27 };
28
30 {
31 EffectDescription description;
32
33 Cogs::EffectHandle handle;
34
35 uint32_t usage = 0;
36 };
37
38 struct COGSCORE_DLL_API EffectCache
39 {
40 void reload(struct RenderTaskContext * context);
41 void reload(struct RenderTaskContext * context, CachedEffect * effect);
42
43 CachedEffect * loadEffect(struct RenderTaskContext * context, StringView cs);
44 CachedEffect * loadEffect(struct RenderTaskContext * context, StringView vs, StringView ps);
45 CachedEffect * loadEffect(struct RenderTaskContext * context, EffectDescription & desc);
46 void release(struct RenderTaskContext * context, CachedEffect * effect);
47
48 private:
49 std::unordered_map<size_t, CachedEffect> effects;
50 };
51 }
52}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:50
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
std::vector< PreprocessorDefinition > PreprocessorDefinitions
A set of preprocessor definitions.
Definition: IEffects.h:20
BindGroupSetDescription bindGroupLayoutDesc
Optional bind-group layout metadata. Backends may use this instead of source introspection.
Definition: EffectCache.h:25