diff options
author | Mike Klein <mtklein@chromium.org> | 2018-06-26 11:43:06 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-26 19:02:52 +0000 |
commit | 3785471ff641b7ec4218a32fcf76363b9ac81bab (patch) | |
tree | 7596487528841f9a6e32c105c909667c54799d72 /tests/SurfaceTest.cpp | |
parent | 9b6125d046198bff736a509769b51908aaff326a (diff) |
basic first pass at RGBA F32 support
Draws basically the same as f16.
The existing load_f32, load_f32_dst, and store_f32 stages all had the
same bug that we'd never noticed because dy was always 0 until now.
Change-Id: Ibbd393fa1acc5df414be4cdef0f5a9d11dcccdb3
Reviewed-on: https://skia-review.googlesource.com/137585
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'tests/SurfaceTest.cpp')
-rw-r--r-- | tests/SurfaceTest.cpp | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 9a3a3aae6d..3370e76ad8 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -894,7 +894,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf static void test_surface_creation_and_snapshot_with_color_space( skiatest::Reporter* reporter, const char* prefix, - bool f16Support, + bool supportsF16, + bool supportsF32, bool supports1010102, std::function<sk_sp<SkSurface>(const SkImageInfo&)> surfaceMaker) { @@ -914,17 +915,21 @@ static void test_surface_creation_and_snapshot_with_color_space( bool fShouldWork; const char* fDescription; } testConfigs[] = { - { kN32_SkColorType, nullptr, true, "N32-nullptr" }, - { kN32_SkColorType, linearColorSpace, true, "N32-linear" }, - { kN32_SkColorType, srgbColorSpace, true, "N32-srgb" }, - { kN32_SkColorType, oddColorSpace, true, "N32-odd" }, - { kRGBA_F16_SkColorType, nullptr, true, "F16-nullptr" }, - { kRGBA_F16_SkColorType, linearColorSpace, true, "F16-linear" }, - { kRGBA_F16_SkColorType, srgbColorSpace, true, "F16-srgb" }, - { kRGBA_F16_SkColorType, oddColorSpace, true, "F16-odd" }, - { kRGB_565_SkColorType, srgbColorSpace, false, "565-srgb" }, - { kAlpha_8_SkColorType, srgbColorSpace, false, "A8-srgb" }, - { kRGBA_1010102_SkColorType, nullptr, true, "1010102-nullptr" }, + { kN32_SkColorType, nullptr, true, "N32-nullptr" }, + { kN32_SkColorType, linearColorSpace, true, "N32-linear" }, + { kN32_SkColorType, srgbColorSpace, true, "N32-srgb" }, + { kN32_SkColorType, oddColorSpace, true, "N32-odd" }, + { kRGBA_F16_SkColorType, nullptr, supportsF16, "F16-nullptr" }, + { kRGBA_F16_SkColorType, linearColorSpace, supportsF16, "F16-linear" }, + { kRGBA_F16_SkColorType, srgbColorSpace, supportsF16, "F16-srgb" }, + { kRGBA_F16_SkColorType, oddColorSpace, supportsF16, "F16-odd" }, + { kRGBA_F32_SkColorType, nullptr, supportsF32, "F32-nullptr" }, + { kRGBA_F32_SkColorType, linearColorSpace, supportsF32, "F32-linear" }, + { kRGBA_F32_SkColorType, srgbColorSpace, supportsF32, "F32-srgb" }, + { kRGBA_F32_SkColorType, oddColorSpace, supportsF32, "F32-odd" }, + { kRGB_565_SkColorType, srgbColorSpace, false, "565-srgb" }, + { kAlpha_8_SkColorType, srgbColorSpace, false, "A8-srgb" }, + { kRGBA_1010102_SkColorType, nullptr, supports1010102, "1010102-nullptr" }, }; for (auto& testConfig : testConfigs) { @@ -932,16 +937,11 @@ static void test_surface_creation_and_snapshot_with_color_space( SkImageInfo info = SkImageInfo::Make(10, 10, testConfig.fColorType, kPremul_SkAlphaType, testConfig.fColorSpace); - // For some GPU contexts (eg ANGLE), we don't have f16 support, so we should fail to create - // any surface of that type: - bool shouldWork = testConfig.fShouldWork && - (f16Support || kRGBA_F16_SkColorType != testConfig.fColorType) && - (supports1010102 || kRGBA_1010102_SkColorType != testConfig.fColorType); - auto surface(surfaceMaker(info)); - REPORTER_ASSERT(reporter, SkToBool(surface) == shouldWork, fullTestName.c_str()); + REPORTER_ASSERT(reporter, + SkToBool(surface) == testConfig.fShouldWork, fullTestName.c_str()); - if (shouldWork && surface) { + if (testConfig.fShouldWork && surface) { sk_sp<SkImage> image(surface->makeImageSnapshot()); REPORTER_ASSERT(reporter, image, testConfig.fDescription); SkColorSpace* imageColorSpace = as_IB(image)->onImageInfo().colorSpace(); @@ -956,22 +956,25 @@ DEF_TEST(SurfaceCreationWithColorSpace, reporter) { return SkSurface::MakeRaster(info); }; - test_surface_creation_and_snapshot_with_color_space(reporter, "raster", true, true, + test_surface_creation_and_snapshot_with_color_space(reporter, "raster", + true, true, true, surfaceMaker); } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) { auto context = ctxInfo.grContext(); - bool f16Support = context->contextPriv().caps()->isConfigRenderable(kRGBA_half_GrPixelConfig); - bool supports1010102 = - context->contextPriv().caps()->isConfigRenderable(kRGBA_1010102_GrPixelConfig); + bool supportsF16 = context->contextPriv().caps()->isConfigRenderable(kRGBA_half_GrPixelConfig), + supportsF32 = context->contextPriv().caps()->isConfigRenderable(kRGBA_float_GrPixelConfig), + supports1010102 = context->contextPriv().caps()->isConfigRenderable(kRGBA_1010102_GrPixelConfig); + auto surfaceMaker = [context](const SkImageInfo& info) { return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info); }; - test_surface_creation_and_snapshot_with_color_space(reporter, "gpu", f16Support, - supports1010102, surfaceMaker); + test_surface_creation_and_snapshot_with_color_space(reporter, "gpu", + supportsF16, supportsF32, supports1010102, + surfaceMaker); std::vector<GrBackendTexture> backendTextures; auto wrappedSurfaceMaker = [ context, &backendTextures ](const SkImageInfo& info) { @@ -996,8 +999,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, sk_ref_sp(info.colorSpace()), nullptr); }; - test_surface_creation_and_snapshot_with_color_space(reporter, "wrapped", f16Support, - supports1010102, wrappedSurfaceMaker); + test_surface_creation_and_snapshot_with_color_space(reporter, "wrapped", + supportsF16, supportsF32, supports1010102, + wrappedSurfaceMaker); context->flush(); |