aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLGpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp72
1 files changed, 0 insertions, 72 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) {