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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
60 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; | 60 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; |
61 static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^
24 | 61 static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^
24 |
62 | 62 |
63 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInf
o) { | 63 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInfo)
{ |
64 runFPTest<float>(reporter, ctxInfo.fGrContext, FLT_MIN, FLT_MAX, FLT_EPSILON
, | 64 runFPTest<float>(reporter, ctxInfo.fGrContext, FLT_MIN, FLT_MAX, FLT_EPSILON
, |
65 kMaxIntegerRepresentableInSPFloatingPoint, | 65 kMaxIntegerRepresentableInSPFloatingPoint, |
66 FP_CONTROL_ARRAY_SIZE, kRGBA_float_GrPixelConfig); | 66 FP_CONTROL_ARRAY_SIZE, kRGBA_float_GrPixelConfig); |
67 } | 67 } |
68 | 68 |
69 static const int HALF_ALPHA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 1 /*alpha-only*
/; | 69 static const int HALF_ALPHA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 1 /*alpha-only*
/; |
70 static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2
^ 11 | 70 static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2
^ 11 |
71 | 71 |
72 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxIn
fo) { | 72 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo)
{ |
73 runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_H
alfEpsilon, | 73 runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_H
alfEpsilon, |
74 kMaxIntegerRepresentableInHalfFloatingPoint, | 74 kMaxIntegerRepresentableInHalfFloatingPoint, |
75 HALF_ALPHA_CONTROL_ARRAY_SIZE, kAlpha_half_GrPixelConfig); | 75 HALF_ALPHA_CONTROL_ARRAY_SIZE, kAlpha_half_GrPixelConfig); |
76 } | 76 } |
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_GL_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInf
o) { | 80 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo)
{ |
81 runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_H
alfEpsilon, | 81 runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_H
alfEpsilon, |
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 |