13 #ifndef OGLPLUS_UNIFORM_SUBROUTINE_1107121519_HPP
14 #define OGLPLUS_UNIFORM_SUBROUTINE_1107121519_HPP
21 #include <oglplus/prog_var/set_ops.hpp>
29 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_0 || GL_ARB_shader_subroutine
36 static const char* MsgGettingInactive(
void);
38 static const char* MsgUsingInactive(
void);
52 static GLint GetLocation(
59 GLint result = OGLPLUS_GLFUNC(GetSubroutineIndex)(
68 Identifier(identifier).
71 OGLPLUS_HANDLE_ERROR_IF(
72 active_only && (result < 0),
77 Identifier(identifier).
139 typedef ProgVar<tag::ImplicitSel, tag::Subroutine, tag::NoTypecheck, void>
147 static const char* MsgGettingInactive(
void);
149 static const char* MsgUsingInactive(
void);
162 static GLint GetLocation(
169 GLint result = OGLPLUS_GLFUNC(GetSubroutineUniformLocation)(
175 GetSubroutineUniformLocation,
178 Identifier(identifier).
181 OGLPLUS_HANDLE_ERROR_IF(
182 active_only && (result < 0),
183 GL_INVALID_OPERATION,
184 MsgGettingInactive(),
187 Identifier(identifier).
253 typedef ProgVar<tag::ImplicitSel, tag::SubroutineUniform, tag::NoTypecheck, void>
267 std::vector<GLuint> _indices;
269 static GLsizei _get_location_count(
275 OGLPLUS_GLFUNC(GetProgramStageiv)(
278 GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS,
290 std::vector<GLuint>& _get_indices(
void)
325 assert(uniform.
Program() == _program);
326 assert(subroutine.
Program() == _program);
327 assert(uniform.Stage() ==
ShaderType(_stage));
328 assert(subroutine.Stage() ==
ShaderType(_stage));
330 assert(uniform.
Location() <= GLint(_get_indices().size()));
352 const std::vector<GLuint> _indices;
363 const std::vector<GLuint>& indices
372 : _indices(std::move(tmp._indices))
374 , _program(tmp._program)
407 assert(_program == preset._program);
408 assert(_stage == preset._stage);
409 assert(_get_indices().size() == preset._indices.size());
410 _get_indices() = preset._indices;
423 assert(_program == preset._program);
424 assert(_stage == preset._stage);
425 assert(_get_indices().size() == preset._indices.size());
427 OGLPLUS_GLFUNC(UniformSubroutinesuiv)(
429 GLsizei(preset._indices.size()),
430 preset._indices.data()
433 UniformSubroutinesuiv,
445 OGLPLUS_GLFUNC(UniformSubroutinesuiv)(
447 GLsizei(_get_indices().size()),
448 _get_indices().data()
451 UniformSubroutinesuiv,
458 #endif // GL_ARB_shader_subroutine
462 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
463 #include <oglplus/uniform_subroutines.ipp>
464 #endif // OGLPLUS_LINK_LIBRARY
466 #endif // include guard
ProgVar< tag::ImplicitSel, tag::Subroutine, tag::NoTypecheck, void > Subroutine
Subroutine.
Definition: uniform_subroutines.hpp:140
const Char * c_str(void) const
Returns the null-terminated c-string.
Definition: ref_tpl.hpp:200
ShaderType
The type of a Shader.
Definition: shader_type.hpp:26
Program variable wrapper.
Program variable location wrapper.
Wrapper encapsulating program variable location/index.
Definition: fwd.hpp:191
Declaration of OGLplus object-related error.
ProgVar(ProgramName program, ShaderType stage, StrCRef identifier, bool active_only)
Subroutine with the specified identifier in stage of program.
Definition: uniform_subroutines.hpp:129
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
Specialization of ProgVar for subroutines.
Definition: uniform_subroutines.hpp:114
String const reference wrapper template.
Definition: ref_tpl.hpp:72
ProgVar(SubroutineLoc pvloc)
Subroutine with the specified location.
Definition: uniform_subroutines.hpp:119
Helper macro for optional checking of availability of GL function.
Exception class for GL program-variable-related errors.
Definition: prog_var.hpp:22
bool IsActive(void) const
Returns true if the variable is active.
Definition: location.hpp:159
ProgVar< tag::ImplicitSel, tag::SubroutineUniform, tag::NoTypecheck, void > SubroutineUniform
SubroutineUniform.
Definition: uniform_subroutines.hpp:254
Exception class for general OpenGL errors.
Definition: basic.hpp:43
Exception class for GL object-related errors.
Definition: object.hpp:24
Program variable (vertex attrib / uniform ) wrapper.
Definition: fwd.hpp:222
ProgVar(ProgramName program, ShaderType stage, StrCRef identifier)
Subroutine with the specified identifier in stage of program.
Definition: uniform_subroutines.hpp:124
Declaration of OGLplus program-variable-related error.
GLint Location(void) const
Returns the location of the variable.
Definition: location.hpp:152
ProgramName Program(void) const
The program the variable belongs to.
Definition: location.hpp:145