removed all dependence on NodeOutputs
If Nodes only have the one output, we don't need to do so much differentiation between them. Previous iteration used outputs as like a distinct function within a Node (e.g. length output would return one result, buffer output would produce a different result - each run different code to produce their results). Now in this iteration, it's more accurate to say a Node is just one function (which seems more appropriate for a node system anyway).
This commit is contained in:
@@ -2,33 +2,27 @@
|
||||
|
||||
#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->parentNode()->id(), output->id());
|
||||
}
|
||||
|
||||
void OpenGLShaderCache::Clear()
|
||||
{
|
||||
compiled_nodes_.clear();
|
||||
}
|
||||
|
||||
void OpenGLShaderCache::AddShader(NodeOutput *output, OpenGLShaderPtr shader)
|
||||
void OpenGLShaderCache::AddShader(Node *output, OpenGLShaderPtr shader)
|
||||
{
|
||||
compiled_nodes_.insert(GenerateShaderID(output), shader);
|
||||
}
|
||||
|
||||
OpenGLShaderPtr OpenGLShaderCache::GetShader(NodeOutput *output)
|
||||
OpenGLShaderPtr OpenGLShaderCache::GetShader(Node *output)
|
||||
{
|
||||
return compiled_nodes_.value(GenerateShaderID(output));
|
||||
}
|
||||
|
||||
bool OpenGLShaderCache::HasShader(NodeOutput *output)
|
||||
QString OpenGLShaderCache::GenerateShaderID(Node *output)
|
||||
{
|
||||
return output->id();
|
||||
}
|
||||
|
||||
bool OpenGLShaderCache::HasShader(Node *output)
|
||||
{
|
||||
return compiled_nodes_.contains(GenerateShaderID(output));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user