aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-12-13 09:22:45 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-13 15:20:12 +0000
commitc25db637532cd10dde7855d868c0d033e96f61f2 (patch)
tree63a14b28af84ebf7f2bee6eef63db3de6623a811 /src/gpu/gl
parent2a3009931d7bb0f5ca31490c4cf19eef205e4e7a (diff)
Update SkImage::MakeFromYUVTexturesCopy to GrBackendTexture
Change-Id: I7ba030c5d7856309709e892a2b1b625cf74c70b8 Reviewed-on: https://skia-review.googlesource.com/82823 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp72
-rw-r--r--src/gpu/gl/GrGLGpu.h6
2 files changed, 0 insertions, 78 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index c114c6c2ed..95eb339db8 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -4387,78 +4387,6 @@ void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
}
}
-GrBackendObject GrGLGpu::createTestingOnlyBackendObject(void* pixels, int w, int h,
- GrPixelConfig config, bool /*isRT*/,
- GrMipMapped mipMapped) {
- if (!this->caps()->isConfigTexturable(config)) {
- return reinterpret_cast<GrBackendObject>(nullptr);
- }
-
- // Currently we don't support uploading pixel data when mipped.
- if (pixels && GrMipMapped::kYes == mipMapped) {
- return reinterpret_cast<GrBackendObject>(nullptr);
- }
-
- std::unique_ptr<GrGLTextureInfo> info = skstd::make_unique<GrGLTextureInfo>();
- info->fTarget = GR_GL_TEXTURE_2D;
- info->fID = 0;
- GL_CALL(GenTextures(1, &info->fID));
- GL_CALL(ActiveTexture(GR_GL_TEXTURE0));
- GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1));
- GL_CALL(BindTexture(info->fTarget, info->fID));
- fHWBoundTextureUniqueIDs[0].makeInvalid();
- GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST));
- GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST));
- GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_EDGE));
- GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_EDGE));
-
- GrGLenum internalFormat;
- GrGLenum externalFormat;
- GrGLenum externalType;
-
- if (!this->glCaps().getTexImageFormats(config, config, &internalFormat, &externalFormat,
- &externalType)) {
- return reinterpret_cast<GrBackendObject>(nullptr);
- }
-
- this->unbindCpuToGpuXferBuffer();
-
- // Figure out the number of mip levels.
- int mipLevels = 1;
- if (GrMipMapped::kYes == mipMapped) {
- mipLevels = SkMipMap::ComputeLevelCount(w, h) + 1;
- }
-
- size_t bpp = GrBytesPerPixel(config);
- size_t baseLayerSize = bpp * w * h;
- SkAutoMalloc defaultStorage(baseLayerSize);
- if (!pixels) {
- // Fill in the texture with all zeros so we don't have random garbage
- pixels = defaultStorage.get();
- memset(pixels, 0, baseLayerSize);
- }
-
- int width = w;
- int height = h;
- for (int i = 0; i < mipLevels; ++i) {
- GL_CALL(TexImage2D(info->fTarget, i, internalFormat, width, height, 0, externalFormat,
- externalType, pixels));
- width = SkTMax(1, width / 2);
- height = SkTMax(1, height / 2);
- }
-
- return reinterpret_cast<GrBackendObject>(info.release());
-}
-
-void GrGLGpu::deleteTestingOnlyBackendObject(GrBackendObject id, bool abandonTexture) {
- std::unique_ptr<const GrGLTextureInfo> info(reinterpret_cast<const GrGLTextureInfo*>(id));
- GrGLuint texID = info->fID;
-
- if (!abandonTexture) {
- GL_CALL(DeleteTextures(1, &texID));
- }
-}
-
GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, int h,
GrPixelConfig config, bool /*isRT*/,
GrMipMapped mipMapped) {
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 42897abc1c..5c059a0da1 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -161,12 +161,6 @@ public:
int width,
int height) override;
- GrBackendObject createTestingOnlyBackendObject(void* pixels, int w, int h,
- GrPixelConfig config,
- bool isRenderTarget,
- GrMipMapped mipMapped) override;
- void deleteTestingOnlyBackendObject(GrBackendObject, bool abandonTexture) override;
-
GrBackendTexture createTestingOnlyBackendTexture(void* pixels, int w, int h,
GrPixelConfig config,
bool isRenderTarget,