Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: tests/FloatingPointTextureTest.cpp

Issue 1448873002: Generate list of GPU contexts outside tests (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-01-gpu-test-context-support
Patch Set: make blurtest for all rendering contexts Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/ClipBoundsTest.cpp ('k') | tests/GpuColorFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/FloatingPointTextureTest.cpp
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index c5103c813fba95a28a153a42fc06d341382c6abc..04f73c7cd9558cba7befb874600564acbc43d778 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -14,19 +14,17 @@
#include <float.h>
#include "Test.h"
+
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrTexture.h"
-#include "GrContextFactory.h"
-
-#include "SkGpuDevice.h"
#include "SkHalf.h"
static const int DEV_W = 100, DEV_H = 100;
static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H);
template <typename T>
-void runFPTest(skiatest::Reporter* reporter, GrContextFactory* factory,
+void runFPTest(skiatest::Reporter* reporter, GrContext* context,
T min, T max, T epsilon, T maxInt, int arraySize, GrPixelConfig config) {
SkTDArray<T> controlPixelData, readBuffer;
controlPixelData.setCount(arraySize);
@@ -40,43 +38,30 @@ void runFPTest(skiatest::Reporter* reporter, GrContextFactory* factory,
}
for (int origin = 0; origin < 2; ++origin) {
- for (int glCtxType = 0; glCtxType < GrContextFactory::kGLContextTypeCnt; ++glCtxType) {
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = DEV_W;
- desc.fHeight = DEV_H;
- desc.fConfig = config;
- desc.fOrigin = 0 == origin ?
+ GrSurfaceDesc desc;
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fWidth = DEV_W;
+ desc.fHeight = DEV_H;
+ desc.fConfig = config;
+ desc.fOrigin = 0 == origin ?
kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
-
- GrContextFactory::GLContextType type =
- static_cast<GrContextFactory::GLContextType>(glCtxType);
- if (!GrContextFactory::IsRenderingGLContext(type)) {
- continue;
- }
- GrContext* context = factory->get(type);
- if (nullptr == context) {
- continue;
- }
-
- SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
- desc, false, controlPixelData.begin(), 0));
- // Floating point textures are NOT supported everywhere
- if (nullptr == fpTexture) {
- continue;
- }
- fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
- REPORTER_ASSERT(reporter,
- 0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBuffer.bytes()));
+ SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
+ desc, false, controlPixelData.begin(), 0));
+ // Floating point textures are NOT supported everywhere
+ if (nullptr == fpTexture) {
+ continue;
}
+ fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
+ REPORTER_ASSERT(reporter,
+ 0 == memcmp(readBuffer.begin(), controlPixelData.begin(), readBuffer.bytes()));
}
}
static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/;
static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^ 24
-DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
- runFPTest<float>(reporter, factory, FLT_MIN, FLT_MAX, FLT_EPSILON,
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, context) {
+ runFPTest<float>(reporter, context, FLT_MIN, FLT_MAX, FLT_EPSILON,
kMaxIntegerRepresentableInSPFloatingPoint,
FP_CONTROL_ARRAY_SIZE, kRGBA_float_GrPixelConfig);
}
@@ -84,16 +69,16 @@ DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
static const int HALF_ALPHA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 1 /*alpha-only*/;
static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2 ^ 11
-DEF_GPUTEST(HalfFloatAlphaTextureTest, reporter, factory) {
- runFPTest<SkHalf>(reporter, factory, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, context) {
+ runFPTest<SkHalf>(reporter, context, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint,
HALF_ALPHA_CONTROL_ARRAY_SIZE, kAlpha_half_GrPixelConfig);
}
static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/;
-DEF_GPUTEST(HalfFloatRGBATextureTest, reporter, factory) {
- runFPTest<SkHalf>(reporter, factory, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, context) {
+ runFPTest<SkHalf>(reporter, context, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint,
HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig);
}
« no previous file with comments | « tests/ClipBoundsTest.cpp ('k') | tests/GpuColorFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698