OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "gpu/command_buffer/service/gl_utils.h" | 10 #include "gpu/command_buffer/service/gl_utils.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 framebuffer_(0u) {} | 260 framebuffer_(0u) {} |
261 | 261 |
262 CopyTextureCHROMIUMResourceManager::~CopyTextureCHROMIUMResourceManager() { | 262 CopyTextureCHROMIUMResourceManager::~CopyTextureCHROMIUMResourceManager() { |
263 // |buffer_id_| and |framebuffer_| can be not-null because when GPU context is | 263 // |buffer_id_| and |framebuffer_| can be not-null because when GPU context is |
264 // lost, this class can be deleted without releasing resources like | 264 // lost, this class can be deleted without releasing resources like |
265 // GLES2DecoderImpl. | 265 // GLES2DecoderImpl. |
266 } | 266 } |
267 | 267 |
268 void CopyTextureCHROMIUMResourceManager::Initialize( | 268 void CopyTextureCHROMIUMResourceManager::Initialize( |
269 const gles2::GLES2Decoder* decoder) { | 269 const gles2::GLES2Decoder* decoder) { |
270 COMPILE_ASSERT( | 270 static_assert( |
271 kVertexPositionAttrib == 0u, | 271 kVertexPositionAttrib == 0u, |
272 Position_attribs_must_be_0); | 272 "kVertexPositionAttrib must be 0"); |
273 DCHECK(!buffer_id_); | 273 DCHECK(!buffer_id_); |
274 DCHECK(!framebuffer_); | 274 DCHECK(!framebuffer_); |
275 DCHECK(programs_.empty()); | 275 DCHECK(programs_.empty()); |
276 | 276 |
277 // Initialize all of the GPU resources required to perform the copy. | 277 // Initialize all of the GPU resources required to perform the copy. |
278 glGenBuffersARB(1, &buffer_id_); | 278 glGenBuffersARB(1, &buffer_id_); |
279 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); | 279 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); |
280 const GLfloat kQuadVertices[] = {-1.0f, -1.0f, | 280 const GLfloat kQuadVertices[] = {-1.0f, -1.0f, |
281 1.0f, -1.0f, | 281 1.0f, -1.0f, |
282 1.0f, 1.0f, | 282 1.0f, 1.0f, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 decoder->RestoreTextureState(dest_id); | 475 decoder->RestoreTextureState(dest_id); |
476 decoder->RestoreTextureUnitBindings(0); | 476 decoder->RestoreTextureUnitBindings(0); |
477 decoder->RestoreActiveTexture(); | 477 decoder->RestoreActiveTexture(); |
478 decoder->RestoreProgramBindings(); | 478 decoder->RestoreProgramBindings(); |
479 decoder->RestoreBufferBindings(); | 479 decoder->RestoreBufferBindings(); |
480 decoder->RestoreFramebufferBindings(); | 480 decoder->RestoreFramebufferBindings(); |
481 decoder->RestoreGlobalState(); | 481 decoder->RestoreGlobalState(); |
482 } | 482 } |
483 | 483 |
484 } // namespace gpu | 484 } // namespace gpu |
OLD | NEW |