| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_clear_framebuffer.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 Initialize(decoder); | 61 Initialize(decoder); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ClearFramebufferResourceManager::~ClearFramebufferResourceManager() { | 64 ClearFramebufferResourceManager::~ClearFramebufferResourceManager() { |
| 65 Destroy(); | 65 Destroy(); |
| 66 DCHECK(!buffer_id_); | 66 DCHECK(!buffer_id_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ClearFramebufferResourceManager::Initialize( | 69 void ClearFramebufferResourceManager::Initialize( |
| 70 const gles2::GLES2Decoder* decoder) { | 70 const gles2::GLES2Decoder* decoder) { |
| 71 COMPILE_ASSERT( | 71 static_assert( |
| 72 kVertexPositionAttrib == 0u, | 72 kVertexPositionAttrib == 0u, |
| 73 Position_attribs_must_be_0); | 73 "kVertexPositionAttrib must be 0"); |
| 74 DCHECK(!buffer_id_); | 74 DCHECK(!buffer_id_); |
| 75 | 75 |
| 76 glGenBuffersARB(1, &buffer_id_); | 76 glGenBuffersARB(1, &buffer_id_); |
| 77 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); | 77 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); |
| 78 const GLfloat kQuadVertices[] = {-1.0f, -1.0f, | 78 const GLfloat kQuadVertices[] = {-1.0f, -1.0f, |
| 79 1.0f, -1.0f, | 79 1.0f, -1.0f, |
| 80 1.0f, 1.0f, | 80 1.0f, 1.0f, |
| 81 -1.0f, 1.0f}; | 81 -1.0f, 1.0f}; |
| 82 glBufferData( | 82 glBufferData( |
| 83 GL_ARRAY_BUFFER, sizeof(kQuadVertices), kQuadVertices, GL_STATIC_DRAW); | 83 GL_ARRAY_BUFFER, sizeof(kQuadVertices), kQuadVertices, GL_STATIC_DRAW); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 glViewport(0, 0, framebuffer_size.width(), framebuffer_size.height()); | 179 glViewport(0, 0, framebuffer_size.width(), framebuffer_size.height()); |
| 180 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); | 180 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); |
| 181 | 181 |
| 182 decoder->RestoreAllAttributes(); | 182 decoder->RestoreAllAttributes(); |
| 183 decoder->RestoreProgramBindings(); | 183 decoder->RestoreProgramBindings(); |
| 184 decoder->RestoreBufferBindings(); | 184 decoder->RestoreBufferBindings(); |
| 185 decoder->RestoreGlobalState(); | 185 decoder->RestoreGlobalState(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace gpu | 188 } // namespace gpu |
| OLD | NEW |