Browse Source

Added TransformFeedback::maxVertexStreams() limit query.

pull/187/head^2
Vladimír Vondruš 10 years ago
parent
commit
9a7d3a1bec
  1. 1
      doc/opengl-mapping.dox
  2. 2
      src/Magnum/Implementation/TransformFeedbackState.cpp
  3. 3
      src/Magnum/Implementation/TransformFeedbackState.h
  4. 1
      src/Magnum/Platform/magnum-info.cpp
  5. 12
      src/Magnum/TransformFeedback.cpp
  6. 12
      src/Magnum/TransformFeedback.h

1
doc/opengl-mapping.dox

@ -478,6 +478,7 @@ OpenGL function | Matching API
@def_gl{MAX_VERTEX_ATTRIB_STRIDE} | | @def_gl{MAX_VERTEX_ATTRIB_STRIDE} | |
@def_gl{MAX_VERTEX_ATTRIB_BINDINGS} | | @def_gl{MAX_VERTEX_ATTRIB_BINDINGS} | |
@def_gl{MAX_VERTEX_ATTRIB_RELATIVE_OFFSET} | | @def_gl{MAX_VERTEX_ATTRIB_RELATIVE_OFFSET} | |
@def_gl{MAX_VERTEX_STREAMS} | @ref TransformFeedback::maxVertexStreams()
@def_gl{MAX_VIEWPORTS} | | @def_gl{MAX_VIEWPORTS} | |
@def_gl{MAX_VIEWPORT_DIMS} | @ref AbstractFramebuffer::maxViewportSize() @def_gl{MAX_VIEWPORT_DIMS} | @ref AbstractFramebuffer::maxViewportSize()
@def_gl{MIN_FRAGMENT_INTERPOLATION_OFFSET}, \n @def_gl{MAX_FRAGMENT_INTERPOLATION_OFFSET} | | @def_gl{MIN_FRAGMENT_INTERPOLATION_OFFSET}, \n @def_gl{MAX_FRAGMENT_INTERPOLATION_OFFSET} | |

2
src/Magnum/Implementation/TransformFeedbackState.cpp

@ -10,7 +10,7 @@ namespace Magnum { namespace Implementation {
TransformFeedbackState::TransformFeedbackState(Context& context, std::vector<std::string>& extensions): maxInterleavedComponents{0}, maxSeparateAttributes{0}, maxSeparateComponents{0} TransformFeedbackState::TransformFeedbackState(Context& context, std::vector<std::string>& extensions): maxInterleavedComponents{0}, maxSeparateAttributes{0}, maxSeparateComponents{0}
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
, maxBuffers{0} , maxBuffers{0}, maxVertexStreams{0}
#endif #endif
{ {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

3
src/Magnum/Implementation/TransformFeedbackState.h

@ -53,7 +53,8 @@ struct TransformFeedbackState {
maxSeparateAttributes, maxSeparateAttributes,
maxSeparateComponents; maxSeparateComponents;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GLint maxBuffers; GLint maxBuffers,
maxVertexStreams;
#endif #endif
GLuint binding; GLuint binding;

1
src/Magnum/Platform/magnum-info.cpp

@ -612,6 +612,7 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_h(ARB::transform_feedback3) _h(ARB::transform_feedback3)
_l(TransformFeedback::maxBuffers()) _l(TransformFeedback::maxBuffers())
_l(TransformFeedback::maxVertexStreams())
} }
#endif #endif

12
src/Magnum/TransformFeedback.cpp

@ -94,6 +94,18 @@ Int TransformFeedback::maxBuffers() {
return value; return value;
} }
Int TransformFeedback::maxVertexStreams() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback3>())
return 1;
GLint& value = Context::current().state().transformFeedback->maxVertexStreams;
if(value == 0)
glGetIntegerv(GL_MAX_VERTEX_STREAMS, &value);
return value;
}
#endif #endif
TransformFeedback::TransformFeedback(): _flags{ObjectFlag::DeleteOnDestruction} { TransformFeedback::TransformFeedback(): _flags{ObjectFlag::DeleteOnDestruction} {

12
src/Magnum/TransformFeedback.h

@ -147,6 +147,18 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject {
* WebGL. * WebGL.
*/ */
static Int maxBuffers(); static Int maxBuffers();
/**
* @brief Max supported vertex stream count
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,transform_feedback3} (part
* of OpenGL 4.0) is not available, returns `1`.
* @see @fn_gl{Get} with @def_gl{MAX_VERTEX_STREAMS}
* @requires_gl Multiple vertex streams are not available in OpenGL ES
* and WebGL.
*/
static Int maxVertexStreams();
#endif #endif
/** /**

Loading…
Cancel
Save