VKVIEWPORT(3)

NAME
VkViewport - Structure specifying a viewport

C SPECIFICATION

The VkViewport structure is defined as:

    typedef struct VkViewport {
        float    x;
        float    y;
        float    width;
        float    height;
        float    minDepth;
        float    maxDepth;
    } VkViewport;

MEMBERS

    • x and y are the viewport’s upper left corner [ $(x,y)$ ].

    • width and height are the viewport’s width and height, respectively.

    • minDepth and maxDepth are the depth range for the viewport. It is valid for minDepth to be greater than or equal to maxDepth.

DESCRIPTION

The framebuffer depth coordinate [ $z_f$ ] may be represented using either a fixed-point or floating-point representation. However, a floating-point representation must be used if the depth/stencil attachment has a floating-point depth component. If an [ $m$ ]-bit fixed-point representation is used, we assume that it represents each value [ $ac{k}{2^m - 1}$ ], where [ $k in 0,1, in binary as a string of all ones).

The viewport parameters shown in the above equations are found from these values as

    \begin{align*}
        o_x & = x + \frac{width}{2} \\
        o_y & = y + \frac{height}{2} \\
        o_z & = minDepth \\
        p_x & = width \\
        p_y & = height \\
        p_z & = maxDepth - minDepth. \end{align*}

The width and height of the implementation-dependent maximum viewport dimensions must be greater than or equal to the width and height of the largest image which can be created and attached to a framebuffer.

The floating-point viewport bounds are represented with an implementation-dependent precision.

VALID USAGE

    • width must be greater than 0.0 and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[0]

    • height must be greater than 0.0 and less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[1]

    • x and y must each be between viewportBoundsRange[0] and viewportBoundsRange[1], inclusive

    • x + width must be less than or equal to viewportBoundsRange[1]

    • y + height must be less than or equal to viewportBoundsRange[1]

    • minDepth must be between 0.0 and 1.0, inclusive

    • maxDepth must be between 0.0 and 1.0, inclusive

SEE ALSO

VkPipelineViewportStateCreateInfo, vkCmdSetViewport

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkViewport

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification,not directly.

COPYRIGHT

Copyright (c) 2014-2016 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.

AUTHOR

Khronos Group
    Author.