Cogs.Core
ProcessTask.h
1#pragma once
2
3#include "RenderTask.h"
4#include "Renderer/EffectCache.h"
5#include "Resources/MaterialDefinition.h"
6#include "Resources/MaterialOptions.h"
7#include "Serialization/RenderPipelineReader.h"
8#include "Utilities/Expressions.h"
9
10#include "Rendering/Common.h"
11#include "Rendering/SamplerState.h"
12
13namespace Cogs
14{
15 namespace Core
16 {
18 {
20 ProcessTaskProperty(const ProcessTaskProperty& original) : expressions(original.expressions) {
21 definition = original.definition;
22
23 std::memcpy(static_cast<void*>(&float4x4Value), &original.float4x4Value, sizeof(float4x4Value));
24 }
25 const ParsedValue* definition = nullptr;
26
27 std::vector<std::pair<size_t, Expression*>> expressions;
28 union
29 {
30 float floatValue;
31 glm::vec2 float2Value;
32 glm::vec3 float3Value;
33 glm::vec4 float4Value;
34 glm::mat4 float4x4Value;
35 int intValue;
36 glm::ivec2 int2Value;
37 glm::ivec3 int3Value;
38 glm::ivec4 int4Value;
39 uint32_t uintValue;
40 glm::uvec2 uint2Value;
41 glm::uvec3 uint3Value;
42 glm::uvec4 uint4Value;
43 bool boolValue;
44 struct {
45 StringView samplerName; // Stable views from Strings, will be passed to Cogs.Rendering
46 SamplerStateHandle samplerState;
47 } texture;
48 };
49
50 size_t size;
51 size_t offset;
52 };
53
54 struct ProcessTask : public RenderTask
55 {
56 virtual ~ProcessTask() {}
57
58 EffectDescription createEffectDesc(RenderTaskContext* context);
59
60 void addProperty(ProcessTaskProperty& property);
61 virtual void initialize(RenderTaskContext* context) override;
62 virtual void initialize(RenderTaskContext* context, const RenderTaskDefinition& taskDefinition);
63
64 void cleanup(RenderTaskContext * context) override;
65
66 void setProperties(RenderTaskContext * context, Cogs::Core::RenderTexture* targetSource = nullptr);
67
68 ParsedValue effectParameter;
69
70 BlendMode blendMode = BlendMode::None;
71 uint32_t texUnit = 0;
72
73 ExpressionContext* scope = nullptr;
74
75 std::vector<ProcessTaskProperty> properties;
77
78 struct CachedEffect * effect = nullptr;
79 ConstantBufferDefinition paramBufferDesc;
80 BufferHandle constantBuffer = BufferHandle::NoHandle;
81 std::vector<uint8_t> constantBufferData;
83 };
84 }
85}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
BlendMode
Defines blending modes for rendering.
@ None
No blending enabled for opaque shapes, defaults to Blend for transparent shapes.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Provides a context for evaluation of expressions.
Definition: Expressions.h:54
Stores the parsed output of a key/value pair.
Definition: Parsing.h:40
static const Handle_t NoHandle
Represents a handle to nothing.
Definition: Common.h:78