Browse Source

Implemented EXT_tessellation_shader AEP extension.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
3adec2432c
  1. 2
      doc/opengl-support.dox
  2. 17
      src/Magnum/Implementation/ShaderState.h
  3. 31
      src/Magnum/Platform/magnum-info.cpp
  4. 87
      src/Magnum/Shader.cpp
  5. 76
      src/Magnum/Shader.h

2
doc/opengl-support.dox

@ -365,7 +365,7 @@ Extension | Status
@es_extension{EXT,geometry_shader} | missing some ES-specific limit queries @es_extension{EXT,geometry_shader} | missing some ES-specific limit queries
@es_extension{EXT,gpu_shader5} | done (shading language only) @es_extension{EXT,gpu_shader5} | done (shading language only)
@es_extension{EXT,shader_io_blocks} | done (shading language only) @es_extension{EXT,shader_io_blocks} | done (shading language only)
@es_extension{EXT,tessellation_shader} | | @es_extension{EXT,tessellation_shader} | see above
@es_extension{EXT,texture_border_clamp} | done @es_extension{EXT,texture_border_clamp} | done
@es_extension{EXT,texture_buffer} | done @es_extension{EXT,texture_buffer} | done
@es_extension{EXT,texture_cube_map_array} | done @es_extension{EXT,texture_cube_map_array} | done

17
src/Magnum/Implementation/ShaderState.h

@ -34,11 +34,8 @@ namespace Magnum { namespace Implementation {
struct ShaderState { struct ShaderState {
explicit ShaderState(): explicit ShaderState():
maxVertexOutputComponents{}, maxFragmentInputComponents{}, maxVertexOutputComponents{}, maxFragmentInputComponents{},
#ifndef MAGNUM_TARGET_GLES
maxTessellationControlInputComponents{}, maxTessellationControlOutputComponents{}, maxTessellationControlTotalOutputComponents{}, maxTessellationEvaluationInputComponents{}, maxTessellationEvaluationOutputComponents{},
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
maxGeometryInputComponents{}, maxGeometryOutputComponents{}, maxGeometryTotalOutputComponents{}, maxAtomicCounterBuffers{}, maxCombinedAtomicCounterBuffers{}, maxAtomicCounters{}, maxCombinedAtomicCounters{}, maxImageUniforms{}, maxCombinedImageUniforms{}, maxShaderStorageBlocks{}, maxCombinedShaderStorageBlocks{}, maxTessellationControlInputComponents{}, maxTessellationControlOutputComponents{}, maxTessellationControlTotalOutputComponents{}, maxTessellationEvaluationInputComponents{}, maxTessellationEvaluationOutputComponents{}, maxGeometryInputComponents{}, maxGeometryOutputComponents{}, maxGeometryTotalOutputComponents{}, maxAtomicCounterBuffers{}, maxCombinedAtomicCounterBuffers{}, maxAtomicCounters{}, maxCombinedAtomicCounters{}, maxImageUniforms{}, maxCombinedImageUniforms{}, maxShaderStorageBlocks{}, maxCombinedShaderStorageBlocks{},
#endif #endif
maxTextureImageUnits{}, maxTextureImageUnitsCombined{}, maxTextureImageUnits{}, maxTextureImageUnitsCombined{},
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -51,9 +48,7 @@ struct ShaderState {
{} {}
enum: std::size_t { enum: std::size_t {
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
StageCount = 6
#elif !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
StageCount = 4 StageCount = 4
#else #else
StageCount = 2 StageCount = 2
@ -62,15 +57,13 @@ struct ShaderState {
GLint maxVertexOutputComponents, GLint maxVertexOutputComponents,
maxFragmentInputComponents; maxFragmentInputComponents;
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
GLint maxTessellationControlInputComponents, GLint maxTessellationControlInputComponents,
maxTessellationControlOutputComponents, maxTessellationControlOutputComponents,
maxTessellationControlTotalOutputComponents, maxTessellationControlTotalOutputComponents,
maxTessellationEvaluationInputComponents, maxTessellationEvaluationInputComponents,
maxTessellationEvaluationOutputComponents; maxTessellationEvaluationOutputComponents,
#endif maxGeometryInputComponents,
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
GLint maxGeometryInputComponents,
maxGeometryOutputComponents, maxGeometryOutputComponents,
maxGeometryTotalOutputComponents; maxGeometryTotalOutputComponents;
GLint maxAtomicCounterBuffers[StageCount]; GLint maxAtomicCounterBuffers[StageCount];

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

@ -317,22 +317,18 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(Shader::maxVertexOutputComponents()) _l(Shader::maxVertexOutputComponents())
_l(Shader::maxFragmentInputComponents()) _l(Shader::maxFragmentInputComponents())
_l(Shader::maxTextureImageUnits(Shader::Type::Vertex)) _l(Shader::maxTextureImageUnits(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
_l(Shader::maxTextureImageUnits(Shader::Type::TessellationControl)) _l(Shader::maxTextureImageUnits(Shader::Type::TessellationControl))
_l(Shader::maxTextureImageUnits(Shader::Type::TessellationEvaluation)) _l(Shader::maxTextureImageUnits(Shader::Type::TessellationEvaluation))
#endif
#ifndef MAGNUM_TARGET_GLES2
_l(Shader::maxTextureImageUnits(Shader::Type::Geometry)) _l(Shader::maxTextureImageUnits(Shader::Type::Geometry))
_l(Shader::maxTextureImageUnits(Shader::Type::Compute)) _l(Shader::maxTextureImageUnits(Shader::Type::Compute))
#endif #endif
_l(Shader::maxTextureImageUnits(Shader::Type::Fragment)) _l(Shader::maxTextureImageUnits(Shader::Type::Fragment))
_l(Shader::maxCombinedTextureImageUnits()) _l(Shader::maxCombinedTextureImageUnits())
_l(Shader::maxUniformComponents(Shader::Type::Vertex)) _l(Shader::maxUniformComponents(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
_l(Shader::maxUniformComponents(Shader::Type::TessellationControl)) _l(Shader::maxUniformComponents(Shader::Type::TessellationControl))
_l(Shader::maxUniformComponents(Shader::Type::TessellationEvaluation)) _l(Shader::maxUniformComponents(Shader::Type::TessellationEvaluation))
#endif
#ifndef MAGNUM_TARGET_GLES2
_l(Shader::maxUniformComponents(Shader::Type::Geometry)) _l(Shader::maxUniformComponents(Shader::Type::Geometry))
_l(Shader::maxUniformComponents(Shader::Type::Compute)) _l(Shader::maxUniformComponents(Shader::Type::Compute))
#endif #endif
@ -413,19 +409,15 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(Buffer::maxAtomicCounterBindings()) _l(Buffer::maxAtomicCounterBindings())
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Vertex)) _l(Shader::maxAtomicCounterBuffers(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES
_l(Shader::maxAtomicCounterBuffers(Shader::Type::TessellationControl)) _l(Shader::maxAtomicCounterBuffers(Shader::Type::TessellationControl))
_l(Shader::maxAtomicCounterBuffers(Shader::Type::TessellationEvaluation)) _l(Shader::maxAtomicCounterBuffers(Shader::Type::TessellationEvaluation))
#endif
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Geometry)) _l(Shader::maxAtomicCounterBuffers(Shader::Type::Geometry))
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Compute)) _l(Shader::maxAtomicCounterBuffers(Shader::Type::Compute))
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Fragment)) _l(Shader::maxAtomicCounterBuffers(Shader::Type::Fragment))
_l(Shader::maxCombinedAtomicCounterBuffers()) _l(Shader::maxCombinedAtomicCounterBuffers())
_l(Shader::maxAtomicCounters(Shader::Type::Vertex)) _l(Shader::maxAtomicCounters(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES
_l(Shader::maxAtomicCounters(Shader::Type::TessellationControl)) _l(Shader::maxAtomicCounters(Shader::Type::TessellationControl))
_l(Shader::maxAtomicCounters(Shader::Type::TessellationEvaluation)) _l(Shader::maxAtomicCounters(Shader::Type::TessellationEvaluation))
#endif
_l(Shader::maxAtomicCounters(Shader::Type::Geometry)) _l(Shader::maxAtomicCounters(Shader::Type::Geometry))
_l(Shader::maxAtomicCounters(Shader::Type::Compute)) _l(Shader::maxAtomicCounters(Shader::Type::Compute))
_l(Shader::maxAtomicCounters(Shader::Type::Fragment)) _l(Shader::maxAtomicCounters(Shader::Type::Fragment))
@ -442,10 +434,8 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
#endif #endif
_l(Shader::maxImageUniforms(Shader::Type::Vertex)) _l(Shader::maxImageUniforms(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES
_l(Shader::maxImageUniforms(Shader::Type::TessellationControl)) _l(Shader::maxImageUniforms(Shader::Type::TessellationControl))
_l(Shader::maxImageUniforms(Shader::Type::TessellationEvaluation)) _l(Shader::maxImageUniforms(Shader::Type::TessellationEvaluation))
#endif
_l(Shader::maxImageUniforms(Shader::Type::Geometry)) _l(Shader::maxImageUniforms(Shader::Type::Geometry))
_l(Shader::maxImageUniforms(Shader::Type::Compute)) _l(Shader::maxImageUniforms(Shader::Type::Compute))
_l(Shader::maxImageUniforms(Shader::Type::Fragment)) _l(Shader::maxImageUniforms(Shader::Type::Fragment))
@ -466,10 +456,8 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
#endif #endif
_l(Shader::maxShaderStorageBlocks(Shader::Type::Vertex)) _l(Shader::maxShaderStorageBlocks(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES
_l(Shader::maxShaderStorageBlocks(Shader::Type::TessellationControl)) _l(Shader::maxShaderStorageBlocks(Shader::Type::TessellationControl))
_l(Shader::maxShaderStorageBlocks(Shader::Type::TessellationEvaluation)) _l(Shader::maxShaderStorageBlocks(Shader::Type::TessellationEvaluation))
#endif
_l(Shader::maxShaderStorageBlocks(Shader::Type::Geometry)) _l(Shader::maxShaderStorageBlocks(Shader::Type::Geometry))
_l(Shader::maxShaderStorageBlocks(Shader::Type::Compute)) _l(Shader::maxShaderStorageBlocks(Shader::Type::Compute))
_l(Shader::maxShaderStorageBlocks(Shader::Type::Fragment)) _l(Shader::maxShaderStorageBlocks(Shader::Type::Fragment))
@ -479,9 +467,18 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
} }
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(c->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>()) { if(c->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>())
#else
if(c->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
#endif
{
#ifndef MAGNUM_TARGET_GLES
_h(ARB::tessellation_shader) _h(ARB::tessellation_shader)
#else
_h(EXT::tessellation_shader)
#endif
_l(Buffer::shaderStorageOffsetAlignment()) _l(Buffer::shaderStorageOffsetAlignment())
_l(Buffer::maxShaderStorageBindings()) _l(Buffer::maxShaderStorageBindings())
@ -576,19 +573,15 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(Buffer::uniformOffsetAlignment()) _l(Buffer::uniformOffsetAlignment())
_l(Shader::maxUniformBlocks(Shader::Type::Vertex)) _l(Shader::maxUniformBlocks(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES
_l(Shader::maxUniformBlocks(Shader::Type::TessellationControl)) _l(Shader::maxUniformBlocks(Shader::Type::TessellationControl))
_l(Shader::maxUniformBlocks(Shader::Type::TessellationEvaluation)) _l(Shader::maxUniformBlocks(Shader::Type::TessellationEvaluation))
#endif
_l(Shader::maxUniformBlocks(Shader::Type::Geometry)) _l(Shader::maxUniformBlocks(Shader::Type::Geometry))
_l(Shader::maxUniformBlocks(Shader::Type::Compute)) _l(Shader::maxUniformBlocks(Shader::Type::Compute))
_l(Shader::maxUniformBlocks(Shader::Type::Fragment)) _l(Shader::maxUniformBlocks(Shader::Type::Fragment))
_l(Shader::maxCombinedUniformBlocks()) _l(Shader::maxCombinedUniformBlocks())
_l(Shader::maxCombinedUniformComponents(Shader::Type::Vertex)) _l(Shader::maxCombinedUniformComponents(Shader::Type::Vertex))
#ifndef MAGNUM_TARGET_GLES
_l(Shader::maxCombinedUniformComponents(Shader::Type::TessellationControl)) _l(Shader::maxCombinedUniformComponents(Shader::Type::TessellationControl))
_l(Shader::maxCombinedUniformComponents(Shader::Type::TessellationEvaluation)) _l(Shader::maxCombinedUniformComponents(Shader::Type::TessellationEvaluation))
#endif
_l(Shader::maxCombinedUniformComponents(Shader::Type::Geometry)) _l(Shader::maxCombinedUniformComponents(Shader::Type::Geometry))
_l(Shader::maxCombinedUniformComponents(Shader::Type::Compute)) _l(Shader::maxCombinedUniformComponents(Shader::Type::Compute))
_l(Shader::maxCombinedUniformComponents(Shader::Type::Fragment)) _l(Shader::maxCombinedUniformComponents(Shader::Type::Fragment))

87
src/Magnum/Shader.cpp

@ -62,12 +62,8 @@ std::string shaderName(const Shader::Type type) {
case Shader::Type::Vertex: return "vertex"; case Shader::Type::Vertex: return "vertex";
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
case Shader::Type::Geometry: return "geometry"; case Shader::Type::Geometry: return "geometry";
#endif
#ifndef MAGNUM_TARGET_GLES
case Shader::Type::TessellationControl: return "tessellation control"; case Shader::Type::TessellationControl: return "tessellation control";
case Shader::Type::TessellationEvaluation: return "tessellation evaluation"; case Shader::Type::TessellationEvaluation: return "tessellation evaluation";
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
case Shader::Type::Compute: return "compute"; case Shader::Type::Compute: return "compute";
#endif #endif
case Shader::Type::Fragment: return "fragment"; case Shader::Type::Fragment: return "fragment";
@ -83,8 +79,6 @@ UnsignedInt typeToIndex(const Shader::Type type) {
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
case Shader::Type::Compute: return 2; case Shader::Type::Compute: return 2;
case Shader::Type::Geometry: return 3; case Shader::Type::Geometry: return 3;
#endif
#ifndef MAGNUM_TARGET_GLES
case Shader::Type::TessellationControl: return 4; case Shader::Type::TessellationControl: return 4;
case Shader::Type::TessellationEvaluation: return 5; case Shader::Type::TessellationEvaluation: return 5;
#endif #endif
@ -111,6 +105,9 @@ bool isTypeSupported(const Shader::Type type) {
if(type == Shader::Type::Geometry && !Context::current()->isExtensionSupported<Extensions::GL::EXT::geometry_shader>()) if(type == Shader::Type::Geometry && !Context::current()->isExtensionSupported<Extensions::GL::EXT::geometry_shader>())
return false; return false;
if((type == Shader::Type::TessellationControl || type == Shader::Type::TessellationEvaluation) && !Context::current()->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
return false;
if(type == Shader::Type::Compute && !Context::current()->isVersionSupported(Version::GLES310)) if(type == Shader::Type::Compute && !Context::current()->isVersionSupported(Version::GLES310))
return false; return false;
@ -143,74 +140,122 @@ Int Shader::maxVertexOutputComponents() {
return value; return value;
} }
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Int Shader::maxTessellationControlInputComponents() { Int Shader::maxTessellationControlInputComponents() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>())
return 0; return 0;
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
return 0;
#endif
GLint& value = Context::current()->state().shader->maxTessellationControlInputComponents; GLint& value = Context::current()->state().shader->maxTessellationControlInputComponents;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0) glGetIntegerv(
glGetIntegerv(GL_MAX_TESS_CONTROL_INPUT_COMPONENTS, &value); #ifndef MAGNUM_TARGET_GLES
GL_MAX_TESS_CONTROL_INPUT_COMPONENTS,
#else
GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT,
#endif
&value);
return value; return value;
} }
Int Shader::maxTessellationControlOutputComponents() { Int Shader::maxTessellationControlOutputComponents() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>())
return 0; return 0;
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
return 0;
#endif
GLint& value = Context::current()->state().shader->maxTessellationControlOutputComponents; GLint& value = Context::current()->state().shader->maxTessellationControlOutputComponents;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0) glGetIntegerv(
glGetIntegerv(GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS, &value); #ifndef MAGNUM_TARGET_GLES
GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS,
#else
GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT,
#endif
&value);
return value; return value;
} }
Int Shader::maxTessellationControlTotalOutputComponents() { Int Shader::maxTessellationControlTotalOutputComponents() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>())
return 0; return 0;
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
return 0;
#endif
GLint& value = Context::current()->state().shader->maxTessellationControlTotalOutputComponents; GLint& value = Context::current()->state().shader->maxTessellationControlTotalOutputComponents;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0) glGetIntegerv(
glGetIntegerv(GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS, &value); #ifndef MAGNUM_TARGET_GLES
GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS,
#else
GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT,
#endif
&value);
return value; return value;
} }
Int Shader::maxTessellationEvaluationInputComponents() { Int Shader::maxTessellationEvaluationInputComponents() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>())
return 0; return 0;
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
return 0;
#endif
GLint& value = Context::current()->state().shader->maxTessellationEvaluationInputComponents; GLint& value = Context::current()->state().shader->maxTessellationEvaluationInputComponents;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0) glGetIntegerv(
glGetIntegerv(GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS, &value); #ifndef MAGNUM_TARGET_GLES
GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS,
#else
GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT,
#endif
&value);
return value; return value;
} }
Int Shader::maxTessellationEvaluationOutputComponents() { Int Shader::maxTessellationEvaluationOutputComponents() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::tessellation_shader>())
return 0; return 0;
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::tessellation_shader>())
return 0;
#endif
GLint& value = Context::current()->state().shader->maxTessellationEvaluationOutputComponents; GLint& value = Context::current()->state().shader->maxTessellationEvaluationOutputComponents;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0) glGetIntegerv(
glGetIntegerv(GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS, &value); #ifndef MAGNUM_TARGET_GLES
GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS,
#else
GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT,
#endif
&value);
return value; return value;
} }
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Int Shader::maxGeometryInputComponents() { Int Shader::maxGeometryInputComponents() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::geometry_shader4>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::geometry_shader4>())
@ -857,11 +902,9 @@ Debug operator<<(Debug debug, const Shader::Type value) {
switch(value) { switch(value) {
#define _c(value) case Shader::Type::value: return debug << "Shader::Type::" #value; #define _c(value) case Shader::Type::value: return debug << "Shader::Type::" #value;
_c(Vertex) _c(Vertex)
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
_c(TessellationControl) _c(TessellationControl)
_c(TessellationEvaluation) _c(TessellationEvaluation)
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
_c(Geometry) _c(Geometry)
_c(Compute) _c(Compute)
#endif #endif

76
src/Magnum/Shader.h

@ -67,25 +67,35 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
enum class Type: GLenum { enum class Type: GLenum {
Vertex = GL_VERTEX_SHADER, /**< Vertex shader */ Vertex = GL_VERTEX_SHADER, /**< Vertex shader */
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* Tessellation control shader * Tessellation control shader
* @requires_gl40 Extension @extension{ARB,tessellation_shader} * @requires_gl40 Extension @extension{ARB,tessellation_shader}
* @requires_gl Tessellation shaders are not available in OpenGL ES * @requires_gles30 Not defined in OpenGL ES 2.0.
* or WebGL. * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader}
* @requires_gles Tessellation shaders are not available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES
TessellationControl = GL_TESS_CONTROL_SHADER, TessellationControl = GL_TESS_CONTROL_SHADER,
#else
TessellationControl = GL_TESS_CONTROL_SHADER_EXT,
#endif
/** /**
* Tessellation evaluation shader * Tessellation evaluation shader
* @requires_gl40 Extension @extension{ARB,tessellation_shader} * @requires_gl40 Extension @extension{ARB,tessellation_shader}
* @requires_gl Tessellation shaders are not available in OpenGL ES * @requires_gles30 Not defined in OpenGL ES 2.0.
* or WebGL. * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader}
* @requires_gles Tessellation shaders are not available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES
TessellationEvaluation = GL_TESS_EVALUATION_SHADER, TessellationEvaluation = GL_TESS_EVALUATION_SHADER,
#else
TessellationEvaluation = GL_TESS_EVALUATION_SHADER_EXT,
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* Geometry shader * Geometry shader
* @requires_gl32 Extension @extension{ARB,geometry_shader4} * @requires_gl32 Extension @extension{ARB,geometry_shader4}
@ -127,16 +137,18 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
/** @todo `GL_MAX_PATCH_VERTICES`, `GL_MAX_TESS_GEN_LEVEL`, `GL_MAX_TESS_PATCH_COMPONENTS` when @extension{ARB,tessellation_shader} is done */ /** @todo `GL_MAX_PATCH_VERTICES`, `GL_MAX_TESS_GEN_LEVEL`, `GL_MAX_TESS_PATCH_COMPONENTS` when @extension{ARB,tessellation_shader} is done */
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @brief Max supported component count of tessellation control shader input vertex * @brief Max supported component count of tessellation control shader input vertex
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,tessellation_shader} (part * OpenGL calls. If neither @extension{ARB,tessellation_shader} (part
* of OpenGL 4.0) is not available, returns `0`. * of OpenGL 4.0) nor @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader} ES extension is available,
* returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_TESS_CONTROL_INPUT_COMPONENTS} * @see @fn_gl{Get} with @def_gl{MAX_TESS_CONTROL_INPUT_COMPONENTS}
* @requires_gl Tessellation shaders are not available in OpenGL ES or * @requires_gles30 Not defined in OpenGL ES 2.0.
* WebGL. * @requires_gl Tessellation shaders are not available in WebGL.
*/ */
static Int maxTessellationControlInputComponents(); static Int maxTessellationControlInputComponents();
@ -144,11 +156,13 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Max supported component count of tessellation control shader output vertex * @brief Max supported component count of tessellation control shader output vertex
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,tessellation_shader} (part * OpenGL calls. If neither @extension{ARB,tessellation_shader} (part
* of OpenGL 4.0) is not available, returns `0`. * of OpenGL 4.0) nor @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader} ES extension is available,
* returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_TESS_CONTROL_OUTPUT_COMPONENTS} * @see @fn_gl{Get} with @def_gl{MAX_TESS_CONTROL_OUTPUT_COMPONENTS}
* @requires_gl Tessellation shaders are not available in OpenGL ES or * @requires_gles30 Not defined in OpenGL ES 2.0.
* WebGL. * @requires_gl Tessellation shaders are not available in WebGL.
*/ */
static Int maxTessellationControlOutputComponents(); static Int maxTessellationControlOutputComponents();
@ -156,11 +170,13 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Max supported component count of all tessellation control shader output vertices combined * @brief Max supported component count of all tessellation control shader output vertices combined
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,tessellation_shader} (part * OpenGL calls. If neither @extension{ARB,tessellation_shader} (part
* of OpenGL 4.0) is not available, returns `0`. * of OpenGL 4.0) nor @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader} ES extension is available,
* returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS} * @see @fn_gl{Get} with @def_gl{MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS}
* @requires_gl Tessellation shaders are not available in OpenGL ES or * @requires_gles30 Not defined in OpenGL ES 2.0.
* WebGL. * @requires_gl Tessellation shaders are not available in WebGL.
*/ */
static Int maxTessellationControlTotalOutputComponents(); static Int maxTessellationControlTotalOutputComponents();
@ -168,11 +184,13 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Max supported component count of tessellation evaluation shader input vertex * @brief Max supported component count of tessellation evaluation shader input vertex
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,tessellation_shader} (part * OpenGL calls. If neither @extension{ARB,tessellation_shader} (part
* of OpenGL 4.0) is not available, returns `0`. * of OpenGL 4.0) nor @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader} ES extension is available,
* returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_TESS_EVALUATION_INPUT_COMPONENTS} * @see @fn_gl{Get} with @def_gl{MAX_TESS_EVALUATION_INPUT_COMPONENTS}
* @requires_gl Tessellation shaders are not available in OpenGL ES or * @requires_gles30 Not defined in OpenGL ES 2.0.
* WebGL. * @requires_gl Tessellation shaders are not available in WebGL.
*/ */
static Int maxTessellationEvaluationInputComponents(); static Int maxTessellationEvaluationInputComponents();
@ -180,16 +198,16 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Max supported component count of tessellation evaluation shader output vertex * @brief Max supported component count of tessellation evaluation shader output vertex
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,tessellation_shader} (part * OpenGL calls. If neither @extension{ARB,tessellation_shader} (part
* of OpenGL 4.0) is not available, returns `0`. * of OpenGL 4.0) nor @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,tessellation_shader} ES extension is available,
* returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_TESS_EVALUATION_OUTPUT_COMPONENTS} * @see @fn_gl{Get} with @def_gl{MAX_TESS_EVALUATION_OUTPUT_COMPONENTS}
* @requires_gl Tessellation shaders are not available in OpenGL ES or * @requires_gles30 Not defined in OpenGL ES 2.0.
* WebGL. * @requires_gl Tessellation shaders are not available in WebGL.
*/ */
static Int maxTessellationEvaluationOutputComponents(); static Int maxTessellationEvaluationOutputComponents();
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** /**
* @brief Max supported component count of geometry shader input vertex * @brief Max supported component count of geometry shader input vertex
* *

Loading…
Cancel
Save