diff --git a/experimental/graphite/include/TextureInfo.h b/experimental/graphite/include/TextureInfo.h index db81a986ac..9029dde554 100644 --- a/experimental/graphite/include/TextureInfo.h +++ b/experimental/graphite/include/TextureInfo.h @@ -16,6 +16,13 @@ namespace skgpu { +// Forward declares so we can friend classes in other namespaces +#ifdef SK_METAL +namespace mtl { + class Caps; +} +#endif + class TextureInfo { public: TextureInfo() {} @@ -44,7 +51,7 @@ public: if (!this->isValid() || fBackend != BackendApi::kMetal) { return false; } - *info = mtl::TextureSpecToTextureInfo(fMtlSpec, fSampleCount, fLevelCount, fProtected); + *info = mtl::TextureSpecToTextureInfo(fMtlSpec, fSampleCount, fLevelCount); return true; } #endif diff --git a/experimental/graphite/src/Texture.cpp b/experimental/graphite/src/Texture.cpp new file mode 100644 index 0000000000..80361ec4c7 --- /dev/null +++ b/experimental/graphite/src/Texture.cpp @@ -0,0 +1,17 @@ +/* + * Copyright 2021 Google LLC + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "experimental/graphite/src/Texture.h" + +namespace skgpu { + +Texture::Texture(SkISize dimensions, const TextureInfo& info) + : fDimensions(dimensions), fInfo(info) {} + +Texture::~Texture() {} + +} // namespace skgpu diff --git a/experimental/graphite/src/Texture.h b/experimental/graphite/src/Texture.h new file mode 100644 index 0000000000..b49ab8993f --- /dev/null +++ b/experimental/graphite/src/Texture.h @@ -0,0 +1,34 @@ +/* + * Copyright 2021 Google LLC + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef skgpu_Texture_DEFINED +#define skgpu_Texture_DEFINED + +#include "experimental/graphite/include/TextureInfo.h" +#include "include/core/SkRefCnt.h" +#include "include/core/SkSize.h" + +namespace skgpu { + +class Texture : public SkRefCnt { +public: + ~Texture() override; + + SkISize dimensions() const { return fDimensions; } + const TextureInfo& textureInfo() const { return fInfo; } + +protected: + Texture(SkISize dimensions, const TextureInfo& info); + +private: + SkISize fDimensions; + TextureInfo fInfo; +}; + +} // namepsace skgpu + +#endif // skgpu_Texture_DEFINED diff --git a/gn/graphite.gni b/gn/graphite.gni index d80a9e060d..786da9dfd3 100644 --- a/gn/graphite.gni +++ b/gn/graphite.gni @@ -46,6 +46,8 @@ skia_graphite_sources = [ "$_src/Surface_Graphite.h", "$_src/Task.cpp", "$_src/Task.h", + "$_src/Texture.cpp", + "$_src/Texture.h", ] skia_graphite_mtl_sources = [