Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 304403003: Generate path names on the client side (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index ff53b9c14cdeb5e8e141899249399ed58bff55f7..b5b1686d79b516e7ad06d94168c448b3645e12b8 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -7,6 +7,7 @@
#include "GrGpuGL.h"
+#include "GrGLNameAllocator.h"
#include "GrGLStencilBuffer.h"
#include "GrGLPath.h"
#include "GrGLShaderBuilder.h"
@@ -2379,6 +2380,39 @@ void GrGpuGL::notifyTextureDelete(GrGLTexture* texture) {
}
}
+
+GrGLuint GrGpuGL::createGLPathObject() {
+ if (NULL == fPathNameAllocator.get()) {
+ static const int range = 65536;
+ GrGLuint firstName;
+ GL_CALL_RET(firstName, GenPaths(range));
+ fPathNameAllocator.reset(SkNEW_ARGS(GrGLNameAllocator, (firstName, firstName + range)));
+ }
+
+ GrGLuint name = fPathNameAllocator->allocateName();
+ if (0 == name) {
+ // Our reserved path names are all in use. Fall back on GenPaths.
+ GL_CALL_RET(name, GenPaths(1));
+ }
+
+ return name;
+}
+
+void GrGpuGL::deleteGLPathObject(GrGLuint name) {
+ if (NULL == fPathNameAllocator.get() ||
+ name < fPathNameAllocator->firstName() ||
+ name >= fPathNameAllocator->endName()) {
+ // If we aren't inside fPathNameAllocator's range then this name was
+ // generated by the GenPaths fallback (or else the name is unallocated).
+ GL_CALL(DeletePaths(name, 1));
+ return;
+ }
+
+ // Make the path empty to save memory, but don't free the name in the driver.
+ GL_CALL(PathCommands(name, 0, NULL, 0, GR_GL_FLOAT, NULL));
+ fPathNameAllocator->free(name);
+}
+
bool GrGpuGL::configToGLFormats(GrPixelConfig config,
bool getSizedInternalFormat,
GrGLenum* internalFormat,
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698