Skip to content

Commit

Permalink
De-member some helper functions from GLProgramFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Mar 2, 2022
1 parent f610223 commit ba4fb83
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
13 changes: 9 additions & 4 deletions radiantcore/rendersystem/backend/GLProgramFactory.cpp
Expand Up @@ -72,7 +72,7 @@ void GLProgramFactory::realise()
}

// Unrealise the program factory.
void GLProgramFactory::unrealise()
void GLProgramFactory::unrealise()
{
// Destroy each GLProgram in the map
for (ProgramMap::value_type& pair : _builtInPrograms)
Expand Down Expand Up @@ -111,7 +111,10 @@ GLProgramFactory::getFileAsBuffer(const std::string& filename,
return buffer;
}

void GLProgramFactory::assertShaderCompiled(GLuint shader)
namespace
{

void assertShaderCompiled(GLuint shader)
{
// Get compile status
GLint compileStatus;
Expand All @@ -136,7 +139,7 @@ void GLProgramFactory::assertShaderCompiled(GLuint shader)
}
}

std::string GLProgramFactory::getProgramInfoLog(GLuint program)
std::string getProgramInfoLog(GLuint program)
{
// Get log length
int logLength;
Expand All @@ -151,7 +154,7 @@ std::string GLProgramFactory::getProgramInfoLog(GLuint program)
return logStr;
}

void GLProgramFactory::assertProgramLinked(GLuint program)
void assertProgramLinked(GLuint program)
{
// Check the link status
GLint linkStatus;
Expand Down Expand Up @@ -183,6 +186,8 @@ void GLProgramFactory::assertProgramLinked(GLuint program)
#endif
}

} // namespace

GLuint GLProgramFactory::createGLSLProgram(const std::string& vFile,
const std::string& fFile)
{
Expand Down
14 changes: 2 additions & 12 deletions radiantcore/rendersystem/backend/GLProgramFactory.h
Expand Up @@ -50,16 +50,6 @@ class GLProgramFactory
static CharBufPtr getFileAsBuffer(const std::string& filename,
bool nullTerminated);

// Get the program info log as a string
static std::string getProgramInfoLog(GLuint program);

// Check the status of a shader, and throw exception with the info log if it
// is not valid
static void assertShaderCompiled(GLuint shader);

// Check the program has linked, throwing exception if failed
static void assertProgramLinked(GLuint program);

public:
// Constructor, populates internal map
GLProgramFactory();
Expand All @@ -75,9 +65,9 @@ class GLProgramFactory
/**
* Gets or creates the GL program for the given V/F program filenames.
* The programs will be loaded from the game's glprogs/ folder
* as in the idTech4 engine.
* as in the idTech4 engine.
*
* The returned pointer is always non-null, on failures a
* The returned pointer is always non-null, on failures a
* std::runtime_error will be thrown.
*/
GLProgram* getProgram(const std::string& vertexProgramFilename,
Expand Down
4 changes: 2 additions & 2 deletions radiantcore/rendersystem/backend/glprogram/GLSLBumpProgram.h
Expand Up @@ -6,7 +6,7 @@
namespace render
{

class GLSLBumpProgram :
class GLSLBumpProgram :
public GLSLProgramBase
{
private:
Expand All @@ -30,7 +30,7 @@ class GLSLBumpProgram :

void applyRenderParams(const Vector3& viewer,
const Matrix4& localToWorld,
const Params&);
const Params&) override;
};

} // namespace render
Expand Down
Expand Up @@ -23,9 +23,8 @@ class GLSLCubeMapProgram :
void enable() override;
void disable() override;

void applyRenderParams(const Vector3& viewer,
const Matrix4& localToWorld,
const Params&);
void applyRenderParams(const Vector3& viewer, const Matrix4& localToWorld,
const Params&) override;
};

} // namespace render
Expand Down

0 comments on commit ba4fb83

Please sign in to comment.