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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLNameAllocator.h"
10 #include "GrGLStencilBuffer.h" 11 #include "GrGLStencilBuffer.h"
11 #include "GrGLPath.h" 12 #include "GrGLPath.h"
12 #include "GrGLShaderBuilder.h" 13 #include "GrGLShaderBuilder.h"
13 #include "GrTemplates.h" 14 #include "GrTemplates.h"
14 #include "GrTypes.h" 15 #include "GrTypes.h"
15 #include "SkStrokeRec.h" 16 #include "SkStrokeRec.h"
16 #include "SkTemplates.h" 17 #include "SkTemplates.h"
17 18
18 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) 19 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
19 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) 20 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X)
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 2373
2373 void GrGpuGL::notifyTextureDelete(GrGLTexture* texture) { 2374 void GrGpuGL::notifyTextureDelete(GrGLTexture* texture) {
2374 for (int s = 0; s < fHWBoundTextures.count(); ++s) { 2375 for (int s = 0; s < fHWBoundTextures.count(); ++s) {
2375 if (fHWBoundTextures[s] == texture) { 2376 if (fHWBoundTextures[s] == texture) {
2376 // deleting bound texture does implied bind to 0 2377 // deleting bound texture does implied bind to 0
2377 fHWBoundTextures[s] = NULL; 2378 fHWBoundTextures[s] = NULL;
2378 } 2379 }
2379 } 2380 }
2380 } 2381 }
2381 2382
2383
2384 GrGLuint GrGpuGL::createGLPathObject() {
2385 if (NULL == fPathNameAllocator.get()) {
2386 static const int range = 65536;
2387 GrGLuint firstName;
2388 GL_CALL_RET(firstName, GenPaths(range));
2389 fPathNameAllocator.reset(SkNEW_ARGS(GrGLNameAllocator, (firstName, first Name + range)));
2390 }
2391
2392 GrGLuint name = fPathNameAllocator->allocateName();
2393 if (0 == name) {
2394 // Our reserved path names are all in use. Fall back on GenPaths.
2395 GL_CALL_RET(name, GenPaths(1));
2396 }
2397
2398 return name;
2399 }
2400
2401 void GrGpuGL::deleteGLPathObject(GrGLuint name) {
2402 if (NULL == fPathNameAllocator.get() ||
2403 name < fPathNameAllocator->firstName() ||
2404 name >= fPathNameAllocator->endName()) {
2405 // If we aren't inside fPathNameAllocator's range then this name was
2406 // generated by the GenPaths fallback (or else the name is unallocated).
2407 GL_CALL(DeletePaths(name, 1));
2408 return;
2409 }
2410
2411 // Make the path empty to save memory, but don't free the name in the driver .
2412 GL_CALL(PathCommands(name, 0, NULL, 0, GR_GL_FLOAT, NULL));
2413 fPathNameAllocator->free(name);
2414 }
2415
2382 bool GrGpuGL::configToGLFormats(GrPixelConfig config, 2416 bool GrGpuGL::configToGLFormats(GrPixelConfig config,
2383 bool getSizedInternalFormat, 2417 bool getSizedInternalFormat,
2384 GrGLenum* internalFormat, 2418 GrGLenum* internalFormat,
2385 GrGLenum* externalFormat, 2419 GrGLenum* externalFormat,
2386 GrGLenum* externalType) { 2420 GrGLenum* externalType) {
2387 GrGLenum dontCare; 2421 GrGLenum dontCare;
2388 if (NULL == internalFormat) { 2422 if (NULL == internalFormat) {
2389 internalFormat = &dontCare; 2423 internalFormat = &dontCare;
2390 } 2424 }
2391 if (NULL == externalFormat) { 2425 if (NULL == externalFormat) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 this->setVertexArrayID(gpu, 0); 2837 this->setVertexArrayID(gpu, 0);
2804 } 2838 }
2805 int attrCount = gpu->glCaps().maxVertexAttributes(); 2839 int attrCount = gpu->glCaps().maxVertexAttributes();
2806 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2840 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2807 fDefaultVertexArrayAttribState.resize(attrCount); 2841 fDefaultVertexArrayAttribState.resize(attrCount);
2808 } 2842 }
2809 attribState = &fDefaultVertexArrayAttribState; 2843 attribState = &fDefaultVertexArrayAttribState;
2810 } 2844 }
2811 return attribState; 2845 return attribState;
2812 } 2846 }
OLDNEW
« 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