Clean up
This commit is contained in:
@@ -37,41 +37,6 @@ RuntimeShaderRenderer::~RuntimeShaderRenderer()
|
|||||||
ShutdownGl();
|
ShutdownGl();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RuntimeShaderRenderer::CommitFragmentShader(const std::string& fragmentShaderSource, std::string& error)
|
|
||||||
{
|
|
||||||
RuntimeShaderArtifact artifact;
|
|
||||||
artifact.shaderId = "runtime-fragment";
|
|
||||||
artifact.displayName = "Runtime Fragment";
|
|
||||||
artifact.fragmentShaderSource = fragmentShaderSource;
|
|
||||||
return CommitShaderArtifact(artifact, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RuntimeShaderRenderer::CommitShaderArtifact(const RuntimeShaderArtifact& artifact, std::string& error)
|
|
||||||
{
|
|
||||||
if (artifact.fragmentShaderSource.empty())
|
|
||||||
{
|
|
||||||
error = "Cannot commit an empty fragment shader.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EnsureStaticGlResources(error))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
GLuint vertexShader = 0;
|
|
||||||
GLuint fragmentShader = 0;
|
|
||||||
GLuint program = 0;
|
|
||||||
if (!BuildProgram(artifact.fragmentShaderSource, program, vertexShader, fragmentShader, error))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
DestroyProgram();
|
|
||||||
mProgram = program;
|
|
||||||
mVertexShader = vertexShader;
|
|
||||||
mFragmentShader = fragmentShader;
|
|
||||||
mArtifact = artifact;
|
|
||||||
AssignSamplerUniforms(mProgram);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RuntimeShaderRenderer::CommitPreparedProgram(RuntimePreparedShaderProgram& preparedProgram, std::string& error)
|
bool RuntimeShaderRenderer::CommitPreparedProgram(RuntimePreparedShaderProgram& preparedProgram, std::string& error)
|
||||||
{
|
{
|
||||||
if (!preparedProgram.succeeded || preparedProgram.program == 0)
|
if (!preparedProgram.succeeded || preparedProgram.program == 0)
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ public:
|
|||||||
RuntimeShaderRenderer& operator=(const RuntimeShaderRenderer&) = delete;
|
RuntimeShaderRenderer& operator=(const RuntimeShaderRenderer&) = delete;
|
||||||
~RuntimeShaderRenderer();
|
~RuntimeShaderRenderer();
|
||||||
|
|
||||||
bool CommitFragmentShader(const std::string& fragmentShaderSource, std::string& error);
|
|
||||||
bool CommitShaderArtifact(const RuntimeShaderArtifact& artifact, std::string& error);
|
|
||||||
bool CommitPreparedProgram(RuntimePreparedShaderProgram& preparedProgram, std::string& error);
|
bool CommitPreparedProgram(RuntimePreparedShaderProgram& preparedProgram, std::string& error);
|
||||||
bool HasProgram() const { return mProgram != 0; }
|
bool HasProgram() const { return mProgram != 0; }
|
||||||
void UpdateArtifactState(const RuntimeShaderArtifact& artifact);
|
void UpdateArtifactState(const RuntimeShaderArtifact& artifact);
|
||||||
|
|||||||
Reference in New Issue
Block a user