Reland "Make it easier to test rectangle textures by using createBackendTexture."
This is a reland of 4e37751693a793505b0070eb8121fba99247d098
Original change's description:
> Make it easier to test rectangle textures by using createBackendTexture.
>
> Also allows internal creation of rectangle textures, only used by unit
> tests currently.
>
> Previously GrContext::createBackendTexture() would ignore the request
> for RECTANGLE or EXTERNAL and always make 2D. Now it makes RECTANGLE if
> supported and always fails for EXTERNAL.
>
> Change-Id: Iafbb3f5acddb37bfb8d39740f2590177a07dae78
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297472
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Change-Id: Ibf6921c97278c9f0f71c46883cfbaa04f229affa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297865
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp
index cfcff66..d0f4c5a 100644
--- a/tests/TextureBindingsResetTest.cpp
+++ b/tests/TextureBindingsResetTest.cpp
@@ -135,18 +135,11 @@
}
if (supportRectangle) {
- GrGLuint id = ctxInfo.glContext()->createTextureRectangle(10, 10, GR_GL_RGBA, GR_GL_RGBA,
- GR_GL_UNSIGNED_BYTE, nullptr);
- // Above texture creation will have messed with GL state and bindings.
- resetBindings();
- context->resetContext();
- if (id) {
- GrGLTextureInfo info;
- info.fTarget = GR_GL_TEXTURE_RECTANGLE;
- info.fFormat = GR_GL_RGBA8;
- info.fID = id;
- GrBackendTexture backendTexture(10, 10, GrMipMapped::kNo, info);
- img = SkImage::MakeFromTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin,
+ auto format = GrBackendFormat::MakeGL(GR_GL_RGBA8, GR_GL_TEXTURE_RECTANGLE);
+ GrBackendTexture rectangleTexture =
+ context->createBackendTexture(10, 10, format, GrMipMapped::kNo, GrRenderable::kNo);
+ if (rectangleTexture.isValid()) {
+ img = SkImage::MakeFromTexture(context, rectangleTexture, kTopLeft_GrSurfaceOrigin,
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr);
REPORTER_ASSERT(reporter, img);
surf->getCanvas()->drawImage(img, 0, 0);
@@ -155,8 +148,7 @@
context->resetGLTextureBindings();
checkBindings();
resetBindings();
- GL(DeleteTextures(1, &id));
- context->resetContext();
+ context->deleteBackendTexture(rectangleTexture);
}
}