aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-04-13 14:29:25 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-13 14:29:25 -0700
commit7e68ab73186ab02a6030d3959e7372f983f85af5 (patch)
tree973b20fb786c0e2ac42344652ec07a36d112b3f8 /src
parent0e3c55431b463b5575983c0c875909e08a3562bf (diff)
Remove GrTextureStorageAllocator. This was added from Chromium but never used and not expected to be used.
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrTexture.cpp3
-rw-r--r--src/gpu/GrTextureProvider.cpp3
-rw-r--r--src/gpu/SkGpuDevice.cpp15
-rw-r--r--src/gpu/SkGpuDevice.h5
-rw-r--r--src/gpu/SkGrPixelRef.cpp1
-rw-r--r--src/gpu/gl/GrGLGpu.cpp40
-rw-r--r--src/gpu/gl/GrGLGpu.h5
-rw-r--r--src/gpu/gl/GrGLTexture.cpp8
-rw-r--r--src/image/SkSurface.cpp2
-rw-r--r--src/image/SkSurface_Gpu.cpp6
10 files changed, 15 insertions, 73 deletions
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 9051c851bd..349e6a383f 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -90,8 +90,7 @@ GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc,
GrSLType samplerType, bool wasMipMapDataProvided)
: INHERITED(gpu, lifeCycle, desc)
, fSamplerType(samplerType) {
- if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) &&
- !desc.fTextureStorageAllocator.fAllocateTextureStorage) {
+ if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig)) {
GrScratchKey key;
GrTexturePriv::ComputeScratchKey(desc, &key);
this->setScratchKey(key);
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
index 3596ba6c12..1053ab272b 100644
--- a/src/gpu/GrTextureProvider.cpp
+++ b/src/gpu/GrTextureProvider.cpp
@@ -50,8 +50,7 @@ GrTexture* GrTextureProvider::createMipMappedTexture(const GrSurfaceDesc& desc,
!fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
return nullptr;
}
- if (!GrPixelConfigIsCompressed(desc.fConfig) &&
- !desc.fTextureStorageAllocator.fAllocateTextureStorage) {
+ if (!GrPixelConfigIsCompressed(desc.fConfig)) {
if (mipLevelCount < 2) {
static const uint32_t kFlags = kExact_ScratchTextureFlag |
kNoCreate_ScratchTextureFlag;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 9bc60c2036..4d82b201e7 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -144,15 +144,13 @@ SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, int width, int height,
SkGpuDevice* SkGpuDevice::Create(GrContext* context, SkBudgeted budgeted,
const SkImageInfo& info, int sampleCount,
- const SkSurfaceProps* props, InitContents init,
- GrTextureStorageAllocator customAllocator) {
+ const SkSurfaceProps* props, InitContents init) {
unsigned flags;
if (!CheckAlphaTypeAndGetFlags(&info, init, &flags)) {
return nullptr;
}
- SkAutoTUnref<GrRenderTarget> rt(CreateRenderTarget(
- context, budgeted, info, sampleCount, customAllocator));
+ SkAutoTUnref<GrRenderTarget> rt(CreateRenderTarget(context, budgeted, info, sampleCount));
if (nullptr == rt) {
return nullptr;
}
@@ -179,9 +177,8 @@ SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height,
}
}
-GrRenderTarget* SkGpuDevice::CreateRenderTarget(
- GrContext* context, SkBudgeted budgeted, const SkImageInfo& origInfo,
- int sampleCount, GrTextureStorageAllocator textureStorageAllocator) {
+GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkBudgeted budgeted,
+ const SkImageInfo& origInfo, int sampleCount) {
if (kUnknown_SkColorType == origInfo.colorType() ||
origInfo.width() < 0 || origInfo.height() < 0) {
return nullptr;
@@ -211,7 +208,6 @@ GrRenderTarget* SkGpuDevice::CreateRenderTarget(
desc.fHeight = info.height();
desc.fConfig = SkImageInfo2GrPixelConfig(info, *context->caps());
desc.fSampleCnt = sampleCount;
- desc.fTextureStorageAllocator = textureStorageAllocator;
desc.fIsMipMapped = false;
GrTexture* texture = context->textureProvider()->createTexture(desc, budgeted, nullptr, 0);
if (nullptr == texture) {
@@ -359,8 +355,7 @@ void SkGpuDevice::replaceRenderTarget(bool shouldRetainContent) {
SkBudgeted budgeted = fRenderTarget->resourcePriv().isBudgeted();
SkAutoTUnref<GrRenderTarget> newRT(CreateRenderTarget(
- this->context(), budgeted, this->imageInfo(), fRenderTarget->desc().fSampleCnt,
- fRenderTarget->desc().fTextureStorageAllocator));
+ this->context(), budgeted, this->imageInfo(), fRenderTarget->desc().fSampleCnt));
if (nullptr == newRT) {
return;
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 544240812b..4eaeab7a72 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -52,8 +52,7 @@ public:
* the resource cache budget. On failure, returns nullptr.
*/
static SkGpuDevice* Create(GrContext*, SkBudgeted, const SkImageInfo&,
- int sampleCount, const SkSurfaceProps*,
- InitContents, GrTextureStorageAllocator = GrTextureStorageAllocator());
+ int sampleCount, const SkSurfaceProps*, InitContents);
~SkGpuDevice() override {}
@@ -259,7 +258,7 @@ private:
bool drawDashLine(const SkPoint pts[2], const SkPaint& paint);
static GrRenderTarget* CreateRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&,
- int sampleCount, GrTextureStorageAllocator);
+ int sampleCount);
void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y,
const SkPaint&) override;
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index d01554b0a8..df720da551 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -75,7 +75,6 @@ static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp
}
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType, dstPT, *context->caps());
- desc.fTextureStorageAllocator = texture->desc().fTextureStorageAllocator;
desc.fIsMipMapped = false;
GrTexture* dst = context->textureProvider()->createTexture(desc, SkBudgeted::kNo, nullptr, 0);
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index af5955014a..4f09ebae00 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1342,8 +1342,7 @@ bool GrGLGpu::uploadTexData(const GrSurfaceDesc& desc,
bool succeeded = true;
if (kNewTexture_UploadType == uploadType &&
0 == left && 0 == top &&
- desc.fWidth == width && desc.fHeight == height &&
- !desc.fTextureStorageAllocator.fAllocateTextureStorage) {
+ desc.fWidth == width && desc.fHeight == height) {
succeeded = allocate_and_populate_uncompressed_texture(desc, *interface, caps, target,
internalFormat, externalFormat,
externalType, texelsShallowCopy,
@@ -1863,10 +1862,6 @@ int GrGLGpu::getCompatibleStencilIndex(GrPixelConfig config) {
bool GrGLGpu::createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info,
bool renderTarget, GrGLTexture::TexParams* initialTexParams,
const SkTArray<GrMipLevel>& texels) {
- if (desc.fTextureStorageAllocator.fAllocateTextureStorage) {
- return this->createTextureExternalAllocatorImpl(desc, info, texels);
- }
-
info->fID = 0;
info->fTarget = GR_GL_TEXTURE_2D;
GL_CALL(GenTextures(1, &(info->fID)));
@@ -1897,39 +1892,6 @@ bool GrGLGpu::createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info
return true;
}
-bool GrGLGpu::createTextureExternalAllocatorImpl(const GrSurfaceDesc& desc,
- GrGLTextureInfo* info,
- const SkTArray<GrMipLevel>& texels) {
- // We do not make SkTArray available outside of Skia,
- // and so we do not want to allow mipmaps to external
- // allocators just yet.
- SkASSERT(texels.count() < 2);
-
- const void* pixels = nullptr;
- if (!texels.empty()) {
- pixels = texels.begin()->fPixels;
- }
- switch (desc.fTextureStorageAllocator.fAllocateTextureStorage(
- desc.fTextureStorageAllocator.fCtx, reinterpret_cast<GrBackendObject>(info),
- desc.fWidth, desc.fHeight, desc.fConfig, pixels, desc.fOrigin)) {
- case GrTextureStorageAllocator::Result::kSucceededAndUploaded:
- return true;
- case GrTextureStorageAllocator::Result::kFailed:
- return false;
- case GrTextureStorageAllocator::Result::kSucceededWithoutUpload:
- break;
- }
-
- if (!this->uploadTexData(desc, info->fTarget, kNewTexture_UploadType, 0, 0,
- desc.fWidth, desc.fHeight,
- desc.fConfig, texels)) {
- desc.fTextureStorageAllocator.fDeallocateTextureStorage(
- desc.fTextureStorageAllocator.fCtx, reinterpret_cast<GrBackendObject>(info));
- return false;
- }
- return true;
-}
-
GrStencilAttachment* GrGLGpu::createStencilAttachmentForRenderTarget(const GrRenderTarget* rt,
int width,
int height) {
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index c8b5d70f1b..738d046450 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -141,8 +141,7 @@ private:
// compatible stencil format, or negative if there is no compatible stencil format.
int getCompatibleStencilIndex(GrPixelConfig config);
- // If |desc.fTextureStorageAllocator| exists, use that to create the
- // texture. Otherwise, create the texture directly.
+
// Returns whether the texture is successfully created. On success, the
// result is stored in |info|.
// The texture is populated with |texels|, if it exists.
@@ -150,8 +149,6 @@ private:
bool createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info,
bool renderTarget, GrGLTexture::TexParams* initialTexParams,
const SkTArray<GrMipLevel>& texels);
- bool createTextureExternalAllocatorImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info,
- const SkTArray<GrMipLevel>& texels);
void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override;
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index aff91ebe22..ea02274ad7 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -58,13 +58,7 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
void GrGLTexture::onRelease() {
if (fInfo.fID) {
if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) {
- if (this->desc().fTextureStorageAllocator.fDeallocateTextureStorage) {
- this->desc().fTextureStorageAllocator.fDeallocateTextureStorage(
- this->desc().fTextureStorageAllocator.fCtx,
- reinterpret_cast<GrBackendObject>(&fInfo));
- } else {
- GL_CALL(DeleteTextures(1, &fInfo.fID));
- }
+ GL_CALL(DeleteTextures(1, &fInfo.fID));
}
fInfo.fID = 0;
}
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index b3a65fa7b4..d6f69806ee 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -227,7 +227,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget*, const SkSurf
}
sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&, int,
- const SkSurfaceProps*, GrTextureStorageAllocator) {
+ const SkSurfaceProps*) {
return nullptr;
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index a023acd9a2..2203f47126 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -146,11 +146,9 @@ sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget* target,
sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted,
const SkImageInfo& info, int sampleCount,
- const SkSurfaceProps* props,
- GrTextureStorageAllocator customAllocator) {
+ const SkSurfaceProps* props) {
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(
- ctx, budgeted, info, sampleCount, props, SkGpuDevice::kClear_InitContents,
- customAllocator));
+ ctx, budgeted, info, sampleCount, props, SkGpuDevice::kClear_InitContents));
if (!device) {
return nullptr;
}