Hash :
e4e2d0c5
Author :
Date :
2018-06-22T08:25:05
Vulkan: Add RenderTargetVk::getImageForRead. This helper method will also transition the Image to the correct read layout. We will need to revisit the implementation when working on simulatenous read. Bug: angleproject:2539 Change-Id: Id61404460f3ef0dbb054e6ac2dfc0b59adb78402 Reviewed-on: https://chromium-review.googlesource.com/1108378 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// RenderTargetVk:
// Wrapper around a Vulkan renderable resource, using an ImageView.
//
#ifndef LIBANGLE_RENDERER_VULKAN_RENDERTARGETVK_H_
#define LIBANGLE_RENDERER_VULKAN_RENDERTARGETVK_H_
#include <vulkan/vulkan.h>
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/renderer_utils.h"
namespace rx
{
namespace vk
{
class CommandBuffer;
class CommandGraphResource;
struct Format;
class ImageHelper;
class ImageView;
class RenderPassDesc;
} // namespace vk
// This is a very light-weight class that does not own to the resources it points to.
// It's meant only to copy across some information from a FramebufferAttachment to the
// business rendering logic. It stores Images and ImageView by pointer for performance.
class RenderTargetVk final : public FramebufferAttachmentRenderTarget
{
public:
RenderTargetVk(vk::ImageHelper *image,
vk::ImageView *imageView,
vk::CommandGraphResource *resource);
~RenderTargetVk();
// Note: RenderTargets should be called in order, with the depth/stencil onRender last.
void onColorDraw(vk::CommandGraphResource *framebufferVk,
vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc);
void onDepthStencilDraw(vk::CommandGraphResource *framebufferVk,
vk::CommandBuffer *commandBuffer,
vk::RenderPassDesc *renderPassDesc);
const vk::ImageHelper &getImage() const;
// getImageForRead will also transition the resource to the given layout.
vk::ImageHelper *getImageForRead(vk::CommandGraphResource *readingResource,
VkImageLayout layout,
VkImageAspectFlags aspectFlags,
vk::CommandBuffer *commandBuffer);
vk::ImageHelper *getImageForWrite(vk::CommandGraphResource *writingResource) const;
vk::ImageView *getImageView() const;
vk::CommandGraphResource *getResource() const;
const vk::Format &getImageFormat() const;
const gl::Extents &getImageExtents() const;
// Special mutator for Surface RenderTargets. Allows the Framebuffer to keep a single
// RenderTargetVk pointer.
void updateSwapchainImage(vk::ImageHelper *image, vk::ImageView *imageView);
private:
vk::ImageHelper *mImage;
vk::ImageView *mImageView;
vk::CommandGraphResource *mResource;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_RENDERTARGETVK_H_