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

Side by Side Diff: src/gpu/gl/GrGLBufferImpl.cpp

Issue 27487003: Third wave of Win64 warning cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Got compiling on linux Created 7 years, 2 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 | « include/core/SkTDArray.h ('k') | src/gpu/gl/GrGLShaderBuilder.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 2013 Google Inc. 2 * Copyright 2013 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 #include "GrGLBufferImpl.h" 8 #include "GrGLBufferImpl.h"
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 void* GrGLBufferImpl::lock(GrGpuGL* gpu) { 72 void* GrGLBufferImpl::lock(GrGpuGL* gpu) {
73 VALIDATE(); 73 VALIDATE();
74 SkASSERT(!this->isLocked()); 74 SkASSERT(!this->isLocked());
75 if (0 == fDesc.fID) { 75 if (0 == fDesc.fID) {
76 fLockPtr = fCPUData; 76 fLockPtr = fCPUData;
77 } else if (gpu->caps()->bufferLockSupport()) { 77 } else if (gpu->caps()->bufferLockSupport()) {
78 this->bind(gpu); 78 this->bind(gpu);
79 // Let driver know it can discard the old data 79 // Let driver know it can discard the old data
80 GL_CALL(gpu, BufferData(fBufferType, 80 GL_CALL(gpu, BufferData(fBufferType,
81 fDesc.fSizeInBytes, 81 (GrGLsizeiptr) fDesc.fSizeInBytes,
82 NULL, 82 NULL,
83 fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STA TIC_DRAW)); 83 fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STA TIC_DRAW));
84 GR_GL_CALL_RET(gpu->glInterface(), 84 GR_GL_CALL_RET(gpu->glInterface(),
85 fLockPtr, 85 fLockPtr,
86 MapBuffer(fBufferType, GR_GL_WRITE_ONLY)); 86 MapBuffer(fBufferType, GR_GL_WRITE_ONLY));
87 } 87 }
88 return fLockPtr; 88 return fLockPtr;
89 } 89 }
90 90
91 void GrGLBufferImpl::unlock(GrGpuGL* gpu) { 91 void GrGLBufferImpl::unlock(GrGpuGL* gpu) {
(...skipping 20 matching lines...) Expand all
112 } 112 }
113 if (0 == fDesc.fID) { 113 if (0 == fDesc.fID) {
114 memcpy(fCPUData, src, srcSizeInBytes); 114 memcpy(fCPUData, src, srcSizeInBytes);
115 return true; 115 return true;
116 } 116 }
117 this->bind(gpu); 117 this->bind(gpu);
118 GrGLenum usage = fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW; 118 GrGLenum usage = fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW;
119 119
120 #if GR_GL_USE_BUFFER_DATA_NULL_HINT 120 #if GR_GL_USE_BUFFER_DATA_NULL_HINT
121 if (fDesc.fSizeInBytes == srcSizeInBytes) { 121 if (fDesc.fSizeInBytes == srcSizeInBytes) {
122 GL_CALL(gpu, BufferData(fBufferType, srcSizeInBytes, src, usage)); 122 GL_CALL(gpu, BufferData(fBufferType, (GrGLsizeiptr) srcSizeInBytes, src, usage));
123 } else { 123 } else {
124 // Before we call glBufferSubData we give the driver a hint using 124 // Before we call glBufferSubData we give the driver a hint using
125 // glBufferData with NULL. This makes the old buffer contents 125 // glBufferData with NULL. This makes the old buffer contents
126 // inaccessible to future draws. The GPU may still be processing 126 // inaccessible to future draws. The GPU may still be processing
127 // draws that reference the old contents. With this hint it can 127 // draws that reference the old contents. With this hint it can
128 // assign a different allocation for the new contents to avoid 128 // assign a different allocation for the new contents to avoid
129 // flushing the gpu past draws consuming the old contents. 129 // flushing the gpu past draws consuming the old contents.
130 GL_CALL(gpu, BufferData(fBufferType, fDesc.fSizeInBytes, NULL, usage)); 130 GL_CALL(gpu, BufferData(fBufferType, (GrGLsizeiptr) fDesc.fSizeInBytes, NULL, usage));
131 GL_CALL(gpu, BufferSubData(fBufferType, 0, srcSizeInBytes, src)); 131 GL_CALL(gpu, BufferSubData(fBufferType, 0, (GrGLsizeiptr) srcSizeInBytes , src));
132 } 132 }
133 #else 133 #else
134 // Note that we're cheating on the size here. Currently no methods 134 // Note that we're cheating on the size here. Currently no methods
135 // allow a partial update that preserves contents of non-updated 135 // allow a partial update that preserves contents of non-updated
136 // portions of the buffer (lock() does a glBufferData(..size, NULL..)) 136 // portions of the buffer (lock() does a glBufferData(..size, NULL..))
137 bool doSubData = false; 137 bool doSubData = false;
138 #if GR_GL_MAC_BUFFER_OBJECT_PERFOMANCE_WORKAROUND 138 #if GR_GL_MAC_BUFFER_OBJECT_PERFOMANCE_WORKAROUND
139 static int N = 0; 139 static int N = 0;
140 // 128 was chosen experimentally. At 256 a slight hitchiness was noticed 140 // 128 was chosen experimentally. At 256 a slight hitchiness was noticed
141 // when dragging a Chromium window around with a canvas tab backgrounded. 141 // when dragging a Chromium window around with a canvas tab backgrounded.
(...skipping 14 matching lines...) Expand all
156 return true; 156 return true;
157 } 157 }
158 158
159 void GrGLBufferImpl::validate() const { 159 void GrGLBufferImpl::validate() const {
160 SkASSERT(GR_GL_ARRAY_BUFFER == fBufferType || GR_GL_ELEMENT_ARRAY_BUFFER == fBufferType); 160 SkASSERT(GR_GL_ARRAY_BUFFER == fBufferType || GR_GL_ELEMENT_ARRAY_BUFFER == fBufferType);
161 // The following assert isn't valid when the buffer has been abandoned: 161 // The following assert isn't valid when the buffer has been abandoned:
162 // SkASSERT((0 == fDesc.fID) == (NULL != fCPUData)); 162 // SkASSERT((0 == fDesc.fID) == (NULL != fCPUData));
163 SkASSERT(0 != fDesc.fID || !fDesc.fIsWrapped); 163 SkASSERT(0 != fDesc.fID || !fDesc.fIsWrapped);
164 SkASSERT(NULL == fCPUData || NULL == fLockPtr || fCPUData == fLockPtr); 164 SkASSERT(NULL == fCPUData || NULL == fLockPtr || fCPUData == fLockPtr);
165 } 165 }
OLDNEW
« no previous file with comments | « include/core/SkTDArray.h ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698