Class NVShaderImageFootprint


  • public final class NVShaderImageFootprint
    extends java.lang.Object
    This extension adds Vulkan support for the SPV_NV_shader_image_footprint SPIR-V extension. That SPIR-V extension provides a new instruction OpImageSampleFootprintNV allowing shaders to determine the set of texels that would be accessed by an equivalent filtered texture lookup.

    Instead of returning a filtered texture value, the instruction returns a structure that can be interpreted by shader code to determine the footprint of a filtered texture lookup. This structure includes integer values that identify a small neighborhood of texels in the image being accessed and a bitfield that indicates which texels in that neighborhood would be used. The structure also includes a bitfield where each bit identifies whether any texel in a small aligned block of texels would be fetched by the texture lookup. The size of each block is specified by an access granularity provided by the shader. The minimum granularity supported by this extension is 2x2 (for 2D textures) and 2x2x2 (for 3D textures); the maximum granularity is 256x256 (for 2D textures) or 64x32x32 (for 3D textures). Each footprint query returns the footprint from a single texture level. When using minification filters that combine accesses from multiple mipmap levels, shaders must perform separate queries for the two levels accessed ("fine" and "coarse"). The footprint query also returns a flag indicating if the texture lookup would access texels from only one mipmap level or from two neighboring levels.

    This extension should be useful for multi-pass rendering operations that do an initial expensive rendering pass to produce a first image that is then used as a texture for a second pass. If the second pass ends up accessing only portions of the first image (e.g., due to visbility), the work spent rendering the non-accessed portion of the first image was wasted. With this feature, an application can limit this waste using an initial pass over the geometry in the second image that performs a footprint query for each visible pixel to determine the set of pixels that it needs from the first image. This pass would accumulate an aggregate footprint of all visible pixels into a separate "footprint image" using shader atomics. Then, when rendering the first image, the application can kill all shading work for pixels not in this aggregate footprint.

    This extension has a number of limitations. The OpImageSampleFootprintNV instruction only supports for two- and three-dimensional textures. Footprint evaluation only supports the CLAMP_TO_EDGE wrap mode; results are undefined for all other wrap modes. Only a limited set of granularity values and that set does not support separate coverage information for each texel in the original image.

    When using SPIR-V generated from the OpenGL Shading Language, the new instruction will be generated from code using the new textureFootprint*NV built-in functions from the GL_NV_shader_texture_footprint shading language extension.

    Examples

    TBD

    Name String
    VK_NV_shader_image_footprint
    Extension Type
    Device extension
    Registered Extension Number
    205
    Revision
    1
    Extension and Version Dependencies
    Contact
    Last Modified Date
    2018-09-13
    IP Status
    No known IP claims.
    Contributors
    • Pat Brown, NVIDIA
    • Chris Lentini, NVIDIA
    • Daniel Koch, NVIDIA
    • Jeff Bolz, NVIDIA
    • Field Detail

      • VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION

        public static final int VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION
        The extension specification version.
        See Also:
        Constant Field Values
      • VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME

        public static final java.lang.String VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME
        The extension name.
        See Also:
        Constant Field Values
      • VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV

        public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV
        Extends VkStructureType.
        See Also:
        Constant Field Values