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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 for (int origin = 0; origin < 2; ++origin) { | 40 for (int origin = 0; origin < 2; ++origin) { |
41 GrSurfaceDesc desc; | 41 GrSurfaceDesc desc; |
42 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 42 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
43 desc.fWidth = DEV_W; | 43 desc.fWidth = DEV_W; |
44 desc.fHeight = DEV_H; | 44 desc.fHeight = DEV_H; |
45 desc.fConfig = config; | 45 desc.fConfig = config; |
46 desc.fOrigin = 0 == origin ? | 46 desc.fOrigin = 0 == origin ? |
47 kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; | 47 kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; |
48 SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createText
ure( | 48 SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createText
ure( |
49 desc, false, controlPixelData.begin(), 0)); | 49 desc, SkBudgeted::kNo, controlPixelData.begin(), 0)); |
50 // Floating point textures are NOT supported everywhere | 50 // Floating point textures are NOT supported everywhere |
51 if (nullptr == fpTexture) { | 51 if (nullptr == fpTexture) { |
52 continue; | 52 continue; |
53 } | 53 } |
54 fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin
(), 0); | 54 fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin
(), 0); |
55 REPORTER_ASSERT(reporter, | 55 REPORTER_ASSERT(reporter, |
56 0 == memcmp(readBuffer.begin(), controlPixelData.begin()
, readBuffer.bytes())); | 56 0 == memcmp(readBuffer.begin(), controlPixelData.begin()
, readBuffer.bytes())); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
(...skipping 17 matching lines...) Expand all Loading... |
77 | 77 |
78 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; | 78 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; |
79 | 79 |
80 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, context)
{ | 80 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, context)
{ |
81 runFPTest<SkHalf>(reporter, context, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, | 81 runFPTest<SkHalf>(reporter, context, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, |
82 kMaxIntegerRepresentableInHalfFloatingPoint, | 82 kMaxIntegerRepresentableInHalfFloatingPoint, |
83 HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig); | 83 HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig); |
84 } | 84 } |
85 | 85 |
86 #endif | 86 #endif |
OLD | NEW |