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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 desc.fConfig = config; | 48 desc.fConfig = config; |
49 desc.fOrigin = 0 == origin ? | 49 desc.fOrigin = 0 == origin ? |
50 kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; | 50 kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; |
51 | 51 |
52 GrContextFactory::GLContextType type = | 52 GrContextFactory::GLContextType type = |
53 static_cast<GrContextFactory::GLContextType>(glCtxType); | 53 static_cast<GrContextFactory::GLContextType>(glCtxType); |
54 if (!GrContextFactory::IsRenderingGLContext(type)) { | 54 if (!GrContextFactory::IsRenderingGLContext(type)) { |
55 continue; | 55 continue; |
56 } | 56 } |
57 GrContext* context = factory->get(type); | 57 GrContext* context = factory->get(type); |
58 if (NULL == 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 (NULL == fpTexture) { | 65 if (nullptr == fpTexture) { |
66 continue; | 66 continue; |
67 } | 67 } |
68 fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.b
egin(), 0); | 68 fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.b
egin(), 0); |
69 REPORTER_ASSERT(reporter, | 69 REPORTER_ASSERT(reporter, |
70 0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBu
ffer.bytes())); | 70 0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBu
ffer.bytes())); |
71 } | 71 } |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; | 75 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; |
(...skipping 16 matching lines...) Expand all Loading... |
92 | 92 |
93 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; | 93 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; |
94 | 94 |
95 DEF_GPUTEST(HalfFloatRGBATextureTest, reporter, factory) { | 95 DEF_GPUTEST(HalfFloatRGBATextureTest, reporter, factory) { |
96 runFPTest<SkHalf>(reporter, factory, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, | 96 runFPTest<SkHalf>(reporter, factory, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, |
97 kMaxIntegerRepresentableInHalfFloatingPoint, | 97 kMaxIntegerRepresentableInHalfFloatingPoint, |
98 HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig); | 98 HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig); |
99 } | 99 } |
100 | 100 |
101 #endif | 101 #endif |
OLD | NEW |