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"
27 enum class EnginePermutationFlags
32 ReverseDepth = 1 << 2,
35 ENABLE_ENUM_FLAGS(EnginePermutationFlags);
44 std::string vertexShader;
45 std::string geometryShader;
46 std::string pixelShader;
48 ShaderVariants variants;
52 EnginePermutationFlags flags = EnginePermutationFlags::None;
65 std::span<const ShaderVariantDefinition> getVariants()
const {
return definition->variants; }
66 std::span<const ShaderVariantSelector> getSelectors()
const {
return selectors; }
69 void setVariant(
const StringView & key,
const char * value) { setVariant(key,
StringView(value)); }
70 void setVariant(
const StringView & key,
bool value);
71 void setVariant(
const StringView & key,
int value);
75 void setProperty(
const StringView & name,
const void * value,
int valueSize);
77 bool isDirty()
const {
return dirty; }
78 bool isDepthOnly()
const {
return (flags & EnginePermutationFlags::DepthOnly) != 0; }
79 bool isShadowPass()
const {
return isDepthOnly(); }
80 bool isShadingPass()
const {
return (flags & EnginePermutationFlags::NoShading) == 0; }
81 bool hasBuiltins()
const {
return (flags & EnginePermutationFlags::HasBuiltins) != 0; }
82 bool isReverseDepth()
const {
return (flags & EnginePermutationFlags::ReverseDepth) != 0; }
84 size_t getCode()
const;
85 size_t getNameHash()
const {
return nameHash; }
86 size_t getIndex()
const {
return index; }
88 const std::string & getName()
const {
return definition->name; }
93 RenderItemFlags requiredFlags = RenderItemFlags::None;
94 size_t permutationMask = 0;
97 std::vector<Cogs::BufferHandle> bufferHandles;
100 mutable size_t code = 0;
101 mutable bool dirty =
false;
104 EnginePermutationFlags flags = EnginePermutationFlags::None;
106 ShaderVariantSelectors selectors;
117 void initialize(
Context * context);
132 size_t size()
const {
return enginePermutations.size(); }
133 size_t getIndex(
const StringView & name)
const;
135 bool load(
const StringView & resource,
bool isContent =
false);
136 EnginePermutationFlags getFlag(
const StringView & name);
139 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.