/ appendices / VK_KHR_sampler_mirror_clamp_to_edge.txt
VK_KHR_sampler_mirror_clamp_to_edge.txt
 1  // Copyright (c) 2014-2019 Khronos Group. This work is licensed under a
 2  // Creative Commons Attribution 4.0 International License; see
 3  // http://creativecommons.org/licenses/by/4.0/
 4  
 5  include::meta/VK_KHR_sampler_mirror_clamp_to_edge.txt[]
 6  
 7  *Last Modified Date*::
 8      2016-02-16
 9  *Contributors*::
10    - Tobias Hector, Imagination Technologies
11  
12  `VK_KHR_sampler_mirror_clamp_to_edge` extends the set of sampler address
13  modes to include an additional mode
14  (ename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) that effectively uses a
15  texture map twice as large as the original image in which the additional
16  half of the new image is a mirror image of the original image.
17  
18  This new mode relaxes the need to generate images whose opposite edges match
19  by using the original image to generate a matching "`mirror image`".
20  This mode allows the texture to be mirrored only once in the negative s, t,
21  and r directions.
22  
23  === New Enum Constants
24  
25    * Extending elink:VkSamplerAddressMode:
26    ** ename:VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE
27  
28  === Example
29  
30  Creating a sampler with the new address mode in each dimension
31  
32  
33  [source,c++]
34  ----------------------------------------
35      VkSamplerCreateInfo createInfo =
36      {
37          VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO // sType
38          // Other members set to application-desired values
39      };
40  
41      createInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
42      createInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
43      createInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
44  
45      VkSampler sampler;
46      VkResult result = vkCreateSampler(
47          device,
48          &createInfo,
49          &sampler);
50  ----------------------------------------
51  
52  === Version History
53  
54   * Revision 1, 2016-02-16 (Tobias Hector)
55     - Initial draft