Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "Test.h" |
| 9 | |
| 10 | #if SK_SUPPORT_GPU |
Brian Salomon | c65aec9 | 2017-03-09 09:03:58 -0500 | [diff] [blame] | 11 | #include "GrClip.h" |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 12 | #include "GrContext.h" |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 13 | #include "GrContextPriv.h" |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 14 | #include "GrRenderTargetContext.h" |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 15 | #include "GrResourceProvider.h" |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 16 | #include "GrTexture.h" |
| 17 | #include "effects/GrSimpleTextureEffect.h" |
| 18 | |
| 19 | template <typename I> |
| 20 | static SK_WHEN(std::is_integral<I>::value && 4 == sizeof(I), void) |
Brian Osman | 07792b2 | 2017-01-04 14:11:36 -0500 | [diff] [blame] | 21 | check_pixels(skiatest::Reporter* reporter, int w, int h, const I exepctedData[], |
| 22 | const I actualData[], const char* testName) { |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 23 | for (int j = 0; j < h; ++j) { |
| 24 | for (int i = 0; i < w; ++i) { |
| 25 | I expected = exepctedData[j * w + i]; |
| 26 | I actual = actualData[j * w + i]; |
| 27 | if (expected != actual) { |
Brian Osman | 07792b2 | 2017-01-04 14:11:36 -0500 | [diff] [blame] | 28 | ERRORF(reporter, "[%s] Expected 0x08%x, got 0x%08x at %d, %d.", testName, expected, |
| 29 | actual, i, j); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 30 | return; |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) { |
| 37 | GrContext* context = ctxInfo.grContext(); |
| 38 | if (!context->caps()->isConfigTexturable(kRGBA_8888_sint_GrPixelConfig)) { |
| 39 | return; |
| 40 | } |
| 41 | static const int kS = UINT8_MAX + 1; |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 42 | static const size_t kRowBytes = kS * sizeof(int32_t); |
| 43 | |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 44 | GrSurfaceDesc desc; |
| 45 | desc.fConfig = kRGBA_8888_sint_GrPixelConfig; |
| 46 | desc.fWidth = kS; |
| 47 | desc.fHeight = kS; |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 48 | |
| 49 | std::unique_ptr<int32_t[]> testData(new int32_t[kS * kS]); |
| 50 | for (int j = 0; j < kS; ++j) { |
| 51 | for (int i = 0; i < kS; ++i) { |
| 52 | uint32_t r = i - INT8_MIN; |
| 53 | uint32_t g = j - INT8_MIN; |
| 54 | uint32_t b = INT8_MAX - r; |
| 55 | uint32_t a = INT8_MAX - g; |
| 56 | testData.get()[j * kS + i] = (a << 24) | (b << 16) | (g << 8) | r; |
| 57 | } |
| 58 | } |
| 59 | |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 60 | // Test that attempting to create a integer texture with multiple MIP levels fails. |
| 61 | { |
| 62 | GrMipLevel levels[2]; |
| 63 | levels[0].fPixels = testData.get(); |
| 64 | levels[0].fRowBytes = kRowBytes; |
| 65 | levels[1].fPixels = testData.get(); |
| 66 | levels[1].fRowBytes = (kS / 2) * sizeof(int32_t); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 67 | |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 68 | sk_sp<GrTextureProxy> temp(context->resourceProvider()->createMipMappedTexture( |
| 69 | desc, |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 70 | SkBudgeted::kYes, |
| 71 | levels, 2)); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 72 | REPORTER_ASSERT(reporter, !temp); |
| 73 | } |
| 74 | |
| 75 | // Test that we can create an integer texture. |
Robert Phillips | 26c90e0 | 2017-03-14 14:39:29 -0400 | [diff] [blame] | 76 | sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(), |
Robert Phillips | 2f49314 | 2017-03-02 18:18:38 -0500 | [diff] [blame] | 77 | desc, SkBudgeted::kYes, |
| 78 | testData.get(), |
| 79 | kRowBytes); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 80 | REPORTER_ASSERT(reporter, proxy); |
Robert Phillips | 2f49314 | 2017-03-02 18:18:38 -0500 | [diff] [blame] | 81 | if (!proxy) { |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 82 | return; |
| 83 | } |
| 84 | |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 85 | sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( |
| 86 | std::move(proxy), nullptr); |
| 87 | if (!sContext) { |
| 88 | return; |
| 89 | } |
| 90 | |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 91 | std::unique_ptr<int32_t[]> readData(new int32_t[kS * kS]); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 92 | // Test that reading to a non-integer config fails. |
| 93 | { |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 94 | bool success = context->contextPriv().readSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 95 | 0, 0, kS, kS, |
| 96 | kRGBA_8888_GrPixelConfig, |
| 97 | nullptr, readData.get()); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 98 | REPORTER_ASSERT(reporter, !success); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 99 | } |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 100 | { |
| 101 | std::unique_ptr<uint16_t[]> halfData(new uint16_t[4 * kS * kS]); |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 102 | bool success = context->contextPriv().readSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 103 | 0, 0, kS, kS, |
| 104 | kRGBA_half_GrPixelConfig, |
| 105 | nullptr, halfData.get()); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 106 | REPORTER_ASSERT(reporter, !success); |
| 107 | } |
| 108 | { |
| 109 | // Can read back as ints. (ES only requires being able to read back into 32bit ints which |
| 110 | // we don't support. Right now this test is counting on GR_RGBA_INTEGER/GL_BYTE being the |
| 111 | // implementation-dependent second format). |
| 112 | sk_bzero(readData.get(), sizeof(int32_t) * kS * kS); |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 113 | bool success = context->contextPriv().readSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 114 | 0, 0, kS, kS, |
| 115 | kRGBA_8888_sint_GrPixelConfig, |
| 116 | nullptr, readData.get()); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 117 | REPORTER_ASSERT(reporter, success); |
| 118 | if (success) { |
| 119 | check_pixels(reporter, kS, kS, testData.get(), readData.get(), "readPixels"); |
| 120 | } |
| 121 | } |
| 122 | { |
| 123 | // readPixels should fail if we attempt to use the unpremul flag with an integer texture. |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 124 | bool success = context->contextPriv().readSurfacePixels( |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 125 | sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 126 | 0, 0, kS, kS, |
| 127 | kRGBA_8888_sint_GrPixelConfig, |
| 128 | nullptr, readData.get(), 0, |
| 129 | GrContextPriv::kUnpremul_PixelOpsFlag); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 130 | REPORTER_ASSERT(reporter, !success); |
| 131 | } |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 132 | |
| 133 | // Test that copying from one integer texture to another succeeds. |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 134 | { |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 135 | sk_sp<GrSurfaceContext> dstContext(GrSurfaceProxy::TestCopy(context, desc, |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 136 | sContext->asSurfaceProxy())); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 137 | REPORTER_ASSERT(reporter, dstContext); |
Robert Phillips | f200a90 | 2017-01-30 13:27:37 -0500 | [diff] [blame] | 138 | if (!dstContext || !dstContext->asTextureProxy()) { |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 139 | return; |
| 140 | } |
| 141 | |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 142 | sk_bzero(readData.get(), sizeof(int32_t) * kS * kS); |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 143 | bool success = context->contextPriv().readSurfacePixels(dstContext.get(), 0, 0, kS, kS, |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 144 | kRGBA_8888_sint_GrPixelConfig, |
| 145 | nullptr, readData.get()); |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 146 | REPORTER_ASSERT(reporter, success); |
| 147 | if (success) { |
Brian Osman | 07792b2 | 2017-01-04 14:11:36 -0500 | [diff] [blame] | 148 | check_pixels(reporter, kS, kS, testData.get(), readData.get(), "copyIntegerToInteger"); |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 149 | } |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 150 | } |
| 151 | |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 152 | |
| 153 | // Test that copying to a non-integer (8888) texture fails. |
| 154 | { |
| 155 | GrSurfaceDesc nonIntDesc = desc; |
| 156 | nonIntDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| 157 | |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 158 | sk_sp<GrSurfaceContext> dstContext(GrSurfaceProxy::TestCopy(context, nonIntDesc, |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 159 | sContext->asSurfaceProxy())); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 160 | REPORTER_ASSERT(reporter, !dstContext); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 161 | } |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 162 | |
| 163 | // Test that copying to a non-integer (RGBA_half) texture fails. |
| 164 | if (context->caps()->isConfigTexturable(kRGBA_half_GrPixelConfig)) { |
| 165 | GrSurfaceDesc nonIntDesc = desc; |
| 166 | nonIntDesc.fConfig = kRGBA_half_GrPixelConfig; |
| 167 | |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 168 | sk_sp<GrSurfaceContext> dstContext(GrSurfaceProxy::TestCopy(context, nonIntDesc, |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 169 | sContext->asSurfaceProxy())); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 170 | REPORTER_ASSERT(reporter, !dstContext); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | // We overwrite the top left quarter of the texture with the bottom right quarter of the |
| 174 | // original data. |
| 175 | const void* bottomRightQuarter = testData.get() + kS / 2 * kS + kS / 2; |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 176 | |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 177 | { |
| 178 | // Can't write pixels from a non-int config. |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 179 | bool success = context->contextPriv().writeSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 180 | 0, 0, kS/2, kS/2, |
| 181 | kRGBA_8888_GrPixelConfig, nullptr, |
| 182 | bottomRightQuarter, kRowBytes); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 183 | REPORTER_ASSERT(reporter, !success); |
| 184 | } |
| 185 | { |
| 186 | // Can't use unpremul flag. |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 187 | bool success = context->contextPriv().writeSurfacePixels( |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 188 | sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 189 | 0, 0, kS/2, kS/2, |
| 190 | kRGBA_8888_sint_GrPixelConfig, |
| 191 | nullptr, |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 192 | bottomRightQuarter, kRowBytes, |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 193 | GrContextPriv::kUnpremul_PixelOpsFlag); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 194 | REPORTER_ASSERT(reporter, !success); |
| 195 | } |
| 196 | { |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 197 | bool success = context->contextPriv().writeSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 198 | 0, 0, kS/2, kS/2, |
| 199 | kRGBA_8888_sint_GrPixelConfig, |
| 200 | nullptr, |
| 201 | bottomRightQuarter, kRowBytes); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 202 | REPORTER_ASSERT(reporter, success); |
| 203 | if (!success) { |
| 204 | return; |
| 205 | } |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 206 | |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 207 | sk_bzero(readData.get(), sizeof(int32_t) * kS * kS); |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 208 | success = context->contextPriv().readSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 209 | 0, 0, kS, kS, |
| 210 | kRGBA_8888_sint_GrPixelConfig, |
| 211 | nullptr, readData.get(), 0); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 212 | REPORTER_ASSERT(reporter, success); |
| 213 | if (!success) { |
| 214 | return; |
| 215 | } |
| 216 | std::unique_ptr<int32_t[]> overwrittenTestData(new int32_t[kS * kS]); |
| 217 | memcpy(overwrittenTestData.get(), testData.get(), sizeof(int32_t) * kS * kS); |
| 218 | char* dst = (char*)overwrittenTestData.get(); |
| 219 | char* src = (char*)(testData.get() + kS/2 * kS + kS/2); |
| 220 | for (int i = 0; i < kS/2; ++i) { |
| 221 | memcpy(dst, src, sizeof(int32_t) * kS/2); |
| 222 | dst += kRowBytes; |
| 223 | src += kRowBytes; |
| 224 | } |
| 225 | check_pixels(reporter, kS, kS, overwrittenTestData.get(), readData.get(), "overwrite"); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 226 | } |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 227 | |
| 228 | // Test drawing from the integer texture to a fixed point texture. To avoid any premul issues |
| 229 | // we init the int texture with 0s and 1s and make alpha always be 1. We expect that 1s turn |
| 230 | // into 0xffs and zeros stay zero. |
| 231 | std::unique_ptr<uint32_t[]> expectedData(new uint32_t[kS * kS]); |
| 232 | std::unique_ptr<uint32_t[]> actualData(new uint32_t[kS * kS]); |
| 233 | for (int i = 0; i < kS*kS; ++i) { |
| 234 | int32_t a = 0x1; |
| 235 | int32_t b = ((i & 0x1) ? 1 : 0); |
| 236 | int32_t g = ((i & 0x1) ? 0 : 1); |
| 237 | int32_t r = ((i & 0x2) ? 1 : 0); |
| 238 | testData.get()[i] = (a << 24) | (b << 16) | (g << 8) | r; |
| 239 | expectedData.get()[i] = ((0xFF * a) << 24) | ((0xFF * b) << 16) | |
| 240 | ((0xFF * g) << 8) | (0xFF * r); |
| 241 | } |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 242 | context->contextPriv().writeSurfacePixels(sContext.get(), |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 243 | 0, 0, kS, kS, |
| 244 | kRGBA_8888_sint_GrPixelConfig, nullptr, |
| 245 | testData.get(), 0); |
Robert Phillips | 769e80d | 2017-03-29 13:06:57 -0400 | [diff] [blame] | 246 | |
Robert Phillips | dd3b3f4 | 2017-04-24 10:57:28 -0400 | [diff] [blame] | 247 | sk_sp<GrRenderTargetContext> rtContext = context->makeDeferredRenderTargetContext( |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 248 | SkBackingFit::kExact, kS, kS, kRGBA_8888_GrPixelConfig, nullptr); |
| 249 | |
Brian Osman | 07792b2 | 2017-01-04 14:11:36 -0500 | [diff] [blame] | 250 | struct { |
| 251 | GrSamplerParams::FilterMode fMode; |
| 252 | const char* fName; |
| 253 | } kNamedFilters[] ={ |
| 254 | { GrSamplerParams::kNone_FilterMode, "filter-none" }, |
| 255 | { GrSamplerParams::kBilerp_FilterMode, "filter-bilerp" }, |
| 256 | { GrSamplerParams::kMipMap_FilterMode, "filter-mipmap" } |
| 257 | }; |
| 258 | |
| 259 | for (auto filter : kNamedFilters) { |
Robert Phillips | 769e80d | 2017-03-29 13:06:57 -0400 | [diff] [blame] | 260 | sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(context->resourceProvider(), |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 261 | sContext->asTextureProxyRef(), |
| 262 | nullptr, |
Robert Phillips | 67c18d6 | 2017-01-20 12:44:06 -0500 | [diff] [blame] | 263 | SkMatrix::I(), |
Brian Osman | 07792b2 | 2017-01-04 14:11:36 -0500 | [diff] [blame] | 264 | filter.fMode)); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 265 | REPORTER_ASSERT(reporter, fp); |
| 266 | if (!fp) { |
| 267 | return; |
| 268 | } |
| 269 | rtContext->clear(nullptr, 0xDDAABBCC, true); |
| 270 | GrPaint paint; |
| 271 | paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
| 272 | paint.addColorFragmentProcessor(fp); |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 273 | rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I()); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 274 | SkImageInfo readInfo = SkImageInfo::Make(kS, kS, kRGBA_8888_SkColorType, |
| 275 | kPremul_SkAlphaType); |
| 276 | rtContext->readPixels(readInfo, actualData.get(), 0, 0, 0); |
Brian Osman | 07792b2 | 2017-01-04 14:11:36 -0500 | [diff] [blame] | 277 | check_pixels(reporter, kS, kS, expectedData.get(), actualData.get(), filter.fName); |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 278 | } |
| 279 | |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 280 | { |
| 281 | // No rendering to integer textures. |
| 282 | GrSurfaceDesc intRTDesc = desc; |
| 283 | intRTDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame] | 284 | sk_sp<GrTexture> temp(context->resourceProvider()->createTexture(intRTDesc, |
| 285 | SkBudgeted::kYes)); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 286 | REPORTER_ASSERT(reporter, !temp); |
| 287 | } |
Brian Salomon | bf7b620 | 2016-11-11 16:08:03 -0500 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | #endif |