| 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 <cmath> | 10 #include <cmath> |
| (...skipping 12441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12452 if (!gl_image->BindTexImage(target)) { | 12452 if (!gl_image->BindTexImage(target)) { |
| 12453 LOCAL_SET_GL_ERROR( | 12453 LOCAL_SET_GL_ERROR( |
| 12454 GL_INVALID_OPERATION, | 12454 GL_INVALID_OPERATION, |
| 12455 "glBindTexImage2DCHROMIUM", "fail to bind image with the given ID"); | 12455 "glBindTexImage2DCHROMIUM", "fail to bind image with the given ID"); |
| 12456 return; | 12456 return; |
| 12457 } | 12457 } |
| 12458 } | 12458 } |
| 12459 | 12459 |
| 12460 gfx::Size size = gl_image->GetSize(); | 12460 gfx::Size size = gl_image->GetSize(); |
| 12461 texture_manager()->SetLevelInfo( | 12461 texture_manager()->SetLevelInfo( |
| 12462 texture_ref, target, 0, GL_RGBA, size.width(), size.height(), 1, 0, | 12462 texture_ref, target, 0, gl_image->GetFormat(), |
| 12463 GL_RGBA, GL_UNSIGNED_BYTE, true); | 12463 size.width(), size.height(), 1, 0, |
| 12464 gl_image->GetFormat(), GL_UNSIGNED_BYTE, true); |
| 12464 texture_manager()->SetLevelImage(texture_ref, target, 0, gl_image); | 12465 texture_manager()->SetLevelImage(texture_ref, target, 0, gl_image); |
| 12465 } | 12466 } |
| 12466 | 12467 |
| 12467 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( | 12468 void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( |
| 12468 GLenum target, GLint image_id) { | 12469 GLenum target, GLint image_id) { |
| 12469 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); | 12470 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"); |
| 12470 | 12471 |
| 12471 // Default target might be conceptually valid, but disallow it to avoid | 12472 // Default target might be conceptually valid, but disallow it to avoid |
| 12472 // accidents. | 12473 // accidents. |
| 12473 TextureRef* texture_ref = | 12474 TextureRef* texture_ref = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 12491 if (texture_ref->texture()->GetLevelImage(target, 0) != gl_image) | 12492 if (texture_ref->texture()->GetLevelImage(target, 0) != gl_image) |
| 12492 return; | 12493 return; |
| 12493 | 12494 |
| 12494 { | 12495 { |
| 12495 ScopedGLErrorSuppressor suppressor( | 12496 ScopedGLErrorSuppressor suppressor( |
| 12496 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); | 12497 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); |
| 12497 gl_image->ReleaseTexImage(target); | 12498 gl_image->ReleaseTexImage(target); |
| 12498 } | 12499 } |
| 12499 | 12500 |
| 12500 texture_manager()->SetLevelInfo( | 12501 texture_manager()->SetLevelInfo( |
| 12501 texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, | 12502 texture_ref, target, 0, gl_image->GetFormat(), 0, 0, 1, 0, |
| 12502 GL_RGBA, GL_UNSIGNED_BYTE, false); | 12503 gl_image->GetFormat(), GL_UNSIGNED_BYTE, false); |
| 12503 } | 12504 } |
| 12504 | 12505 |
| 12505 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( | 12506 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( |
| 12506 uint32 immediate_data_size, | 12507 uint32 immediate_data_size, |
| 12507 const void* cmd_data) { | 12508 const void* cmd_data) { |
| 12508 const gles2::cmds::TraceBeginCHROMIUM& c = | 12509 const gles2::cmds::TraceBeginCHROMIUM& c = |
| 12509 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); | 12510 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); |
| 12510 Bucket* category_bucket = GetBucket(c.category_bucket_id); | 12511 Bucket* category_bucket = GetBucket(c.category_bucket_id); |
| 12511 Bucket* name_bucket = GetBucket(c.name_bucket_id); | 12512 Bucket* name_bucket = GetBucket(c.name_bucket_id); |
| 12512 if (!category_bucket || category_bucket->size() == 0 || | 12513 if (!category_bucket || category_bucket->size() == 0 || |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13139 } | 13140 } |
| 13140 } | 13141 } |
| 13141 | 13142 |
| 13142 // Include the auto-generated part of this file. We split this because it means | 13143 // Include the auto-generated part of this file. We split this because it means |
| 13143 // we can easily edit the non-auto generated parts right here in this file | 13144 // we can easily edit the non-auto generated parts right here in this file |
| 13144 // instead of having to edit some template or the code generator. | 13145 // instead of having to edit some template or the code generator. |
| 13145 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 13146 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 13146 | 13147 |
| 13147 } // namespace gles2 | 13148 } // namespace gles2 |
| 13148 } // namespace gpu | 13149 } // namespace gpu |
| OLD | NEW |