Hash :
243ebfa7
Author :
Date :
2025-06-16T16:07:06
WebGPU: Allow glReadPixels from non-base mip levels. Before, the WebGPU backend always read from the base level of the texture attached to the current framebuffer. Bug: angleproject:42267090 Change-Id: Ibe5b8575f6fa90c1942ba566485b6175ee10f808 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6634558 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Matthew Denton <mpdenton@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.h:
// Defines the class interface for RenderTargetWgpu.
//
#ifndef LIBANGLE_RENDERER_WGPU_RENDERTARGETWGPU_H_
#define LIBANGLE_RENDERER_WGPU_RENDERTARGETWGPU_H_
#include <stdint.h>
#include <webgpu/webgpu.h>
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/angletypes.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 webgpu::TextureViewHandle &texture,
const webgpu::LevelIndex level,
uint32_t layer,
WGPUTextureFormat format);
void reset();
angle::Result flushImageStagedUpdates(ContextWgpu *contextWgpu,
webgpu::ClearValuesArray *deferredClears,
uint32_t deferredClearIndex);
webgpu::TextureViewHandle getTextureView() { return mTextureView; }
webgpu::ImageHelper *getImage() { return mImage; }
webgpu::LevelIndex getLevelIndex() const { return mLevelIndex; }
uint32_t getLayer() const { return mLayerIndex; }
gl::LevelIndex getGlLevel() const { return mImage->toGlLevel(mLevelIndex); }
private:
webgpu::ImageHelper *mImage = nullptr;
// TODO(liza): move TextureView into ImageHelper.
webgpu::TextureViewHandle mTextureView;
webgpu::LevelIndex mLevelIndex{0};
uint32_t mLayerIndex = 0;
const WGPUTextureFormat *mFormat = nullptr;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_WGPU_RENDERTARGETWGPU_H_