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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 DCHECK(m_threadChecker.CalledOnValidThread()); | 170 DCHECK(m_threadChecker.CalledOnValidThread()); |
171 unsigned textureId = 0; | 171 unsigned textureId = 0; |
172 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); | 172 WebGraphicsContext3D* context3d = m_outputSurface->Context3D(); |
173 DCHECK(context3d); | 173 DCHECK(context3d); |
174 GLC(context3d, textureId = context3d->createTexture()); | 174 GLC(context3d, textureId = context3d->createTexture()); |
175 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId)); | 175 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId)); |
176 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER , GL_LINEAR)); | 176 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER , GL_LINEAR)); |
177 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER , GL_LINEAR)); | 177 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER , GL_LINEAR)); |
178 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL _CLAMP_TO_EDGE)); | 178 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL _CLAMP_TO_EDGE)); |
179 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL _CLAMP_TO_EDGE)); | 179 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL _CLAMP_TO_EDGE)); |
180 if (pool == Renderer::ContentPool) | |
181 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_POOL_C HROMIUM, GL_TEXTURE_POOL_MANAGED_CHROMIUM)); | |
piman
2012/12/13 02:31:55
Layering violation - the resource provider shouldn
| |
180 | 182 |
181 if (m_useTextureUsageHint && hint == TextureUsageFramebuffer) | 183 if (m_useTextureUsageHint && hint == TextureUsageFramebuffer) |
182 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_USAGE_ ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); | 184 GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_USAGE_ ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); |
183 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { | 185 if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { |
184 GLenum storageFormat = textureToStorageFormat(format); | 186 GLenum storageFormat = textureToStorageFormat(format); |
185 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageForma t, size.width(), size.height())); | 187 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageForma t, size.width(), size.height())); |
186 } else | 188 } else |
187 GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.widt h(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0)); | 189 GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.widt h(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0)); |
188 | 190 |
189 ResourceId id = m_nextId++; | 191 ResourceId id = m_nextId++; |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
949 return false; | 951 return false; |
950 } | 952 } |
951 | 953 |
952 resource->pendingSetPixels = false; | 954 resource->pendingSetPixels = false; |
953 unlockForWrite(id); | 955 unlockForWrite(id); |
954 | 956 |
955 return true; | 957 return true; |
956 } | 958 } |
957 | 959 |
958 } // namespace cc | 960 } // namespace cc |
OLD | NEW |