OGLPLUS_LIB_FUNC String GetInfoLog( GLuint object_name, void (GLAPIENTRY *GetObjectiv)(GLuint, GLenum, GLint*), void (GLAPIENTRY *GetObjectInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*), const char* name_GetObjectiv, const char* name_GetObjectInfoLog ) #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY) { int length = 0; GetObjectiv(object_name, GL_INFO_LOG_LENGTH, &length); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO_STR(name_GetObjectiv)); if(length > 0) { GLsizei real_length = 0; std::vector<GLchar> buffer(length); GetObjectInfoLog( object_name, buffer.size(), &real_length, buffer.data() ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO_STR(name_GetObjectInfoLog)); return String(buffer.data(), buffer.size()); } else return String(); }
/** * @glsymbols * @glfunref{GetPerfMonitorCountersAMD} */ void GetCounters( GLint& max_active_counters, std::vector<PerfMonitorAMDCounter>& counters ) const { GLint count = 0; OGLPLUS_GLFUNC(GetPerfMonitorCountersAMD)( _group, &count, &max_active_counters, 0, nullptr ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorCountersAMD)); std::vector<GLuint> buffer(count); OGLPLUS_GLFUNC(GetPerfMonitorCountersAMD)( _group, &count, &max_active_counters, buffer.size(), buffer.data() ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorCountersAMD)); counters.clear(); counters.reserve(count); for(auto i=buffer.begin(), e=buffer.end(); i!=e; ++i) counters.push_back(PerfMonitorAMDCounter(_group, *i)); }
/** * @glsymbols * @glfunref{GetPerfMonitorCounterDataAMD} * @gldefref{PERFMON_RESULT_SIZE_AMD} * @gldefref{PERFMON_RESULT_AMD} */ void Result(std::vector<PerfMonitorAMDResult>& results) const { GLuint size = 0; OGLPLUS_GLFUNC(GetPerfMonitorCounterDataAMD)( this->_name, GL_PERFMON_RESULT_SIZE_AMD, sizeof(size), &size, nullptr ); OGLPLUS_CHECK( GetPerfMonitorCounterDataAMD, ObjectError, Object(*this) ); std::vector<GLuint> data(size / sizeof(GLuint)); OGLPLUS_GLFUNC(GetPerfMonitorCounterDataAMD)( this->_name, GL_PERFMON_RESULT_AMD, data.size() * sizeof(GLuint), data.data(), nullptr ); OGLPLUS_CHECK( GetPerfMonitorCounterDataAMD, ObjectError, Object(*this) ); results.clear(); results.reserve(data.size() / 3); auto i = data.begin(), e = data.end(); while(i != e) { GLuint group = *i++; assert(i != e); GLuint ctr = *i++; assert(i != e); PerfMonitorAMDCounter counter(group, ctr); auto type = counter.Type(); GLuint lo = *i++, hi = 0; if(type == PerfMonitorAMDType::UnsignedInt64) hi = *i++; results.push_back(PerfMonitorAMDResult(counter, lo, hi)); } }
ActiveUniformBlockInfo( ProgramInterfaceContext& context, GLuint index ): _index(0) { GLint length = 0; OGLPLUS_GLFUNC(GetProgramiv)( context.Program(), GL_UNIFORM_BLOCK_NAME_LENGTH, &length ); if(context.Buffer().size() < size_t(length)) context.Buffer().resize(length); OGLPLUS_VERIFY(OGLPLUS_OBJECT_ERROR_INFO( GetProgramiv, Program, nullptr, context.Program() )); GLsizei strlen = 0; OGLPLUS_GLFUNC(GetActiveUniformBlockName)( context.Program(), index, context.Buffer().size(), &strlen, context.Buffer().data() ); OGLPLUS_CHECK(OGLPLUS_OBJECT_ERROR_INFO( GetActiveUniformBlockName, Program, nullptr, context.Program() )); _name = String(context.Buffer().data(), strlen); }
/** * @glsymbols * @glfunref{VertexArrayVertexAttribIOffsetEXT} */ const ObjectOps& VertexAttribIOffset( BufferName buffer, VertexAttribSlot location, GLint values_per_vertex, DataType data_type, GLsizei stride, GLintptr offset ) const { OGLPLUS_GLFUNC(VertexArrayVertexAttribIOffsetEXT)( _name, GetGLName(buffer), GLuint(location), values_per_vertex, GLenum(data_type), stride, offset ); OGLPLUS_CHECK( VertexArrayVertexAttribIOffsetEXT, ObjectError, Object(*this). Index(GLuint(location)) ); return *this; }
/** * @throws Error * * @glvoereq{4,1,ARB,viewport_array} * @glsymbols * @glfunref{Get} * @gldefref{SCISSOR_BOX} */ static ScissorRectangle ScissorBox(GLuint viewport) { ScissorRectangle result; OGLPLUS_GLFUNC(GetIntegeri_v)(GL_SCISSOR_BOX, viewport,result._v); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetIntegeri_v)); return result; }
/** Finds the location / index of the fragment data specified * by @p identifier in a @p program. If active_only is true then * throws if no such fragment data output exists or if it is not active. * * @glsymbols * @glfunref{GetFragDataLocation} */ static GLint GetLocation( ProgramName program, StrCRef identifier, bool active_only ) { GLint result = OGLPLUS_GLFUNC(GetFragDataLocation)( GetGLName(program), identifier.c_str() ); OGLPLUS_CHECK( GetFragDataLocation, ProgVarError, Program(program). Identifier(identifier) ); OGLPLUS_HANDLE_ERROR_IF( active_only && (result < 0), GL_INVALID_OPERATION, MsgGettingInactive(), ProgVarError, Program(program). Identifier(identifier) ); return result; }
/** * @glsymbols * @glfunref{VertexAttribPointer} */ const VertexAttribArray& LPointer( GLuint values_per_vertex, DataType data_type, GLsizei stride, const void* pointer ) const { #if GL_VERSION_4_2 || GL_ARB_vertex_attrib_64bit OGLPLUS_GLFUNC(VertexAttribLPointer)( _location, values_per_vertex, GLenum(data_type), stride, pointer ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(VertexAttribLPointer)); #else assert(! "The glVertexAttribLPointer function is " "required but not available! Double-precision " "vertex attribute values are not supported." ); #endif return *this; }
/** * The @p counters must be from the same group. * * @glsymbols * @glfunref{SelectPerfMonitorCountersAMD} */ void SelectCounters( bool enable, const std::vector<PerfMonitorAMDCounter>& counters ) const { if(counters.empty()) return; std::vector<GLuint> list(counters.size()); GLuint group = counters[0]._group; for(size_t i=0, n=counters.size(); i!=n; ++i) { assert(group == counters[i]._group); list[i] = counters[i]._counter; } OGLPLUS_GLFUNC(SelectPerfMonitorCountersAMD)( this->_name, enable? GL_TRUE: GL_FALSE, group, GLint(list.size()), list.data() ); OGLPLUS_CHECK( SelectPerfMonitorCountersAMD, ObjectError, Object(*this) ); }
ObjectOps& BufferBase(GLuint index, BufferName buffer) { OGLPLUS_GLFUNC(TransformFeedbackBufferBase) (_obj_name(), index, GetGLName(buffer)); OGLPLUS_CHECK( TransformFeedbackBufferBase, ObjectPairError, Subject(buffer).Object(*this).Index(index)); return *this; }
/** * @glextreq{NV,shader_buffer_load} * @glsymbols * @glfunref{MakeNamedBufferNonResidentNV} * * @throws Error */ void MakeNonResident(void) const { OGLPLUS_GLFUNC(MakeNamedBufferNonResidentNV)(_name); OGLPLUS_CHECK( MakeNamedBufferNonResidentNV, ObjectError, Object(*this) ); }
/** * @glsymbols * @glfunref{DisableVertexArrayAttribEXT} */ const DSAVertexArrayAttribEXT& Disable(void) const { OGLPLUS_GLFUNC(DisableVertexArrayAttribEXT)( _vao, GLuint(_location) ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(DisableVertexArrayAttribEXT)); return *this; }
/** * @throws Error * * @glsymbols * @glfunref{DepthRangeIndexed} */ static void DepthRange(GLuint viewport, GLclampd near_val, GLclampd far_val) { OGLPLUS_GLFUNC(DepthRangeIndexed)(viewport, near_val, far_val); OGLPLUS_CHECK( DepthRangeIndexed, Error, Index(viewport) ); }
/** * @glsymbols * @glfunref{BeginPerfMonitorAMD} */ void Begin(void) const { OGLPLUS_GLFUNC(BeginPerfMonitorAMD)(this->_name); OGLPLUS_CHECK( BeginPerfMonitorAMD, ObjectError, Object(*this) ); }
/** * @see GetLocation * @see QueryLocation * * @glsymbols * @glfunref{BindFragDataLocation} */ static void BindLocation( ProgramName program, FragDataSlot location, StrCRef identifier) { OGLPLUS_GLFUNC(BindFragDataLocation) (GetGLName(program), GLuint(location), identifier.c_str()); OGLPLUS_CHECK( BindFragDataLocation, ProgVarError, Program(program).Identifier(identifier).Index(GLuint(location))); }
/** * @glsymbols * @glfunref{EndPerfMonitorAMD} */ void End(void) const { OGLPLUS_GLFUNC(EndPerfMonitorAMD)(this->_name); OGLPLUS_CHECK( EndPerfMonitorAMD, ObjectError, Object(*this) ); }
/** * @throws Error * * @glsymbols * @glfunref{ViewportIndexedfv} */ static void Viewport(GLuint viewport, const GLfloat* extents) { OGLPLUS_GLFUNC(ViewportIndexedfv)(viewport, extents); OGLPLUS_CHECK( ViewportIndexedfv, Error, Index(viewport) ); }
/** * @glvoereq{4,1,ARB,viewport_array} * @glsymbols * @glfunref{ScissorIndexedv} */ static void Scissor(GLuint viewport, GLint* v) { OGLPLUS_GLFUNC(ScissorIndexedv)(viewport, v); OGLPLUS_CHECK( ScissorIndexedv, Error, Index(viewport) ); }
/** @note Only presets from the same instance of UniformSubroutines * that saved them can be loaded or applied. * * @see Preset * @see Save * @see Load */ void Apply(const Preset& preset) { assert(_program == preset._program); assert(_stage == preset._stage); assert(_get_indices().size() == preset._indices.size()); OGLPLUS_GLFUNC(UniformSubroutinesuiv) (GLenum(_stage), GLsizei(preset._indices.size()), preset._indices.data()); OGLPLUS_CHECK(UniformSubroutinesuiv, Error, EnumParam(_stage)); }
/** * @throws Error * * @glsymbols * @glfunref{Get} * @gldefref{DEPTH_RANGE} */ static oglplus::context::DepthRange ViewportDepthRange(GLuint viewport) { oglplus::context::DepthRange result; OGLPLUS_GLFUNC(GetFloati_v)(GL_DEPTH_RANGE, viewport,result._v); OGLPLUS_CHECK( GetFloati_v, Error, Index(viewport) ); return result; }
/** * @glsymbols * @glfunref{GetPerfMonitorCounterInfoAMD} * @gldefref{COUNTER_TYPE_AMD} */ PerfMonitorAMDType Type(void) const { GLenum result; OGLPLUS_GLFUNC(GetPerfMonitorCounterInfoAMD)( _group, _counter, GL_COUNTER_TYPE_AMD, &result ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorCounterInfoAMD)); return PerfMonitorAMDType(result); }
/** * @glsymbols * @glfunref{GetPerfMonitorGroupStringAMD} */ String GetString(void) const { GLsizei length = 0; OGLPLUS_GLFUNC(GetPerfMonitorGroupStringAMD)( _group, 0, &length, nullptr ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorGroupStringAMD)); std::vector<GLchar> buffer(length); OGLPLUS_GLFUNC(GetPerfMonitorGroupStringAMD)( _group, GLsizei(buffer.size()), &length, buffer.data() ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorGroupStringAMD)); return String(buffer.data(), buffer.size()); }
/** * @glsymbols * @glfunref{FlushMappedNamedBufferRange} * * @pre Mapped() * * @throws Error */ void FlushRange(BufferSize offset, BufferSize length) { OGLPLUS_GLFUNC(FlushMappedNamedBufferRange)( _name, GLintptr(offset.Get()), GLsizeiptr(length.Get()) ); OGLPLUS_CHECK( FlushMappedNamedBufferRange, ObjectError, Object(BufferName(_name)) ); }
/** * @glextreq{NV,shader_buffer_load} * @glsymbols * @glfunref{MakeNamedBufferResidentNV} * * @throws Error */ void MakeResident(AccessSpecifier access) const { OGLPLUS_GLFUNC(MakeNamedBufferResidentNV)( _name, GLenum(access) ); OGLPLUS_CHECK( MakeNamedBufferResidentNV, ObjectError, Object(*this). EnumParam(access) ); }
/** * @glsymbols * @glfunref{DispatchCompute} */ static void DispatchCompute( GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z ) { OGLPLUS_GLFUNC(DispatchCompute)( num_groups_x, num_groups_y, num_groups_z ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(DispatchCompute)); }
/** * @glsymbols * @glfunref{FlushMappedBufferRange} * * @pre Mapped() * * @throws Error */ void FlushRange(GLintptr offset, GLsizeiptr length) { OGLPLUS_GLFUNC(FlushMappedBufferRange)( GLenum(_target), offset, length ); OGLPLUS_CHECK( FlushMappedBufferRange, ObjectError, ObjectBinding(_target) ); }
/** * @glsymbols * @glfunref{DisableVertexArrayAttribEXT} */ const ObjectOps& DisableVertexAttrib(VertexAttribSlot location) { OGLPLUS_GLFUNC(DisableVertexArrayAttribEXT)( _name, GLuint(location) ); OGLPLUS_CHECK( DisableVertexArrayAttribEXT, ObjectError, Object(*this). Index(GLuint(location)) ); return *this; }
ObjectOps& BufferRange( GLuint index, BufferName buffer, BufferSize offset, BufferSize size) { OGLPLUS_GLFUNC(TransformFeedbackBufferRange) (_obj_name(), index, GetGLName(buffer), GLintptr(offset.Get()), GLsizeiptr(size.Get())); OGLPLUS_CHECK( TransformFeedbackBufferRange, ObjectPairError, Subject(buffer).Object(*this).Index(index)); return *this; }
ActiveSubroutineUniformInfo( ProgramInterfaceContext& context, GLuint index ): _index(index) , _size(0) { OGLPLUS_GLFUNC(GetActiveSubroutineUniformiv)( context.Program(), context.Stage(), index, GL_UNIFORM_SIZE, &_size ); OGLPLUS_CHECK(OGLPLUS_OBJECT_ERROR_INFO( GetActiveSubroutineUniformiv, Program, nullptr, context.Program() )); GLsizei strlen = 0; OGLPLUS_GLFUNC(GetActiveSubroutineUniformName)( context.Program(), context.Stage(), index, context.Buffer().size(), &strlen, context.Buffer().data() ); OGLPLUS_CHECK(OGLPLUS_OBJECT_ERROR_INFO( GetActiveSubroutineUniformName, Program, nullptr, context.Program() )); _name = String(context.Buffer().data(), strlen); }
/** * @throws Error * * @glsymbols * @glfunref{ViewportIndexedf} */ static void Viewport( GLuint viewport, GLfloat x, GLfloat y, GLfloat width, GLfloat height ) { OGLPLUS_GLFUNC(ViewportIndexedf)(viewport, x, y, width, height); OGLPLUS_CHECK( ViewportIndexedf, Error, Index(viewport) ); }