Hash :
657c8c0a
Author :
Date :
2024-06-04T15:16:20
Add optimization to defer clear calls. This change adds a new SubresourceUpdate struct that will hold either an update for a clear call or a texture upload in an ImageHelper's update queue. It also adds logic to defer clear calls similar to Vulkan's, where clears are deferred if there is not an active render pass. Draw based clears are not yet supported, so the optimization does not handle those yet. Bug: angleproject:8582 Change-Id: I3ee010fa64745871835d53ce0ccb56e3fdd74550 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5554984 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@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
//
// Copyright 2024 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.
//
// RenderTargetWgpu.h:
// Defines the class interface for RenderTargetWgpu.
//
#ifndef LIBANGLE_RENDERER_WGPU_RENDERTARGETWGPU_H_
#define LIBANGLE_RENDERER_WGPU_RENDERTARGETWGPU_H_
#include <dawn/webgpu_cpp.h>
#include <stdint.h>
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/wgpu/wgpu_helpers.h"
#include "libANGLE/renderer/wgpu/wgpu_utils.h"
namespace rx
{
class RenderTargetWgpu final : public FramebufferAttachmentRenderTarget
{
public:
RenderTargetWgpu();
~RenderTargetWgpu() override;
// Used in std::vector initialization.
RenderTargetWgpu(RenderTargetWgpu &&other);
void set(webgpu::ImageHelper *image,
const wgpu::TextureView &texture,
const webgpu::LevelIndex level,
uint32_t layer,
const wgpu::TextureFormat &format);
void setTexture(const wgpu::TextureView &texture);
void reset();
wgpu::TextureView getTexture() { return mTexture; }
webgpu::ImageHelper *getImage() { return mImage; }
webgpu::LevelIndex getLevelIndex() const { return mLevelIndex; }
private:
webgpu::ImageHelper *mImage;
// TODO(liza): move TextureView into ImageHelper.
wgpu::TextureView mTexture;
webgpu::LevelIndex mLevelIndex{0};
uint32_t mLayerIndex = 0;
const wgpu::TextureFormat *mFormat = nullptr;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_WGPU_RENDERTARGETWGPU_H_