5#include "Resources/VariantDefinition.h"
6#include "Resources/MaterialPropertyBuffer.h"
7#include "Resources/MaterialProperty.h"
8#include "Resources/MaterialDefinition.h"
9#include "Resources/ConstantBuffers.h"
11#include "Components/Core/RenderComponent.h"
13#include "Utilities/Parsing.h"
15#include "Rendering/IEffects.h"
17#include "Foundation/StringView.h"
18#include "Foundation/Collections/Pool.h"
20#include "Renderer/RenderList.h"
22#include "Resources/EffectDefinition.h"
29 enum class EnginePermutationFlags
34 ReverseDepth = 1 << 2,
37 ENABLE_ENUM_FLAGS(EnginePermutationFlags);
46 std::string vertexShader;
47 std::string geometryShader;
48 std::string pixelShader;
50 ShaderVariants variants;
54 EnginePermutationFlags flags = EnginePermutationFlags::None;
71 std::span<const ShaderVariantDefinition> getVariants()
const {
return definition->variants; }
72 std::span<const ShaderVariantSelector> getSelectors()
const {
return selectors; }
75 void setVariant(
const StringView & key,
const char * value) { setVariant(key,
StringView(value)); }
76 void setVariant(
const StringView & key,
bool value);
77 void setVariant(
const StringView & key,
int value);
81 void setProperty(
const StringView & name,
const void * value,
int valueSize);
83 bool isDirty()
const {
return dirty; }
84 bool isDepthOnly()
const {
return (flags & EnginePermutationFlags::DepthOnly) != 0; }
85 bool isShadowPass()
const {
return isDepthOnly(); }
86 bool isShadingPass()
const {
return (flags & EnginePermutationFlags::NoShading) == 0; }
87 bool hasBuiltins()
const {
return (flags & EnginePermutationFlags::HasBuiltins) != 0; }
88 bool isReverseDepth()
const {
return (flags & EnginePermutationFlags::ReverseDepth) != 0; }
90 size_t getCode()
const;
91 size_t getNameHash()
const {
return nameHash; }
92 size_t getIndex()
const {
return index; }
94 const std::string & getName()
const {
return definition->name; }
99 RenderItemFlags requiredFlags = RenderItemFlags::None;
100 size_t permutationMask = 0;
103 std::vector<Cogs::BufferHandle> bufferHandles;
106 mutable size_t code = 0;
107 mutable bool dirty =
false;
110 EnginePermutationFlags flags = EnginePermutationFlags::None;
112 ShaderVariantSelectors selectors;
123 void initialize(
Context * context);
138 size_t size()
const {
return enginePermutations.size(); }
139 size_t getIndex(
const StringView & name)
const;
141 bool load(
const StringView & resource,
bool isContent =
false);
142 EnginePermutationFlags getFlag(
const StringView & name);
145 std::vector<EnginePermutation> enginePermutations;
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Provides a weakly referenced view over the contents of a string.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
RenderFlags
Contains flags to describe rendering behavior.
@ None
No render flags set.
std::vector< PreprocessorDefinition > PreprocessorDefinitions
A set of preprocessor definitions.
Pool used to store elements of ElementType.