Hash :
3e4fa128
Author :
Date :
2024-08-05T16:20:30
Store ImageHelper's queue by mip levels. This change converts ImageHelper's mSubresourceQueue to store a vector of updates for each mip level. This allows updates to be flushed per mip level. This also adds a call in the RenderTargetWgpu to flush updates such that now when a framebuffer is flushing updates to color attachments the associated render target ensures that only updates associated with its mip level are flushed. Bug: angleproject:42267012 Change-Id: I1abdbc842cf18b1bd897037bf11aeea9c6d09e14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5759469 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@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 54 55 56 57 58 59
//
// 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.cpp:
// Implements the class methods for RenderTargetWgpu.
//
#include "libANGLE/renderer/wgpu/RenderTargetWgpu.h"
namespace rx
{
RenderTargetWgpu::RenderTargetWgpu() {}
RenderTargetWgpu::~RenderTargetWgpu()
{
reset();
}
RenderTargetWgpu::RenderTargetWgpu(RenderTargetWgpu &&other)
: mImage(other.mImage),
mTextureView(std::move(other.mTextureView)),
mLevelIndex(other.mLevelIndex),
mLayerIndex(other.mLayerIndex),
mFormat(other.mFormat)
{}
void RenderTargetWgpu::set(webgpu::ImageHelper *image,
const wgpu::TextureView &texture,
const webgpu::LevelIndex level,
uint32_t layer,
const wgpu::TextureFormat &format)
{
mImage = image;
mTextureView = texture;
mLevelIndex = level;
mLayerIndex = layer;
mFormat = &format;
}
void RenderTargetWgpu::reset()
{
mTextureView = nullptr;
mLevelIndex = webgpu::LevelIndex(0);
mLayerIndex = 0;
mFormat = nullptr;
}
angle::Result RenderTargetWgpu::flushStagedUpdates(ContextWgpu *contextWgpu,
webgpu::ClearValuesArray *deferredClears,
uint32_t deferredClearIndex)
{
gl::LevelIndex targetLevel = mImage->toGlLevel(mLevelIndex);
ANGLE_TRY(mImage->flushSingleLevelUpdates(contextWgpu, targetLevel, deferredClears,
deferredClearIndex));
return angle::Result::Continue;
}
} // namespace rx