aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FloatingPointTextureTest.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-01-22 13:50:35 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-22 13:50:35 -0800
commitcada95ad9b8e6be9bdffe1a70968a2102cc3f09d (patch)
treef217e27014c646cd5d534d3ccfb7b9d11e018fdc /tests/FloatingPointTextureTest.cpp
parent5c05a1b1375301e02ecc3bf2bb5c1b851239bb5c (diff)
Move FP texture test buffers to heap.
This is a speculative fix for the crashing N5 bots. It looks like the bots are always failing in or around FloatingPointTextureTest. It looks like sometimes they're hitting a SIGBUS, which I suspect is stack overflow. FloatingPointTextureTest allocates ~320K on the stack, which may be too much. This CL moves those buffers to the heap. For consistency I did the same with the half-float tests, though they're only using ~1/8th the stack. It looks like sometimes the bots are failing to malloc. I don't understand that, and this CL doesn't address that directly. But it's possible this is still a stack overflow, just trashing RAM and causing arbitrary mayhem instead of a SIGBUS. I have no idea why this is a problem only on the N5. I have been unable to reproduce this locally, neither with a K N5 nor an L N5, but the bots are pretty reliable. NOTREECHECKS=true BUG=skia: Review URL: https://codereview.chromium.org/871623002
Diffstat (limited to 'tests/FloatingPointTextureTest.cpp')
-rw-r--r--tests/FloatingPointTextureTest.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 346c737992..15f2e2eafa 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -28,8 +28,10 @@ static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^
static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H);
DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
- float controlPixelData[FP_CONTROL_ARRAY_SIZE];
- float readBuffer[FP_CONTROL_ARRAY_SIZE];
+ SkTDArray<float> controlPixelData, readBuffer;
+ controlPixelData.setCount(FP_CONTROL_ARRAY_SIZE);
+ readBuffer.setCount(FP_CONTROL_ARRAY_SIZE);
+
for (int i = 0; i < FP_CONTROL_ARRAY_SIZE; i += 4) {
controlPixelData[i] = FLT_MIN;
controlPixelData[i + 1] = FLT_MAX;
@@ -70,8 +72,8 @@ DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
}
// write square
- fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData, 0);
- fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer, 0);
+ fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData.begin(), 0);
+ fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
for (int j = 0; j < FP_CONTROL_ARRAY_SIZE; ++j) {
REPORTER_ASSERT(reporter, readBuffer[j] == controlPixelData[j]);
}
@@ -82,8 +84,10 @@ DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
static const int HALF_CONTROL_ARRAY_SIZE = DEV_W * DEV_H;
DEF_GPUTEST(HalfFloatTextureTest, reporter, factory) {
- SkHalf controlPixelData[HALF_CONTROL_ARRAY_SIZE];
- SkHalf readBuffer[HALF_CONTROL_ARRAY_SIZE];
+ SkTDArray<SkHalf> controlPixelData, readBuffer;
+ controlPixelData.setCount(HALF_CONTROL_ARRAY_SIZE);
+ readBuffer.setCount(HALF_CONTROL_ARRAY_SIZE);
+
for (int i = 0; i < HALF_CONTROL_ARRAY_SIZE; i += 4) {
controlPixelData[i] = SK_HalfMin;
controlPixelData[i + 1] = SK_HalfMax;
@@ -124,8 +128,8 @@ DEF_GPUTEST(HalfFloatTextureTest, reporter, factory) {
}
// write square
- fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData, 0);
- fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer, 0);
+ fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData.begin(), 0);
+ fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
for (int j = 0; j < HALF_CONTROL_ARRAY_SIZE; ++j) {
REPORTER_ASSERT(reporter, readBuffer[j] == controlPixelData[j]);
}