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 9347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9358 SetGLError(GL_INVALID_OPERATION, | 9358 SetGLError(GL_INVALID_OPERATION, |
9359 "glTraceEndCHROMIUM", "no trace begin found"); | 9359 "glTraceEndCHROMIUM", "no trace begin found"); |
9360 return; | 9360 return; |
9361 } | 9361 } |
9362 | 9362 |
9363 linked_ptr<GPUTrace> trace = gpu_trace_stack_.top(); | 9363 linked_ptr<GPUTrace> trace = gpu_trace_stack_.top(); |
9364 trace->EnableEndTrace(); | 9364 trace->EnableEndTrace(); |
9365 gpu_trace_stack_.pop(); | 9365 gpu_trace_stack_.pop(); |
9366 } | 9366 } |
9367 | 9367 |
9368 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( | |
greggman
2012/11/29 02:18:18
You don't need this do you? AsyncTexImage2D can ju
| |
9369 uint32 immediate_data_size, const gles2::AsyncTexImage2DCHROMIUM& c) { | |
9370 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); | |
9371 | |
9372 // TODO: This is a copy of HandleTexImage2D validation. Merge | |
9373 // as much of it as possible. | |
9374 tex_image_2d_failed_ = true; | |
9375 GLenum target = static_cast<GLenum>(c.target); | |
9376 GLint level = static_cast<GLint>(c.level); | |
9377 GLint internal_format = static_cast<GLint>(c.internalformat); | |
9378 GLsizei width = static_cast<GLsizei>(c.width); | |
9379 GLsizei height = static_cast<GLsizei>(c.height); | |
9380 GLint border = static_cast<GLint>(c.border); | |
9381 GLenum format = static_cast<GLenum>(c.format); | |
9382 GLenum type = static_cast<GLenum>(c.type); | |
9383 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | |
9384 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | |
9385 uint32 pixels_size; | |
9386 if (!GLES2Util::ComputeImageDataSizes( | |
9387 width, height, format, type, state_.unpack_alignment, &pixels_size, NULL, | |
9388 NULL)) { | |
9389 return error::kOutOfBounds; | |
9390 } | |
9391 const void* pixels = NULL; | |
9392 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | |
9393 pixels = GetSharedMemoryAs<const void*>( | |
9394 pixels_shm_id, pixels_shm_offset, pixels_size); | |
9395 if (!pixels) { | |
9396 return error::kOutOfBounds; | |
9397 } | |
9398 } | |
9399 | |
9400 // TODO(epenner): Do this via an async task. | |
9401 return DoTexImage2D( | |
9402 target, level, internal_format, width, height, border, format, type, | |
9403 pixels, pixels_size); | |
9404 } | |
9405 | |
9406 error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM( | |
9407 uint32 immediate_data_size, const gles2::AsyncTexSubImage2DCHROMIUM& c) { | |
9408 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM"); | |
9409 | |
9410 // TODO: This is a copy of HandleTexSubImage2D validation. Merge | |
9411 // as much of it as possible. | |
9412 GLenum target = static_cast<GLenum>(c.target); | |
9413 GLint level = static_cast<GLint>(c.level); | |
9414 GLint xoffset = static_cast<GLint>(c.xoffset); | |
9415 GLint yoffset = static_cast<GLint>(c.yoffset); | |
9416 GLsizei width = static_cast<GLsizei>(c.width); | |
9417 GLsizei height = static_cast<GLsizei>(c.height); | |
9418 GLenum format = static_cast<GLenum>(c.format); | |
9419 GLenum type = static_cast<GLenum>(c.type); | |
9420 uint32 data_size; | |
9421 if (!GLES2Util::ComputeImageDataSizes( | |
9422 width, height, format, type, state_.unpack_alignment, &data_size, | |
9423 NULL, NULL)) { | |
9424 return error::kOutOfBounds; | |
9425 } | |
9426 const void* pixels = GetSharedMemoryAs<const void*>( | |
9427 c.data_shm_id, c.data_shm_offset, data_size); | |
9428 if (!validators_->texture_target.IsValid(target)) { | |
9429 SetGLErrorInvalidEnum("glTexSubImage2D", target, "target"); | |
9430 return error::kNoError; | |
9431 } | |
9432 if (width < 0) { | |
9433 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "width < 0"); | |
9434 return error::kNoError; | |
9435 } | |
9436 if (height < 0) { | |
9437 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "height < 0"); | |
9438 return error::kNoError; | |
9439 } | |
9440 if (!validators_->texture_format.IsValid(format)) { | |
9441 SetGLErrorInvalidEnum("glTexSubImage2D", format, "format"); | |
9442 return error::kNoError; | |
9443 } | |
9444 if (!validators_->pixel_type.IsValid(type)) { | |
9445 SetGLErrorInvalidEnum("glTexSubImage2D", type, "type"); | |
9446 return error::kNoError; | |
9447 } | |
9448 if (pixels == NULL) { | |
9449 return error::kOutOfBounds; | |
9450 } | |
9451 | |
9452 // TODO(epenner): Do this via an async task. | |
9453 DoTexSubImage2D( | |
9454 target, level, xoffset, yoffset, width, height, format, type, pixels); | |
9455 return error::kNoError; | |
9456 } | |
9457 | |
9368 // Include the auto-generated part of this file. We split this because it means | 9458 // Include the auto-generated part of this file. We split this because it means |
9369 // we can easily edit the non-auto generated parts right here in this file | 9459 // we can easily edit the non-auto generated parts right here in this file |
9370 // instead of having to edit some template or the code generator. | 9460 // instead of having to edit some template or the code generator. |
9371 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9461 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
9372 | 9462 |
9373 } // namespace gles2 | 9463 } // namespace gles2 |
9374 } // namespace gpu | 9464 } // namespace gpu |
OLD | NEW |