aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_app
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-02-01 18:34:32 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-01 18:34:40 +0000
commitc1ce2f7966babaae0deb150f93f1227ee5af9285 (patch)
treeab4caf4bd03f6e642f618739e4283eb9ef62ebaf /tools/sk_app
parent130fb3f7aac19e40eddfc8fa85a9b39e7c99a7e8 (diff)
Revert "Redefine the meaning of sample counts in GPU backend."
This reverts commit 48825b11ad25c98b9a4884d5cc0edd4e290c4409. Reason for revert: nanobench Original change's description: > Redefine the meaning of sample counts in GPU backend. > > Old: 0 -> nonMSAA > 1+ -> MSAA > > New: > 0 -> error/unsupported > 1 -> nonMSAA > 2+ -> MSAA > > We still allow 0 to mean nonMSAA in three sets of public APIs for backwards compatibility: > > 1) SkSurface factories > 2) GrBackendRenderTarget constructors > 3) GrCaps::getSampleCnt()'s requestedCount parameter > > However, we immediately clamp to 1 and treat 0 as invalid/non-renderable internally. > > This also changes the behavior when using a large sample count. We now fail in that case rather than using the largest sample available sample count. GrCaps::getSampleCount() will return 0 in this case. > > > Bug: skia: > Change-Id: Ida22c6b22c1365e563c9046b611e88bf5eb3ff33 > Reviewed-on: https://skia-review.googlesource.com/101560 > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Brian Salomon <bsalomon@google.com> TBR=egdaniel@google.com,bsalomon@google.com Change-Id: Ic257619a8a5ee9ac15419ecf10259e42daed7f82 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/102662 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tools/sk_app')
-rw-r--r--tools/sk_app/DisplayParams.h5
-rw-r--r--tools/sk_app/GLWindowContext.cpp6
-rw-r--r--tools/sk_app/Window.cpp2
-rw-r--r--tools/sk_app/WindowContext.h10
-rw-r--r--tools/sk_app/android/GLWindowContext_android.cpp7
-rw-r--r--tools/sk_app/ios/GLWindowContext_ios.cpp1
-rw-r--r--tools/sk_app/ios/RasterWindowContext_ios.cpp1
-rw-r--r--tools/sk_app/ios/Window_ios.cpp2
-rw-r--r--tools/sk_app/ios/Window_ios.h6
-rw-r--r--tools/sk_app/mac/GLWindowContext_mac.cpp1
-rw-r--r--tools/sk_app/mac/RasterWindowContext_mac.cpp1
-rw-r--r--tools/sk_app/mac/Window_mac.cpp2
-rw-r--r--tools/sk_app/mac/Window_mac.h6
-rw-r--r--tools/sk_app/unix/GLWindowContext_unix.cpp1
-rw-r--r--tools/sk_app/unix/Window_unix.cpp2
-rw-r--r--tools/sk_app/unix/Window_unix.h15
-rw-r--r--tools/sk_app/win/ANGLEWindowContext_win.cpp5
-rw-r--r--tools/sk_app/win/GLWindowContext_win.cpp3
18 files changed, 39 insertions, 37 deletions
diff --git a/tools/sk_app/DisplayParams.h b/tools/sk_app/DisplayParams.h
index 203e8bdeca..959735e8ff 100644
--- a/tools/sk_app/DisplayParams.h
+++ b/tools/sk_app/DisplayParams.h
@@ -13,7 +13,10 @@
namespace sk_app {
struct DisplayParams {
- DisplayParams() : fColorType(kN32_SkColorType), fColorSpace(nullptr), fMSAASampleCount(1) {}
+ DisplayParams()
+ : fColorType(kN32_SkColorType)
+ , fColorSpace(nullptr)
+ , fMSAASampleCount(0) {}
SkColorType fColorType;
sk_sp<SkColorSpace> fColorSpace;
diff --git a/tools/sk_app/GLWindowContext.cpp b/tools/sk_app/GLWindowContext.cpp
index 9d042cf19e..9ef5141fee 100644
--- a/tools/sk_app/GLWindowContext.cpp
+++ b/tools/sk_app/GLWindowContext.cpp
@@ -24,7 +24,9 @@ GLWindowContext::GLWindowContext(const DisplayParams& params)
: WindowContext(params)
, fBackendContext(nullptr)
, fSurface(nullptr) {
- fDisplayParams.fMSAASampleCount = GrNextPow2(fDisplayParams.fMSAASampleCount);
+ fDisplayParams.fMSAASampleCount = fDisplayParams.fMSAASampleCount ?
+ GrNextPow2(fDisplayParams.fMSAASampleCount) :
+ 0;
}
void GLWindowContext::initializeContext() {
@@ -32,7 +34,7 @@ void GLWindowContext::initializeContext() {
fBackendContext = this->onInitializeContext();
fContext = GrContext::MakeGL(fBackendContext, fDisplayParams.fGrContextOptions);
- if (!fContext && fDisplayParams.fMSAASampleCount > 1) {
+ if (!fContext && fDisplayParams.fMSAASampleCount) {
fDisplayParams.fMSAASampleCount /= 2;
this->initializeContext();
return;
diff --git a/tools/sk_app/Window.cpp b/tools/sk_app/Window.cpp
index 1694beaac8..29e4864ba1 100644
--- a/tools/sk_app/Window.cpp
+++ b/tools/sk_app/Window.cpp
@@ -117,7 +117,7 @@ void Window::setRequestedDisplayParams(const DisplayParams& params, bool /* allo
int Window::sampleCount() const {
if (!fWindowContext) {
- return 0;
+ return -1;
}
return fWindowContext->sampleCount();
}
diff --git a/tools/sk_app/WindowContext.h b/tools/sk_app/WindowContext.h
index 71c21ac089..5e7d76d4ba 100644
--- a/tools/sk_app/WindowContext.h
+++ b/tools/sk_app/WindowContext.h
@@ -21,11 +21,11 @@ namespace sk_app {
class WindowContext {
public:
WindowContext(const DisplayParams& params)
- : fContext(nullptr)
- , fDisplayParams(params)
- , fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
- , fSampleCount(1)
- , fStencilBits(0) {}
+ : fContext(nullptr)
+ , fDisplayParams(params)
+ , fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
+ , fSampleCount(0)
+ , fStencilBits(0) {}
virtual ~WindowContext() {}
diff --git a/tools/sk_app/android/GLWindowContext_android.cpp b/tools/sk_app/android/GLWindowContext_android.cpp
index 5111114115..acdb587230 100644
--- a/tools/sk_app/android/GLWindowContext_android.cpp
+++ b/tools/sk_app/android/GLWindowContext_android.cpp
@@ -70,8 +70,6 @@ sk_sp<const GrGLInterface> GLWindowContext_android::onInitializeContext() {
SkAssertResult(eglBindAPI(EGL_OPENGL_ES_API));
EGLint numConfigs = 0;
- EGLint eglSampleCnt = fDisplayParams.fMSAASampleCount > 1 ? fDisplayParams.fMSAASampleCount > 1
- : 0;
const EGLint configAttribs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -80,8 +78,8 @@ sk_sp<const GrGLInterface> GLWindowContext_android::onInitializeContext() {
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_STENCIL_SIZE, 8,
- EGL_SAMPLE_BUFFERS, eglSampleCnt ? 1 : 0,
- EGL_SAMPLES, eglSampleCnt,
+ EGL_SAMPLE_BUFFERS, fDisplayParams.fMSAASampleCount ? 1 : 0,
+ EGL_SAMPLES, fDisplayParams.fMSAASampleCount,
EGL_NONE
};
@@ -133,7 +131,6 @@ sk_sp<const GrGLInterface> GLWindowContext_android::onInitializeContext() {
eglGetConfigAttrib(fDisplay, surfaceConfig, EGL_STENCIL_SIZE, &fStencilBits);
eglGetConfigAttrib(fDisplay, surfaceConfig, EGL_SAMPLES, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
return GrGLMakeNativeInterface();
}
diff --git a/tools/sk_app/ios/GLWindowContext_ios.cpp b/tools/sk_app/ios/GLWindowContext_ios.cpp
index 2a57b33e30..f4c0d6b3c0 100644
--- a/tools/sk_app/ios/GLWindowContext_ios.cpp
+++ b/tools/sk_app/ios/GLWindowContext_ios.cpp
@@ -67,7 +67,6 @@ sk_sp<const GrGLInterface> GLWindowContext_ios::onInitializeContext() {
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &fStencilBits);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
SDL_GL_GetDrawableSize(fWindow, &fWidth, &fHeight);
glViewport(0, 0, fWidth, fHeight);
diff --git a/tools/sk_app/ios/RasterWindowContext_ios.cpp b/tools/sk_app/ios/RasterWindowContext_ios.cpp
index 53d7c1a372..cae5774c28 100644
--- a/tools/sk_app/ios/RasterWindowContext_ios.cpp
+++ b/tools/sk_app/ios/RasterWindowContext_ios.cpp
@@ -79,7 +79,6 @@ sk_sp<const GrGLInterface> RasterWindowContext_ios::onInitializeContext() {
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &fStencilBits);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
SDL_GL_GetDrawableSize(fWindow, &fWidth, &fHeight);
glViewport(0, 0, fWidth, fHeight);
diff --git a/tools/sk_app/ios/Window_ios.cpp b/tools/sk_app/ios/Window_ios.cpp
index ac0ad0caa0..c1bdeae5fc 100644
--- a/tools/sk_app/ios/Window_ios.cpp
+++ b/tools/sk_app/ios/Window_ios.cpp
@@ -49,7 +49,7 @@ bool Window_ios::initWindow() {
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
- if (fRequestedDisplayParams.fMSAASampleCount > 1) {
+ if (fRequestedDisplayParams.fMSAASampleCount > 0) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fRequestedDisplayParams.fMSAASampleCount);
} else {
diff --git a/tools/sk_app/ios/Window_ios.h b/tools/sk_app/ios/Window_ios.h
index a0fed90697..667fa74e82 100644
--- a/tools/sk_app/ios/Window_ios.h
+++ b/tools/sk_app/ios/Window_ios.h
@@ -18,7 +18,11 @@ namespace sk_app {
class Window_ios : public Window {
public:
- Window_ios() : INHERITED(), fWindow(nullptr), fWindowID(0), fMSAASampleCount(1) {}
+ Window_ios()
+ : INHERITED()
+ , fWindow(nullptr)
+ , fWindowID(0)
+ , fMSAASampleCount(0) {}
~Window_ios() override { this->closeWindow(); }
bool initWindow();
diff --git a/tools/sk_app/mac/GLWindowContext_mac.cpp b/tools/sk_app/mac/GLWindowContext_mac.cpp
index 67fb853fee..005fc07df4 100644
--- a/tools/sk_app/mac/GLWindowContext_mac.cpp
+++ b/tools/sk_app/mac/GLWindowContext_mac.cpp
@@ -67,7 +67,6 @@ sk_sp<const GrGLInterface> GLWindowContext_mac::onInitializeContext() {
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &fStencilBits);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
SDL_GetWindowSize(fWindow, &fWidth, &fHeight);
glViewport(0, 0, fWidth, fHeight);
diff --git a/tools/sk_app/mac/RasterWindowContext_mac.cpp b/tools/sk_app/mac/RasterWindowContext_mac.cpp
index fbe9837911..67022af7fe 100644
--- a/tools/sk_app/mac/RasterWindowContext_mac.cpp
+++ b/tools/sk_app/mac/RasterWindowContext_mac.cpp
@@ -79,7 +79,6 @@ sk_sp<const GrGLInterface> RasterWindowContext_mac::onInitializeContext() {
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &fStencilBits);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
SDL_GetWindowSize(fWindow, &fWidth, &fHeight);
glViewport(0, 0, fWidth, fHeight);
diff --git a/tools/sk_app/mac/Window_mac.cpp b/tools/sk_app/mac/Window_mac.cpp
index f2620518a2..8de5b10450 100644
--- a/tools/sk_app/mac/Window_mac.cpp
+++ b/tools/sk_app/mac/Window_mac.cpp
@@ -49,7 +49,7 @@ bool Window_mac::initWindow() {
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
- if (fRequestedDisplayParams.fMSAASampleCount > 1) {
+ if (fRequestedDisplayParams.fMSAASampleCount > 0) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fRequestedDisplayParams.fMSAASampleCount);
} else {
diff --git a/tools/sk_app/mac/Window_mac.h b/tools/sk_app/mac/Window_mac.h
index 35cba095fa..aa5c8df696 100644
--- a/tools/sk_app/mac/Window_mac.h
+++ b/tools/sk_app/mac/Window_mac.h
@@ -18,7 +18,11 @@ namespace sk_app {
class Window_mac : public Window {
public:
- Window_mac() : INHERITED(), fWindow(nullptr), fWindowID(0), fMSAASampleCount(1) {}
+ Window_mac()
+ : INHERITED()
+ , fWindow(nullptr)
+ , fWindowID(0)
+ , fMSAASampleCount(0) {}
~Window_mac() override { this->closeWindow(); }
bool initWindow();
diff --git a/tools/sk_app/unix/GLWindowContext_unix.cpp b/tools/sk_app/unix/GLWindowContext_unix.cpp
index 3a3a4b16d4..25ec95cdd6 100644
--- a/tools/sk_app/unix/GLWindowContext_unix.cpp
+++ b/tools/sk_app/unix/GLWindowContext_unix.cpp
@@ -99,7 +99,6 @@ sk_sp<const GrGLInterface> GLWindowContext_xlib::onInitializeContext() {
glXGetConfig(fDisplay, fVisualInfo, GLX_STENCIL_SIZE, &fStencilBits);
glXGetConfig(fDisplay, fVisualInfo, GLX_SAMPLES_ARB, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
XWindow root;
int x, y;
diff --git a/tools/sk_app/unix/Window_unix.cpp b/tools/sk_app/unix/Window_unix.cpp
index 745b4dd3fb..f5ca5ee073 100644
--- a/tools/sk_app/unix/Window_unix.cpp
+++ b/tools/sk_app/unix/Window_unix.cpp
@@ -72,7 +72,7 @@ bool Window_unix::initWindow(Display* display) {
None
};
SkASSERT(nullptr == fVisualInfo);
- if (fRequestedDisplayParams.fMSAASampleCount > 1) {
+ if (fRequestedDisplayParams.fMSAASampleCount > 0) {
static const GLint kChooseFBConifgAttCnt = SK_ARRAY_COUNT(kChooseFBConfigAtt);
GLint msaaChooseFBConfigAtt[kChooseFBConifgAttCnt + 4];
memcpy(msaaChooseFBConfigAtt, kChooseFBConfigAtt, sizeof(kChooseFBConfigAtt));
diff --git a/tools/sk_app/unix/Window_unix.h b/tools/sk_app/unix/Window_unix.h
index 62a2795098..b59f502eb9 100644
--- a/tools/sk_app/unix/Window_unix.h
+++ b/tools/sk_app/unix/Window_unix.h
@@ -20,14 +20,13 @@ namespace sk_app {
class Window_unix : public Window {
public:
- Window_unix()
- : Window()
- , fDisplay(nullptr)
- , fWindow(0)
- , fGC(nullptr)
- , fFBConfig(nullptr)
- , fVisualInfo(nullptr)
- , fMSAASampleCount(1) {}
+ Window_unix() : Window()
+ , fDisplay(nullptr)
+ , fWindow(0)
+ , fGC(nullptr)
+ , fFBConfig(nullptr)
+ , fVisualInfo(nullptr)
+ , fMSAASampleCount(0) {}
~Window_unix() override { this->closeWindow(); }
bool initWindow(Display* display);
diff --git a/tools/sk_app/win/ANGLEWindowContext_win.cpp b/tools/sk_app/win/ANGLEWindowContext_win.cpp
index 452b462ba9..649528d6cd 100644
--- a/tools/sk_app/win/ANGLEWindowContext_win.cpp
+++ b/tools/sk_app/win/ANGLEWindowContext_win.cpp
@@ -76,8 +76,7 @@ sk_sp<const GrGLInterface> ANGLEGLWindowContext_win::onInitializeContext() {
}
EGLint numConfigs;
fSampleCount = this->getDisplayParams().fMSAASampleCount;
- const int sampleBuffers = fSampleCount > 1 ? 1 : 0;
- const int eglSampleCnt = fSampleCount > 1 ? fSampleCount : 0;
+ const int sampleBuffers = fSampleCount > 0 ? 1 : 0;
const EGLint configAttribs[] = {EGL_RENDERABLE_TYPE,
// We currently only support ES3.
EGL_OPENGL_ES3_BIT,
@@ -92,7 +91,7 @@ sk_sp<const GrGLInterface> ANGLEGLWindowContext_win::onInitializeContext() {
EGL_SAMPLE_BUFFERS,
sampleBuffers,
EGL_SAMPLES,
- eglSampleCnt,
+ fSampleCount,
EGL_NONE};
EGLConfig surfaceConfig;
diff --git a/tools/sk_app/win/GLWindowContext_win.cpp b/tools/sk_app/win/GLWindowContext_win.cpp
index 1c583cb1ed..7e43d2b544 100644
--- a/tools/sk_app/win/GLWindowContext_win.cpp
+++ b/tools/sk_app/win/GLWindowContext_win.cpp
@@ -96,9 +96,8 @@ sk_sp<const GrGLInterface> GLWindowContext_win::onInitializeContext() {
1,
&kSampleCountAttr,
&fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
} else {
- fSampleCount = 1;
+ fSampleCount = 0;
}
RECT rect;