summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-24 14:38:13 +0000
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-24 14:38:13 +0000
commitaae2fdf10cf8f77c5671165c5bd6b63abbf1d68a (patch)
tree5ec1fd7384b1207fff175959aedf89be306fdc5c
parentb95beaaf90e86e89a1c4ee0cf32dd26b37ac45d4 (diff)
downloadsrc-aae2fdf10cf8f77c5671165c5bd6b63abbf1d68a.tar.gz
Turn NVPR on by default (but off in tools).
BUG=skia:2042 R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/144003006 git-svn-id: http://skia.googlecode.com/svn/trunk/src@13164 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gpu/gl/GrGLCaps.cpp3
-rw-r--r--gpu/gl/GrGLExtensions.cpp50
-rw-r--r--gpu/gl/GrGLInterface.cpp77
-rw-r--r--gpu/gl/angle/GrGLCreateANGLEInterface.cpp5
-rw-r--r--gpu/gl/win/SkNativeGLContext_win.cpp6
5 files changed, 123 insertions, 18 deletions
diff --git a/gpu/gl/GrGLCaps.cpp b/gpu/gl/GrGLCaps.cpp
index 153be6a4..bdb19e2e 100644
--- a/gpu/gl/GrGLCaps.cpp
+++ b/gpu/gl/GrGLCaps.cpp
@@ -309,8 +309,7 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
// attachment, hence this min:
fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize);
- fPathRenderingSupport = GR_GL_USE_NV_PATH_RENDERING &&
- ctxInfo.hasExtension("GL_NV_path_rendering");
+ fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering");
SkASSERT(!fPathRenderingSupport || fFixedFunctionSupport);
fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType;
diff --git a/gpu/gl/GrGLExtensions.cpp b/gpu/gl/GrGLExtensions.cpp
index 4e75d3e0..33273e5f 100644
--- a/gpu/gl/GrGLExtensions.cpp
+++ b/gpu/gl/GrGLExtensions.cpp
@@ -12,12 +12,35 @@
#include "SkTSearch.h"
#include "SkTSort.h"
-namespace {
+namespace { // This cannot be static because it is used as a template parameter.
inline bool extension_compare(const SkString& a, const SkString& b) {
return strcmp(a.c_str(), b.c_str()) < 0;
}
}
+// finds the index of ext in strings or a negative result if ext is not found.
+static int find_string(const SkTArray<SkString>& strings, const char ext[]) {
+ if (strings.empty()) {
+ return -1;
+ }
+ SkString extensionStr(ext);
+ int idx = SkTSearch<SkString, extension_compare>(&strings.front(),
+ strings.count(),
+ extensionStr,
+ sizeof(SkString));
+ return idx;
+}
+
+GrGLExtensions::GrGLExtensions(const GrGLExtensions& that) : fStrings(SkNEW(SkTArray<SkString>)) {
+ *this = that;
+}
+
+GrGLExtensions& GrGLExtensions::operator=(const GrGLExtensions& that) {
+ *fStrings = *that.fStrings;
+ fInitialized = that.fInitialized;
+ return *this;
+}
+
bool GrGLExtensions::init(GrGLStandard standard,
GrGLGetStringProc getString,
GrGLGetStringiProc getStringi,
@@ -76,16 +99,25 @@ bool GrGLExtensions::init(GrGLStandard standard,
return true;
}
-bool GrGLExtensions::has(const char* ext) const {
- if (fStrings->empty()) {
+bool GrGLExtensions::has(const char ext[]) const {
+ SkASSERT(fInitialized);
+ return find_string(*fStrings, ext) >= 0;
+}
+
+bool GrGLExtensions::remove(const char ext[]) {
+ SkASSERT(fInitialized);
+ int idx = find_string(*fStrings, ext);
+ if (idx >= 0) {
+ // This is not terribly effecient but we really only expect this function to be called at
+ // most a handful of times when our test programs start.
+ SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.detach());
+ fStrings.reset(SkNEW(SkTArray<SkString>(oldStrings->count() - 1)));
+ fStrings->push_back_n(idx, &oldStrings->front());
+ fStrings->push_back_n(oldStrings->count() - idx - 1, &(*oldStrings)[idx] + 1);
+ return true;
+ } else {
return false;
}
- SkString extensionStr(ext);
- int idx = SkTSearch<SkString, extension_compare>(&fStrings->front(),
- fStrings->count(),
- extensionStr,
- sizeof(SkString));
- return idx >= 0;
}
void GrGLExtensions::print(const char* sep) const {
diff --git a/gpu/gl/GrGLInterface.cpp b/gpu/gl/GrGLInterface.cpp
index 0a0ff594..f7b0a53c 100644
--- a/gpu/gl/GrGLInterface.cpp
+++ b/gpu/gl/GrGLInterface.cpp
@@ -18,6 +18,64 @@ void GrGLDefaultInterfaceCallback(const GrGLInterface*) {}
}
#endif
+const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) {
+ GrGLInterface* newInterface = GrGLInterface::NewClone(interface);
+
+ newInterface->fExtensions.remove("GL_NV_path_rendering");
+
+ newInterface->fPathCommands = NULL;
+ newInterface->fPathCoords = NULL;
+ newInterface->fPathSubCommands = NULL;
+ newInterface->fPathSubCoords = NULL;
+ newInterface->fPathString = NULL;
+ newInterface->fPathGlyphs = NULL;
+ newInterface->fPathGlyphRange = NULL;
+ newInterface->fWeightPaths = NULL;
+ newInterface->fCopyPath = NULL;
+ newInterface->fInterpolatePaths = NULL;
+ newInterface->fTransformPath = NULL;
+ newInterface->fPathParameteriv = NULL;
+ newInterface->fPathParameteri = NULL;
+ newInterface->fPathParameterfv = NULL;
+ newInterface->fPathParameterf = NULL;
+ newInterface->fPathDashArray = NULL;
+ newInterface->fGenPaths = NULL;
+ newInterface->fDeletePaths = NULL;
+ newInterface->fIsPath = NULL;
+ newInterface->fPathStencilFunc = NULL;
+ newInterface->fPathStencilDepthOffset = NULL;
+ newInterface->fStencilFillPath = NULL;
+ newInterface->fStencilStrokePath = NULL;
+ newInterface->fStencilFillPathInstanced = NULL;
+ newInterface->fStencilStrokePathInstanced = NULL;
+ newInterface->fPathCoverDepthFunc = NULL;
+ newInterface->fPathColorGen = NULL;
+ newInterface->fPathTexGen = NULL;
+ newInterface->fPathFogGen = NULL;
+ newInterface->fCoverFillPath = NULL;
+ newInterface->fCoverStrokePath = NULL;
+ newInterface->fCoverFillPathInstanced = NULL;
+ newInterface->fCoverStrokePathInstanced = NULL;
+ newInterface->fGetPathParameteriv = NULL;
+ newInterface->fGetPathParameterfv = NULL;
+ newInterface->fGetPathCommands = NULL;
+ newInterface->fGetPathCoords = NULL;
+ newInterface->fGetPathDashArray = NULL;
+ newInterface->fGetPathMetrics = NULL;
+ newInterface->fGetPathMetricRange = NULL;
+ newInterface->fGetPathSpacing = NULL;
+ newInterface->fGetPathColorGeniv = NULL;
+ newInterface->fGetPathColorGenfv = NULL;
+ newInterface->fGetPathTexGeniv = NULL;
+ newInterface->fGetPathTexGenfv = NULL;
+ newInterface->fIsPointInFillPath = NULL;
+ newInterface->fIsPointInStrokePath = NULL;
+ newInterface->fGetPathLength = NULL;
+ newInterface->fPointAlongPath = NULL;
+
+ return newInterface;
+}
+
GrGLInterface::GrGLInterface()
// TODO: Remove this madness ASAP.
: fActiveTexture(&fFunctions.fActiveTexture)
@@ -205,8 +263,7 @@ GrGLInterface::GrGLInterface()
, fIsPointInFillPath(&fFunctions.fIsPointInFillPath)
, fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath)
, fGetPathLength(&fFunctions.fGetPathLength)
- , fPointAlongPath(&fFunctions.fPointAlongPath)
-{
+ , fPointAlongPath(&fFunctions.fPointAlongPath) {
fStandard = kNone_GrGLStandard;
#if GR_GL_PER_GL_FUNC_CALLBACK
@@ -215,6 +272,20 @@ GrGLInterface::GrGLInterface()
#endif
}
+GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) {
+ SkASSERT(NULL != interface);
+
+ GrGLInterface* clone = SkNEW(GrGLInterface);
+ clone->fStandard = interface->fStandard;
+ clone->fExtensions = interface->fExtensions;
+ clone->fFunctions = interface->fFunctions;
+#if GR_GL_PER_GL_FUNC_CALLBACK
+ clone->fCallback = interface->fCallback;
+ clone->fCallbackData = interface->fCallbackData;
+#endif
+ return clone;
+}
+
bool GrGLInterface::validate() const {
if (kNone_GrGLStandard == fStandard) {
@@ -405,7 +476,7 @@ bool GrGLInterface::validate() const {
return false;
}
}
- if (false && fExtensions.has("GL_NV_path_rendering")) {
+ if (fExtensions.has("GL_NV_path_rendering")) {
if (NULL == fFunctions.fPathCommands ||
NULL == fFunctions.fPathCoords ||
NULL == fFunctions.fPathSubCommands ||
diff --git a/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
index 2858541e..1695c3c3 100644
--- a/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
+++ b/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
@@ -152,5 +152,10 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES");
functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES");
+
+ interface->fExtensions.init(kGLES_GrGLStandard,
+ interface->fFunctions.fGetString,
+ interface->fFunctions.fGetStringi,
+ interface->fFunctions.fGetIntegerv);
return interface;
}
diff --git a/gpu/gl/win/SkNativeGLContext_win.cpp b/gpu/gl/win/SkNativeGLContext_win.cpp
index 17b4e4ad..bae97a78 100644
--- a/gpu/gl/win/SkNativeGLContext_win.cpp
+++ b/gpu/gl/win/SkNativeGLContext_win.cpp
@@ -86,10 +86,8 @@ const GrGLInterface* SkNativeGLContext::createGLContext() {
return NULL;
}
- // We don't want the core profile when using NV path rendering (since
- // NV path rendering relies on fixed function calls)
- if (!(fGlRenderContext = SkCreateWGLContext(fDeviceContext, 0,
- !GR_GL_USE_NV_PATH_RENDERING))) {
+ // Requesting a Core profile would bar us from using NVPR. So we pass false.
+ if (!(fGlRenderContext = SkCreateWGLContext(fDeviceContext, 0, false))) {
SkDebugf("Could not create rendering context.\n");
this->destroyGLContext();
return NULL;