Vulkan-Docs/doc/specs/vulkan/chapters/clears.txt

269 lines
11 KiB
Plaintext
Raw Normal View History

2016-02-16 09:53:44 +00:00
// Copyright (c) 2015-2016 The Khronos Group Inc.
// Copyright notice at https://www.khronos.org/registry/speccopyright.html
[[clears]]
= Clear Commands
[[clears-outside]]
== Clearing Images Outside A Render Pass Instance
Color and depth/stencil images can: be cleared outside a render pass
instance using flink:vkCmdClearColorImage or
flink:vkCmdClearDepthStencilImage, respectively. These commands are only
allowed outside of a render pass instance.
To clear one or more subranges of a color image, call:
include::../protos/vkCmdClearColorImage.txt[]
* pname:commandBuffer is the command buffer into which the command will be
recorded.
* pname:image is the image to be cleared.
* pname:imageLayout specifies the current layout of the image subresource
ranges to be cleared, and must: be ename:VK_IMAGE_LAYOUT_GENERAL or
ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL.
* pname:pColor is a pointer to a slink:VkClearColorValue structure that
contains the values the image subresource ranges will be cleared to (see
<<clears-values>> below).
Change log for April 15, 2016 Vulkan 1.0.10 spec update: * Bump API patch number and header version number to 10 for this update. Github Issues: * Slightly tweak the <<memory-allocation,Host Memory>> allocator language so that an application wrapping the standard C alloc/free/realloc functions is still correct - the previous language was too strong with regards to freeing memory. Also made certain scenarios clearer - an implementation may now continue without error if an allocation failed and it is able to continue correctly (public issue 21). * Require that etext:VK_*_CREATE_SPARSE_BINDING_BIT is set when the corresponding etext:VK_*_CREATE_SPARSE_RESIDENCY_BIT is used, in the <<sparsememory-miptail,Mip Tail Regions>> section and related commands flink:vkCreateBuffer and flink:vkCreateImage (public issue 84). * Update the <<features,Features, Limits, and Formats>> chapter to clarify interactions between optional features and dynamic state for the pname:depthBiasClamp and pname:wideLines features (public issue 89). * Describe the code:WorkgroupSize builtin in the <<interfaces-builtin-variables,Built-In Variables>> section, and update the <<compute-shaders,Compute Shaders>> section to further clarify how to set the number of workgroups to execute in a compute shader (public issue 145). * Use the term *image subresource* everywhere instead of *subresource*, except for the special case of *host-accessible subresource*, which may be either an image subresource or buffer range (public issue 120) * Add a note to the <<features,Features, Limits, and Formats>> section about extensibility of structures (Public issue 165). * Fix return code flink:vkAcquireNextImageKHR when the timeout parameter is 0 to ename:VK_NOT_READY instead of ename:VK_TIMEOUT (public issue 170). * Fix typo in slink:VkLayerProperties::pname:apiVersion field (public issue 172). Internal Issues: * Fix a few minor internally-detected typos. * Minor formatting tweaks to pseudocode in the <<resources,Resource Creation>> chapter (internal issue 179). * Fix typo in the definition of point sampling for elink:VkCullModeFlagBits (internal issue 268).
2016-04-14 08:58:49 +00:00
* pname:rangeCount is the number of image subresource range structures in
2016-02-16 09:53:44 +00:00
pname:pRanges.
* pname:pRanges points to an array of slink:VkImageSubresourceRange
structures that describe a range of mipmap levels, array layers, and
aspects to be cleared, as described in <<resources-image-views,Image
Change log for April 15, 2016 Vulkan 1.0.10 spec update: * Bump API patch number and header version number to 10 for this update. Github Issues: * Slightly tweak the <<memory-allocation,Host Memory>> allocator language so that an application wrapping the standard C alloc/free/realloc functions is still correct - the previous language was too strong with regards to freeing memory. Also made certain scenarios clearer - an implementation may now continue without error if an allocation failed and it is able to continue correctly (public issue 21). * Require that etext:VK_*_CREATE_SPARSE_BINDING_BIT is set when the corresponding etext:VK_*_CREATE_SPARSE_RESIDENCY_BIT is used, in the <<sparsememory-miptail,Mip Tail Regions>> section and related commands flink:vkCreateBuffer and flink:vkCreateImage (public issue 84). * Update the <<features,Features, Limits, and Formats>> chapter to clarify interactions between optional features and dynamic state for the pname:depthBiasClamp and pname:wideLines features (public issue 89). * Describe the code:WorkgroupSize builtin in the <<interfaces-builtin-variables,Built-In Variables>> section, and update the <<compute-shaders,Compute Shaders>> section to further clarify how to set the number of workgroups to execute in a compute shader (public issue 145). * Use the term *image subresource* everywhere instead of *subresource*, except for the special case of *host-accessible subresource*, which may be either an image subresource or buffer range (public issue 120) * Add a note to the <<features,Features, Limits, and Formats>> section about extensibility of structures (Public issue 165). * Fix return code flink:vkAcquireNextImageKHR when the timeout parameter is 0 to ename:VK_NOT_READY instead of ename:VK_TIMEOUT (public issue 170). * Fix typo in slink:VkLayerProperties::pname:apiVersion field (public issue 172). Internal Issues: * Fix a few minor internally-detected typos. * Minor formatting tweaks to pseudocode in the <<resources,Resource Creation>> chapter (internal issue 179). * Fix typo in the definition of point sampling for elink:VkCullModeFlagBits (internal issue 268).
2016-04-14 08:58:49 +00:00
Views>>. The pname:aspectMask of all image subresource ranges must: only
2016-02-16 09:53:44 +00:00
include ename:VK_IMAGE_ASPECT_COLOR_BIT.
Each specified range in pname:pRanges is cleared to the value specified by
pname:pColor.
include::../validity/protos/vkCmdClearColorImage.txt[]
To clear one or more subranges of a depth/stencil image, call:
include::../protos/vkCmdClearDepthStencilImage.txt[]
* pname:commandBuffer is the command buffer into which the command will be
recorded.
* pname:image is the image to be cleared.
* pname:imageLayout specifies the current layout of the image subresource
ranges to be cleared, and must: be ename:VK_IMAGE_LAYOUT_GENERAL or
ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL.
* pname:pDepthStencil is a pointer to a slink:VkClearDepthStencilValue
structure that contains the values the depth and stencil image
subresource ranges will be cleared to (see <<clears-values>> below).
Change log for April 15, 2016 Vulkan 1.0.10 spec update: * Bump API patch number and header version number to 10 for this update. Github Issues: * Slightly tweak the <<memory-allocation,Host Memory>> allocator language so that an application wrapping the standard C alloc/free/realloc functions is still correct - the previous language was too strong with regards to freeing memory. Also made certain scenarios clearer - an implementation may now continue without error if an allocation failed and it is able to continue correctly (public issue 21). * Require that etext:VK_*_CREATE_SPARSE_BINDING_BIT is set when the corresponding etext:VK_*_CREATE_SPARSE_RESIDENCY_BIT is used, in the <<sparsememory-miptail,Mip Tail Regions>> section and related commands flink:vkCreateBuffer and flink:vkCreateImage (public issue 84). * Update the <<features,Features, Limits, and Formats>> chapter to clarify interactions between optional features and dynamic state for the pname:depthBiasClamp and pname:wideLines features (public issue 89). * Describe the code:WorkgroupSize builtin in the <<interfaces-builtin-variables,Built-In Variables>> section, and update the <<compute-shaders,Compute Shaders>> section to further clarify how to set the number of workgroups to execute in a compute shader (public issue 145). * Use the term *image subresource* everywhere instead of *subresource*, except for the special case of *host-accessible subresource*, which may be either an image subresource or buffer range (public issue 120) * Add a note to the <<features,Features, Limits, and Formats>> section about extensibility of structures (Public issue 165). * Fix return code flink:vkAcquireNextImageKHR when the timeout parameter is 0 to ename:VK_NOT_READY instead of ename:VK_TIMEOUT (public issue 170). * Fix typo in slink:VkLayerProperties::pname:apiVersion field (public issue 172). Internal Issues: * Fix a few minor internally-detected typos. * Minor formatting tweaks to pseudocode in the <<resources,Resource Creation>> chapter (internal issue 179). * Fix typo in the definition of point sampling for elink:VkCullModeFlagBits (internal issue 268).
2016-04-14 08:58:49 +00:00
* pname:rangeCount is the number of image subresource range structures in
2016-02-16 09:53:44 +00:00
pname:pRanges.
* pname:pRanges points to an array of slink:VkImageSubresourceRange
structures that describe a range of mipmap levels, array layers, and
aspects to be cleared, as described in <<resources-image-views,Image
Change log for April 15, 2016 Vulkan 1.0.10 spec update: * Bump API patch number and header version number to 10 for this update. Github Issues: * Slightly tweak the <<memory-allocation,Host Memory>> allocator language so that an application wrapping the standard C alloc/free/realloc functions is still correct - the previous language was too strong with regards to freeing memory. Also made certain scenarios clearer - an implementation may now continue without error if an allocation failed and it is able to continue correctly (public issue 21). * Require that etext:VK_*_CREATE_SPARSE_BINDING_BIT is set when the corresponding etext:VK_*_CREATE_SPARSE_RESIDENCY_BIT is used, in the <<sparsememory-miptail,Mip Tail Regions>> section and related commands flink:vkCreateBuffer and flink:vkCreateImage (public issue 84). * Update the <<features,Features, Limits, and Formats>> chapter to clarify interactions between optional features and dynamic state for the pname:depthBiasClamp and pname:wideLines features (public issue 89). * Describe the code:WorkgroupSize builtin in the <<interfaces-builtin-variables,Built-In Variables>> section, and update the <<compute-shaders,Compute Shaders>> section to further clarify how to set the number of workgroups to execute in a compute shader (public issue 145). * Use the term *image subresource* everywhere instead of *subresource*, except for the special case of *host-accessible subresource*, which may be either an image subresource or buffer range (public issue 120) * Add a note to the <<features,Features, Limits, and Formats>> section about extensibility of structures (Public issue 165). * Fix return code flink:vkAcquireNextImageKHR when the timeout parameter is 0 to ename:VK_NOT_READY instead of ename:VK_TIMEOUT (public issue 170). * Fix typo in slink:VkLayerProperties::pname:apiVersion field (public issue 172). Internal Issues: * Fix a few minor internally-detected typos. * Minor formatting tweaks to pseudocode in the <<resources,Resource Creation>> chapter (internal issue 179). * Fix typo in the definition of point sampling for elink:VkCullModeFlagBits (internal issue 268).
2016-04-14 08:58:49 +00:00
Views>>. The pname:aspectMask of each image subresource range in
pname:pRanges can: include ename:VK_IMAGE_ASPECT_DEPTH_BIT if the image
format has a depth component, and ename:VK_IMAGE_ASPECT_STENCIL_BIT if
the image format has a stencil component. pname:pDepthStencil is a
pointer to a sname:VkClearDepthStencilValue structure that contains the
values the image subresource ranges will be cleared to (see
<<clears-values>> below).
2016-02-16 09:53:44 +00:00
include::../validity/protos/vkCmdClearDepthStencilImage.txt[]
Clears outside render pass instances are treated as transfer operations for
the purposes of memory barriers.
[[clears-inside]]
== Clearing Images Inside A Render Pass Instance
To clear one or more regions of color and depth/stencil attachments inside a
render pass instance, call:
include::../protos/vkCmdClearAttachments.txt[]
* pname:commandBuffer is the command buffer into which the command will be
recorded.
* pname:attachmentCount is the number of entries in the pname:pAttachments
array.
* pname:pAttachments is a pointer to an array of slink:VkClearAttachment
structures defining the attachments to clear and the clear values to
use.
* pname:rectCount is the number of entries in the pname:pRects array.
* pname:pRects points to an array of slink:VkClearRect structures defining
Change log for March 10, 2016 Vulkan 1.0.6 spec update: * Bump API patch number and header version number to 6 for this update. Github Issues: * Define 'invocation group' for compute and graphics shaders. Cleanup definition and use of 'workgroup', and add glossary entries (public issue 1). * Various minor editorial fixes (public issue 33). * Clarify locations for block members in the &lt;&lt;interfaces-iointerfaces-locations,Location Assignment>> section (public issue 45). * Editorial fixes for &lt;&lt;commandbuffer-allocation,Command Buffer Allocation>> section (public issues 54, 59). * Clarify behavior of depth test in the &lt;&lt;fragops-depth,Depth Test&gt;&gt; section (public issues 80, 81). * Remove discussion of return codes from flink:vkGetPhysicalDeviceSparseImageFormatProperties and flink:vkGetImageSparseMemoryRequirements, which don't return values (public issue 82). * Allow flink:vkCmdDrawIndirect and flink:vkCmdDrawIndexedIndirect pname:drawCount of 0, as well as 1, when the multiDrawIndirect feature is not supported (public issue 88). * Remove confusing wording in the &lt;&lt;features-limits,Limits>> section describing the slink:VkPhysicalDeviceLimits pname:minTexelBufferOffsetAlignment, pname:minUniformBufferOffsetAlignment, and pname:minStorageBufferOffsetAlignment members as both minimums and maximums (public issue 91). * Clarified that only the RGB components should be affected in places where sRGB is referred to in the spec, such as ASTC formats. Minor re-wording to avoid "color space" when actively incorrect, now that we refer to the Data Format Spec which actually makes a distinction between color space and transfer function (public issue 94). * Treat pname:pPropertyCount == 0 consistently in flink:vkEnumerateInstanceLayerProperties and flink:vkEnumerateDeviceLayerProperties (public issue 99) * Cleanup minor editorial issues in chapters 14-17 (public issue 100). * Clarify definition of flink:vkEnumerateInstanceExtensionProperties and flink:vkEnumerateDeviceExtensionProperties (public issue 101). * Define the flink:vkEnumerateInstanceExtensionProperties and flink:vkEnumerateDeviceExtensionProperties pname:pLayerName parameter to be a pointer to a null-terminated UTF-8 string (public issue 101). * Rearrange "Missing information" references in mandatory format tables (public issue 101). * Clarify that the enumerated extensions returned by flink:vkEnumerateInstanceExtensionProperties and flink:vkEnumerateDeviceExtensionProperties will only include extensions provided by the platform or extensions implemented in implicitly enabled layers (public issue 101). * Miscellaneous editorial fixes. Include the Vulkan spec patch number in the PDF title. Fix label on &lt;&lt;fig-non-strict-lines,Non strict lines>> diagram. Use more easily distinguished symbols in tables in the &lt;&lt;features-required-format-support,Required Format Support>> section. Don't require FQDNs used as layer names be encoded in lower case if not possible, in the &lt;&lt;extensions-naming-conventions, Extension and Layer Naming Conventions>> section (public issues 101, 119, 121). Internal Issues: * Fixed excessive spacing in tables in XHTML (internal issue 18). * Clarify that ename:VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT applies to secondary command buffers. Previously spec only referred to the members of pname:pCommandBuffers being affected by this bit. Added a separate slink:VkSubmitInfo Valid Usage restriction specifying that ename:VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT also applies to any secondary command buffers that are recorded into the primary command buffers in pname:pCommandBuffers (internal issue 106). * Clarify that slink:VkDeviceCreateInfo::pname:pEnabledFeatures can be NULL (internal issue 117). * Remove "the value of" where it is redundant (e.g. speaking of an API parameter, struct member, or SPIR-V variable, but not when speaking of color components) (internal issue 175). * Forced patch version to always be 0 in the header. Add a "VK_API_VERSION_<major>_<minor>" macro for people to use to do the right thing. Add a VK_HEADER_VERSION which captures the header release number independent of the spec patch number (internal issue 176). * Correct description of slink:VkPipelineShaderStageCreateInfo::pname:pName to "a pointer to a null-terminated UTF-8 string" (internal issue #197). Other Commits: * Updated DataFormat spec reference to the new date for revision 5 of that spec. * Fixed KEEP option (to retain LaTeX intermediate files) in the Makefile to be included when edited there, as well as set on the command line. * Reserve and add "VK_IMG_filter_cubic" to the registry, and implement script functionality to add and remove validity from existing functions. Includes schema and readme changes. * Update GL_KHR_vulkan_glsl so push_constants do not have descriptor sets.
2016-03-11 01:33:02 +00:00
regions within each selected attachment to clear.
2016-02-16 09:53:44 +00:00
fname:vkCmdClearAttachments can: clear multiple regions of each attachment
used in the current subpass of a render pass instance. This command must: be
called only inside a render pass instance, and implicitly selects the images
to clear based on the current framebuffer attachments and the command
parameters.
include::../validity/protos/vkCmdClearAttachments.txt[]
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
The sname:VkClearRect structure is defined as:
2016-02-16 09:53:44 +00:00
include::../structs/VkClearRect.txt[]
* pname:rect is the two-dimensional region to be cleared.
* pname:baseArrayLayer is the first layer to be cleared.
* pname:layerCount is the number of layers to clear.
The layers latexmath:[$[baseArrayLayer, baseArrayLayer+layerCount)$]
counting from the base layer of the attachment image view are cleared.
include::../validity/structs/VkClearRect.txt[]
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
The sname:VkClearAttachment structure is defined as:
2016-02-16 09:53:44 +00:00
include::../structs/VkClearAttachment.txt[]
* pname:aspectMask is a mask selecting the color, depth and/or stencil
aspects of the attachment to be cleared. pname:aspectMask can: include
ename:VK_IMAGE_ASPECT_COLOR_BIT for color attachments,
ename:VK_IMAGE_ASPECT_DEPTH_BIT for depth/stencil attachments with a
depth component, and ename:VK_IMAGE_ASPECT_STENCIL_BIT for depth/stencil
attachments with a stencil component.
* pname:colorAttachment is only meaningful if
ename:VK_IMAGE_ASPECT_COLOR_BIT is set in pname:aspectMask, in which
case it is an index to the pname:pColorAttachments array in the
slink:VkSubpassDescription structure of the current subpass which
selects the color attachment to clear.
* pname:clearValue is the color or depth/stencil value to clear the
attachment to, as described in <<clears-values,Clear Values>> below.
No memory barriers are needed between fname:vkCmdClearAttachments and
preceding or subsequent draw or attachment clear commands in the same
subpass.
The fname:vkCmdClearAttachments commands is not affected by the bound
pipeline state.
Attachments can: also be cleared at the beginning of a render pass instance
by setting pname:loadOp (or pname:stencilLoadOp) of
slink:VkAttachmentDescription to ename:VK_ATTACHMENT_LOAD_OP_CLEAR, as
described for flink:vkCreateRenderPass.
include::../validity/structs/VkClearAttachment.txt[]
[[clears-values]]
== Clear Values
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
The sname:VkClearColorValue structure is defined as:
2016-02-16 09:53:44 +00:00
include::../structs/VkClearColorValue.txt[]
Color clear values are taken from the sname:VkClearColorValue union based on
the format of the image or attachment. Floating point, unorm, snorm,
uscaled, packed float, and sRGB images use the pname:float32 member,
unsigned integer formats use the pname:uint32 member, and signed integer
formats use the pname:int32 member. Floating point values are automatically
converted to the format of the image, with the clear value being treated as
linear if the image is sRGB.
Unsigned integer values are converted to the format of the image by casting
to the integer type with fewer bits. Signed integer values are converted to
the format of the image by casting to the smaller type (with negative 32-bit
values mapping to negative values in the smaller type). If the integer clear
value is not representable in the target type (e.g. would overflow in
conversion to that type), the clear value is undefined.
The four array elements of the clear color map to R, G, B, and A components
of image formats, in order.
If the image has more than one sample, the same value is written to all
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
samples for any pixels being cleared.
2016-02-16 09:53:44 +00:00
include::../validity/structs/VkClearColorValue.txt[]
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
The sname:VkClearDepthStencilValue structure is defined as:
2016-02-16 09:53:44 +00:00
include::../structs/VkClearDepthStencilValue.txt[]
* pname:depth is the clear value for the depth aspect of the depth/stencil
attachment. It is a floating-point value which is automatically
converted to the attachment's format.
* pname:stencil is the clear value for the stencil aspect of the
depth/stencil attachment. It is a 32-bit integer value which is
converted to the attachment's format by taking the appropriate number of
LSBs.
include::../validity/structs/VkClearDepthStencilValue.txt[]
Some parts of the API require either color or depth/stencil clear values,
Change log for April 22, 2016 Vulkan 1.0.11 spec update: * Bump API patch number and header version number to 11 for this update. Github Issues: * Clarify the WSI extension language by switching from the fuzzier "ownership" language to more-consistent "acquire" language (public issue 117). * Clarify that memory barriers apply to all commands in the dependency chains in the flink:vkGetRenderAreaGranularity command and the <<synchronization-execution-and-memory-dependencies,Execution And Memory Dependencies>> section (public issue 132). * Clarify that a queue family is a set of queues in the <<fundamentals-execmodel,Execution Model>> section (public issue 166). * Removed requirement from valid usage language that VkPresentInfoKHR::waitSemaphoreCount must be greater than 0 (public issue 171). * Fix broken internal links, describe structures consistently, use consistent style for SPIR-V codewords, and tag normative terms that were missing asciidoc tags (public issue 183 and ancillary markup/normative language fixes). * Fix typos for slink:VkPhysicalDeviceLimits member names in slink:VkImageCreateInfo validity language (public issue 184). Internal Issues: * Document that the requested patch version number specified as part of slink:VkApplicationInfo::pname:apiVersion is ignored when creating an instance (internal issue 176). * Clarify handling of extension structs in the <<fundamentals-validusageValid Usage>> section (internal issue 254). * Update required slink:VkImageFormatProperties::pname:maxMipLevels to be limited to the maximum allowed mipmap pyramid size corresponding to the actual maximum supported size for the format (internal issue 256). * Modify the <<features-extentperimagetype,Allowed Extent Values Based On Image Type>> section so the allowed maximum extent is the maximum image dimension supported for each dimension of the type of texture being queried (internal issue 257). * Clarify in the <<spirvenv-module-validation,Validation Rules within a Module>> section that at least one of the code:LocalSize execution mode or code:WorkgroupSize decoration is required for each compute shader entry point in a shader module (internal issue 279). * Add validity rules for formats in flink:vkCmdClearColorImage and flink:vkCmdClearDepthStencilImage (internal issue 283). * Clarify that slink:VkImageFormatProperties::pname:maxResourceSize is an upper bound, and that it may not be possible to create an image anywhere near that size (internal issue 284). Other Commits: * Fix various minor markup errors reported by validation scripts. * Change copyright from Khronos Free Use License to Apache 2.0 license on relevant script/XML/header files. This does not affect the specification source copyright.
2016-04-21 08:08:38 +00:00
depending on the attachment. The sname:VkClearValue union represents such
values.
The sname:VkClearValue union is defined as:
2016-02-16 09:53:44 +00:00
include::../structs/VkClearValue.txt[]
* pname:color specifies the color image clear values to use when
clearing a color image or attachment.
* pname:depthStencil specifies the depth and stencil clear values to use
when clearing a depth/stencil image or attachment.
This union is used to define the initial clear values in the
sname:VkRenderPassBeginInfo structure.
include::../validity/structs/VkClearValue.txt[]
[[clears-filling-buffers]]
== Filling Buffers
To clear buffer data, call:
include::../protos/vkCmdFillBuffer.txt[]
* pname:commandBuffer is the command buffer into which the command will be
recorded.
* pname:dstBuffer is the buffer to be filled.
* pname:dstOffset is the byte offset into the buffer at which to start
filling, and must: be a multiple of 4.
* pname:size is the number of bytes to fill, and must: be either a
multiple of 4, or ename:VK_WHOLE_SIZE to fill the range from
pname:offset to the end of the buffer.
* pname:data is the 4-byte word written repeatedly to the buffer to fill
pname:size bytes of data. The data word is written to memory according
to the host endianness.
fname:vkCmdFillBuffer is treated as ``transfer'' operation for the purposes
of synchronization barriers. The ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT
must: be specified in pname:usage of sname:VkBufferCreateInfo in order for
the buffer to be compatible with fname:vkCmdFillBuffer.
include::../validity/protos/vkCmdFillBuffer.txt[]
[[clears-updating-buffers]]
== Updating Buffers
To update buffer data inline in a command buffer, call:
include::../protos/vkCmdUpdateBuffer.txt[]
* pname:commandBuffer is the command buffer into which the command will be
recorded.
* pname:dstBuffer is a handle to the buffer to be updated.
* pname:dstOffset is the byte offset into the buffer to start updating,
and must: be a multiple of 4.
* pname:dataSize is the number of bytes to update, and must: be a multiple
of 4.
* pname:pData is a pointer to the source data for the buffer update, and
must: be at least pname:dataSize bytes in size.
pname:dataSize must: be less than or equal to 65536 bytes. For larger
updates, applications can: use buffer to buffer <<copies-buffers,copies>>.
The source data is copied from the user pointer to the command buffer when
the command is called.
fname:vkCmdUpdateBuffer is only allowed outside of a render pass. This
command is treated as ``transfer'' operation, for the purposes of
synchronization barriers. The ename:VK_BUFFER_USAGE_TRANSFER_DST_BIT must:
be specified in pname:usage of sname:VkBufferCreateInfo in order for the
buffer to be compatible with fname:vkCmdUpdateBuffer.
include::../validity/protos/vkCmdUpdateBuffer.txt[]
[[clears-end]]