| 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_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 LOG(ERROR) << "Offscreen saved FBO was incomplete."; | 2475 LOG(ERROR) << "Offscreen saved FBO was incomplete."; |
| 2476 Destroy(true); | 2476 Destroy(true); |
| 2477 return false; | 2477 return false; |
| 2478 } | 2478 } |
| 2479 | 2479 |
| 2480 // Bind to the new default frame buffer (the offscreen target frame buffer). | 2480 // Bind to the new default frame buffer (the offscreen target frame buffer). |
| 2481 // This should now be associated with ID zero. | 2481 // This should now be associated with ID zero. |
| 2482 DoBindFramebuffer(GL_FRAMEBUFFER, 0); | 2482 DoBindFramebuffer(GL_FRAMEBUFFER, 0); |
| 2483 } | 2483 } |
| 2484 | 2484 |
| 2485 // Clear the backbuffer. | |
| 2486 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | |
| 2487 | |
| 2488 // OpenGL ES 2.0 implicitly enables the desktop GL capability | 2485 // OpenGL ES 2.0 implicitly enables the desktop GL capability |
| 2489 // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact | 2486 // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact |
| 2490 // isn't well documented; it was discovered in the Khronos OpenGL ES | 2487 // isn't well documented; it was discovered in the Khronos OpenGL ES |
| 2491 // mailing list archives. It also implicitly enables the desktop GL | 2488 // mailing list archives. It also implicitly enables the desktop GL |
| 2492 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord | 2489 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord |
| 2493 // variable in fragment shaders. | 2490 // variable in fragment shaders. |
| 2494 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 2491 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 2495 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | 2492 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); |
| 2496 glEnable(GL_POINT_SPRITE); | 2493 glEnable(GL_POINT_SPRITE); |
| 2497 } | 2494 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2521 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); | 2518 glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit); |
| 2522 glHint(GL_GENERATE_MIPMAP_HINT, state_.hint_generate_mipmap); | 2519 glHint(GL_GENERATE_MIPMAP_HINT, state_.hint_generate_mipmap); |
| 2523 glPixelStorei(GL_PACK_ALIGNMENT, state_.pack_alignment); | 2520 glPixelStorei(GL_PACK_ALIGNMENT, state_.pack_alignment); |
| 2524 glPixelStorei(GL_UNPACK_ALIGNMENT, state_.unpack_alignment); | 2521 glPixelStorei(GL_UNPACK_ALIGNMENT, state_.unpack_alignment); |
| 2525 | 2522 |
| 2526 DoBindBuffer(GL_ARRAY_BUFFER, 0); | 2523 DoBindBuffer(GL_ARRAY_BUFFER, 0); |
| 2527 DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | 2524 DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); |
| 2528 DoBindFramebuffer(GL_FRAMEBUFFER, 0); | 2525 DoBindFramebuffer(GL_FRAMEBUFFER, 0); |
| 2529 DoBindRenderbuffer(GL_RENDERBUFFER, 0); | 2526 DoBindRenderbuffer(GL_RENDERBUFFER, 0); |
| 2530 | 2527 |
| 2528 // Clear the backbuffer. |
| 2529 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
| 2530 |
| 2531 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { | 2531 if (feature_info_->workarounds().reverse_point_sprite_coord_origin) { |
| 2532 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); | 2532 glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); |
| 2533 } | 2533 } |
| 2534 | 2534 |
| 2535 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { | 2535 if (feature_info_->workarounds().unbind_fbo_on_context_switch) { |
| 2536 context_->SetUnbindFboOnMakeCurrent(); | 2536 context_->SetUnbindFboOnMakeCurrent(); |
| 2537 } | 2537 } |
| 2538 | 2538 |
| 2539 // Only compositor contexts are known to use only the subset of GL | 2539 // Only compositor contexts are known to use only the subset of GL |
| 2540 // that can be safely migrated between the iGPU and the dGPU. Mark | 2540 // that can be safely migrated between the iGPU and the dGPU. Mark |
| (...skipping 7871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10412 return error::kNoError; | 10412 return error::kNoError; |
| 10413 } | 10413 } |
| 10414 | 10414 |
| 10415 // Include the auto-generated part of this file. We split this because it means | 10415 // Include the auto-generated part of this file. We split this because it means |
| 10416 // we can easily edit the non-auto generated parts right here in this file | 10416 // we can easily edit the non-auto generated parts right here in this file |
| 10417 // instead of having to edit some template or the code generator. | 10417 // instead of having to edit some template or the code generator. |
| 10418 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10418 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10419 | 10419 |
| 10420 } // namespace gles2 | 10420 } // namespace gles2 |
| 10421 } // namespace gpu | 10421 } // namespace gpu |
| OLD | NEW |