• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "include/private/gpu/graphite/DawnTypesPriv.h"
9 
10 #include "include/core/SkTypes.h"
11 
12 namespace skgpu::graphite {
13 
DawnTextureInfo(const wgpu::Texture & texture)14 DawnTextureInfo::DawnTextureInfo(const wgpu::Texture& texture) {
15     SkASSERT(texture);
16 
17     fSampleCount = texture.GetSampleCount();
18     fMipmapped  = texture.GetMipLevelCount() > 1 ? Mipmapped::kYes : Mipmapped::kNo;
19 
20     fFormat = texture.GetFormat();
21     fUsage =  texture.GetUsage();
22 }
23 
DawnTextureSpecToTextureInfo(const DawnTextureSpec & dawnSpec,uint32_t sampleCount,Mipmapped mipmapped)24 DawnTextureInfo DawnTextureSpecToTextureInfo(const DawnTextureSpec& dawnSpec,
25                                              uint32_t sampleCount,
26                                              Mipmapped mipmapped) {
27     DawnTextureInfo info;
28     // Shared info
29     info.fSampleCount = sampleCount;
30     info.fMipmapped = mipmapped;
31 
32     // Dawn info
33     info.fFormat = dawnSpec.fFormat;
34     info.fUsage = dawnSpec.fUsage;
35 
36     return info;
37 }
38 
39 }  // namespace skgpu::graphite
40