1 /* 2 * Copyright 2021 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 "experimental/graphite/include/TextureInfo.h" 9 10 namespace skgpu { 11 operator =(const TextureInfo & that)12TextureInfo& TextureInfo::operator=(const TextureInfo& that) { 13 if (!that.isValid()) { 14 fValid = false; 15 return *this; 16 } 17 fBackend = that.fBackend; 18 fSampleCount = that.fSampleCount; 19 fLevelCount = that.fLevelCount; 20 fProtected = that.fProtected; 21 22 switch (that.backend()) { 23 #ifdef SK_METAL 24 case BackendApi::kMetal: 25 fMtlSpec = that.fMtlSpec; 26 break; 27 #endif 28 default: 29 SK_ABORT("Unsupport Backend"); 30 } 31 32 fValid = true; 33 return *this; 34 } 35 operator ==(const TextureInfo & that) const36bool TextureInfo::operator==(const TextureInfo& that) const { 37 if (!this->isValid() && !that.isValid()) { 38 return true; 39 } 40 if (!this->isValid() || !that.isValid()) { 41 return false; 42 } 43 44 if (fBackend != that.fBackend) { 45 return false; 46 } 47 48 if (fSampleCount != that.fSampleCount || 49 fLevelCount != that.fLevelCount || 50 fProtected != that.fProtected) { 51 return false; 52 } 53 54 switch (fBackend) { 55 #ifdef SK_METAL 56 case BackendApi::kMetal: 57 return fMtlSpec == that.fMtlSpec; 58 #endif 59 default: 60 return false; 61 } 62 } 63 64 } // namespace skgpu 65 66