[graphite] Add basic Texture files.

Bug: skia:12466
Change-Id: If708d8a4bd00802e60a860215edcb64db179e573
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454616
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Greg Daniel 2021-09-30 10:51:08 -04:00 committed by SkCQ
parent 37035fc648
commit b2d20e02e7
4 changed files with 61 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 = [