MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetShader

Method GetShader

Source/Engine/Graphics/Shaders/GPUShader.cpp:182–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182GPUShaderProgram* GPUShader::GetShader(ShaderStage stage, const StringAnsiView& name, int32 permutationIndex) const
183{
184 GPUShaderProgram* shader = nullptr;
185 const uint32 hash = HashPermutation(name, permutationIndex);
186 _shaders.TryGet(hash, shader);
187#if BUILD_RELEASE
188 // Release build is more critical on that
189 ASSERT(shader != nullptr && shader->GetStage() == stage);
190#else
191 if (shader == nullptr)
192 {
193 LOG(Error, "Missing {0} shader \'{1}\'[{2}]. Object: {3}.", ::ToString(stage), String(name), permutationIndex, ToString());
194 }
195 else if (shader->GetStage() != stage)
196 {
197 LOG(Error, "Invalid shader stage \'{1}\'[{2}]. Expected: {0}. Actual: {4}. Object: {3}.", ::ToString(stage), String(name), permutationIndex, ToString(), ::ToString(shader->GetStage()));
198 }
199#endif
200 return shader;
201}
202
203void GPUShader::ReadVertexLayout(MemoryReadStream& stream, GPUVertexLayout*& inputLayout, GPUVertexLayout*& vertexLayout)
204{

Callers 1

LoadContentMethod · 0.45

Calls 5

HashPermutationFunction · 0.85
ToStringFunction · 0.50
StringClass · 0.50
TryGetMethod · 0.45
GetStageMethod · 0.45

Tested by

no test coverage detected