Name Strings

SPV_AMD_shader_fragment_mask

Contact

To report problems with this extension, please open a new issue at:

Contributors

  • Aaron Hagan, AMD

  • Daniel Rakos, AMD

  • Rex Xu, AMD

Notice

Copyright (c) 2017 The Khronos Group Inc. Copyright terms at http://www.khronos.org/registry/speccopyright.html

Status

Draft.

Version

Modified Date: August 16, 2017 Revision: 1

Dependencies

This extension is written against Revision 1 of the version 1.12 of the SPIR-V Specification.

The extension is written against Revision 1 of the OpenGL extension AMD_shader_fragment_mask.

Overview

This extension is written to provide the functionality of the AMD_shader_fragment_mask, OpenGL Shading Language Specification extension, for SPIR-V.

This extension introduces two core instructions to SPIR-V that enable fetching the fragment mask of compressed multisampled color surfaces, and an instruction for sampling the surface with the fragment mask.

Extension Name

To use this extension within a SPIR-V module, the following OpExtension must be present in the module:

OpExtension "SPV_AMD_shader_fragment_mask"

New Capabilities

This extension introduces a new capability:

FragmentMaskAMD = 5010

New Instructions

This extension adds the following core instructions

OpFragmentMaskFetchAMD = 5011
OpFragmentFetchAMD     = 5012

Modifications to the SPIR-V Specification, Version 1.1

Modify Section 3.32.10, Image Instructions

Add the following items to the instruction sections.

OpFragmentMaskFetchAMD

The fragment mask can be fetched from a compressed multisampled color surface with a call to fragmentMaskFetchAMD in the shader. The returned value is a single unsigned integer where each subsequent 4 bit specifies the color fragment index corresponding to the color sample, starting from the least significant bit.

Result Type must be a 32-bit unsigned integer type scalar.

Image must be an object whose type is OpTypeImage with MS of 1. Dim must be 2D or SubpassData

Coordinate is an integer scalar or vector containing (u[, v] …​ [, array layer]) as needed by the definition of Sampled Image. When the Image Dim operand is SubpassData, Coordinate is relative to the current fragment location. That is, the integer value (rounded down) of the current fragment’s window-relative (x, y) coordinate is added to (u, v).

5

5011

<id> Result Type

Result <id>

<id> Image

<id> Coordinate

OpFragmentFetchAMD

The color fragment for a particular sample can be fetched using the coorespondng fragment mask index and calling fragmentFetchAMD.

Result Type must be a vector of four components of floating-point type or integer type. Its components must be the same as Sampled Type of the underlying OpTypeImage (unless that underlying Sampled Type isOpTypeVoid).

Image must be an object whose type is OpTypeImage with MS of 1. Dim must be 2D or SubpassData

Coordinate is an integer scalar or vector containing (u[, v] …​ [, array layer]) as needed by the definition of Sampled Image. When the Image Dim operand is SubpassData, Coordinate is relative to the current fragment location. That is, the integer value (rounded down) of the current fragment’s window-relative (x, y) coordinate is added to (u, v).

Fragment Index fragment mask index used to sample the color fragment

6

5012

<id> Result Type

Result <id>

<id> Image

<id> Coordinate

<id> Fragment Index

Validation Rules

None.

Issues

None

Revision History

Rev Date Author Changes

1

August 16, 2017

Aaron Hagan

Initial revision based on SPV_AMD_shader_fragment_mask.