diff options
author | 2014-02-21 18:45:30 +0000 | |
---|---|---|
committer | 2014-02-21 18:45:30 +0000 | |
commit | a3baf3be0e2a3128fb73bd41d40d130f75a4dc86 (patch) | |
tree | 935d08c9f4098a57a4bde7bbffc2763fc863eae6 /src/gpu/gl | |
parent | 5301070de894dbfa4772cf01e111450102837803 (diff) |
Add hooks for GL_EXT_debug_marker in gpu
BUG=skia:
R=bsalomon@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/174123003
git-svn-id: http://skia.googlecode.com/svn/trunk@13538 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCreateNullInterface.cpp | 3 | ||||
-rw-r--r-- | src/gpu/gl/GrGLExtensions.cpp | 11 | ||||
-rw-r--r-- | src/gpu/gl/GrGLInterface.cpp | 30 | ||||
-rw-r--r-- | src/gpu/gl/GrGLNoOpInterface.cpp | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLNoOpInterface.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 19 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.h | 6 | ||||
-rw-r--r-- | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp | 12 | ||||
-rw-r--r-- | src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp | 6 |
15 files changed, 128 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index bdb19e2e3a..a60230a2fe 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -312,6 +312,8 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering"); SkASSERT(!fPathRenderingSupport || fFixedFunctionSupport); + fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); + fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; // Disable scratch texture reuse on Mali and Adreno devices diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index 105fb0b604..fa404ce090 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -335,12 +335,15 @@ const GrGLInterface* GrGLCreateNullInterface() { functions->fGetStringi = noOpGLGetStringi; functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; functions->fGetUniformLocation = noOpGLGetUniformLocation; + functions->fInsertEventMarker = noOpGLInsertEventMarker; functions->fLoadIdentity = noOpGLLoadIdentity; functions->fLoadMatrixf = noOpGLLoadMatrixf; functions->fLineWidth = noOpGLLineWidth; functions->fLinkProgram = noOpGLLinkProgram; functions->fMatrixMode = noOpGLMatrixMode; functions->fPixelStorei = nullGLPixelStorei; + functions->fPopGroupMarker = noOpGLPopGroupMarker; + functions->fPushGroupMarker = noOpGLPushGroupMarker; functions->fQueryCounter = noOpGLQueryCounter; functions->fReadBuffer = noOpGLReadBuffer; functions->fReadPixels = nullGLReadPixels; diff --git a/src/gpu/gl/GrGLExtensions.cpp b/src/gpu/gl/GrGLExtensions.cpp index 33273e5f65..6d1b04d2cc 100644 --- a/src/gpu/gl/GrGLExtensions.cpp +++ b/src/gpu/gl/GrGLExtensions.cpp @@ -120,6 +120,17 @@ bool GrGLExtensions::remove(const char ext[]) { } } +void GrGLExtensions::add(const char ext[]) { + int idx = find_string(*fStrings, ext); + if (idx < 0) { + // This is not the most effecient approach since we end up doing a full sort of the + // extensions after the add + fStrings->push_back().set(ext); + SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp; + SkTQSort(&fStrings->front(), &fStrings->back(), cmp); + } +} + void GrGLExtensions::print(const char* sep) const { if (NULL == sep) { sep = " "; diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index f7b0a53c20..5bee4084eb 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -18,6 +18,23 @@ void GrGLDefaultInterfaceCallback(const GrGLInterface*) {} } #endif +const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interface, + GrGLInsertEventMarkerProc insertEventMarkerFn, + GrGLPushGroupMarkerProc pushGroupMarkerFn, + GrGLPopGroupMarkerProc popGroupMarkerFn) { + GrGLInterface* newInterface = GrGLInterface::NewClone(interface); + + if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { + newInterface->fExtensions.add("GL_EXT_debug_marker"); + } + + newInterface->fInsertEventMarker = insertEventMarkerFn; + newInterface->fPushGroupMarker = pushGroupMarkerFn; + newInterface->fPopGroupMarker = popGroupMarkerFn; + + return newInterface; +} + const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { GrGLInterface* newInterface = GrGLInterface::NewClone(interface); @@ -157,6 +174,7 @@ GrGLInterface::GrGLInterface() , fGetStringi(&fFunctions.fGetStringi) , fGetTexLevelParameteriv(&fFunctions.fGetTexLevelParameteriv) , fGetUniformLocation(&fFunctions.fGetUniformLocation) + , fInsertEventMarker(&fFunctions.fInsertEventMarker) , fLineWidth(&fFunctions.fLineWidth) , fLinkProgram(&fFunctions.fLinkProgram) , fLoadIdentity(&fFunctions.fLoadIdentity) @@ -164,6 +182,8 @@ GrGLInterface::GrGLInterface() , fMapBuffer(&fFunctions.fMapBuffer) , fMatrixMode(&fFunctions.fMatrixMode) , fPixelStorei(&fFunctions.fPixelStorei) + , fPopGroupMarker(&fFunctions.fPopGroupMarker) + , fPushGroupMarker(&fFunctions.fPushGroupMarker) , fQueryCounter(&fFunctions.fQueryCounter) , fReadBuffer(&fFunctions.fReadBuffer) , fReadPixels(&fFunctions.fReadPixels) @@ -655,5 +675,15 @@ bool GrGLInterface::validate() const { } } } + +#if 0 + if (fExtensions.has("GL_EXT_debug_marker")) { + if (NULL == fFunctions.fInsertEventMarker || + NULL == fFunctions.fPushGroupMarker || + NULL == fFunctions.fPopGroupMarker) { + return false; + } + } +#endif return true; } diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp index 0641af85d7..a9a7d3f631 100644 --- a/src/gpu/gl/GrGLNoOpInterface.cpp +++ b/src/gpu/gl/GrGLNoOpInterface.cpp @@ -656,3 +656,10 @@ GrGLint GR_GL_FUNCTION_TYPE noOpGLGetUniformLocation(GrGLuint program, const cha static int gUniLocation = 0; return ++gUniLocation; } + +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLInsertEventMarker(GrGLsizei length, const char* marker) { +} +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPushGroupMarker(GrGLsizei length , const char* marker) { +} +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPopGroupMarker() { +} diff --git a/src/gpu/gl/GrGLNoOpInterface.h b/src/gpu/gl/GrGLNoOpInterface.h index 8fe9b44ea2..20c67a3128 100644 --- a/src/gpu/gl/GrGLNoOpInterface.h +++ b/src/gpu/gl/GrGLNoOpInterface.h @@ -375,4 +375,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetTexLevelParameteriv(GrGLenum target, GrGLint GR_GL_FUNCTION_TYPE noOpGLGetUniformLocation(GrGLuint program, const char* name); +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLInsertEventMarker(GrGLsizei length, const char* marker); +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPushGroupMarker(GrGLsizei length , const char* marker); +GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPopGroupMarker(); + #endif diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index ec9c8d6fab..5fb268863b 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -117,14 +117,12 @@ GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context) , fGLContext(ctx) { SkASSERT(ctx.isInitialized()); - fCaps.reset(SkRef(ctx.caps())); fHWBoundTextures.reset(this->glCaps().maxFragmentTextureUnits()); fHWTexGenSettings.reset(this->glCaps().maxFixedFunctionTextureCoords()); GrGLClearErr(fGLContext.interface()); - if (gPrintStartupSpew) { const GrGLubyte* vendor; const GrGLubyte* renderer; @@ -2663,6 +2661,23 @@ bool GrGpuGL::onCanCopySurface(GrSurface* dst, return INHERITED::onCanCopySurface(dst, src, srcRect, dstPoint); } +void GrGpuGL::onInstantGpuTraceEvent(const char* marker) { + if (this->caps()->gpuTracingSupport()) { + // GL_CALL(InsertEventMarker(0, marker)); + } +} + +void GrGpuGL::onPushGpuTraceEvent(const char* marker) { + if (this->caps()->gpuTracingSupport()) { + // GL_CALL(PushGroupMarker(0, marker)); + } +} + +void GrGpuGL::onPopGpuTraceEvent() { + if (this->caps()->gpuTracingSupport()) { + // GL_CALL(PopGroupMarker()); + } +} /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h index edd58c44bc..05802550af 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -162,6 +162,12 @@ private: bool insideClip) SK_OVERRIDE; virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; + // GrDrawTarget ovverides + virtual void onInstantGpuTraceEvent(const char* marker) SK_OVERRIDE; + virtual void onPushGpuTraceEvent(const char* marker) SK_OVERRIDE; + virtual void onPopGpuTraceEvent() SK_OVERRIDE; + + // binds texture unit in GL void setTextureUnit(int unitIdx); diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp index 1f91165304..4c8c37827a 100644 --- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp +++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp @@ -190,6 +190,12 @@ static GrGLInterface* create_es_interface(GrGLVersion version, functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES"); #endif + if (extensions.has("GL_EXT_debug_marker")) { + functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glInsertEventMarkerEXT"); + functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glPushGroupMarkerEXT"); + functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGropuMarkerEXT"); + } + return interface; } @@ -389,6 +395,12 @@ static GrGLInterface* create_desktop_interface(GrGLVersion version, functions->fPointAlongPath = (GrGLPointAlongPathProc) eglGetProcAddress("glPointAlongPathNV"); } + if (extensions.has("GL_EXT_debug_marker")) { + functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glInsertEventMarkerEXT"); + functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glPushGroupMarkerEXT"); + functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGropuMarkerEXT"); + } + return interface; } diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp index 1695c3c36f..95229df36d 100644 --- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp +++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp @@ -153,6 +153,12 @@ const GrGLInterface* GrGLCreateANGLEInterface() { functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES"); functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES"); + if (extensions.has("GL_EXT_debug_marker")) { + functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glInsertEventMarkerEXT"); + functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glPushGroupMarkerEXT"); + functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGropuMarkerEXT"); + } + interface->fExtensions.init(kGLES_GrGLStandard, interface->fFunctions.fGetString, interface->fFunctions.fGetStringi, diff --git a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp index d8b4e1f8cc..ee41df7715 100644 --- a/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp +++ b/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp @@ -144,6 +144,12 @@ const GrGLInterface* GrGLCreateNativeInterface() { functions->fGenVertexArrays = glGenVertexArraysOES; #endif +#if GL_EXT_debug_marker + functions->fInsertEventMarker = glInsertEventMarkerEXT; + functions->fPushGroupMarker = glPushGroupMarkerEXT; + functions->fPopGroupMarker = glPopGropuMarkerEXT; +#endif + interface->fStandard = kGLES_GrGLStandard; interface->fExtensions.init(kGLES_GrGLStandard, glGetString, NULL, glGetIntegerv); diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp index f57b80ebc7..f580997a89 100644 --- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp +++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp @@ -241,6 +241,12 @@ const GrGLInterface* GrGLCreateNativeInterface() { GET_PROC(BindFragDataLocationIndexed); } + if (extensions.has("GL_EXT_debug_marker")) { + GET_PROC_SUFFIX(InsertEventMarker, EXT); + GET_PROC_SUFFIX(PushGroupMarker, EXT); + GET_PROC_SUFFIX(PopGroupMarker, EXT); + } + interface->fExtensions.swap(&extensions); return interface; } diff --git a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp index 59314445b3..0ce6d2f295 100644 --- a/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp +++ b/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp @@ -221,6 +221,12 @@ const GrGLInterface* GrGLCreateMesaInterface() { } GR_GL_GET_PROC(BindFragDataLocationIndexed); + if (extensions.has("GL_EXT_debug_marker")) { + GR_GL_GET_PROC_SUFFIX(InsertEventMarker, EXT); + GR_GL_GET_PROC_SUFFIX(PopGroupMarker, EXT); + GR_GL_GET_PROC_SUFFIX(PushGroupMarker, EXT); + } + interface->fStandard = kGL_GrGLStandard; interface->fExtensions.swap(&extensions); diff --git a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp index 67d7ef5a5f..8ef5ca231e 100644 --- a/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp +++ b/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp @@ -275,6 +275,12 @@ const GrGLInterface* GrGLCreateNativeInterface() { GR_GL_GET_PROC_SUFFIX(PointAlongPath, NV); } + if (extensions.has("GL_EXT_debug_marker")) { + GR_GL_GET_PROC_SUFFIX(InsertEventMarker, EXT); + GR_GL_GET_PROC_SUFFIX(PushGroupMarker, EXT); + GR_GL_GET_PROC_SUFFIX(PopGroupMarker, EXT); + } + interface->fStandard = kGL_GrGLStandard; interface->fExtensions.swap(&extensions); diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp index e901b3602c..645a582037 100644 --- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp +++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp @@ -304,6 +304,12 @@ const GrGLInterface* GrGLCreateNativeInterface() { WGL_SET_PROC_SUFFIX(PointAlongPath, NV); } + if (extensions.has("GL_EXT_debug_marker")) { + WGL_SET_PROC_SUFFIX(InsertEventMarker, EXT); + WGL_SET_PROC_SUFFIX(PushGroupMarker, EXT); + WGL_SET_PROC_SUFFIX(PopGroupMarker, EXT); + } + interface->fStandard = kGL_GrGLStandard; interface->fExtensions.swap(&extensions); |