Hash :
69841d3c
Author :
Date :
2025-04-30T23:55:16
WebGPU: Use WebGPU C API for Textures and Framebuffers Bug: angleproject:414831373 Change-Id: I6b547a726b22e8eb5d407e2d6340b1d18bf39033 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6503024 Reviewed-by: Liza Burakova <liza@chromium.org> Commit-Queue: Geoff Lang <geofflang@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 webgpu::TextureViewHandle &texture,
const webgpu::LevelIndex level,
uint32_t layer,
WGPUTextureFormat 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::flushImageStagedUpdates(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