11#ifndef CSCI441_SHADER_PROGRAM_PIPELINE_HPP
12#define CSCI441_SHADER_PROGRAM_PIPELINE_HPP
14#include "LogUtils.hpp"
33 [[maybe_unused]]
static void enableDebugMessages();
38 [[maybe_unused]]
static void disableDebugMessages();
76 [[maybe_unused]]
void useProgramStages( GLbitfield programStages, const
ShaderProgram *shaderProgram ) const;
83 [[maybe_unused]]
void useProgramStages( const
ShaderProgram *shaderProgram ) const;
89 [[maybe_unused]]
void bindPipeline() const;
94 [[maybe_unused]]
void printPipelineInfo() const;
100 [[maybe_unused]] [[nodiscard]]
bool validatePipeline() const;
105 GLuint _pipelineHandle;
124 glGenProgramPipelines(1,& _pipelineHandle);
128 glDeleteProgramPipelines(1, &_pipelineHandle);
132 _pipelineHandle = src._pipelineHandle;
133 src._pipelineHandle = 0;
140 glDeleteProgramPipelines(1, &_pipelineHandle);
142 _pipelineHandle = src._pipelineHandle;
143 src._pipelineHandle = 0;
163 glBindProgramPipeline( _pipelineHandle );
173 CSCI441_INTERNAL::ShaderUtils::printProgramPipelineLog(_pipelineHandle);
177 GLint vs, tcs, tes, gs, fs, cs;
178 glGetProgramPipelineiv( _pipelineHandle, GL_VERTEX_SHADER, &vs );
179 glGetProgramPipelineiv( _pipelineHandle, GL_TESS_CONTROL_SHADER, &tcs );
180 glGetProgramPipelineiv( _pipelineHandle, GL_TESS_EVALUATION_SHADER, &tes );
181 glGetProgramPipelineiv( _pipelineHandle, GL_GEOMETRY_SHADER, &gs );
182 glGetProgramPipelineiv( _pipelineHandle, GL_FRAGMENT_SHADER, &fs );
185 glGetIntegerv(GL_MAJOR_VERSION, &major);
186 glGetIntegerv(GL_MINOR_VERSION, &minor);
188 if(major > 4 || (major == 4 && minor >= 3)) {
189 glGetProgramPipelineiv( _pipelineHandle, GL_COMPUTE_SHADER, &cs );
197 if(major < 4 || (major == 4 && minor >= 3)) {
208 glValidateProgramPipeline(_pipelineHandle);
209 GLint validateStatus;
210 glGetProgramPipelineiv(_pipelineHandle, GL_VALIDATE_STATUS, &validateStatus);
211 return (validateStatus == GL_TRUE);
Class to work with OpenGL 4.0+ Shaders.
Handles registration and compilation of Shaders.
Definition: ShaderProgram.hpp:37
virtual GLbitfield getProgramStages() const
returns a single value corresponding to which shader stages are present in this shader program
Definition: ShaderProgram.hpp:2127
virtual GLuint getShaderProgramHandle() const final
Returns the handle for this shader program.
Definition: ShaderProgram.hpp:1529
Handles registration and compilation of Shader Program Pipelines.
Definition: ShaderProgramPipeline.hpp:27
ShaderProgramPipeline(const ShaderProgramPipeline &)=delete
do not allow shader program pipelines to be copied
void useProgramStages(GLbitfield programStages, const ShaderProgram *shaderProgram) const
adds shader program stages to pipeline
Definition: ShaderProgramPipeline.hpp:151
ShaderProgramPipeline()
creates a shader program pipeline by generating a shader program pipeline handle
Definition: ShaderProgramPipeline.hpp:123
bool validatePipeline() const
Definition: ShaderProgramPipeline.hpp:207
void bindPipeline() const
bind shader program pipeline
Definition: ShaderProgramPipeline.hpp:161
ShaderProgramPipeline & operator=(const ShaderProgramPipeline &)=delete
do not allow shader program pipelines to be copied
~ShaderProgramPipeline()
deletes a shader program pipeline by deleting the shader program pipeline handle
Definition: ShaderProgramPipeline.hpp:127
static void disableDebugMessages()
Disables debug messages from Shader Program functions.
Definition: ShaderProgramPipeline.hpp:119
void printPipelineInfo() const
prints shader program pipeline information to console
Definition: ShaderProgramPipeline.hpp:167
void log(const char *MSG,...)
log a message to both the standard output stream and file
Definition: LogUtils.hpp:116
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17