Browse Source

GL,Vk: clarify behavior with implementation-specific type/format values.

It may soon start happening that those will have an
implementation-specific value that is neither a GL or a Vulkan
identifier, so people should not just pass them around without checking.
pull/549/head
Vladimír Vondruš 4 years ago
parent
commit
cad13c9f40
  1. 18
      src/Magnum/GL/Mesh.h
  2. 20
      src/Magnum/Vk/ImageCreateInfo.h
  3. 20
      src/Magnum/Vk/MeshLayout.h

18
src/Magnum/GL/Mesh.h

@ -511,7 +511,14 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
*/
explicit Mesh(MeshPrimitive primitive = MeshPrimitive::Triangles);
/** @overload */
/** @overload
* @brief Construct with a generic primitive type
*
* Note that implementation-specific values are passed as-is with
* @ref meshPrimitiveUnwrap(). It's the user responsibility to ensure
* an implementation-specific value actually represents a valid OpenGL
* primitive type.
*/
explicit Mesh(Magnum::MeshPrimitive primitive): Mesh{meshPrimitive(primitive)} {}
/**
@ -654,7 +661,14 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
return *this;
}
/** @overload */
/** @overload
* @brief Set a generic primitive type
*
* Note that implementation-specific values are passed as-is with
* @ref meshPrimitiveUnwrap(). It's the user responsibility to ensure
* an implementation-specific value actually represents a valid OpenGL
* primitive type.
*/
Mesh& setPrimitive(Magnum::MeshPrimitive primitive) {
return setPrimitive(meshPrimitive(primitive));
}

20
src/Magnum/Vk/ImageCreateInfo.h

@ -226,9 +226,25 @@ class MAGNUM_VK_EXPORT ImageCreateInfo {
* this constructor.
*/
explicit ImageCreateInfo(VkImageType type, ImageUsages usages, PixelFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {});
/** @overload */
/** @overload
* @brief Construct with a generic pixel format
*
* Note that implementation-specific values are passed as-is with
* @ref pixelFormatUnwrap(). It's the user responsibility to ensure
* an implementation-specific value actually represents a valid Vulkan
* pixel format.
*/
explicit ImageCreateInfo(VkImageType type, ImageUsages usages, Magnum::PixelFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {});
/** @overload */
/** @overload
* @brief Constructor with a generic compressed pixel format
*
* Note that implementation-specific values are passed as-is with
* @ref compressedPixelFormatUnwrap(). It's the user responsibility to
* ensure an implementation-specific actually represents a valid Vulkan
* pixel format.
*/
explicit ImageCreateInfo(VkImageType type, ImageUsages usages, Magnum::CompressedPixelFormat format, const Vector3i& size, Int layers, Int levels, Int samples = 1, ImageLayout initialLayout = ImageLayout::Undefined, Flags flags = {});
/* No overload w/o initialLayout here as the general public is expected

20
src/Magnum/Vk/MeshLayout.h

@ -227,7 +227,15 @@ class MAGNUM_VK_EXPORT MeshLayout {
* @ref vkPipelineInputAssemblyStateCreateInfo()
*/
explicit MeshLayout(MeshPrimitive primitive);
/** @overload */
/** @overload
* @brief Construct with a generic primitive type
*
* Note that implementation-specific values are passed as-is with
* @ref meshPrimitiveUnwrap(). It's the user responsibility to ensure
* an implementation-specific value actually represents a valid Vulkan
* primitive type.
*/
explicit MeshLayout(Magnum::MeshPrimitive primitive);
/**
@ -376,7 +384,15 @@ class MAGNUM_VK_EXPORT MeshLayout {
MeshLayout& addAttribute(UnsignedInt location, UnsignedInt binding, VertexFormat format, UnsignedInt offset) &;
/** @overload */
MeshLayout&& addAttribute(UnsignedInt location, UnsignedInt binding, VertexFormat format, UnsignedInt offset) &&;
/** @overload */
/** @overload
* @brief Add an attribute with a generic primitive type
*
* Note that implementation-specific values are passed as-is with
* @ref vertexFormatUnwrap(). It's the user responsibility to ensure an
* implementation-specific value actually represents a valid Vulkan
* vertex format.
*/
MeshLayout& addAttribute(UnsignedInt location, UnsignedInt binding, Magnum::VertexFormat format, UnsignedInt offset) &;
/** @overload */
MeshLayout&& addAttribute(UnsignedInt location, UnsignedInt binding, Magnum::VertexFormat format, UnsignedInt offset) &&;

Loading…
Cancel
Save