OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resource_provider.h" | 5 #include "cc/resource_provider.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 const int8* name = reinterpret_cast<const int8*>(mailbox.data()); | 250 const int8* name = reinterpret_cast<const int8*>(mailbox.data()); |
251 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); | 251 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); |
252 DCHECK(context3d); | 252 DCHECK(context3d); |
253 unsigned textureId = context3d->createTexture(); | 253 unsigned textureId = context3d->createTexture(); |
254 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId)); | 254 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId)); |
255 GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D, name)); | 255 GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D, name)); |
256 | 256 |
257 ResourceId id = m_nextId++; | 257 ResourceId id = m_nextId++; |
258 Resource resource(textureId, gfx::Size(), 0, GL_LINEAR); | 258 Resource resource(textureId, gfx::Size(), 0, GL_LINEAR); |
259 resource.external = true; | 259 resource.external = true; |
| 260 resource.allocated = true; |
260 resource.mailbox.setName(name); | 261 resource.mailbox.setName(name); |
261 resource.mailboxReleaseCallback = releaseCallback; | 262 resource.mailboxReleaseCallback = releaseCallback; |
262 m_resources[id] = resource; | 263 m_resources[id] = resource; |
263 return id; | 264 return id; |
264 } | 265 } |
265 | 266 |
266 void ResourceProvider::deleteResource(ResourceId id) | 267 void ResourceProvider::deleteResource(ResourceId id) |
267 { | 268 { |
268 DCHECK(m_threadChecker.CalledOnValidThread()); | 269 DCHECK(m_threadChecker.CalledOnValidThread()); |
269 ResourceMap::iterator it = m_resources.find(id); | 270 ResourceMap::iterator it = m_resources.find(id); |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->glId)); | 1043 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->glId)); |
1043 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { | 1044 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { |
1044 GLenum storageFormat = textureToStorageFormat(format); | 1045 GLenum storageFormat = textureToStorageFormat(format); |
1045 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageForma
t, size.width(), size.height())); | 1046 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageForma
t, size.width(), size.height())); |
1046 } else | 1047 } else |
1047 GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.widt
h(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0)); | 1048 GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.widt
h(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0)); |
1048 } | 1049 } |
1049 | 1050 |
1050 | 1051 |
1051 } // namespace cc | 1052 } // namespace cc |
OLD | NEW |