Index: src/gpu/gl/GrGLNameAllocator.h |
diff --git a/src/gpu/gl/GrGLNameAllocator.h b/src/gpu/gl/GrGLNameAllocator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bb71d4583c21a23ec103a05ffa452adfe5cebe92 |
--- /dev/null |
+++ b/src/gpu/gl/GrGLNameAllocator.h |
@@ -0,0 +1,42 @@ |
+ |
+/* |
+ * Copyright 2014 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef GrGLNameAllocator_DEFINED |
+#define GrGLNameAllocator_DEFINED |
+ |
+#include "SkRefCnt.h" |
+#include "gl/GrGLFunctions.h" |
bsalomon
2014/05/30 18:09:11
Is this for the GrGL data types?
Chris Dalton
2014/05/30 21:39:41
Yeah - GrGLuint. Would you prefer to use a more ge
bsalomon
2014/06/02 15:14:43
I was mostly just curious. But maybe we could sepa
|
+ |
+/** |
+ * This class takes ownership of a range of OpenGL object names and manages |
+ * allocations within that range. This allows the app to generate new objects |
+ * on the client side without having to make round trips to the GL server. |
+ */ |
+ |
+class GrGLNameAllocator { |
+ class SparseNameRange; |
bsalomon
2014/05/30 18:09:11
Can you move these down to the explicit private se
|
+ class SparseNameTree; |
+ class ContiguousNameRange; |
+ |
+public: |
+ GrGLNameAllocator(GrGLuint names, GrGLuint range); |
+ ~GrGLNameAllocator(); |
+ |
+ GrGLuint names() const { return fNames; } |
bsalomon
2014/05/30 18:09:11
some docs here would useful
|
+ GrGLuint range() const { return fRange; } |
+ |
+ GrGLuint allocateName(); |
+ void freeName(GrGLuint name); |
+ |
+private: |
+ const GrGLuint fNames; |
+ const GrGLuint fRange; |
+ SkAutoTUnref<SparseNameRange> fAllocatedNames; |
+}; |
+ |
+#endif |