Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions include/ghoul/opengl/ghoul_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif

#include <glbinding/gl41core/gl.h>
#include <glbinding/gl46core/gl.h>
#include <glbinding/Binding.h>
#define __GL_H__

Expand All @@ -69,20 +69,16 @@ namespace ghoul {

struct GLDebugGroup {
explicit GLDebugGroup(std::string_view name) {
if (glbinding::Binding::PushDebugGroup.isResolved()) {
glPushDebugGroup(
GL_DEBUG_SOURCE_APPLICATION,
0,
static_cast<GLsizei>(name.length()),
name.data()
);
}
glPushDebugGroup(
GL_DEBUG_SOURCE_APPLICATION,
0,
static_cast<GLsizei>(name.length()),
name.data()
);
}

~GLDebugGroup() {
if (glbinding::Binding::PopDebugGroup.isResolved()) {
glPopDebugGroup();
}
glPopDebugGroup();
}
};

Expand Down
38 changes: 38 additions & 0 deletions include/ghoul/opengl/programobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

namespace ghoul::opengl {

class NewTexture;

/**
* This class is a wrapper for an OpenGL program object storing an array of OpenGL
* shaders. The usual restrictions for shader objects as described in the OpenGL and GLSL
Expand Down Expand Up @@ -239,6 +241,17 @@ class ProgramObject {
*/
void rebuildFromFile();

/**
* Calls the OpenGL driver to validate the program object. This should only be done
* close to the actual draw call usage and with the same state. Any messages reported
* by the driver will be printed as informational messages. If the validation fails
* an error message will be raised.
*
* Note: This function should only be called when full performance is not needed, for
* example in Debug environments or during shaderd development
*/
void validate() const;

/**
* Returns whether this ProgramObject is dirty and needs to be recompiled and rebuilt
* due to a change in the underlying file. A ProgramObject is automatically set to be
Expand Down Expand Up @@ -1286,6 +1299,19 @@ class ProgramObject {
bool setUniform(const std::string& name, const glm::dmat4x4& value,
Transpose transpose = Transpose::No) const;

/**
* Locates and sets the uniform(s) \p name with the passed value \p value. Returns
* `true` if the initial uniform could be found; `false` otherwise. Will call the
* OpenGL function `glProgramUniformHandleui64ARB`.
*
* \param name The name of the uniform in the ShaderObject%s
* \param value The value the uniform should be set to
* \return `true` if the initial uniform was successfully located, `false` otherwise
*
* \pre \p name must not be empty
*/
bool setUniform(const std::string& name, const NewTexture& value) const;

/**
* Sets the uniform located at \p location with the passed \p value. Will call the
* OpenGL function `glProgramUniform1ui`.
Expand Down Expand Up @@ -2076,6 +2102,18 @@ class ProgramObject {
void setUniform(GLint location, const glm::dmat4x4& value,
Transpose transpose = Transpose::No) const;

/**
* Sets the uniform(s) located at \p location with the passed value \p value. Returns
* `true` if the initial uniform could be found; `false` otherwise. Will call the
* OpenGL function `glProgramUniformHandleui64ARB`.
*
* \param location The location of the uniform retrieved from #uniformLocation
* \param value The value the uniform should be set to
*
* \pre \p location must not be `-1`
*/
void setUniform(GLint location, const NewTexture& value) const;


//////////////////////////////////////////////////////////////////////////////////////
////// SSBO Bindings
Expand Down
Loading