| 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Make sure the queries are finished otherwise we'll delete the | 268 // Make sure the queries are finished otherwise we'll delete the |
| 269 // shared memory (mapped_memory_) which will free the memory used | 269 // shared memory (mapped_memory_) which will free the memory used |
| 270 // by the queries. The GPU process when validating that memory is still | 270 // by the queries. The GPU process when validating that memory is still |
| 271 // shared will fail and abort (ie, it will stop running). | 271 // shared will fail and abort (ie, it will stop running). |
| 272 WaitForCmd(); | 272 WaitForCmd(); |
| 273 query_tracker_.reset(); | 273 query_tracker_.reset(); |
| 274 | 274 |
| 275 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 275 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) |
| 276 DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); | 276 DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); |
| 277 #endif | 277 #endif |
| 278 |
| 279 // Release any per-context data in share group. |
| 280 share_group_->FreeContext(this); |
| 281 |
| 278 buffer_tracker_.reset(); | 282 buffer_tracker_.reset(); |
| 279 | 283 |
| 280 // Make sure the commands make it the service. | 284 // Make sure the commands make it the service. |
| 281 WaitForCmd(); | 285 WaitForCmd(); |
| 282 } | 286 } |
| 283 | 287 |
| 284 GLES2CmdHelper* GLES2Implementation::helper() const { | 288 GLES2CmdHelper* GLES2Implementation::helper() const { |
| 285 return helper_; | 289 return helper_; |
| 286 } | 290 } |
| 287 | 291 |
| (...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2422 break; | 2426 break; |
| 2423 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: | 2427 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: |
| 2424 bound_pixel_unpack_transfer_buffer_id_ = buffer; | 2428 bound_pixel_unpack_transfer_buffer_id_ = buffer; |
| 2425 break; | 2429 break; |
| 2426 default: | 2430 default: |
| 2427 changed = true; | 2431 changed = true; |
| 2428 break; | 2432 break; |
| 2429 } | 2433 } |
| 2430 // TODO(gman): There's a bug here. If the target is invalid the ID will not be | 2434 // TODO(gman): There's a bug here. If the target is invalid the ID will not be |
| 2431 // used even though it's marked it as used here. | 2435 // used even though it's marked it as used here. |
| 2432 GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(buffer); | 2436 GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(this, buffer); |
| 2433 return changed; | 2437 return changed; |
| 2434 } | 2438 } |
| 2435 | 2439 |
| 2436 bool GLES2Implementation::BindFramebufferHelper( | 2440 bool GLES2Implementation::BindFramebufferHelper( |
| 2437 GLenum target, GLuint framebuffer) { | 2441 GLenum target, GLuint framebuffer) { |
| 2438 // TODO(gman): See note #1 above. | 2442 // TODO(gman): See note #1 above. |
| 2439 bool changed = false; | 2443 bool changed = false; |
| 2440 switch (target) { | 2444 switch (target) { |
| 2441 case GL_FRAMEBUFFER: | 2445 case GL_FRAMEBUFFER: |
| 2442 if (bound_framebuffer_ != framebuffer || | 2446 if (bound_framebuffer_ != framebuffer || |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2463 } | 2467 } |
| 2464 if (bound_framebuffer_ != framebuffer) { | 2468 if (bound_framebuffer_ != framebuffer) { |
| 2465 bound_framebuffer_ = framebuffer; | 2469 bound_framebuffer_ = framebuffer; |
| 2466 changed = true; | 2470 changed = true; |
| 2467 } | 2471 } |
| 2468 break; | 2472 break; |
| 2469 default: | 2473 default: |
| 2470 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); | 2474 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); |
| 2471 return false; | 2475 return false; |
| 2472 } | 2476 } |
| 2473 GetIdHandler(id_namespaces::kFramebuffers)->MarkAsUsedForBind(framebuffer); | 2477 GetIdHandler(id_namespaces::kFramebuffers) |
| 2478 ->MarkAsUsedForBind(this, framebuffer); |
| 2474 return changed; | 2479 return changed; |
| 2475 } | 2480 } |
| 2476 | 2481 |
| 2477 bool GLES2Implementation::BindRenderbufferHelper( | 2482 bool GLES2Implementation::BindRenderbufferHelper( |
| 2478 GLenum target, GLuint renderbuffer) { | 2483 GLenum target, GLuint renderbuffer) { |
| 2479 // TODO(gman): See note #1 above. | 2484 // TODO(gman): See note #1 above. |
| 2480 bool changed = false; | 2485 bool changed = false; |
| 2481 switch (target) { | 2486 switch (target) { |
| 2482 case GL_RENDERBUFFER: | 2487 case GL_RENDERBUFFER: |
| 2483 if (bound_renderbuffer_ != renderbuffer) { | 2488 if (bound_renderbuffer_ != renderbuffer) { |
| 2484 bound_renderbuffer_ = renderbuffer; | 2489 bound_renderbuffer_ = renderbuffer; |
| 2485 changed = true; | 2490 changed = true; |
| 2486 } | 2491 } |
| 2487 break; | 2492 break; |
| 2488 default: | 2493 default: |
| 2489 changed = true; | 2494 changed = true; |
| 2490 break; | 2495 break; |
| 2491 } | 2496 } |
| 2492 // TODO(gman): There's a bug here. If the target is invalid the ID will not be | 2497 // TODO(gman): There's a bug here. If the target is invalid the ID will not be |
| 2493 // used even though it's marked it as used here. | 2498 // used even though it's marked it as used here. |
| 2494 GetIdHandler(id_namespaces::kRenderbuffers)->MarkAsUsedForBind(renderbuffer); | 2499 GetIdHandler(id_namespaces::kRenderbuffers) |
| 2500 ->MarkAsUsedForBind(this, renderbuffer); |
| 2495 return changed; | 2501 return changed; |
| 2496 } | 2502 } |
| 2497 | 2503 |
| 2498 bool GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { | 2504 bool GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { |
| 2499 // TODO(gman): See note #1 above. | 2505 // TODO(gman): See note #1 above. |
| 2500 // TODO(gman): Change this to false once we figure out why it's failing | 2506 // TODO(gman): Change this to false once we figure out why it's failing |
| 2501 // on daisy. | 2507 // on daisy. |
| 2502 bool changed = true; | 2508 bool changed = true; |
| 2503 TextureUnit& unit = texture_units_[active_texture_unit_]; | 2509 TextureUnit& unit = texture_units_[active_texture_unit_]; |
| 2504 switch (target) { | 2510 switch (target) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2519 unit.bound_texture_external_oes = texture; | 2525 unit.bound_texture_external_oes = texture; |
| 2520 changed = true; | 2526 changed = true; |
| 2521 } | 2527 } |
| 2522 break; | 2528 break; |
| 2523 default: | 2529 default: |
| 2524 changed = true; | 2530 changed = true; |
| 2525 break; | 2531 break; |
| 2526 } | 2532 } |
| 2527 // TODO(gman): There's a bug here. If the target is invalid the ID will not be | 2533 // TODO(gman): There's a bug here. If the target is invalid the ID will not be |
| 2528 // used. even though it's marked it as used here. | 2534 // used. even though it's marked it as used here. |
| 2529 GetIdHandler(id_namespaces::kTextures)->MarkAsUsedForBind(texture); | 2535 GetIdHandler(id_namespaces::kTextures)->MarkAsUsedForBind(this, texture); |
| 2530 return changed; | 2536 return changed; |
| 2531 } | 2537 } |
| 2532 | 2538 |
| 2533 bool GLES2Implementation::BindVertexArrayHelper(GLuint array) { | 2539 bool GLES2Implementation::BindVertexArrayHelper(GLuint array) { |
| 2534 // TODO(gman): See note #1 above. | 2540 // TODO(gman): See note #1 above. |
| 2535 bool changed = false; | 2541 bool changed = false; |
| 2536 if (!vertex_array_object_manager_->BindVertexArray(array, &changed)) { | 2542 if (!vertex_array_object_manager_->BindVertexArray(array, &changed)) { |
| 2537 SetGLError( | 2543 SetGLError( |
| 2538 GL_INVALID_OPERATION, "glBindVertexArrayOES", | 2544 GL_INVALID_OPERATION, "glBindVertexArrayOES", |
| 2539 "id was not generated with glGenVertexArrayOES"); | 2545 "id was not generated with glGenVertexArrayOES"); |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3897 CheckGLError(); | 3903 CheckGLError(); |
| 3898 } | 3904 } |
| 3899 | 3905 |
| 3900 // Include the auto-generated part of this file. We split this because it means | 3906 // Include the auto-generated part of this file. We split this because it means |
| 3901 // we can easily edit the non-auto generated parts right here in this file | 3907 // we can easily edit the non-auto generated parts right here in this file |
| 3902 // instead of having to edit some template or the code generator. | 3908 // instead of having to edit some template or the code generator. |
| 3903 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 3909 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 3904 | 3910 |
| 3905 } // namespace gles2 | 3911 } // namespace gles2 |
| 3906 } // namespace gpu | 3912 } // namespace gpu |
| OLD | NEW |