Nebula
Loading...
Searching...
No Matches
shaderserverbase.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
25//------------------------------------------------------------------------------
26#include "core/refcounted.h"
27#include "core/singleton.h"
28#include "coregraphics/shader.h"
30#include "coregraphics/shader.h"
33#include "threading/safequeue.h"
34
35namespace Threading
36{
37class Thread;
38}
39
40namespace IO
41{
42class FileWatcher;
43class FileWatcherThread;
44}
45
46namespace CoreGraphics
47{
48class Shader;
49}
50
51namespace Frame
52{
53class FrameScript;
54};
55
56namespace Base
57{
115
116//------------------------------------------------------------------------------
119inline bool
121{
122 return this->isOpen;
123}
124
125//------------------------------------------------------------------------------
128inline bool
130{
131 return this->shaders.Contains(resId);
132}
133
134//------------------------------------------------------------------------------
139{
140 return this->shaders;
141}
142
143//------------------------------------------------------------------------------
146inline const CoreGraphics::ShaderId
148{
149 n_assert_fmt(this->shaders.Contains(resId), "%s not found!\n This might be a problem with your export. Check the exports folder!\n", resId.Value());
150 Resources::ResourceId shader = this->shaders[resId];
151 CoreGraphics::ShaderId ret = shader.resource;
152 return ret;
153}
154
155//------------------------------------------------------------------------------
163
164//------------------------------------------------------------------------------
167inline Util::String
172
173//------------------------------------------------------------------------------
176inline void
181
182//------------------------------------------------------------------------------
185inline void
190
191//------------------------------------------------------------------------------
194inline void
199
200//------------------------------------------------------------------------------
205{
206 return this->curShaderFeatureBits;
207}
208
209} // namespace Base
210//------------------------------------------------------------------------------
211
The ShaderServer loads all shaders when created, meaning all shaders in the project must be valid and...
Definition shaderserverbase.h:59
void ClearFeatureBits(CoreGraphics::ShaderFeature::Mask m)
clear shader feature by bit mask
Definition shaderserverbase.h:195
Threading::SafeQueue< Resources::ResourceName > pendingShaderReloads
Definition shaderserverbase.h:110
bool HasShader(const Resources::ResourceName &resId) const
return true if a shader exists
Definition shaderserverbase.h:129
bool Open()
open the shader server
Definition shaderserverbase.cc:76
void ResetFeatureBits()
reset the current feature bits
Definition shaderserverbase.h:177
void SetFeatureBits(CoreGraphics::ShaderFeature::Mask m)
set shader feature by bit mask
Definition shaderserverbase.h:186
Util::String FeatureMaskToString(CoreGraphics::ShaderFeature::Mask mask)
convert shader feature bit mask into string
Definition shaderserverbase.h:168
void BeforeFrame()
update shader server outside of frame
Definition shaderserverbase.cc:218
CoreGraphics::ShaderFeature::Mask FeatureStringToMask(const Util::String &str)
convert a shader feature string into a feature bit mask
Definition shaderserverbase.h:159
virtual ~ShaderServerBase()
destructor
Definition shaderserverbase.cc:43
void Close()
close the shader server
Definition shaderserverbase.cc:176
bool IsOpen() const
return true if the shader server is open
Definition shaderserverbase.h:120
void LoadShader(const Resources::ResourceName &shdName)
explicitly loads a shader by resource id
Definition shaderserverbase.cc:202
__DeclareSingleton(ShaderServerBase)
bool isOpen
Definition shaderserverbase.h:113
CoreGraphics::ShaderFeature shaderFeature
Definition shaderserverbase.h:107
friend class ShaderBase
Definition shaderserverbase.h:104
Util::Dictionary< Resources::ResourceName, Resources::ResourceId > shaders
Definition shaderserverbase.h:109
const Util::Dictionary< Resources::ResourceName, Resources::ResourceId > & GetAllShaders() const
get all loaded shaders
Definition shaderserverbase.h:138
Ids::Id32 objectIdShaderVar
Definition shaderserverbase.h:111
CoreGraphics::ShaderFeature::Mask GetFeatureBits() const
get the current feature mask
Definition shaderserverbase.h:204
CoreGraphics::ShaderFeature::Mask curShaderFeatureBits
Definition shaderserverbase.h:108
CoreGraphics::ShaderIdentifier shaderIdentifierRegistry
Definition shaderserverbase.h:106
__DeclareClass(ShaderServerBase)
const CoreGraphics::ShaderId GetShader(Resources::ResourceName resId) const
get shader by name
Definition shaderserverbase.h:147
ShaderServerBase()
constructor
Definition shaderserverbase.cc:32
The common base class of Nebula.
Definition refcounted.h:38
Wrapper class for shader permutations by name.
Definition shaderfeature.h:28
uint Mask
a shader feature bit mask
Definition shaderfeature.h:31
Mask StringToMask(const Util::String &str)
generate a bit mask from a shader feature string
Definition shaderfeature.cc:27
Util::String MaskToString(Mask mask)
convert a bit mask into a shader feature string
Definition shaderfeature.cc:49
The ShaderIdentifier is a zero-indexed registry which is used to identify shaders in a constant time ...
Definition shaderidentifier.h:33
A FrameScript describes render operations being done to produce a single frame.
Definition framescript.h:41
Linux implementation of filewatcher.
Thread-safe version of Util::Queue.
Definition safequeue.h:27
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
A StringAtom.
Definition stringatom.h:22
const char * Value() const
get contained string as char ptr (fast)
Definition stringatom.h:362
#define n_assert_fmt(exp, msg,...)
Definition debug.h:53
Definition gamecontentserverbase.cc:10
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
ImGUI debug interface for inspecting frame scripts.
Definition shaderserverbase.h:52
Instances of wrapped stream classes.
Definition orientation.cc:10
uint32_t Id32
Definition id.h:138
The Jobs2 system provides a set of threads and a pool of jobs from which threads can pickup work.
Definition jobs2.h:16
A shader represents an entire shader resource, containing several stages and programs.
Definition shader.h:51
Nebula's universal string class.
Definition string.h:50