| 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_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 12 |
| 11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 12 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 15 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 17 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 16 #include "gpu/command_buffer/service/context_group.h" | 18 #include "gpu/command_buffer/service/context_group.h" |
| 17 #include "gpu/command_buffer/service/context_state.h" | 19 #include "gpu/command_buffer/service/context_state.h" |
| 18 #include "gpu/command_buffer/service/gl_surface_mock.h" | 20 #include "gpu/command_buffer/service/gl_surface_mock.h" |
| 19 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" | 21 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 20 | 22 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 GL_UNSIGNED_BYTE, | 567 GL_UNSIGNED_BYTE, |
| 566 pixels_shm_id, | 568 pixels_shm_id, |
| 567 pixels_shm_offset, | 569 pixels_shm_offset, |
| 568 result_shm_id, | 570 result_shm_id, |
| 569 result_shm_offset, | 571 result_shm_offset, |
| 570 false); | 572 false); |
| 571 result->success = 0; | 573 result->success = 0; |
| 572 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 574 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 573 | 575 |
| 574 GLint unpadded_row_size = emu.ComputeImageDataSize(in_read_width, 1); | 576 GLint unpadded_row_size = emu.ComputeImageDataSize(in_read_width, 1); |
| 575 scoped_ptr<int8_t[]> zero(new int8_t[unpadded_row_size]); | 577 std::unique_ptr<int8_t[]> zero(new int8_t[unpadded_row_size]); |
| 576 scoped_ptr<int8_t[]> pack(new int8_t[kPackAlignment]); | 578 std::unique_ptr<int8_t[]> pack(new int8_t[kPackAlignment]); |
| 577 memset(zero.get(), kInitialMemoryValue, unpadded_row_size); | 579 memset(zero.get(), kInitialMemoryValue, unpadded_row_size); |
| 578 memset(pack.get(), kInitialMemoryValue, kPackAlignment); | 580 memset(pack.get(), kInitialMemoryValue, kPackAlignment); |
| 579 for (GLint yy = 0; yy < in_read_height; ++yy) { | 581 for (GLint yy = 0; yy < in_read_height; ++yy) { |
| 580 const int8_t* row = static_cast<const int8_t*>( | 582 const int8_t* row = static_cast<const int8_t*>( |
| 581 emu.ComputePackAlignmentAddress(0, yy, in_read_width, dest)); | 583 emu.ComputePackAlignmentAddress(0, yy, in_read_width, dest)); |
| 582 GLint y = in_read_y + yy; | 584 GLint y = in_read_y + yy; |
| 583 if (y < 0 || y >= kHeight) { | 585 if (y < 0 || y >= kHeight) { |
| 584 EXPECT_EQ(0, memcmp(zero.get(), row, unpadded_row_size)); | 586 EXPECT_EQ(0, memcmp(zero.get(), row, unpadded_row_size)); |
| 585 } else { | 587 } else { |
| 586 // check off left. | 588 // check off left. |
| (...skipping 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3311 EXPECT_EQ(1, result->GetNumResults()); | 3313 EXPECT_EQ(1, result->GetNumResults()); |
| 3312 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3314 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3313 } | 3315 } |
| 3314 | 3316 |
| 3315 // TODO(gman): PixelStorei | 3317 // TODO(gman): PixelStorei |
| 3316 | 3318 |
| 3317 // TODO(gman): SwapBuffers | 3319 // TODO(gman): SwapBuffers |
| 3318 | 3320 |
| 3319 } // namespace gles2 | 3321 } // namespace gles2 |
| 3320 } // namespace gpu | 3322 } // namespace gpu |
| OLD | NEW |