blob: f9060f4c44787aa9fe15ed2cbdf5ef05e0c14ffc [file] [log] [blame]
* 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_graphite_TextureProxy_DEFINED
#define skgpu_graphite_TextureProxy_DEFINED
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
#include "include/gpu/graphite/TextureInfo.h"
namespace skgpu::graphite {
class ResourceProvider;
class Texture;
class TextureProxy : public SkRefCnt {
TextureProxy(SkISize dimensions, const TextureInfo& info, SkBudgeted budgeted);
~TextureProxy() override;
int numSamples() const { return fInfo.numSamples(); }
Mipmapped mipmapped() const { return Mipmapped(fInfo.numMipLevels() > 1); }
SkISize dimensions() const { return fDimensions; }
const TextureInfo& textureInfo() const { return fInfo; }
bool instantiate(ResourceProvider*);
bool isInstantiated() const { return SkToBool(fTexture); }
sk_sp<Texture> refTexture() const;
const Texture* texture() const;
#ifdef SK_DEBUG
void validateTexture(const Texture*);
SkISize fDimensions;
TextureInfo fInfo;
SkBudgeted fBudgeted;
sk_sp<Texture> fTexture;
} // namepsace skgpu::graphite
#endif // skgpu_graphite_TextureProxy_DEFINED