Vulkan-Docs/doc/specs/vulkan/appendices/VK_AMD_shader_fragment_mask.txt
Jon Leech 0cc6bba634 Change log for September 15, 2017 Vulkan 1.0.61 spec update:
* Bump API patch number and header version number to 61 for this update.

Github Issues:

  * Provide alternate length attributes (altlen=) in the XML schema, for
    those using length attributes to generate code instead of documentation
    (public issue 555).
  * Fix erroneous references to `latex:` being used for asciidoc math
    markup, rather than `latexmath:` (public pull request 556).
  * Add author ID to XML for Kazan software renderer (public pull request
    557).

Internal Issues:

  * Add the <<fundamentals-abi,Application Binary Interface>> section
    describing platform ABI requirements and recommendations, add examples
    of function and function pointer declarations to the
    <<boilerplate-platform-specific-calling-conventions, Platform-Specific
    Calling Conventions>> section, and remove related language that existed
    elsewhere in the specification (internal issue 64).
  * Describe where to document valid usage interactions of chained
    structures in the style guide, and fix one case now appearing in
    slink:VkBufferCreateInfo instead of the child
    slink:VkDedicatedAllocationBufferCreateInfoNV structure (internal issue
    715).
  * Add example to the style guide of describing enumerated types which are
    empty when the spec is built without relevant extensions enabled, and
    apply it to existing examples for
    elink:VkDescriptorSetLayoutCreateFlagBits and
    elink:VkSubpassDescriptionFlagBits (internal issue 864).
  * Add a note to the <<fundamentals-validusage-enums, Valid Usage for
    Enumerated Types>> section that the special values suffixed with
    etext:_BEGIN_RANGE, etext:_END_RANGE, etext:_RANGE_SIZE and
    etext:_MAX_ENUM are not part of the API and should: not be used by
    applications (internal issue 872).
  * Added note to flink:vkCmdUpdateBuffers explaining the performance
    penalty for copies done in this way, and why the upper copy limit is
    what it is (internal issue 952).
  * Update `VK_KHX_device_group` to split some functionality into the new
    `VK_KHR_bind_memory2` extension, and rename that functionality (internal
    issue 969).
  * Remove *Status* fields from extension appendices, since they are by
    definition published and complete by the time they reach the public
    github repository (internal issue 973).

Other Issues:

  * Update Data Format specification dependency to version 1.2 and change
    references to DF sections accordingly.
  * Update XML to make the pname:pAllocator parameter of
    flink:vkRegisterDeviceEventEXT and flink:vkRegisterDisplayEventEXT in
    the `VK_EXT_display_control` extension as optional.

New Extensions:

  * `VK_KHR_bind_memory2`
  * `VK_KHR_image_format_list`
  * `VK_KHR_maintenance2`
  * `VK_KHR_sampler_ycbcr_conversion`
2017-09-14 22:41:33 -07:00

100 lines
2.6 KiB
Plaintext

include::meta/VK_AMD_shader_fragment_mask.txt[]
*Last Modified Date*::
2017-08-16
*IP Status*::
No known IP claims.
*Dependencies*::
- Requires the
https://www.khronos.org/registry/spir-v/extensions/AMD/SPV_AMD_fragment_mask.html[+SPV_AMD_fragment_mask+]
SPIR-V extension.
*Contributors*::
- Aaron Hagan, AMD
- Daniel Rakos, AMD
- Timothy Lottes, AMD
This extension provides efficient read access to the fragment mask in
compressed multisampled color surfaces.
The fragment mask is a lookup table that associates color samples with color
fragment values.
The fragment mask can be fetched with a call to pname:fragmentMaskFetchAMD
from a shader, which returns a single uint where each subsequent 4 bit
specifies the color fragment index corresponding to the color sample,
starting from the least significant bit.
For example, when 8 color samples are used, the color fragment index for
color sample 0 will be in bits 0-3 of the fragment mask, for color sample 7
the index will be in bits 28-31.
The color fragment for a particular color sample may then be fetched with
the correspoding fragment mask value using the pname:fragmentFetchAMD shader
function.
=== New Object Types
None.
=== New Enum Constants
None.
=== New Enums
None.
=== New SPIR-V Capabilities
* <<spirvenv-capabilities-table-shaderfragmentmaskamd,
code:ShaderFragmentMaskAMD>>
=== New Structures
None.
=== New Functions
None.
=== Examples
This example shows a shader that queries the fragment mask from a
multisampled compressed surface and uses it to query fragment values.
[source,c++]
----------------------------------------
#version 450 core
#extension GL_AMD_shader_fragment_mask: enable
layout(binding = 0) uniform sampler2DMS s2DMS;
layout(binding = 1) uniform isampler2DMSArray is2DMSArray;
layout(binding = 2, input_attachment_index = 0) uniform usubpassInputMS usubpassMS;
layout(location = 0) out vec4 fragColor;
void main()
{
vec4 fragOne = vec4(0.0);
uint fragMask = fragmentMaskFetchAMD(s2DMS, ivec2(2, 3));
uint fragIndex = (fragMask & 0xF0) >> 4;
fragOne += fragmentFetchAMD(s2DMS, ivec2(2, 3), 1);
fragMask = fragmentMaskFetchAMD(is2DMSArray, ivec3(2, 3, 1));
fragIndex = (fragMask & 0xF0) >> 4;
fragOne += fragmentFetchAMD(is2DMSArray, ivec3(2, 3, 1), fragIndex);
fragMask = fragmentMaskFetchAMD(usubpassMS);
fragIndex = (fragMask & 0xF0) >> 4;
fragOne += fragmentFetchAMD(usubpassMS, fragIndex);
fragColor = fragOne;
}
----------------------------------------
=== Version History
* Revision 1, 2017-08-16 (Aaron Hagan)
- Initial draft