Cogs.Core
EffectCache.h
1#pragma once
2
3#include "Rendering/Common.h"
4#include "Rendering/IEffects.h"
5
6#include "Foundation/StringView.h"
7
8#include "Base.h"
9
10#include <unordered_map>
11
12namespace Cogs
13{
14 namespace Core
15 {
17 {
18 std::string vs;
19 std::string ps;
20 std::string cs;
21
22 PreprocessorDefinitions definitions;
23 };
24
26 {
27 EffectDescription description;
28
29 Cogs::EffectHandle handle;
30
31 uint32_t usage = 0;
32 };
33
34 struct COGSCORE_DLL_API EffectCache
35 {
36 void reload(struct RenderTaskContext * context);
37 void reload(struct RenderTaskContext * context, CachedEffect * effect);
38
39 CachedEffect * loadEffect(struct RenderTaskContext * context, StringView cs);
40 CachedEffect * loadEffect(struct RenderTaskContext * context, StringView vs, StringView ps);
41 CachedEffect * loadEffect(struct RenderTaskContext * context, EffectDescription & desc);
42 void release(struct RenderTaskContext * context, CachedEffect * effect);
43
44 private:
45 std::unordered_map<size_t, CachedEffect> effects;
46 };
47 }
48}
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:13