Files
oak-editor/app/render/backend/opengl/openglshadercache.cpp
T
itsmattkc 3b224c7638 multithreaded download and files that probably should have been in the last
commit

For testing the new iteration, the texture cache disk download was written
into the main thread instead of into the separate threads. Now they're back
in separate threads again.

Also I think some of these files probably should have been in the previous
commit.
2019-11-06 09:14:20 +11:00

35 lines
774 B
C++

#include "openglshadercache.h"
#include "node/node.h"
OpenGLShaderCache::OpenGLShaderCache()
{
}
QString OpenGLShaderCache::GenerateShaderID(NodeOutput *output)
{
// Creates a unique identifier for this specific node and this specific output
return QString("%1:%2").arg(output->parent()->id(), output->id());
}
void OpenGLShaderCache::Clear()
{
compiled_nodes_.clear();
}
void OpenGLShaderCache::AddShader(NodeOutput *output, OpenGLShaderPtr shader)
{
compiled_nodes_.insert(GenerateShaderID(output), shader);
}
OpenGLShaderPtr OpenGLShaderCache::GetShader(NodeOutput *output)
{
return compiled_nodes_.value(GenerateShaderID(output));
}
bool OpenGLShaderCache::HasShader(NodeOutput *output)
{
return compiled_nodes_.contains(GenerateShaderID(output));
}