aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlTexture.mm
diff options
context:
space:
mode:
authorGravatar Timothy Liang <timliang@google.com>2018-06-27 14:58:12 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-28 15:30:57 +0000
commit2df9b45ab9d3115dcb5ed31b7db45a6d34983cbf (patch)
tree202e2e6402b709ceac52f8005ba8782eea554807 /src/gpu/mtl/GrMtlTexture.mm
parentb1b87d9df81eb4ddb25fc76a2a2a6664fc4ef0ec (diff)
added TextureRenderTarget to Metal gpu backend
Bug: skia: Change-Id: I5cacdb832deefe0f8d8460ff10b2216d5dec1ed7 Reviewed-on: https://skia-review.googlesource.com/137890 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Timothy Liang <timliang@google.com>
Diffstat (limited to 'src/gpu/mtl/GrMtlTexture.mm')
-rw-r--r--src/gpu/mtl/GrMtlTexture.mm45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/gpu/mtl/GrMtlTexture.mm b/src/gpu/mtl/GrMtlTexture.mm
index ac4e73579a..90bfcb38fb 100644
--- a/src/gpu/mtl/GrMtlTexture.mm
+++ b/src/gpu/mtl/GrMtlTexture.mm
@@ -11,6 +11,35 @@
#include "GrMtlUtil.h"
#include "GrTexturePriv.h"
+// This method parallels GrTextureProxy::highestFilterMode
+static inline GrSamplerState::Filter highest_filter_mode(GrPixelConfig config) {
+ return GrSamplerState::Filter::kMipMap;
+}
+
+GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
+ SkBudgeted budgeted,
+ const GrSurfaceDesc& desc,
+ id<MTLTexture> texture,
+ GrMipMapsStatus mipMapsStatus)
+ : GrSurface(gpu, desc)
+ , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, highest_filter_mode(desc.fConfig),
+ mipMapsStatus)
+ , fTexture(texture) {
+ SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
+ this->registerWithCache(budgeted);
+}
+
+GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
+ const GrSurfaceDesc& desc,
+ id<MTLTexture> texture,
+ GrMipMapsStatus mipMapsStatus)
+ : GrSurface(gpu, desc)
+ , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, highest_filter_mode(desc.fConfig),
+ mipMapsStatus)
+ , fTexture(texture) {
+ SkASSERT((GrMipMapsStatus::kNotAllocated == mipMapsStatus) == (1 == texture.mipmapLevelCount));
+}
+
sk_sp<GrMtlTexture> GrMtlTexture::CreateNewTexture(GrMtlGpu* gpu, SkBudgeted budgeted,
const GrSurfaceDesc& desc, int mipLevels) {
MTLPixelFormat format;
@@ -41,22 +70,6 @@ sk_sp<GrMtlTexture> GrMtlTexture::CreateNewTexture(GrMtlGpu* gpu, SkBudgeted bud
return sk_sp<GrMtlTexture>(new GrMtlTexture(gpu, budgeted, desc, texture, mipMapsStatus));
}
-// This method parallels GrTextureProxy::highestFilterMode
-static inline GrSamplerState::Filter highest_filter_mode(GrPixelConfig config) {
- return GrSamplerState::Filter::kMipMap;
-}
-
-GrMtlTexture::GrMtlTexture(GrMtlGpu* gpu,
- SkBudgeted budgeted,
- const GrSurfaceDesc& desc,
- id<MTLTexture> texture,
- GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, desc)
- , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, highest_filter_mode(desc.fConfig),
- mipMapsStatus)
- , fTexture(texture) {
-}
-
GrMtlTexture::~GrMtlTexture() {
SkASSERT(nil == fTexture);
}