• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2018-2020 NVIDIA Corporation
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5[[vertexpostproc-viewportwscaling]]
6== Controlling Viewport W Scaling
7
8If viewport *W* scaling is enabled, the *W* component of the clip coordinate
9is modified by the provided coefficients from the corresponding viewport as
10follows.
11
12  {empty}:: [eq]#w~c~' = x~coeff~ x~c~ {plus} y~coeff~ y~c~ {plus} w~c~#
13
14[open,refpage='VkPipelineViewportWScalingStateCreateInfoNV',desc='Structure specifying parameters of a newly created pipeline viewport W scaling state',type='structs']
15--
16The sname:VkPipelineViewportWScalingStateCreateInfoNV structure is defined
17as:
18
19include::{generated}/api/structs/VkPipelineViewportWScalingStateCreateInfoNV.txt[]
20
21  * pname:sType is the type of this structure.
22  * pname:pNext is `NULL` or a pointer to a structure extending this
23    structure.
24  * pname:viewportWScalingEnable controls whether viewport *W* scaling is
25    enabled.
26  * pname:viewportCount is the number of viewports used by *W* scaling, and
27    must: match the number of viewports in the pipeline if viewport *W*
28    scaling is enabled.
29  * pname:pViewportWScalings is a pointer to an array of
30    sname:VkViewportWScalingNV structures defining the *W* scaling
31    parameters for the corresponding viewports.
32    If the viewport *W* scaling state is dynamic, this member is ignored.
33
34include::{generated}/validity/structs/VkPipelineViewportWScalingStateCreateInfoNV.txt[]
35--
36
37The sname:VkPipelineViewportWScalingStateCreateInfoNV state is set by adding
38this structure to the pname:pNext chain of a
39sname:VkPipelineViewportStateCreateInfo structure and setting the graphics
40pipeline state with flink:vkCreateGraphicsPipelines.
41
42[open,refpage='vkCmdSetViewportWScalingNV',desc='Set the viewport W scaling dynamically for a command buffer',type='protos']
43--
44To <<pipelines-dynamic-state, dynamically set>> the viewport *W* scaling
45parameters, call:
46
47include::{generated}/api/protos/vkCmdSetViewportWScalingNV.txt[]
48
49  * pname:commandBuffer is the command buffer into which the command will be
50    recorded.
51  * pname:firstViewport is the index of the first viewport whose parameters
52    are updated by the command.
53  * pname:viewportCount is the number of viewports whose parameters are
54    updated by the command.
55  * pname:pViewportWScalings is a pointer to an array of
56    slink:VkViewportWScalingNV structures specifying viewport parameters.
57
58The viewport parameters taken from element [eq]#i# of
59pname:pViewportWScalings replace the current state for the viewport index
60[eq]#pname:firstViewport {plus} i#, for [eq]#i# in [eq]#[0,
61pname:viewportCount)#.
62
63This command sets the viewport *W* scaling for subsequent drawing commands
64when the graphics pipeline is created with
65ename:VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV set in
66slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
67Otherwise, this state is specified by the
68slink:VkPipelineViewportWScalingStateCreateInfoNV::pname:pViewportWScalings
69values used to create the currently active pipeline.
70
71.Valid Usage
72****
73  * [[VUID-vkCmdSetViewportWScalingNV-firstViewport-01324]]
74    The sum of pname:firstViewport and pname:viewportCount must: be between
75    `1` and slink:VkPhysicalDeviceLimits::pname:maxViewports, inclusive
76****
77
78include::{generated}/validity/protos/vkCmdSetViewportWScalingNV.txt[]
79--
80
81Both slink:VkPipelineViewportWScalingStateCreateInfoNV and
82flink:vkCmdSetViewportWScalingNV use sname:VkViewportWScalingNV to set the
83viewport transformation parameters.
84
85[open,refpage='VkViewportWScalingNV',desc='Structure specifying a viewport',type='structs']
86--
87The sname:VkViewportWScalingNV structure is defined as:
88
89include::{generated}/api/structs/VkViewportWScalingNV.txt[]
90
91  * pname:xcoeff and pname:ycoeff are the viewport's W scaling factor for x
92    and y respectively.
93
94include::{generated}/validity/structs/VkViewportWScalingNV.txt[]
95--
96