Browse Source

doc: rename DOXYGEN_IGNORE() to DOXYGEN_ELLIPSIS().

And use DOXYGEN_IGNORE() for replacing with nothing.
pull/525/head
Vladimír Vondruš 4 years ago
parent
commit
9c2181dc3c
  1. 27
      doc/conf.py
  2. 6
      doc/snippets/Magnum.cpp
  3. 8
      doc/snippets/MagnumGL-application.cpp
  4. 32
      doc/snippets/MagnumGL.cpp
  5. 6
      doc/snippets/MagnumMath.cpp
  6. 4
      doc/snippets/MagnumMeshTools-gl.cpp
  7. 2
      doc/snippets/MagnumShaderTools.cpp
  8. 46
      doc/snippets/MagnumShaders-gl.cpp
  9. 38
      doc/snippets/MagnumTrade.cpp
  10. 278
      doc/snippets/MagnumVk.cpp
  11. 4
      doc/snippets/debugtools-compareimage.cpp

27
doc/conf.py

@ -41,22 +41,25 @@ VERSION_LABELS = True
_magnum_colors_src = re.compile(r"""<span class="mh">0x(?P<hex>[0-9a-f]{6})(?P<alpha>[0-9a-f]{2})?(?P<literal>_s?rgba?f?)</span>""")
_magnum_colors_dst = r"""<span class="mh">0x\g<hex>\g<alpha>\g<literal><span class="m-code-color" style="background-color: #\g<hex>;"></span></span>"""
# Code wrapped in DOXYGEN_IGNORE() will get replaced by an (Unicode) ellipsis
# in the output. In order to make the same code compilable, add
# Code wrapped in DOXYGEN_ELLIPSIS() will get replaced by an (Unicode) ellipsis
# in the output; code wrapped in DOXYGEN_IGNORE() will get replaced by nothing.
# In order to make the same code compilable, add
#
# #define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
# #define DOXYGEN_IGNORE(...) __VA_ARGS__
#
# to the snippet code
# to the snippet code.
def _doxygen_ignore(code: str):
while 'DOXYGEN_IGNORE(' in code:
i = code.index('DOXYGEN_IGNORE(')
depth = 1
for j in range(i + len('DOXYGEN_IGNORE('), len(code)):
if code[j] == '(': depth += 1
elif code[j] == ')': depth -= 1
if depth == 0: break
assert depth == 0, "unmatched DOXYGEN_IGNORE() parentheses in %s" % code
code = code[:i] + '' + code[j+1:]
for macro, replace in [('DOXYGEN_ELLIPSIS(', ''), ('DOXYGEN_IGNORE(', '')]:
while macro in code:
i = code.index(macro)
depth = 1
for j in range(i + len(macro), len(code)):
if code[j] == '(': depth += 1
elif code[j] == ')': depth -= 1
if depth == 0: break
assert depth == 0, "unmatched %s) parentheses in %s" % (macro, code)
code = code[:i] + replace + code[j+1:]
return code
M_CODE_FILTERS_PRE = {

6
doc/snippets/Magnum.cpp

@ -38,7 +38,7 @@
#include "Magnum/GL/Texture.h"
#endif
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;
using namespace Magnum::Math::Literals;
@ -87,7 +87,7 @@ namespace Mn = Magnum;
#include <Magnum/Magnum.h> /* only a Matrix4 forward declaration */
#include <Magnum/Math/Matrix4.h> /* the actual definition */
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Matrix4 a = Matrix4::translation({3.0f, 1.0f, 0.5f});
/* [features-forward-declaration-use] */
@ -96,7 +96,7 @@ static_cast<void>(a);
{
/* [features-debug-output] */
Image2D image = DOXYGEN_IGNORE(Image2D{{}, {}, {}});
Image2D image = DOXYGEN_ELLIPSIS(Image2D{{}, {}, {}});
Debug{} << "Image format is" << image.format() << "and size" << image.size();
Debug{} << "Color of the first pixel is" << image.pixels<Color4ub>()[0][0];

8
doc/snippets/MagnumGL-application.cpp

@ -33,23 +33,23 @@
using namespace Magnum;
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
/* [opengl-wrapping-nocreate] */
class MyApplication: public Platform::Application {
DOXYGEN_IGNORE(explicit MyApplication(const Arguments& arguments);)
DOXYGEN_ELLIPSIS(explicit MyApplication(const Arguments& arguments);)
private:
/* Placeholders without an underlying GL object */
GL::Mesh _mesh{NoCreate};
Shaders::PhongGL _shader{NoCreate};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
};
MyApplication::MyApplication(const Arguments& arguments):
Platform::Application{arguments, NoCreate}
{
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
create();
/* GL context is ready, now it's safe to populate the GL objects */

32
doc/snippets/MagnumGL.cpp

@ -85,7 +85,7 @@
#include "Magnum/GL/RectangleTexture.h"
#endif
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;
using namespace Magnum::Math::Literals;
@ -453,7 +453,7 @@ GL::BufferImage2D image = framebuffer.read(framebuffer.viewport(),
{
/* [Buffer-setdata] */
const Vector3 data[]{
DOXYGEN_IGNORE({})
DOXYGEN_ELLIPSIS({})
};
GL::Buffer buffer;
@ -466,7 +466,7 @@ GL::Buffer buffer2{data}; // or construct & fill in a single step
{
GL::Buffer buffer;
/* [Buffer-setdata-stl] */
std::vector<Vector3> data = DOXYGEN_IGNORE({});
std::vector<Vector3> data = DOXYGEN_ELLIPSIS({});
buffer.setData(data);
/* [Buffer-setdata-stl] */
}
@ -1042,7 +1042,7 @@ framebuffer.mapForDraw({
{
/* [Mesh-vertices] */
const Vector3 positions[]{
DOXYGEN_IGNORE({})
DOXYGEN_ELLIPSIS({})
};
GL::Buffer vertices{positions};
@ -1059,7 +1059,7 @@ struct Vertex {
Vector3 normal;
};
const Vertex vertexData[]{
DOXYGEN_IGNORE({})
DOXYGEN_ELLIPSIS({})
};
GL::Buffer vertices{vertexData};
@ -1075,11 +1075,11 @@ mesh.setCount(Containers::arraySize(vertexData))
GL::Mesh mesh;
/* [Mesh-indices] */
const UnsignedInt indexData[]{
DOXYGEN_IGNORE(0)
DOXYGEN_ELLIPSIS(0)
};
GL::Buffer indices{indexData};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
mesh.setIndexBuffer(indices, 0, MeshIndexType::UnsignedInt);
/* [Mesh-indices] */
}
@ -1087,11 +1087,11 @@ mesh.setIndexBuffer(indices, 0, MeshIndexType::UnsignedInt);
{
GL::Mesh mesh;
/* [Mesh-vertices-interleaved-tool] */
Containers::ArrayView<const Vector3> positions = DOXYGEN_IGNORE({});
Containers::ArrayView<const Vector3> normals = DOXYGEN_IGNORE({});
Containers::ArrayView<const Vector3> positions = DOXYGEN_ELLIPSIS({});
Containers::ArrayView<const Vector3> normals = DOXYGEN_ELLIPSIS({});
GL::Buffer vertices{MeshTools::interleave(positions, normals)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
mesh.addVertexBuffer(vertices, 0,
Shaders::PhongGL::Position{},
Shaders::PhongGL::Normal{});
@ -1107,7 +1107,7 @@ MeshIndexType type;
std::tie(compressed, type) = MeshTools::compressIndices(indexData);
GL::Buffer indices{compressed};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
mesh.setIndexBuffer(indices, 0, type);
/* [Mesh-indices-tool] */
}
@ -1125,11 +1125,11 @@ struct Packed {
Short:16;
};
const Packed vertexData[]{
DOXYGEN_IGNORE({})
DOXYGEN_ELLIPSIS({})
};
GL::Buffer vertices{vertexData};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
mesh.addVertexBuffer(vertices, 0,
Shaders::PhongGL::Position{Shaders::PhongGL::Position::Components::Three,
Shaders::PhongGL::Position::DataType::Half},
@ -1167,7 +1167,7 @@ mesh.addVertexBuffer(colorBuffer, 0, 4, GL::DynamicAttribute{
GL::Mesh mesh;
/* [Mesh-buffer-ownership] */
GL::Buffer vertices, indices;
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
mesh.addVertexBuffer(std::move(vertices), 0,
Shaders::PhongGL::Position{},
Shaders::PhongGL::Normal{})
@ -1183,8 +1183,8 @@ mesh.addVertexBuffer(vertices, 0, Shaders::PhongGL::Position{}, 20)
{
GL::Mesh mesh;
/* [Mesh-draw] */
Shaders::PhongGL shader{DOXYGEN_IGNORE()};
DOXYGEN_IGNORE()
Shaders::PhongGL shader{DOXYGEN_ELLIPSIS()};
DOXYGEN_ELLIPSIS()
shader.draw(mesh);
/* [Mesh-draw] */
}

6
doc/snippets/MagnumMath.cpp

@ -41,7 +41,7 @@
#include "Magnum/Math/StrictWeakOrdering.h"
#include "Magnum/Math/Swizzle.h"
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;
using namespace Magnum::Math::Literals;
@ -1037,7 +1037,7 @@ static_cast<void>(transformation);
{
/* [Matrix3-rotation-extract-reflection] */
Matrix3 transformation = DOXYGEN_IGNORE({});
Matrix3 transformation = DOXYGEN_ELLIPSIS({});
Matrix2x2 rotation = transformation.rotation();
Vector2 scaling = transformation.scaling();
if(rotation.determinant() < 0.0f) {
@ -1060,7 +1060,7 @@ static_cast<void>(transformation);
{
/* [Matrix4-rotation-extract-reflection] */
Matrix4 transformation = DOXYGEN_IGNORE({});
Matrix4 transformation = DOXYGEN_ELLIPSIS({});
Matrix3x3 rotation = transformation.rotation();
Vector3 scaling = transformation.scaling();
if(rotation.determinant() < 0.0f) {

4
doc/snippets/MagnumMeshTools-gl.cpp

@ -38,7 +38,7 @@
#include <vector>
#endif
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;
@ -58,7 +58,7 @@ GL::Mesh mesh = MeshTools::compile(meshData, indices, vertices);
{
Trade::MeshData meshData{MeshPrimitive::Lines, 5};
/* [compile-external-attributes] */
Trade::MeshAttribute myCustomAttribute = DOXYGEN_IGNORE({});
Trade::MeshAttribute myCustomAttribute = DOXYGEN_ELLIPSIS({});
GL::Buffer indices, vertices;
indices.setData(meshData.indexData());

2
doc/snippets/MagnumShaderTools.cpp

@ -33,7 +33,7 @@
#include "Magnum/ShaderTools/AbstractConverter.h"
#include "Magnum/ShaderTools/Stage.h"
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;

46
doc/snippets/MagnumShaders-gl.cpp

@ -65,7 +65,7 @@
#include "Magnum/Shaders/Vector.h"
#endif
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;
using namespace Magnum::Math::Literals;
@ -103,7 +103,7 @@ mesh.addVertexBuffer(vertices, 0,
{
GL::Mesh mesh;
/* [shaders-classic] */
Matrix4 transformationMatrix{DOXYGEN_IGNORE()}, projectionMatrix{DOXYGEN_IGNORE()};
Matrix4 transformationMatrix{DOXYGEN_ELLIPSIS()}, projectionMatrix{DOXYGEN_ELLIPSIS()};
Shaders::PhongGL shader;
shader
@ -159,10 +159,10 @@ shader
GL::Buffer projectionUniform, transformationUniform, drawUniform, lightUniform,
materialUniform;
/* [shaders-multi] */
GL::Mesh redCone{DOXYGEN_IGNORE()}, yellowCube{DOXYGEN_IGNORE()}, redSphere{DOXYGEN_IGNORE()};
Matrix4 redConeTransformation{DOXYGEN_IGNORE()},
yellowCubeTransformation{DOXYGEN_IGNORE()},
redSphereTransformation{DOXYGEN_IGNORE()};
GL::Mesh redCone{DOXYGEN_ELLIPSIS()}, yellowCube{DOXYGEN_ELLIPSIS()}, redSphere{DOXYGEN_ELLIPSIS()};
Matrix4 redConeTransformation{DOXYGEN_ELLIPSIS()},
yellowCubeTransformation{DOXYGEN_ELLIPSIS()},
redSphereTransformation{DOXYGEN_ELLIPSIS()};
materialUniform.setData({
Shaders::PhongMaterialUniform{}
@ -210,13 +210,13 @@ shader
{
GL::Mesh mesh;
/* [shaders-multidraw] */
GL::MeshView redConeView{DOXYGEN_IGNORE(mesh)}, yellowCubeView{DOXYGEN_IGNORE(mesh)}, redSphereView{DOXYGEN_IGNORE(mesh)};
DOXYGEN_IGNORE()
GL::MeshView redConeView{DOXYGEN_ELLIPSIS(mesh)}, yellowCubeView{DOXYGEN_ELLIPSIS(mesh)}, redSphereView{DOXYGEN_ELLIPSIS(mesh)};
DOXYGEN_ELLIPSIS()
/* One light, two materials, three draws; with multidraw enabled */
Shaders::PhongGL shader{Shaders::PhongGL::Flag::MultiDraw, 1, 2, 3};
shader
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.draw({redConeView, yellowCubeView, redSphereView});
/* [shaders-multidraw] */
}
@ -225,9 +225,9 @@ shader
{
Matrix4 projectionMatrix;
/* [shaders-instancing] */
Matrix4 redSphereTransformation{DOXYGEN_IGNORE()},
yellowSphereTransformation{DOXYGEN_IGNORE()},
greenSphereTransformation{DOXYGEN_IGNORE()};
Matrix4 redSphereTransformation{DOXYGEN_ELLIPSIS()},
yellowSphereTransformation{DOXYGEN_ELLIPSIS()},
greenSphereTransformation{DOXYGEN_ELLIPSIS()};
struct {
Matrix4 transformationMatrix;
@ -245,7 +245,7 @@ struct {
0x3bd267_rgbf},
};
GL::Mesh sphereInstanced{DOXYGEN_IGNORE()};
GL::Mesh sphereInstanced{DOXYGEN_ELLIPSIS()};
sphereInstanced.addVertexBufferInstanced(GL::Buffer{instanceData}, 1, 0,
Shaders::PhongGL::TransformationMatrix{},
Shaders::PhongGL::NormalMatrix{},
@ -256,7 +256,7 @@ Shaders::PhongGL shader{Shaders::PhongGL::Flag::InstancedTransformation|
Shaders::PhongGL::Flag::VertexColor};
shader
.setProjectionMatrix(projectionMatrix)
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.draw(sphereInstanced);
/* [shaders-instancing] */
}
@ -265,11 +265,11 @@ shader
GL::Mesh mesh;
/* [shaders-textures] */
GL::Texture2D diffuseTexture;
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Shaders::PhongGL shader{Shaders::PhongGL::Flag::DiffuseTexture};
shader.bindDiffuseTexture(diffuseTexture)
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.draw(mesh);
/* [shaders-textures] */
}
@ -277,13 +277,13 @@ shader.bindDiffuseTexture(diffuseTexture)
#ifndef MAGNUM_TARGET_GLES2
{
GL::Mesh mesh;
GL::MeshView redConeView{DOXYGEN_IGNORE(mesh)}, yellowCubeView{DOXYGEN_IGNORE(mesh)}, redSphereView{DOXYGEN_IGNORE(mesh)};
GL::MeshView redConeView{DOXYGEN_ELLIPSIS(mesh)}, yellowCubeView{DOXYGEN_ELLIPSIS(mesh)}, redSphereView{DOXYGEN_ELLIPSIS(mesh)};
/* [shaders-texture-arrays] */
ImageView2D coneDiffuse{DOXYGEN_IGNORE({}, {})}, cubeDiffuse{DOXYGEN_IGNORE({}, {})}, sphereDiffuse{DOXYGEN_IGNORE({}, {})};
ImageView2D coneDiffuse{DOXYGEN_ELLIPSIS({}, {})}, cubeDiffuse{DOXYGEN_ELLIPSIS({}, {})}, sphereDiffuse{DOXYGEN_ELLIPSIS({}, {})};
GL::Texture2DArray diffuseTexture;
diffuseTexture
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
/* Assuming all iamges have the same format and size */
.setStorage(1, GL::textureFormat(coneDiffuse.format()),
{coneDiffuse.size(), 3})
@ -307,7 +307,7 @@ Shaders::PhongGL shader{
Shaders::PhongGL::Flag::TextureArrays,
1, 2, 3};
shader
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.bindDiffuseTexture(diffuseTexture)
.bindTextureTransformationBuffer(textureTransformationUniform)
.draw({redConeView, yellowCubeView, redSphereView});
@ -885,7 +885,7 @@ shader
.setLightColors({0xf0f0ff_srgbf*0.1f,
0xff8080_srgbf*10.0f,
0x80ff80_srgbf*10.0f})
.setLightColors(DOXYGEN_IGNORE({0xf0f0ff_srgbf}))
.setLightColors(DOXYGEN_ELLIPSIS({0xf0f0ff_srgbf}))
.setLightRanges({Constants::inf(),
2.0f,
2.0f});
@ -896,9 +896,9 @@ shader
Color3 ambientColor;
GL::Texture2D diffuseTexture;
/* [PhongGL-usage-lights-ambient] */
Trade::LightData ambientLight = DOXYGEN_IGNORE(Trade::LightData{{}, {}, {}});
Trade::LightData ambientLight = DOXYGEN_ELLIPSIS(Trade::LightData{{}, {}, {}});
Shaders::PhongGL shader{Shaders::PhongGL::Flag::AmbientTexture|DOXYGEN_IGNORE(Shaders::PhongGL::Flag::DiffuseTexture), DOXYGEN_IGNORE(3)};
Shaders::PhongGL shader{Shaders::PhongGL::Flag::AmbientTexture|DOXYGEN_ELLIPSIS(Shaders::PhongGL::Flag::DiffuseTexture), DOXYGEN_ELLIPSIS(3)};
shader
.setAmbientColor(ambientColor + ambientLight.color()*ambientLight.intensity())
.bindAmbientTexture(diffuseTexture)

38
doc/snippets/MagnumTrade.cpp

@ -71,7 +71,7 @@
#include "Magnum/Trade/MeshData3D.h"
#endif
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
using namespace Magnum;
using namespace Magnum::Math::Literals;
@ -85,7 +85,7 @@ PluginManager::Manager<Trade::AbstractImageConverter> manager;
Containers::Pointer<Trade::AbstractImageConverter> converter =
manager.loadAndInstantiate("AnyImageConverter");
Image2D image{PixelFormat::RGBA8Unorm, size, DOXYGEN_IGNORE({})};
Image2D image{PixelFormat::RGBA8Unorm, size, DOXYGEN_ELLIPSIS({})};
if(!converter || !converter->convertToFile(image, "image.png"))
Fatal{} << "Can't save image.png with AnyImageConverter";
/* [AbstractImageConverter-usage-file] */
@ -97,9 +97,9 @@ PluginManager::Manager<Trade::AbstractImageConverter> manager;
Containers::Pointer<Trade::AbstractImageConverter> converter =
manager.loadAndInstantiate("AnyImageConverter");
Image2D level0{PixelFormat::RGBA16F, {256, 256}, DOXYGEN_IGNORE({})};
Image2D level1{PixelFormat::RGBA16F, {128, 128}, DOXYGEN_IGNORE({})};
Image2D level2{PixelFormat::RGBA16F, {64, 64}, DOXYGEN_IGNORE({})};
Image2D level0{PixelFormat::RGBA16F, {256, 256}, DOXYGEN_ELLIPSIS({})};
Image2D level1{PixelFormat::RGBA16F, {128, 128}, DOXYGEN_ELLIPSIS({})};
Image2D level2{PixelFormat::RGBA16F, {64, 64}, DOXYGEN_ELLIPSIS({})};
if(!converter || !converter->convertToFile({level0, level1, level2}, "image.exr"))
Fatal{} << "Can't save image.exr with AnyImageConverter";
@ -236,7 +236,7 @@ void doOpenData(Containers::Array<char>&& data, Trade::DataFlags dataFlags) over
Utility::copy(data, _in);
}
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
}
/* [AbstractImporter-doOpenData-ownership] */
} importer;
@ -248,7 +248,7 @@ PluginManager::Manager<Trade::AbstractSceneConverter> manager;
Containers::Pointer<Trade::AbstractSceneConverter> converter =
manager.loadAndInstantiate("AnySceneConverter");
Trade::MeshData mesh = DOXYGEN_IGNORE(Trade::MeshData{{}, {}});
Trade::MeshData mesh = DOXYGEN_ELLIPSIS(Trade::MeshData{{}, {}});
if(!converter || !converter->convertToFile(mesh, "mesh.ply"))
Fatal{} << "Can't save mesh.ply with AnySceneConverter";
/* [AbstractSceneConverter-usage-file] */
@ -339,7 +339,7 @@ Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
if(!image) Fatal{} << "Oopsie!";
GL::Texture2D texture;
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
texture.setStorage(1, GL::textureFormat(image->format()), image->size());
if(!image->isCompressed())
texture.setSubImage(0, {}, *image);
@ -397,7 +397,7 @@ Trade::MaterialAttributeData b{"DiffuseColor", 0x3bd267ff_srgbaf};
{
/* [MaterialData-usage] */
Trade::MaterialData data = DOXYGEN_IGNORE(Trade::MaterialData{{}, {}});
Trade::MaterialData data = DOXYGEN_ELLIPSIS(Trade::MaterialData{{}, {}});
// Assumes the attribute exists
Float roughness = data.attribute<Float>(Trade::MaterialAttribute::Roughness);
@ -426,7 +426,7 @@ if(data.types() & Trade::MaterialType::PbrSpecularGlossiness) {
Color4 specular = pbr.specularColor();
Float glossiness = pbr.glossiness();
DOXYGEN_IGNORE(static_cast<void>(diffuse), static_cast<void>(specular), static_cast<void>(glossiness);)
DOXYGEN_ELLIPSIS(static_cast<void>(diffuse), static_cast<void>(specular), static_cast<void>(glossiness);)
/* Otherwise use metallic/roughness (or defaults if no attributes present) */
} else {
@ -436,14 +436,14 @@ if(data.types() & Trade::MaterialType::PbrSpecularGlossiness) {
Float metalness = pbr.metalness();
Float roughness = pbr.roughness();
DOXYGEN_IGNORE(static_cast<void>(base), static_cast<void>(metalness), static_cast<void>(roughness);)
DOXYGEN_ELLIPSIS(static_cast<void>(base), static_cast<void>(metalness), static_cast<void>(roughness);)
}
/* [MaterialData-usage-types] */
}
{
/* [MaterialData-usage-texture-complexity] */
Trade::PbrSpecularGlossinessMaterialData data = DOXYGEN_IGNORE(Trade::PbrSpecularGlossinessMaterialData{{}, {}});
Trade::PbrSpecularGlossinessMaterialData data = DOXYGEN_ELLIPSIS(Trade::PbrSpecularGlossinessMaterialData{{}, {}});
/* Simple case for diffuse + packed specular/glossiness texture, the default
coordinate set and a common coordinate transformation for all textures */
@ -455,11 +455,11 @@ if(data.hasAttribute(Trade::MaterialAttribute::DiffuseTexture) &&
UnsignedInt specularGlossiness = data.specularTexture();
Matrix3 textureMatrix = data.commonTextureMatrix();
DOXYGEN_IGNORE(static_cast<void>(diffuse), static_cast<void>(specularGlossiness), static_cast<void>(textureMatrix);)
DOXYGEN_ELLIPSIS(static_cast<void>(diffuse), static_cast<void>(specularGlossiness), static_cast<void>(textureMatrix);)
/* Extra work needed when using a non-default texture coordinate set */
} else if(data.hasTextureCoordinates() && data.hasCommonTextureCoordinates()) {
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
/* Etc... */
} else Fatal{} << "Material too complex, giving up";
@ -475,7 +475,7 @@ if(data.hasLayer(Trade::MaterialLayer::ClearCoat)) {
Float clearCoatRoughness = data.attributeOr(Trade::MaterialLayer::ClearCoat,
Trade::MaterialAttribute::Roughness, 0.0f);
DOXYGEN_IGNORE(static_cast<void>(clearCoatFactor), static_cast<void>(clearCoatRoughness);)
DOXYGEN_ELLIPSIS(static_cast<void>(clearCoatFactor), static_cast<void>(clearCoatRoughness);)
}
/* [MaterialData-usage-layers] */
}
@ -489,7 +489,7 @@ if(data.types() & Trade::MaterialType::PbrClearCoat) {
Float clearCoatFactor = clearCoat.layerFactor();
Float clearCoatRoughness = clearCoat.roughness();
DOXYGEN_IGNORE(static_cast<void>(clearCoatFactor), static_cast<void>(clearCoatRoughness);)
DOXYGEN_ELLIPSIS(static_cast<void>(clearCoatFactor), static_cast<void>(clearCoatRoughness);)
}
/* [MaterialData-usage-layers-types] */
}
@ -638,7 +638,7 @@ constexpr Trade::MeshAttributeData colors{Trade::MeshAttribute::Color,
/* Actual data populated later */
Containers::Array<char> vertexData{15*sizeof(Vertex)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Trade::MeshData{MeshPrimitive::Triangles, std::move(vertexData),
{positions, colors}};
/* [MeshAttributeData-usage-offset-only] */
@ -659,7 +659,7 @@ Trade::MeshAttributeData normals{Trade::MeshAttribute::Normal,
{
/* This snippet is also used by GL::Mesh, bear that in mind when updating */
/* [MeshData-usage-compile] */
Trade::MeshData data = DOXYGEN_IGNORE(Trade::MeshData{MeshPrimitive::Points, 0});
Trade::MeshData data = DOXYGEN_ELLIPSIS(Trade::MeshData{MeshPrimitive::Points, 0});
GL::Mesh mesh = MeshTools::compile(data);
/* [MeshData-usage-compile] */
@ -747,7 +747,7 @@ struct Vertex {
Containers::Array<char> indexData{indexCount*sizeof(UnsignedShort)};
Containers::Array<char> vertexData{vertexCount*sizeof(Vertex)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
auto vertices = Containers::arrayCast<const Vertex>(vertexData);
auto indices = Containers::arrayCast<const UnsignedShort>(indexData);

278
doc/snippets/MagnumVk.cpp

@ -82,7 +82,7 @@
using namespace Magnum;
using namespace Magnum::Math::Literals;
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
/* [Instance-delayed-creation] */
class MyApplication {
@ -96,8 +96,8 @@ class MyApplication {
MyApplication::MyApplication() {
// decide on layers, extensions, ...
_instance.create(Vk::InstanceCreateInfo{DOXYGEN_IGNORE()}
DOXYGEN_IGNORE()
_instance.create(Vk::InstanceCreateInfo{DOXYGEN_ELLIPSIS()}
DOXYGEN_ELLIPSIS()
);
}
/* [Instance-delayed-creation] */
@ -107,17 +107,17 @@ namespace B {
/* [Device-delayed-creation] */
class MyApplication {
public:
explicit MyApplication(DOXYGEN_IGNORE(Vk::Instance& instance));
explicit MyApplication(DOXYGEN_ELLIPSIS(Vk::Instance& instance));
private:
Vk::Device _device{NoCreate};
};
MyApplication::MyApplication(DOXYGEN_IGNORE(Vk::Instance& instance)) {
MyApplication::MyApplication(DOXYGEN_ELLIPSIS(Vk::Instance& instance)) {
// decide on extensions, features, ...
_device.create(instance, Vk::DeviceCreateInfo{DOXYGEN_IGNORE(Vk::pickDevice(instance))}
DOXYGEN_IGNORE()
_device.create(instance, Vk::DeviceCreateInfo{DOXYGEN_ELLIPSIS(Vk::pickDevice(instance))}
DOXYGEN_ELLIPSIS()
);
}
/* [Device-delayed-creation] */
@ -128,7 +128,7 @@ int main() {
{
/* [wrapping-extending-create-info] */
Vk::InstanceCreateInfo info{DOXYGEN_IGNORE()};
Vk::InstanceCreateInfo info{DOXYGEN_ELLIPSIS()};
/* Add a custom validation features setup */
VkValidationFeaturesEXT validationFeatures{};
@ -146,8 +146,8 @@ using namespace Containers::Literals;
int argc{};
char** argv{};
/* [wrapping-optimizing-properties-instance] */
Vk::LayerProperties layers = DOXYGEN_IGNORE(Vk::enumerateLayerProperties());
Vk::InstanceExtensionProperties extensions = DOXYGEN_IGNORE(Vk::enumerateInstanceExtensionProperties(layers.names()));
Vk::LayerProperties layers = DOXYGEN_ELLIPSIS(Vk::enumerateLayerProperties());
Vk::InstanceExtensionProperties extensions = DOXYGEN_ELLIPSIS(Vk::enumerateInstanceExtensionProperties(layers.names()));
/* Pass the layer and extension properties for use by InstanceCreateInfo */
Vk::InstanceCreateInfo info{argc, argv, &layers, &extensions};
@ -155,7 +155,7 @@ if(layers.isSupported("VK_LAYER_KHRONOS_validation"_s))
info.addEnabledLayers({"VK_LAYER_KHRONOS_validation"_s});
if(extensions.isSupported<Vk::Extensions::EXT::debug_report>())
info.addEnabledExtensions<Vk::Extensions::EXT::debug_report>();
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Instance instance{info};
/* [wrapping-optimizing-properties-instance] */
@ -166,8 +166,8 @@ Vk::Instance instance{NoCreate};
Vk::Queue queue{NoCreate};
/* [wrapping-optimizing-properties-device-single-expression] */
Vk::Device device{instance, Vk::DeviceCreateInfo{Vk::pickDevice(instance)}
.addQueues(DOXYGEN_IGNORE(Vk::QueueFlag::Graphics, {0.0f}, {queue}))
DOXYGEN_IGNORE()
.addQueues(DOXYGEN_ELLIPSIS(Vk::QueueFlag::Graphics, {0.0f}, {queue}))
DOXYGEN_ELLIPSIS()
};
/* [wrapping-optimizing-properties-device-single-expression] */
}
@ -186,7 +186,7 @@ if(extensions.isSupported<Vk::Extensions::EXT::index_type_uint8>())
info.addEnabledExtensions<Vk::Extensions::EXT::index_type_uint8>();
if(extensions.isSupported("VK_NV_mesh_shader"_s))
info.addEnabledExtensions({"VK_NV_mesh_shader"_s});
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
/* Finally, be sure to move the info structure to the device as well */
Vk::Device device{instance, std::move(info)};
@ -214,7 +214,7 @@ Vk::Device device{NoCreate};
/* [Buffer-creation] */
#include <Magnum/Vk/BufferCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Buffer buffer{device,
Vk::BufferCreateInfo{Vk::BufferUsage::VertexBuffer, 1024*1024},
@ -247,10 +247,10 @@ Vk::Device device{NoCreate};
Vk::CommandBuffer cmd{NoCreate};
/* [Buffer-usage-fill] */
Vk::Buffer buffer{device, Vk::BufferCreateInfo{
Vk::BufferUsage::TransferDestination|DOXYGEN_IGNORE(Vk::BufferUsage{}), DOXYGEN_IGNORE(0)
}, DOXYGEN_IGNORE(Vk::MemoryFlag{})};
Vk::BufferUsage::TransferDestination|DOXYGEN_ELLIPSIS(Vk::BufferUsage{}), DOXYGEN_ELLIPSIS(0)
}, DOXYGEN_ELLIPSIS(Vk::MemoryFlag{})};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.fillBuffer(buffer, 0x00000000);
/* [Buffer-usage-fill] */
@ -268,7 +268,7 @@ Vk::Buffer vertices{device, Vk::BufferCreateInfo{
Vk::BufferUsage::TransferDestination|Vk::BufferUsage::VertexBuffer, size
}, Vk::MemoryFlag::DeviceLocal};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.copyBuffer({input, vertices, {
{0, 0, size} /* Copy the whole buffer */
@ -285,9 +285,9 @@ cmd.copyBuffer({input, vertices, {
/* [CommandPool-creation] */
#include <Magnum/Vk/CommandPoolCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Device device{DOXYGEN_IGNORE(NoCreate)};
Vk::Device device{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::CommandPool commandPool{device, Vk::CommandPoolCreateInfo{
device.properties().pickQueueFamily(Vk::QueueFlag::Graphics)
@ -298,19 +298,19 @@ Vk::CommandPool commandPool{device, Vk::CommandPoolCreateInfo{
{
Vk::Device device{NoCreate};
/* [CommandBuffer-allocation] */
Vk::CommandPool commandPool{device, DOXYGEN_IGNORE(Vk::CommandPoolCreateInfo{0})};
Vk::CommandPool commandPool{device, DOXYGEN_ELLIPSIS(Vk::CommandPoolCreateInfo{0})};
Vk::CommandBuffer cmd = commandPool.allocate();
/* [CommandBuffer-allocation] */
/* [CommandBuffer-usage] */
cmd.begin()
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.end();
/* [CommandBuffer-usage] */
/* [CommandBuffer-usage-submit] */
Vk::Queue queue{DOXYGEN_IGNORE(NoCreate)};
Vk::Queue queue{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::Fence fence{device};
queue.submit({Vk::SubmitInfo{}.setCommandBuffers({cmd})}, fence);
@ -324,7 +324,7 @@ Vk::Device device{NoCreate};
/* [DescriptorPool-creation] */
#include <Magnum/Vk/DescriptorPoolCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::DescriptorPool pool{device, Vk::DescriptorPoolCreateInfo{8, {
{Vk::DescriptorType::UniformBuffer, 24},
@ -335,8 +335,8 @@ Vk::DescriptorPool pool{device, Vk::DescriptorPoolCreateInfo{8, {
{
/* [DescriptorSet-allocation] */
Vk::DescriptorSetLayout layout{DOXYGEN_IGNORE(NoCreate)};
Vk::DescriptorPool pool{DOXYGEN_IGNORE(NoCreate)};
Vk::DescriptorSetLayout layout{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::DescriptorPool pool{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::DescriptorSet set = pool.allocate(layout);
/* [DescriptorSet-allocation] */
@ -357,8 +357,8 @@ if(!set) set = overflowPool.allocate(layout);
Vk::Device device{NoCreate};
Vk::DescriptorSetLayout layout{NoCreate};
/* [DescriptorSet-allocation-free] */
Vk::DescriptorPool pool{device, Vk::DescriptorPoolCreateInfo{DOXYGEN_IGNORE(0), {
DOXYGEN_IGNORE()
Vk::DescriptorPool pool{device, Vk::DescriptorPoolCreateInfo{DOXYGEN_ELLIPSIS(0), {
DOXYGEN_ELLIPSIS()
}, Vk::DescriptorPoolCreateInfo::Flag::FreeDescriptorSet}};
{
@ -373,20 +373,20 @@ Vk::DescriptorPool pool{device, Vk::DescriptorPoolCreateInfo{DOXYGEN_IGNORE(0),
Vk::Instance instance{NoCreate};
Vk::DescriptorPool pool{NoCreate};
/* [DescriptorSet-allocation-variable] */
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_IGNORE(Vk::pickDevice(instance))}
DOXYGEN_IGNORE()
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_ELLIPSIS(Vk::pickDevice(instance))}
DOXYGEN_ELLIPSIS()
.addEnabledExtensions<Vk::Extensions::EXT::descriptor_indexing>()
.setEnabledFeatures(
Vk::DeviceFeature::DescriptorBindingVariableDescriptorCount|
DOXYGEN_IGNORE(Vk::DeviceFeatures{})
DOXYGEN_ELLIPSIS(Vk::DeviceFeatures{})
)
};
Vk::DescriptorSetLayout layout{device, Vk::DescriptorSetLayoutCreateInfo{
{{DOXYGEN_IGNORE(0), Vk::DescriptorType::SampledImage, 8,
{{DOXYGEN_ELLIPSIS(0), Vk::DescriptorType::SampledImage, 8,
Vk::ShaderStage::Fragment,
Vk::DescriptorSetLayoutBinding::Flag::VariableDescriptorCount}},
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
}};
Vk::DescriptorSet set = pool.allocate(layout, 4);
@ -399,7 +399,7 @@ Vk::Device device{NoCreate};
/* [DescriptorSetLayout-creation] */
#include <Magnum/Vk/DescriptorSetLayoutCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::DescriptorSetLayout layout{device, Vk::DescriptorSetLayoutCreateInfo{
{{0, Vk::DescriptorType::UniformBuffer}},
@ -412,7 +412,7 @@ Vk::DescriptorSetLayout layout{device, Vk::DescriptorSetLayoutCreateInfo{
{
Vk::Device device{NoCreate};
/* [DescriptorSetLayout-creation-immutable-samplers] */
Vk::Sampler sampler{DOXYGEN_IGNORE(NoCreate)};
Vk::Sampler sampler{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::DescriptorSetLayout layout{device, Vk::DescriptorSetLayoutCreateInfo{
{{0, Vk::DescriptorType::UniformBuffer}},
@ -425,12 +425,12 @@ Vk::DescriptorSetLayout layout{device, Vk::DescriptorSetLayoutCreateInfo{
{
Vk::Instance instance{NoCreate};
/* [DescriptorSetLayout-creation-binding-flags] */
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_IGNORE(Vk::pickDevice(instance))}
DOXYGEN_IGNORE()
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_ELLIPSIS(Vk::pickDevice(instance))}
DOXYGEN_ELLIPSIS()
.addEnabledExtensions<Vk::Extensions::EXT::descriptor_indexing>()
.setEnabledFeatures(
Vk::DeviceFeature::DescriptorBindingUniformBufferUpdateAfterBind|
DOXYGEN_IGNORE(Vk::DeviceFeatures{})
DOXYGEN_ELLIPSIS(Vk::DeviceFeatures{})
)
};
@ -438,7 +438,7 @@ Vk::DescriptorSetLayout layout{device, Vk::DescriptorSetLayoutCreateInfo{
{{0, Vk::DescriptorType::UniformBuffer, 1,
~Vk::ShaderStages{},
Vk::DescriptorSetLayoutBinding::Flag::UpdateAfterBind}},
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
}};
/* [DescriptorSetLayout-creation-binding-flags] */
}
@ -449,7 +449,7 @@ Vk::Instance instance;
/* [Device-creation-construct-queue] */
#include <Magnum/Vk/DeviceCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Queue queue{NoCreate};
Vk::Device device{instance, Vk::DeviceCreateInfo{Vk::pickDevice(instance)}
@ -463,8 +463,8 @@ Vk::Instance instance;
Vk::DeviceProperties properties{NoCreate};
using namespace Containers::Literals;
/* [Device-creation-extensions] */
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_IGNORE(properties)}
DOXYGEN_IGNORE()
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_ELLIPSIS(properties)}
DOXYGEN_ELLIPSIS()
.addEnabledExtensions< // predefined extensions
Vk::Extensions::EXT::index_type_uint8,
Vk::Extensions::KHR::device_group>()
@ -478,13 +478,13 @@ Vk::Instance instance;
Vk::DeviceProperties properties{NoCreate};
using namespace Containers::Literals;
/* [Device-creation-features] */
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_IGNORE(properties)}
DOXYGEN_IGNORE()
Vk::Device device{instance, Vk::DeviceCreateInfo{DOXYGEN_ELLIPSIS(properties)}
DOXYGEN_ELLIPSIS()
.setEnabledFeatures(
Vk::DeviceFeature::IndexTypeUnsignedByte|
Vk::DeviceFeature::SamplerAnisotropy|
Vk::DeviceFeature::GeometryShader|
DOXYGEN_IGNORE(Vk::DeviceFeature{}))
DOXYGEN_ELLIPSIS(Vk::DeviceFeature{}))
};
/* [Device-creation-features] */
}
@ -501,26 +501,26 @@ if(extensions.isSupported<Vk::Extensions::EXT::index_type_uint8>())
info.addEnabledExtensions<Vk::Extensions::EXT::index_type_uint8>();
if(extensions.isSupported("VK_NV_mesh_shader"_s))
info.addEnabledExtensions({"VK_NV_mesh_shader"_s});
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
info.setEnabledFeatures(properties.features() & // mask away unsupported ones
(Vk::DeviceFeature::IndexTypeUnsignedByte|
Vk::DeviceFeature::SamplerAnisotropy|
Vk::DeviceFeature::GeometryShader|
DOXYGEN_IGNORE(Vk::DeviceFeature{})));
DOXYGEN_ELLIPSIS(Vk::DeviceFeature{})));
/* [Device-creation-check-supported] */
}
{
Vk::Instance instance;
/* [Device-creation-portability-subset] */
Vk::DeviceProperties properties = DOXYGEN_IGNORE(Vk::pickDevice(instance));
Vk::DeviceProperties properties = DOXYGEN_ELLIPSIS(Vk::pickDevice(instance));
Vk::Device device{instance, Vk::DeviceCreateInfo{properties}
/* enable triangle fans only if actually supported */
.setEnabledFeatures(properties.features() & Vk::DeviceFeature::TriangleFans)
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
if(device.enabledFeatures() & Vk::DeviceFeature::TriangleFans) {
// draw a triangle fan mesh
@ -534,10 +534,10 @@ if(device.enabledFeatures() & Vk::DeviceFeature::TriangleFans) {
Vk::Instance instance;
VkQueryPool pool{};
/* [Device-function-pointers] */
Vk::Device device{DOXYGEN_IGNORE(NoCreate)};
Vk::Device device{DOXYGEN_ELLIPSIS(NoCreate)};
// ...
device->ResetQueryPoolEXT(device, DOXYGEN_IGNORE(pool, 0, 0));
device->ResetQueryPoolEXT(device, DOXYGEN_ELLIPSIS(pool, 0, 0));
/* [Device-function-pointers] */
}
@ -547,13 +547,13 @@ VkQueryPool pool{};
/* [Device-global-function-pointers] */
#include <MagnumExternal/Vulkan/flextVkGlobal.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Device device{DOXYGEN_IGNORE(NoCreate)};
Vk::Device device{DOXYGEN_ELLIPSIS(NoCreate)};
device.populateGlobalFunctionPointers();
DOXYGEN_IGNORE()
vkResetQueryPoolEXT(device, DOXYGEN_IGNORE(pool, 0, 0));
DOXYGEN_ELLIPSIS()
vkResetQueryPoolEXT(device, DOXYGEN_ELLIPSIS(pool, 0, 0));
/* [Device-global-function-pointers] */
}
@ -569,41 +569,41 @@ if(device.isExtensionEnabled<Vk::Extensions::EXT::index_type_uint8>()) {
}
{
Vk::Device device{DOXYGEN_IGNORE(NoCreate)};
Vk::Device device{DOXYGEN_ELLIPSIS(NoCreate)};
/* The include should be a no-op here since it was already included above */
/* [Fence-creation] */
#include <Magnum/Vk/FenceCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Fence fence{device, Vk::FenceCreateInfo{Vk::FenceCreateInfo::Flag::Signaled}};
/* [Fence-creation] */
}
{
Vk::Device device{DOXYGEN_IGNORE(NoCreate)};
Vk::Device device{DOXYGEN_ELLIPSIS(NoCreate)};
Vector2i size;
/* The include should be a no-op here since it was already included above */
/* [Framebuffer-creation] */
#include <Magnum/Vk/FramebufferCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Image color{device, Vk::ImageCreateInfo2D{ /* created before */
Vk::ImageUsage::ColorAttachment,
Vk::PixelFormat::RGBA8Unorm, size, 1}, DOXYGEN_IGNORE(NoAllocate)};
Vk::PixelFormat::RGBA8Unorm, size, 1}, DOXYGEN_ELLIPSIS(NoAllocate)};
Vk::Image depth{device, Vk::ImageCreateInfo2D{
Vk::ImageUsage::DepthStencilAttachment,
Vk::PixelFormat::Depth24UnormStencil8UI, size, 1}, DOXYGEN_IGNORE(NoAllocate)};
Vk::PixelFormat::Depth24UnormStencil8UI, size, 1}, DOXYGEN_ELLIPSIS(NoAllocate)};
Vk::ImageView colorView{device, Vk::ImageViewCreateInfo2D{color}};
Vk::ImageView depthView{device, Vk::ImageViewCreateInfo2D{depth}};
Vk::RenderPass renderPass{device, Vk::RenderPassCreateInfo{} /* created before */
.setAttachments({
Vk::AttachmentDescription{color.format(), DOXYGEN_IGNORE({}, {}, {}, {})},
Vk::AttachmentDescription{depth.format(), DOXYGEN_IGNORE({}, {}, {}, {})},
Vk::AttachmentDescription{color.format(), DOXYGEN_ELLIPSIS({}, {}, {}, {})},
Vk::AttachmentDescription{depth.format(), DOXYGEN_ELLIPSIS({}, {}, {}, {})},
})
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
};
Vk::Framebuffer framebuffer{device, Vk::FramebufferCreateInfo{renderPass, {
@ -619,7 +619,7 @@ Vk::Device device{NoCreate};
/* [Image-creation] */
#include <Magnum/Vk/ImageCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Image image{device, Vk::ImageCreateInfo2D{
Vk::ImageUsage::Sampled, PixelFormat::RGBA8Srgb, {1024, 1024}, 1
@ -650,10 +650,10 @@ Vk::Device device{NoCreate};
Vk::CommandBuffer cmd{NoCreate};
/* [Image-usage-clear] */
Vk::Image image{device, Vk::ImageCreateInfo2D{
Vk::ImageUsage::TransferDestination|DOXYGEN_IGNORE(Vk::ImageUsage{}), Vk::PixelFormat::RGBA8Srgb, DOXYGEN_IGNORE({}, 1)
}, DOXYGEN_IGNORE(Vk::MemoryFlag{})};
Vk::ImageUsage::TransferDestination|DOXYGEN_ELLIPSIS(Vk::ImageUsage{}), Vk::PixelFormat::RGBA8Srgb, DOXYGEN_ELLIPSIS({}, 1)
}, DOXYGEN_ELLIPSIS(Vk::MemoryFlag{})};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.pipelineBarrier(Vk::PipelineStage::TopOfPipe, Vk::PipelineStage::Transfer, {
/* Transition the image to a layout required by the clear operation */
@ -669,14 +669,14 @@ Vk::Device device{NoCreate};
Vk::CommandBuffer cmd{NoCreate};
/* [Image-usage-copy-from-buffer] */
Vk::Buffer input{device, Vk::BufferCreateInfo{
Vk::BufferUsage::TransferSource, 256*256*4 DOXYGEN_IGNORE()
Vk::BufferUsage::TransferSource, 256*256*4 DOXYGEN_ELLIPSIS()
}, Vk::MemoryFlag::HostVisible};
Vk::Image texture{device, Vk::ImageCreateInfo2D{
Vk::ImageUsage::TransferDestination|Vk::ImageUsage::Sampled,
Vk::PixelFormat::RGBA8Srgb, {256, 256}, DOXYGEN_IGNORE(1)
Vk::PixelFormat::RGBA8Srgb, {256, 256}, DOXYGEN_ELLIPSIS(1)
}, Vk::MemoryFlag::DeviceLocal};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.pipelineBarrier(Vk::PipelineStage::TopOfPipe, Vk::PipelineStage::Transfer, {
/* Transition the image to a layout required by the copy operation */
@ -701,7 +701,7 @@ cmd.copyBufferToImage(Vk::CopyBufferToImageInfo2D{
{ 0, Vk::ImageAspect::Color, 0, {{}, {256, 256}}},
{262144, Vk::ImageAspect::Color, 1, {{}, {128, 128}}},
{327680, Vk::ImageAspect::Color, 2, {{}, { 64, 64}}},
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
}
});
/* [Image-usage-copy-from-buffer-multiple] */
@ -712,19 +712,19 @@ Vk::Device device{NoCreate};
Vk::CommandBuffer cmd{NoCreate};
/* [Image-usage-copy-from-image] */
Vk::Image a{device, Vk::ImageCreateInfo2D{
Vk::ImageUsage::TransferSource|DOXYGEN_IGNORE(Vk::ImageUsage{}),
Vk::PixelFormat::RGBA8Srgb, {256, 256}, DOXYGEN_IGNORE(1)
}, DOXYGEN_IGNORE({})};
Vk::ImageUsage::TransferSource|DOXYGEN_ELLIPSIS(Vk::ImageUsage{}),
Vk::PixelFormat::RGBA8Srgb, {256, 256}, DOXYGEN_ELLIPSIS(1)
}, DOXYGEN_ELLIPSIS({})};
Vk::Image b{device, Vk::ImageCreateInfo2D{
Vk::ImageUsage::TransferDestination|DOXYGEN_IGNORE(Vk::ImageUsage{}), Vk::PixelFormat::RGBA8Srgb, {256, 256}, DOXYGEN_IGNORE(1)
}, DOXYGEN_IGNORE({})};
Vk::ImageUsage::TransferDestination|DOXYGEN_ELLIPSIS(Vk::ImageUsage{}), Vk::PixelFormat::RGBA8Srgb, {256, 256}, DOXYGEN_ELLIPSIS(1)
}, DOXYGEN_ELLIPSIS({})};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.pipelineBarrier(Vk::PipelineStage::TopOfPipe, Vk::PipelineStage::Transfer, {
/* Transfer both images to a layout required by the copy operation */
{Vk::Accesses{}, Vk::Access::TransferRead,
Vk::ImageLayout::DOXYGEN_IGNORE(Undefined), Vk::ImageLayout::TransferSource, a},
Vk::ImageLayout::DOXYGEN_ELLIPSIS(Undefined), Vk::ImageLayout::TransferSource, a},
{Vk::Accesses{}, Vk::Access::TransferWrite,
Vk::ImageLayout::Undefined, Vk::ImageLayout::TransferDestination, b}
})
@ -742,11 +742,11 @@ Vk::Device device{NoCreate};
/* [ImageView-creation] */
#include <Magnum/Vk/ImageViewCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Image image{device, Vk::ImageCreateInfo2DArray{ /* created before */
DOXYGEN_IGNORE(Vk::ImageUsage{}, PixelFormat{}, {}, 1)
}, DOXYGEN_IGNORE(Vk::MemoryFlag{})};
DOXYGEN_ELLIPSIS(Vk::ImageUsage{}, PixelFormat{}, {}, 1)
}, DOXYGEN_ELLIPSIS(Vk::MemoryFlag{})};
Vk::ImageView view{device, Vk::ImageViewCreateInfo2DArray{image}};
/* [ImageView-creation] */
@ -759,7 +759,7 @@ const char** argv{};
/* [Instance-creation-minimal] */
#include <Magnum/Vk/InstanceCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Instance instance{{argc, argv}};
/* [Instance-creation-minimal] */
@ -783,7 +783,7 @@ const char** argv{};
using namespace Containers::Literals;
/* [Instance-creation-layers-extensions] */
Vk::Instance instance{Vk::InstanceCreateInfo{argc, argv}
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.addEnabledLayers({"VK_LAYER_KHRONOS_validation"_s})
.addEnabledExtensions< // predefined extensions
Vk::Extensions::EXT::debug_report,
@ -810,7 +810,7 @@ if(layers.isSupported("VK_LAYER_KHRONOS_validation"_s))
info.addEnabledLayers({"VK_LAYER_KHRONOS_validation"_s});
if(extensions.isSupported<Vk::Extensions::EXT::debug_report>())
info.addEnabledExtensions<Vk::Extensions::EXT::debug_report>();
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Instance instance{info};
/* [Instance-creation-check-supported] */
@ -818,7 +818,7 @@ Vk::Instance instance{info};
{
/* [Instance-function-pointers] */
Vk::Instance instance{DOXYGEN_IGNORE()};
Vk::Instance instance{DOXYGEN_ELLIPSIS()};
VkPhysicalDeviceGroupPropertiesKHR properties[10];
UnsignedInt count = Containers::arraySize(properties);
@ -832,7 +832,7 @@ Vk::Instance instance;
/* [Instance-global-function-pointers] */
#include <MagnumExternal/Vulkan/flextVkGlobal.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
instance.populateGlobalFunctionPointers();
@ -862,7 +862,7 @@ Containers::ArrayView<const char> vertexData, indexData;
/* [Memory-allocation] */
#include <Magnum/Vk/MemoryAllocateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
/* Create buffers without allocating them */
Vk::Buffer vertices{device,
@ -937,11 +937,11 @@ meshLayout
.addAttribute(TextureLocation, Binding, VertexFormat::Vector2, 3*sizeof(Float))
.addAttribute(NormalLocation, Binding, VertexFormat::Vector3, 5*sizeof(Float));
Vk::Buffer vertices{DOXYGEN_IGNORE(device), Vk::BufferCreateInfo{
Vk::Buffer vertices{DOXYGEN_ELLIPSIS(device), Vk::BufferCreateInfo{
Vk::BufferUsage::VertexBuffer, vertexCount*8*sizeof(Float)
}, DOXYGEN_IGNORE(NoAllocate)};
}, DOXYGEN_ELLIPSIS(NoAllocate)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Mesh mesh{meshLayout};
mesh.addVertexBuffer(Binding, vertices, 0)
@ -949,11 +949,11 @@ mesh.addVertexBuffer(Binding, vertices, 0)
/* [Mesh-populating] */
/* [Mesh-populating-indexed] */
Vk::Buffer indices{DOXYGEN_IGNORE(device), Vk::BufferCreateInfo{
Vk::Buffer indices{DOXYGEN_ELLIPSIS(device), Vk::BufferCreateInfo{
Vk::BufferUsage::IndexBuffer, indexCount*sizeof(UnsignedShort)
}, DOXYGEN_IGNORE(NoAllocate)};
}, DOXYGEN_ELLIPSIS(NoAllocate)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
mesh.setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort)
.setCount(indexCount);
@ -963,19 +963,19 @@ mesh.setIndexBuffer(indices, 0, MeshIndexType::UnsignedShort)
{
Vk::Device device{NoCreate};
/* [Mesh-populating-owned] */
Vk::Buffer buffer{DOXYGEN_IGNORE(device), Vk::BufferCreateInfo{
Vk::BufferUsage::VertexBuffer|Vk::BufferUsage::IndexBuffer, DOXYGEN_IGNORE(0)
}, DOXYGEN_IGNORE(NoAllocate)};
Vk::Buffer buffer{DOXYGEN_ELLIPSIS(device), Vk::BufferCreateInfo{
Vk::BufferUsage::VertexBuffer|Vk::BufferUsage::IndexBuffer, DOXYGEN_ELLIPSIS(0)
}, DOXYGEN_ELLIPSIS(NoAllocate)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Mesh mesh{Vk::MeshLayout{MeshPrimitive::Triangles}
.addBinding(DOXYGEN_IGNORE(0, 0))
DOXYGEN_IGNORE()
.addBinding(DOXYGEN_ELLIPSIS(0, 0))
DOXYGEN_ELLIPSIS()
};
mesh.addVertexBuffer(DOXYGEN_IGNORE(0), buffer, DOXYGEN_IGNORE(0))
.setIndexBuffer(std::move(buffer), DOXYGEN_IGNORE(0, MeshIndexType{}))
.setCount(DOXYGEN_IGNORE(0));
mesh.addVertexBuffer(DOXYGEN_ELLIPSIS(0), buffer, DOXYGEN_ELLIPSIS(0))
.setIndexBuffer(std::move(buffer), DOXYGEN_ELLIPSIS(0, MeshIndexType{}))
.setCount(DOXYGEN_ELLIPSIS(0));
/* [Mesh-populating-owned] */
}
@ -986,14 +986,14 @@ Vk::ShaderSet shaderSet;
Vk::PipelineLayout pipelineLayout{NoCreate};
Vk::RenderPass renderPass{NoCreate};
/* [Mesh-drawing] */
Vk::Mesh mesh{DOXYGEN_IGNORE(Vk::MeshLayout{MeshPrimitive{}})};
Vk::Mesh mesh{DOXYGEN_ELLIPSIS(Vk::MeshLayout{MeshPrimitive{}})};
Vk::Pipeline pipeline{DOXYGEN_IGNORE(device), Vk::RasterizationPipelineCreateInfo{
DOXYGEN_IGNORE(shaderSet), mesh.layout(), DOXYGEN_IGNORE(pipelineLayout, renderPass, 0, 1)
}DOXYGEN_IGNORE()
Vk::Pipeline pipeline{DOXYGEN_ELLIPSIS(device), Vk::RasterizationPipelineCreateInfo{
DOXYGEN_ELLIPSIS(shaderSet), mesh.layout(), DOXYGEN_ELLIPSIS(pipelineLayout, renderPass, 0, 1)
}DOXYGEN_ELLIPSIS()
};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.bindPipeline(pipeline)
.draw(mesh);
@ -1021,15 +1021,15 @@ dynamicMeshLayout
.addAttribute(TextureLocation, 1, VertexFormat::Vector2, 0)
.addAttribute(NormalLocation, 2, VertexFormat::Vector3, 0);
Vk::Pipeline pipeline{DOXYGEN_IGNORE(device), Vk::RasterizationPipelineCreateInfo{
DOXYGEN_IGNORE(shaderSet), dynamicMeshLayout, DOXYGEN_IGNORE(pipelineLayout, renderPass, 0, 1)}
Vk::Pipeline pipeline{DOXYGEN_ELLIPSIS(device), Vk::RasterizationPipelineCreateInfo{
DOXYGEN_ELLIPSIS(shaderSet), dynamicMeshLayout, DOXYGEN_ELLIPSIS(pipelineLayout, renderPass, 0, 1)}
/* Enable dynamic primitive and stride */
.setDynamicStates(Vk::DynamicRasterizationState::MeshPrimitive|
Vk::DynamicRasterizationState::VertexInputBindingStride)
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
};
Vk::Buffer vertices{DOXYGEN_IGNORE(NoCreate)};
Vk::Buffer vertices{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::Mesh mesh{Vk::MeshLayout{MeshPrimitive::Triangles} /* Or TriangleStrip etc */
/* Concrete stride */
@ -1046,7 +1046,7 @@ Vk::Mesh mesh{Vk::MeshLayout{MeshPrimitive::Triangles} /* Or TriangleStrip etc *
mesh.addVertexBuffer(0, vertices, 0)
.addVertexBuffer(1, vertices, 3*sizeof(Float))
.addVertexBuffer(2, vertices, 5*sizeof(Float))
.setCount(DOXYGEN_IGNORE(0));
.setCount(DOXYGEN_ELLIPSIS(0));
cmd.bindPipeline(pipeline)
/* Updates the dynamic primitive and stride as needed by the mesh */
@ -1060,12 +1060,12 @@ Vk::Device device{NoCreate};
/* [Pipeline-creation-rasterization] */
#include <Magnum/Vk/RasterizationPipelineCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::ShaderSet shaderSet{DOXYGEN_IGNORE()};
Vk::MeshLayout meshLayout{DOXYGEN_IGNORE(MeshPrimitive{})};
Vk::PipelineLayout pipelineLayout{DOXYGEN_IGNORE(NoCreate)};
Vk::RenderPass renderPass{DOXYGEN_IGNORE(NoCreate)};
Vk::ShaderSet shaderSet{DOXYGEN_ELLIPSIS()};
Vk::MeshLayout meshLayout{DOXYGEN_ELLIPSIS(MeshPrimitive{})};
Vk::PipelineLayout pipelineLayout{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::RenderPass renderPass{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::Pipeline pipeline{device, Vk::RasterizationPipelineCreateInfo{
shaderSet, meshLayout, pipelineLayout, renderPass, 0, 1}
@ -1080,10 +1080,10 @@ Vk::Device device{NoCreate};
/* [Pipeline-creation-compute] */
#include <Magnum/Vk/ComputePipelineCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::ShaderSet shaderSet{DOXYGEN_IGNORE()};
Vk::PipelineLayout pipelineLayout{DOXYGEN_IGNORE(NoCreate)};
Vk::ShaderSet shaderSet{DOXYGEN_ELLIPSIS()};
Vk::PipelineLayout pipelineLayout{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::Pipeline pipeline{device, Vk::ComputePipelineCreateInfo{
shaderSet, pipelineLayout
@ -1094,9 +1094,9 @@ Vk::Pipeline pipeline{device, Vk::ComputePipelineCreateInfo{
{
Vk::CommandBuffer cmd{NoCreate};
/* [Pipeline-usage] */
Vk::Pipeline pipeline{DOXYGEN_IGNORE(NoCreate)};
Vk::Pipeline pipeline{DOXYGEN_ELLIPSIS(NoCreate)};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
cmd.bindPipeline(pipeline);
/* [Pipeline-usage] */
@ -1108,14 +1108,14 @@ Vk::Device device{NoCreate};
/* [PipelineLayout-creation] */
#include <Magnum/Vk/PipelineLayoutCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::DescriptorSetLayout layout1{DOXYGEN_IGNORE(NoCreate)};
Vk::DescriptorSetLayout layout2{DOXYGEN_IGNORE(NoCreate)};
DOXYGEN_IGNORE()
Vk::DescriptorSetLayout layout1{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::DescriptorSetLayout layout2{DOXYGEN_ELLIPSIS(NoCreate)};
DOXYGEN_ELLIPSIS()
Vk::PipelineLayout{device, Vk::PipelineLayoutCreateInfo{
layout1, layout2, DOXYGEN_IGNORE(layout1)
layout1, layout2, DOXYGEN_ELLIPSIS(layout1)
}};
/* [PipelineLayout-creation] */
}
@ -1126,7 +1126,7 @@ Vk::Device device{NoCreate};
/* [RenderPass-creation] */
#include <Magnum/Vk/RenderPassCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::RenderPass renderPass{device, Vk::RenderPassCreateInfo{}
.setAttachments({
@ -1168,16 +1168,16 @@ Vk::RenderPass renderPass{device, Vk::RenderPassCreateInfo{}
Vk::Framebuffer framebuffer{NoCreate};
/* [RenderPass-usage-begin] */
Vk::CommandBuffer cmd = DOXYGEN_IGNORE(Vk::CommandBuffer{NoCreate});
Vk::CommandBuffer cmd = DOXYGEN_ELLIPSIS(Vk::CommandBuffer{NoCreate});
cmd.begin()
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.beginRenderPass(Vk::RenderPassBeginInfo{renderPass, framebuffer}
.clearColor(0, 0x1f1f1f_srgbf)
.clearDepthStencil(1, 1.0f, 0))
/* [RenderPass-usage-begin] */
/* [RenderPass-usage-end] */
.endRenderPass()
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
.end();
/* [RenderPass-usage-end] */
}
@ -1188,7 +1188,7 @@ Vk::Device device{NoCreate};
/* [Sampler-creation] */
#include <Magnum/Vk/SamplerCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Sampler sampler{device, Vk::SamplerCreateInfo{}};
/* [Sampler-creation] */
@ -1211,13 +1211,13 @@ Vk::Device device{NoCreate};
/* [Shader-creation] */
#include <Magnum/Vk/ShaderCreateInfo.h>
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::ShaderCreateInfo info{
CORRADE_INTERNAL_ASSERT_EXPRESSION(Utility::Directory::read("shader.spv"))
};
DOXYGEN_IGNORE()
DOXYGEN_ELLIPSIS()
Vk::Shader shader{device, info};
/* [Shader-creation] */
@ -1225,7 +1225,7 @@ Vk::Shader shader{device, info};
{
/* [ShaderSet-usage] */
Vk::Shader vert{DOXYGEN_IGNORE(NoCreate)}, frag{DOXYGEN_IGNORE(NoCreate)};
Vk::Shader vert{DOXYGEN_ELLIPSIS(NoCreate)}, frag{DOXYGEN_ELLIPSIS(NoCreate)};
using namespace Containers::Literals;
@ -1246,7 +1246,7 @@ set.addShader(Vk::ShaderStage::Fragment, frag, "main"_s, {
{
using namespace Containers::Literals;
/* [ShaderSet-usage-ownership-transfer] */
Vk::Shader shader{DOXYGEN_IGNORE(NoCreate)};
Vk::Shader shader{DOXYGEN_ELLIPSIS(NoCreate)};
Vk::ShaderSet set;
set.addShader(Vk::ShaderStage::Vertex, shader, "vert"_s)

4
doc/snippets/debugtools-compareimage.cpp

@ -38,7 +38,7 @@
using namespace Magnum;
#define DOXYGEN_IGNORE(...) __VA_ARGS__
#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__
namespace {
@ -73,7 +73,7 @@ ProcessingTest::ProcessingTest() {
if(false) {
/* [basic] */
Image2D actual{DOXYGEN_IGNORE(doProcessing())}, expected{DOXYGEN_IGNORE(loadExpectedImage())};
Image2D actual{DOXYGEN_ELLIPSIS(doProcessing())}, expected{DOXYGEN_ELLIPSIS(loadExpectedImage())};
CORRADE_COMPARE_AS(actual, expected, DebugTools::CompareImage);
/* [basic] */
}

Loading…
Cancel
Save