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 <unordered_map>
9
10namespace Cogs
11{
12 namespace Core
13 {
15 {
16 std::string vs;
17 std::string ps;
18 std::string cs;
19
20 PreprocessorDefinitions definitions;
21 };
22
24 {
25 EffectDescription description;
26
27 Cogs::EffectHandle handle;
28
29 uint32_t usage = 0;
30 };
31
33 {
34 void reload(struct RenderTaskContext * context);
35 void reload(struct RenderTaskContext * context, CachedEffect * effect);
36
37 CachedEffect * loadEffect(struct RenderTaskContext * context, StringView cs);
38 CachedEffect * loadEffect(struct RenderTaskContext * context, StringView vs, StringView ps);
39 CachedEffect * loadEffect(struct RenderTaskContext * context, EffectDescription & desc);
40 void release(struct RenderTaskContext * context, CachedEffect * effect);
41
42 private:
43 std::unordered_map<size_t, CachedEffect> effects;
44 };
45 }
46}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
std::vector< PreprocessorDefinition > PreprocessorDefinitions
A set of preprocessor definitions.
Definition: IEffects.h:13