aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/GrSurfaceTest.cpp53
-rw-r--r--tests/IntTextureTest.cpp1
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 99c0becbef..19f2df50fe 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -70,4 +70,57 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
context->getGpu()->deleteTestingOnlyBackendTexture(backendTexHandle);
}
+#if 0
+// This test checks that the isConfigTexturable and isConfigRenderable are
+// consistent with createTexture's result.
+DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
+ GrContext* context = ctxInfo.grContext();
+ const GrCaps* caps = context->caps();
+
+ GrPixelConfig configs[] = {
+ kUnknown_GrPixelConfig,
+ kAlpha_8_GrPixelConfig,
+ kGray_8_GrPixelConfig,
+ kRGB_565_GrPixelConfig,
+ kRGBA_4444_GrPixelConfig,
+ kRGBA_8888_GrPixelConfig,
+ kBGRA_8888_GrPixelConfig,
+ kSRGBA_8888_GrPixelConfig,
+ kSBGRA_8888_GrPixelConfig,
+ kRGBA_8888_sint_GrPixelConfig,
+ kETC1_GrPixelConfig,
+ kRGBA_float_GrPixelConfig,
+ kRG_float_GrPixelConfig,
+ kAlpha_half_GrPixelConfig,
+ kRGBA_half_GrPixelConfig,
+ };
+ SkASSERT(kGrPixelConfigCnt == SK_ARRAY_COUNT(configs));
+
+ GrSurfaceDesc desc;
+ desc.fWidth = 64;
+ desc.fHeight = 64;
+
+ for (GrPixelConfig config : configs) {
+ for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
+ desc.fFlags = kNone_GrSurfaceFlags;
+ desc.fOrigin = origin;
+ desc.fSampleCnt = 0;
+ desc.fConfig = config;
+
+ sk_sp<GrSurface> tex = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
+ REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigTexturable(desc.fConfig,
+ desc.fOrigin));
+
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ tex = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
+ REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigRenderable(config, false));
+
+ desc.fSampleCnt = 4;
+ tex = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
+ REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigRenderable(config, true));
+ }
+ }
+}
+#endif
+
#endif
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index 72f05f9591..bfd54ad4f0 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -42,6 +42,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
static const size_t kRowBytes = kS * sizeof(int32_t);
GrSurfaceDesc desc;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fConfig = kRGBA_8888_sint_GrPixelConfig;
desc.fWidth = kS;
desc.fHeight = kS;