aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-02 12:39:37 +0000
committerGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-02 12:39:37 +0000
commitf6a90332ae21414cf19630764d4371ffd24ac0cc (patch)
treed7fed3993fba5b3d7979d58ded3954f42cfe0253 /tools
parent4b32101a1562ef73829994a82d46f72f3f0791d0 (diff)
Add msaa configs to bench_pictures.
Enables msaa4 and msaa16 configs in bench_pictures and render_pictures (and anything else that may use PictureRenderer). Review URL: https://codereview.chromium.org/14544007/ git-svn-id: http://skia.googlecode.com/svn/trunk@8952 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureRenderer.cpp2
-rw-r--r--tools/PictureRenderer.h14
-rw-r--r--tools/PictureRenderingFlags.cpp26
3 files changed, 38 insertions, 4 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 274768b118..86b258d206 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -120,7 +120,7 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
desc.fFlags = kRenderTarget_GrTextureFlagBit;
desc.fWidth = width;
desc.fHeight = height;
- desc.fSampleCnt = 0;
+ desc.fSampleCnt = fSampleCount;
target.reset(fGrContext->createUncachedTexture(desc, NULL, 0));
}
if (NULL == target.get()) {
diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h
index 3fa7a3c3c4..e6da35806c 100644
--- a/tools/PictureRenderer.h
+++ b/tools/PictureRenderer.h
@@ -162,6 +162,12 @@ public:
#endif
}
+#if SK_SUPPORT_GPU
+ void setSampleCount(int sampleCount) {
+ fSampleCount = sampleCount;
+ }
+#endif
+
void setDrawFilters(DrawFilterFlags const * const filters, const SkString& configName) {
memcpy(fDrawFilters, filters, sizeof(fDrawFilters));
fDrawFiltersConfig = configName;
@@ -201,7 +207,11 @@ public:
#if SK_SUPPORT_GPU
switch (fDeviceType) {
case kGPU_DeviceType:
- config.append("_gpu");
+ if (fSampleCount) {
+ config.appendf("_msaa%d", fSampleCount);
+ } else {
+ config.append("_gpu");
+ }
break;
#if SK_ANGLE
case kAngle_DeviceType:
@@ -261,6 +271,7 @@ public:
, fScaleFactor(SK_Scalar1)
#if SK_SUPPORT_GPU
, fGrContext(NULL)
+ , fSampleCount(0)
#endif
{
fGridInfo.fMargin.setEmpty();
@@ -315,6 +326,7 @@ private:
#if SK_SUPPORT_GPU
GrContextFactory fGrContextFactory;
GrContext* fGrContext;
+ int fSampleCount;
#endif
virtual SkString getConfigNameInternal() = 0;
diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp
index ca984efa06..4255773146 100644
--- a/tools/PictureRenderingFlags.cpp
+++ b/tools/PictureRenderingFlags.cpp
@@ -31,9 +31,9 @@ DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc
// consistent.
#if SK_ANGLE
// ANGLE assumes GPU
-DEFINE_string(config, "8888", "[8888|gpu|angle]: Use the corresponding config.");
+DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16|angle]: Use the corresponding config.");
#elif SK_SUPPORT_GPU
-DEFINE_string(config, "8888", "[8888|gpu]: Use the corresponding config.");
+DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16]: Use the corresponding config.");
#else
DEFINE_string(config, "8888", "[8888]: Use the corresponding config.");
#endif
@@ -252,6 +252,9 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
sk_tools::PictureRenderer::SkDeviceTypes deviceType =
sk_tools::PictureRenderer::kBitmap_DeviceType;
+#if SK_SUPPORT_GPU
+ int sampleCount = 0;
+#endif
if (FLAGS_config.count() > 0) {
if (0 == strcmp(FLAGS_config[0], "8888")) {
deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType;
@@ -264,6 +267,22 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
return NULL;
}
}
+ else if (0 == strcmp(FLAGS_config[0], "msaa4")) {
+ deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
+ if (FLAGS_multi > 1) {
+ error.printf("GPU not compatible with multithreaded tiling.\n");
+ return NULL;
+ }
+ sampleCount = 4;
+ }
+ else if (0 == strcmp(FLAGS_config[0], "msaa16")) {
+ deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
+ if (FLAGS_multi > 1) {
+ error.printf("GPU not compatible with multithreaded tiling.\n");
+ return NULL;
+ }
+ sampleCount = 16;
+ }
#if SK_ANGLE
else if (0 == strcmp(FLAGS_config[0], "angle")) {
deviceType = sk_tools::PictureRenderer::kAngle_DeviceType;
@@ -279,6 +298,9 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
return NULL;
}
renderer->setDeviceType(deviceType);
+#if SK_SUPPORT_GPU
+ renderer->setSampleCount(sampleCount);
+#endif
}