• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2024 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // RenderTargetWgpu.cpp:
7 //    Implements the class methods for RenderTargetWgpu.
8 //
9 
10 #include "libANGLE/renderer/wgpu/RenderTargetWgpu.h"
11 
12 namespace rx
13 {
RenderTargetWgpu()14 RenderTargetWgpu::RenderTargetWgpu() {}
15 
~RenderTargetWgpu()16 RenderTargetWgpu::~RenderTargetWgpu()
17 {
18     reset();
19 }
20 
RenderTargetWgpu(RenderTargetWgpu && other)21 RenderTargetWgpu::RenderTargetWgpu(RenderTargetWgpu &&other)
22     : mImage(other.mImage),
23       mTexture(std::move(other.mTexture)),
24       mLevelIndex(other.mLevelIndex),
25       mLayerIndex(other.mLayerIndex),
26       mFormat(other.mFormat)
27 {}
28 
set(webgpu::ImageHelper * image,const wgpu::TextureView & texture,const webgpu::LevelIndex level,uint32_t layer,const wgpu::TextureFormat & format)29 void RenderTargetWgpu::set(webgpu::ImageHelper *image,
30                            const wgpu::TextureView &texture,
31                            const webgpu::LevelIndex level,
32                            uint32_t layer,
33                            const wgpu::TextureFormat &format)
34 {
35     mImage      = image;
36     mTexture    = texture;
37     mLevelIndex = level;
38     mLayerIndex = layer;
39     mFormat     = &format;
40 }
41 
setTexture(const wgpu::TextureView & texture)42 void RenderTargetWgpu::setTexture(const wgpu::TextureView &texture)
43 {
44     mTexture = texture;
45 }
46 
reset()47 void RenderTargetWgpu::reset()
48 {
49     mTexture    = nullptr;
50     mLevelIndex = webgpu::LevelIndex(0);
51     mLayerIndex = 0;
52     mFormat     = nullptr;
53 }
54 }  // namespace rx
55