Revert of Get gpudft support working in dm, gm, nanobench and bench_pictures (patchset #2 id:20001 of https://codereview.chromium.org/699453005/)
Reason for revert:
Not compiling in ANGLE build
Original issue's description:
> Get gpudft support working in dm, gm, nanobench and bench_pictures
>
> Adds a new config to test distance field text.
> Clean up some flags and #defines to read "distance field text",
> not "distance field fonts" to be consistent with Chromium
>
> NOTREECHECKS=true
>
> Committed: https://skia.googlesource.com/skia/+/06ba179838ba4fe187cf290750aeeb4a02a2960b
TBR=bsalomon@google.com,mtklein@google.com,reed@google.com
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/707723005
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 44bc5ec..aade590 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -283,10 +283,8 @@
int samples;
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType ctxType;
- bool useDFText;
#else
int bogusInt;
- bool bogusBool;
#endif
};
@@ -329,11 +327,10 @@
// Append all configs that are enabled and supported.
static void create_configs(SkTDArray<Config>* configs) {
- #define CPU_CONFIG(name, backend, color, alpha) \
- if (is_cpu_config_allowed(#name)) { \
- Config config = { #name, Benchmark::backend, color, alpha, 0, \
- kBogusGLContextType, false }; \
- configs->push(config); \
+ #define CPU_CONFIG(name, backend, color, alpha) \
+ if (is_cpu_config_allowed(#name)) { \
+ Config config = { #name, Benchmark::backend, color, alpha, 0, kBogusGLContextType }; \
+ configs->push(config); \
}
if (FLAGS_cpu) {
@@ -343,7 +340,7 @@
}
#if SK_SUPPORT_GPU
- #define GPU_CONFIG(name, ctxType, samples, useDFText) \
+ #define GPU_CONFIG(name, ctxType, samples) \
if (is_gpu_config_allowed(#name, GrContextFactory::ctxType, samples)) { \
Config config = { \
#name, \
@@ -351,20 +348,18 @@
kN32_SkColorType, \
kPremul_SkAlphaType, \
samples, \
- GrContextFactory::ctxType, \
- useDFText }; \
+ GrContextFactory::ctxType }; \
configs->push(config); \
}
if (FLAGS_gpu) {
- GPU_CONFIG(gpu, kNative_GLContextType, 0, false)
- GPU_CONFIG(msaa4, kNative_GLContextType, 4, false)
- GPU_CONFIG(msaa16, kNative_GLContextType, 16, false)
- GPU_CONFIG(nvprmsaa4, kNVPR_GLContextType, 4, false)
- GPU_CONFIG(nvprmsaa16, kNVPR_GLContextType, 16, false)
- GPU_CONFIG(gpudft, kNative_GLContextType, 0, true)
- GPU_CONFIG(debug, kDebug_GLContextType, 0, false)
- GPU_CONFIG(nullgpu, kNull_GLContextType, 0, false)
+ GPU_CONFIG(gpu, kNative_GLContextType, 0)
+ GPU_CONFIG(msaa4, kNative_GLContextType, 4)
+ GPU_CONFIG(msaa16, kNative_GLContextType, 16)
+ GPU_CONFIG(nvprmsaa4, kNVPR_GLContextType, 4)
+ GPU_CONFIG(nvprmsaa16, kNVPR_GLContextType, 16)
+ GPU_CONFIG(debug, kDebug_GLContextType, 0)
+ GPU_CONFIG(nullgpu, kNull_GLContextType, 0)
#ifdef SK_ANGLE
GPU_CONFIG(angle, kANGLE_GLContextType, 0)
#endif
@@ -388,10 +383,8 @@
}
#if SK_SUPPORT_GPU
else if (Benchmark::kGPU_Backend == config.backend) {
- uint32_t flags = config.useDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
- SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
target->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(config.ctxType), info,
- config.samples, &props));
+ config.samples));
target->gl = gGrFactory->getGLContext(config.ctxType);
}
#endif
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 8e5862d..2a0c636 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -86,14 +86,13 @@
START("565", CpuGMTask, kRGB_565_SkColorType);
START("8888", CpuGMTask, kN32_SkColorType);
- START("gpu", GpuGMTask, native, gpuAPI, 0, false);
- START("msaa4", GpuGMTask, native, gpuAPI, 4, false);
- START("msaa16", GpuGMTask, native, gpuAPI, 16, false);
- START("nvprmsaa4", GpuGMTask, nvpr, gpuAPI, 4, false);
- START("nvprmsaa16", GpuGMTask, nvpr, gpuAPI, 16, false);
- START("gpudft", GpuGMTask, native, gpuAPI, 0, true);
- START("gpunull", GpuGMTask, null, gpuAPI, 0, false);
- START("gpudebug", GpuGMTask, debug, gpuAPI, 0, false);
+ START("gpu", GpuGMTask, native, gpuAPI, 0);
+ START("msaa4", GpuGMTask, native, gpuAPI, 4);
+ START("msaa16", GpuGMTask, native, gpuAPI, 16);
+ START("nvprmsaa4", GpuGMTask, nvpr, gpuAPI, 4);
+ START("nvprmsaa16", GpuGMTask, nvpr, gpuAPI, 16);
+ START("gpunull", GpuGMTask, null, gpuAPI, 0);
+ START("gpudebug", GpuGMTask, debug, gpuAPI, 0);
#if SK_ANGLE
START("angle", GpuGMTask, angle, gpuAPI, 0);
#endif
diff --git a/dm/DMGpuGMTask.cpp b/dm/DMGpuGMTask.cpp
index 9347ebd..2890483 100644
--- a/dm/DMGpuGMTask.cpp
+++ b/dm/DMGpuGMTask.cpp
@@ -13,15 +13,13 @@
skiagm::GMRegistry::Factory gmFactory,
GrContextFactory::GLContextType contextType,
GrGLStandard gpuAPI,
- int sampleCount,
- bool useDFText)
+ int sampleCount)
: GpuTask(reporter, taskRunner)
, fGM(gmFactory(NULL))
, fName(UnderJoin(fGM->getName(), config))
, fContextType(contextType)
, fGpuAPI(gpuAPI)
, fSampleCount(sampleCount)
- , fUseDFText(useDFText)
{}
static bool gAlreadyWarned[GrContextFactory::kGLContextTypeCnt][kGrGLStandardCnt];
@@ -32,7 +30,7 @@
kN32_SkColorType,
kPremul_SkAlphaType);
SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fGpuAPI, info,
- fSampleCount, fUseDFText));
+ fSampleCount));
if (!surface) {
if (!gAlreadyWarned[fContextType][fGpuAPI]) {
SkDebugf("FYI: couldn't create GPU context, type %d API %d. Will skip.\n",
diff --git a/dm/DMGpuGMTask.h b/dm/DMGpuGMTask.h
index 553436d..23f3a45 100644
--- a/dm/DMGpuGMTask.h
+++ b/dm/DMGpuGMTask.h
@@ -22,8 +22,7 @@
skiagm::GMRegistry::Factory,
GrContextFactory::GLContextType,
GrGLStandard gpuAPI,
- int sampleCount,
- bool useDFText);
+ int sampleCount);
virtual void draw(GrContextFactory*) SK_OVERRIDE;
virtual bool shouldSkip() const SK_OVERRIDE;
@@ -35,7 +34,6 @@
const GrContextFactory::GLContextType fContextType;
GrGLStandard fGpuAPI;
const int fSampleCount;
- const bool fUseDFText;
};
} // namespace DM
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index 33d8995..90b0ea5 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -21,11 +21,8 @@
GrContextFactory::GLContextType type,
GrGLStandard gpuAPI,
SkImageInfo info,
- int samples,
- bool useDFText) {
- uint32_t flags = useDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
- SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
- return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), info, samples, &props);
+ int samples) {
+ return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), info, samples, NULL);
}
} // namespace DM
@@ -65,8 +62,7 @@
GrContextFactory::GLContextType,
GrGLStandard,
SkImageInfo,
- int,
- bool) {
+ int) {
return NULL;
}
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 4e49adb..da0f38f 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -151,9 +151,6 @@
/* Read reference GM images if a read path is provided. */
kRead_ConfigFlag = 0x2,
kRW_ConfigFlag = (kWrite_ConfigFlag | kRead_ConfigFlag),
- /* Use distance fields for rendering text */
- kDFText_ConfigFlag = 0x4,
- kRWDFT_ConfigFlag = (kRW_ConfigFlag | kDFText_ConfigFlag),
};
struct ConfigData {
@@ -587,10 +584,7 @@
}
#if SK_SUPPORT_GPU
else { // GPU
- uint32_t flags = (gRec.fFlags & kDFText_ConfigFlag) ?
- SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
- SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
- surface.reset(SkSurface::NewRenderTargetDirect(gpuTarget->asRenderTarget(), &props));
+ surface.reset(SkSurface::NewRenderTargetDirect(gpuTarget->asRenderTarget()));
if (deferred) {
canvas.reset(SkDeferredCanvas::Create(surface));
} else {
@@ -1297,7 +1291,6 @@
{ kN32_SkColorType, kGPU_Backend, GrContextFactory::kNative_GLContextType, 4, kRW_ConfigFlag, "msaa4", false},
{ kN32_SkColorType, kGPU_Backend, GrContextFactory::kNVPR_GLContextType, 4, kRW_ConfigFlag, "nvprmsaa4", true },
{ kN32_SkColorType, kGPU_Backend, GrContextFactory::kNVPR_GLContextType, 16, kRW_ConfigFlag, "nvprmsaa16", false},
- { kN32_SkColorType, kGPU_Backend, GrContextFactory::kNative_GLContextType, 0, kRWDFT_ConfigFlag, "gpudft", true },
/* The gpudebug context does not generate meaningful images, so don't record
* the images it generates! We only run it to look for asserts. */
{ kN32_SkColorType, kGPU_Backend, GrContextFactory::kDebug_GLContextType, 0, kNone_ConfigFlag, "gpudebug", kDebugOnly},
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index dd701dd..d9c0487 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -5,7 +5,7 @@
'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
'SK_SUPPORT_GPU=<(skia_gpu)',
'SK_SUPPORT_OPENCL=<(skia_opencl)',
- 'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
+ 'SK_FORCE_DISTANCEFIELD_FONTS=<(skia_force_distancefield_fonts)',
],
'conditions' : [
['skia_pic', {
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 09d84ec..ab25eef 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -152,7 +152,7 @@
'skia_win_debuggers_path%': '',
'skia_shared_lib%': 0,
'skia_opencl%': 0,
- 'skia_force_distance_field_text%': 0,
+ 'skia_force_distancefield_fonts%': 0,
# These variables determine the default optimization level for different
# compilers.
@@ -231,7 +231,7 @@
'skia_profile_enabled%': '<(skia_profile_enabled)',
'skia_shared_lib%': '<(skia_shared_lib)',
'skia_opencl%': '<(skia_opencl)',
- 'skia_force_distance_field_text%': '<(skia_force_distance_field_text)',
+ 'skia_force_distancefield_fonts%': '<(skia_force_distancefield_fonts)',
'skia_static_initializers%': '<(skia_static_initializers)',
'ios_sdk_version%': '6.0',
'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 58c8121..1976cf1 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -64,7 +64,7 @@
const SkDeviceProperties& properties,
bool enable)
: GrTextContext(context, properties) {
-#if SK_FORCE_DISTANCE_FIELD_TEXT
+#if SK_FORCE_DISTANCEFIELD_FONTS
fEnableDFRendering = true;
#else
fEnableDFRendering = enable;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 96c0714..da81c69 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -67,7 +67,7 @@
#define DO_DEFERRED_CLEAR() \
do { \
- if (fFlags & kNeedClear_Flag) { \
+ if (fNeedClear) { \
this->clear(SK_ColorTRANSPARENT); \
} \
} while (false) \
@@ -137,7 +137,7 @@
fContext = SkRef(surface->getContext());
- fFlags = flags;
+ fNeedClear = flags & kNeedClear_Flag;
fRenderTarget = SkRef(surface->asRenderTarget());
@@ -148,8 +148,8 @@
this->setPixelGeometry(props.pixelGeometry());
- bool useDFT = SkToBool(flags & kDFText_Flag);
- fTextContext = fContext->createTextContext(fRenderTarget, this->getLeakyProperties(), useDFT);
+ bool useDFFonts = !!(flags & kDFFonts_Flag);
+ fTextContext = fContext->createTextContext(fRenderTarget, this->getLeakyProperties(), useDFFonts);
}
SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo,
@@ -310,7 +310,7 @@
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clear", fContext);
SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
fContext->clear(&rect, SkColor2GrColor(color), true, fRenderTarget);
- fFlags &= ~kNeedClear_Flag;
+ fNeedClear = false;
}
void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
@@ -1473,7 +1473,7 @@
// clear of the source device must occur before CHECK_SHOULD_DRAW
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawDevice", fContext);
SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
- if (dev->fFlags & kNeedClear_Flag) {
+ if (dev->fNeedClear) {
// TODO: could check here whether we really need to draw at all
dev->clear(0x0);
}
@@ -1763,8 +1763,6 @@
SkAutoTUnref<GrTexture> texture;
// Skia's convention is to only clear a device if it is non-opaque.
unsigned flags = info.isOpaque() ? 0 : kNeedClear_Flag;
- // If we're using distance field text, enable in the new device
- flags |= (fFlags & kDFText_Flag) ? kDFText_Flag : 0;
#if CACHE_COMPATIBLE_DEVICE_TEXTURES
// layers are never draw in repeat modes, so we can request an approx
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 6bba974..6a68eeb 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -34,7 +34,7 @@
public:
enum Flags {
kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
- kDFText_Flag = 1 << 1, //!< Surface should render text using signed distance fields
+ kDFFonts_Flag = 1 << 1, //!< Surface should render fonts using signed distance fields
};
/**
@@ -136,8 +136,8 @@
GrTextContext* fTextContext;
// state for our render-target
- GrRenderTarget* fRenderTarget;
- uint32_t fFlags;
+ GrRenderTarget* fRenderTarget;
+ bool fNeedClear;
// remove when our clients don't rely on accessBitmap()
SkBitmap fLegacyBitmap;
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 1555c9a..3e1eb94 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -39,7 +39,7 @@
bool doClear)
: INHERITED(renderTarget->width(), renderTarget->height(), props) {
int deviceFlags = 0;
- deviceFlags |= this->props().isUseDistanceFieldFonts() ? SkGpuDevice::kDFText_Flag : 0;
+ deviceFlags |= this->props().isUseDistanceFieldFonts() ? SkGpuDevice::kDFFonts_Flag : 0;
fDevice = SkGpuDevice::Create(renderTarget, this->props(), deviceFlags);
if (kRGB_565_GrPixelConfig != renderTarget->config() && doClear) {
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 1c31e68..e4a6998 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -161,10 +161,8 @@
return NULL;
}
- uint32_t flags = fUseDFText ? SkGpuDevice::kDFText_Flag : 0;
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(target,
- SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType),
- flags));
+ SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)));
canvas = SkNEW_ARGS(SkCanvas, (device.get()));
break;
}
diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h
index c8462d9..e82eb7f 100644
--- a/tools/PictureRenderer.h
+++ b/tools/PictureRenderer.h
@@ -220,10 +220,6 @@
void setSampleCount(int sampleCount) {
fSampleCount = sampleCount;
}
-
- void setUseDFText(bool useDFText) {
- fUseDFText = useDFText;
- }
#endif
void setDrawFilters(DrawFilterFlags const * const filters, const SkString& configName) {
@@ -278,8 +274,6 @@
case kGPU_DeviceType:
if (fSampleCount) {
config.appendf("_msaa%d", fSampleCount);
- } else if (fUseDFText) {
- config.append("_gpudft");
} else {
config.append("_gpu");
}
@@ -331,8 +325,6 @@
tmp = "msaa";
tmp.appendS32(fSampleCount);
result["config"] = tmp.c_str();
- } else if (fUseDFText) {
- result["config"] = "gpudft";
} else {
result["config"] = "gpu";
}
@@ -436,7 +428,6 @@
, fGrContextFactory(opts)
, fGrContext(NULL)
, fSampleCount(0)
- , fUseDFText(false)
#endif
{
fGridInfo.fMargin.setEmpty();
@@ -504,7 +495,6 @@
GrContextFactory fGrContextFactory;
GrContext* fGrContext;
int fSampleCount;
- bool fUseDFText;
#endif
virtual SkString getConfigNameInternal() = 0;
diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp
index ac72cad..d78229a 100644
--- a/tools/PictureRenderingFlags.cpp
+++ b/tools/PictureRenderingFlags.cpp
@@ -28,7 +28,7 @@
#if SK_SUPPORT_GPU
static const char kGpuAPINameGL[] = "gl";
static const char kGpuAPINameGLES[] = "gles";
-#define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16|gpudft"
+#define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16"
#else
#define GPU_CONFIG_STRING ""
#endif
@@ -286,7 +286,6 @@
}
int sampleCount = 0;
- bool useDFText = false;
#endif
if (FLAGS_config.count() > 0) {
if (0 == strcmp(FLAGS_config[0], "8888")) {
@@ -312,10 +311,6 @@
deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType;
sampleCount = 16;
}
- else if (0 == strcmp(FLAGS_config[0], "gpudft")) {
- deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
- useDFText = true;
- }
#if SK_ANGLE
else if (0 == strcmp(FLAGS_config[0], "angle")) {
deviceType = sk_tools::PictureRenderer::kAngle_DeviceType;
@@ -341,7 +336,6 @@
}
#if SK_SUPPORT_GPU
renderer->setSampleCount(sampleCount);
- renderer->setUseDFText(useDFText);
#endif
}
diff --git a/tools/flags/SkCommonFlags.cpp b/tools/flags/SkCommonFlags.cpp
index c7fc17f..4d329c5 100644
--- a/tools/flags/SkCommonFlags.cpp
+++ b/tools/flags/SkCommonFlags.cpp
@@ -9,7 +9,7 @@
DEFINE_string(config, "565 8888 pdf gpu nonrendering angle nvprmsaa4",
"Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvprmsaa16 "
- "gpudft gpunull gpudebug angle mesa");
+ "gpunull gpudebug angle mesa");
DEFINE_bool(cpu, true, "master switch for running CPU-bound work.");