| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 /* | 8 /* |
| 9 * This is a straightforward test of floating point textures, which are | 9 * This is a straightforward test of floating point textures, which are |
| 10 * supported on some platforms. As of right now, this test only supports | 10 * supported on some platforms. As of right now, this test only supports |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (nullptr == context) { | 58 if (nullptr == context) { |
| 59 continue; | 59 continue; |
| 60 } | 60 } |
| 61 | 61 |
| 62 SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->create
Texture( | 62 SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->create
Texture( |
| 63 desc, false, controlPixelData.begin(), 0)); | 63 desc, false, controlPixelData.begin(), 0)); |
| 64 // Floating point textures are NOT supported everywhere | 64 // Floating point textures are NOT supported everywhere |
| 65 if (nullptr == fpTexture) { | 65 if (nullptr == fpTexture) { |
| 66 continue; | 66 continue; |
| 67 } | 67 } |
| 68 |
| 69 fpTexture->setFromRawPixels(true); |
| 70 fpTexture->setException(true); |
| 71 |
| 68 fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.b
egin(), 0); | 72 fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.b
egin(), 0); |
| 69 REPORTER_ASSERT(reporter, | 73 REPORTER_ASSERT(reporter, |
| 70 0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBu
ffer.bytes())); | 74 0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBu
ffer.bytes())); |
| 71 } | 75 } |
| 72 } | 76 } |
| 73 } | 77 } |
| 74 | 78 |
| 75 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; | 79 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; |
| 76 static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^
24 | 80 static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^
24 |
| 77 | 81 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 92 | 96 |
| 93 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; | 97 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; |
| 94 | 98 |
| 95 DEF_GPUTEST(HalfFloatRGBATextureTest, reporter, factory) { | 99 DEF_GPUTEST(HalfFloatRGBATextureTest, reporter, factory) { |
| 96 runFPTest<SkHalf>(reporter, factory, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, | 100 runFPTest<SkHalf>(reporter, factory, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, |
| 97 kMaxIntegerRepresentableInHalfFloatingPoint, | 101 kMaxIntegerRepresentableInHalfFloatingPoint, |
| 98 HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig); | 102 HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig); |
| 99 } | 103 } |
| 100 | 104 |
| 101 #endif | 105 #endif |
| OLD | NEW |