Functions

  • size_t GetImageByteSize (vk::Format format, size_t width, size_t height)

    Defined at line 40 of file ../../src/ui/lib/escher/util/image_utils.cc

  • size_t BytesPerPixel (vk::Format format)

    Returns the number of bytes per pixel for the given format.

    Defined at line 62 of file ../../src/ui/lib/escher/util/image_utils.cc

  • bool IsDepthFormat (vk::Format format)

    Return true if |format| can be used as a depth buffer.

    Defined at line 81 of file ../../src/ui/lib/escher/util/image_utils.cc

  • bool IsStencilFormat (vk::Format format)

    Return true if |format| can be used as a stencil buffer.

    Defined at line 95 of file ../../src/ui/lib/escher/util/image_utils.cc

  • bool IsYuvFormat (vk::Format format)

    Return true is |format| is one of the formats that Escher can treat as a YUV format.

    Currently these include:

    - eG8B8G8R8422Unorm

    - eG8B8R82Plane420Unorm

    TODO(https://fxbug.dev/42098808): use of these formats is not enough to assume NV12, but they're currently

    the only formats we support at the sampler level.

    Defined at line 124 of file ../../src/ui/lib/escher/util/image_utils.cc

  • std::pair<bool, bool> IsDepthStencilFormat (vk::Format format)

    Return a pair of booleans, each of which is true if |format| can be used as

    a depth or stencil buffer, respectively.

    Defined at line 107 of file ../../src/ui/lib/escher/util/image_utils.cc

  • vk::ImageAspectFlags FormatToColorOrDepthStencilAspectFlags (vk::Format format)

    If |format| is a depth-stencil format, return the appropriate combination

    of eDepth and eStencil bits. Otherwise, treat it as a color format, and

    return eColor.

    Defined at line 136 of file ../../src/ui/lib/escher/util/image_utils.cc

  • vk::ImageCreateInfo CreateVkImageCreateInfo (const ImageInfo & info, vk::ImageLayout initial_layout)

    Defined at line 154 of file ../../src/ui/lib/escher/util/image_utils.cc

  • vk::Image CreateVkImage (const vk::Device & device, const ImageInfo & info, vk::ImageLayout initial_layout)

    Helper function that creates a VkImage given the parameters in ImageInfo.

    This does not bind the VkImage to memory; the caller must do that

    separately after calling this function.

    Defined at line 179 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewDepthImage (ImageFactory * image_factory, vk::Format format, uint32_t width, uint32_t height, vk::ImageUsageFlags additional_flags)

    Return a new Image that is suitable for use as a depth attachment.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 186 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewColorAttachmentImage (ImageFactory * image_factory, uint32_t width, uint32_t height, vk::ImageUsageFlags additional_flags)

    Return a new Image that is suitable for use as a color attachment.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 200 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewImage (const vk::Device & device, const vk::ImageCreateInfo & create_info, escher::GpuMemPtr gpu_mem, escher::ResourceRecycler * resource_recycler)

    Returns new image bound to the provided gpu memory, with the specified create info. This

    should only be called in a scenario where we know the |gpu_mem| buffer passed in will be

    compatible with the Vulkan image memory requirements such as being of a sufficiently large

    size to back the image. Otherwise, this function returns nullptr.

    Defined at line 214 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewImage (ImageFactory * image_factory, vk::Format format, ColorSpace color_space, uint32_t width, uint32_t height, vk::ImageUsageFlags additional_flags, vk::MemoryPropertyFlags memory_flags)

    Return new Image containing the provided pixels. Uses transfer queue to

    efficiently transfer image data to GPU.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 248 of file ../../src/ui/lib/escher/util/image_utils.cc

  • void WritePixelsToImage (escher::BatchGpuUploader * batch_gpu_uploader, const uint8_t * pixels, const ImagePtr & gpu_image, vk::ImageLayout final_layout, const escher::image_utils::ImageConversionFunction & convertion_func)

    Write the contents of |pixels| into an existing |gpu_image|.

    The width, and height of |pixels| is assumed to match that of

    |gpu_image|.

    If the format of |pixels| is different from |gpu_image|, a conversion

    function that can convert from |pixels| to |gpu_image| should be

    provided as |convertion_func|.

    Note that all escher images are stored in GPU memory. The use of gpu_image

    here is to specifically differentiate it from pixels, which may be stored in

    host_memory.

    Defined at line 269 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewRgbaImage (ImageFactory * image_factory, BatchGpuUploader * gpu_uploader, uint32_t width, uint32_t height, const uint8_t * bytes, vk::ImageLayout final_layout)

    Return new Image containing the provided pixels. Uses transfer queue to

    efficiently transfer image data to GPU. If bytes is null, don't bother

    transferring.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 298 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewCheckerboardImage (ImageFactory * image_factory, BatchGpuUploader * gpu_uploader, uint32_t width, uint32_t height)

    Returns RGBA image.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 310 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewGradientImage (ImageFactory * image_factory, BatchGpuUploader * gpu_uploader, uint32_t width, uint32_t height)

    Returns RGBA image.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 323 of file ../../src/ui/lib/escher/util/image_utils.cc

  • ImagePtr NewNoiseImage (ImageFactory * image_factory, BatchGpuUploader * gpu_uploader, uint32_t width, uint32_t height, vk::ImageUsageFlags additional_flags)

    Returns single-channel luminance image containing white noise.

    |image_factory| is a generic interface that could be an Image cache (in which

    case a new Image might be created, or an existing one reused). Alternatively

    the factory could allocate a new Image every time.

    Defined at line 336 of file ../../src/ui/lib/escher/util/image_utils.cc

  • std::unique_ptr<uint8_t[]> NewCheckerboardPixels (uint32_t width, uint32_t height, size_t * out_size)

    Return RGBA pixels containing a checkerboard pattern, where each white/black

    region is a single pixel. Only works for even values of width/height.

    Defined at line 349 of file ../../src/ui/lib/escher/util/image_utils.cc

  • std::unique_ptr<uint8_t[]> NewGradientPixels (uint32_t width, uint32_t height, size_t * out_size)

    Return RGBA pixels containing a gradient where the top row is white and the

    bottom row is black. Only works for even values of width/height.

    Defined at line 373 of file ../../src/ui/lib/escher/util/image_utils.cc

  • std::unique_ptr<uint8_t[]> NewNoisePixels (uint32_t width, uint32_t height, size_t * out_size)

    Return eR8Unorm pixels containing random noise.

    Defined at line 398 of file ../../src/ui/lib/escher/util/image_utils.cc

  • vk::ImageCreateInfo GetDefaultImageConstraints (const vk::Format & vk_format)

    Creates a vk::ImageCreateInfo with common default values and |vk_format|.

    Defined at line 425 of file ../../src/ui/lib/escher/util/image_utils.cc

  • vk::FormatFeatureFlags GetFormatFeatureFlagsFromUsage (vk::ImageUsageFlags usage)

    Defined at line 441 of file ../../src/ui/lib/escher/util/image_utils.cc