OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
6 | 6 |
7 namespace gpu { | 7 namespace gpu { |
8 namespace gles2 { | 8 namespace gles2 { |
9 | 9 |
10 // Custom Handlers | 10 // Custom Handlers |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 } | 1804 } |
1805 return error::kNoError; | 1805 return error::kNoError; |
1806 } | 1806 } |
1807 | 1807 |
1808 error::Error GLES2DecoderPassthroughImpl::HandleScheduleDCLayerCHROMIUM( | 1808 error::Error GLES2DecoderPassthroughImpl::HandleScheduleDCLayerCHROMIUM( |
1809 uint32_t immediate_data_size, | 1809 uint32_t immediate_data_size, |
1810 const volatile void* cmd_data) { | 1810 const volatile void* cmd_data) { |
1811 const volatile gles2::cmds::ScheduleDCLayerCHROMIUM& c = | 1811 const volatile gles2::cmds::ScheduleDCLayerCHROMIUM& c = |
1812 *static_cast<const volatile gles2::cmds::ScheduleDCLayerCHROMIUM*>( | 1812 *static_cast<const volatile gles2::cmds::ScheduleDCLayerCHROMIUM*>( |
1813 cmd_data); | 1813 cmd_data); |
1814 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset, | 1814 unsigned int size; |
1815 8 * sizeof(GLfloat)); | 1815 const GLfloat* mem = GetSharedMemoryAndSizeAs<const GLfloat*>( |
| 1816 c.shm_id, c.shm_offset, 8 * sizeof(GLfloat), &size); |
1816 if (!mem) { | 1817 if (!mem) { |
1817 return error::kOutOfBounds; | 1818 return error::kOutOfBounds; |
1818 } | 1819 } |
1819 GLuint contents_texture_id = static_cast<GLint>(c.contents_texture_id); | 1820 const GLsizei num_textures = c.num_textures; |
| 1821 if (num_textures < 0 || (size - 8 * sizeof(GLfloat)) / sizeof(GLuint) < |
| 1822 static_cast<GLuint>(num_textures)) { |
| 1823 return error::kOutOfBounds; |
| 1824 } |
| 1825 const volatile GLuint* contents_texture_ids = |
| 1826 reinterpret_cast<const volatile GLuint*>(mem + 8); |
1820 const GLfloat* contents_rect = mem; | 1827 const GLfloat* contents_rect = mem; |
1821 GLuint background_color = static_cast<GLuint>(c.background_color); | 1828 GLuint background_color = static_cast<GLuint>(c.background_color); |
1822 GLuint edge_aa_mask = static_cast<GLuint>(c.edge_aa_mask); | 1829 GLuint edge_aa_mask = static_cast<GLuint>(c.edge_aa_mask); |
1823 const GLfloat* bounds_rect = mem + 4; | 1830 const GLfloat* bounds_rect = mem + 4; |
1824 error::Error error = | 1831 error::Error error = DoScheduleDCLayerCHROMIUM( |
1825 DoScheduleDCLayerCHROMIUM(contents_texture_id, contents_rect, | 1832 num_textures, contents_texture_ids, contents_rect, background_color, |
1826 background_color, edge_aa_mask, bounds_rect); | 1833 edge_aa_mask, bounds_rect); |
1827 if (error != error::kNoError) { | 1834 if (error != error::kNoError) { |
1828 return error; | 1835 return error; |
1829 } | 1836 } |
1830 return error::kNoError; | 1837 return error::kNoError; |
1831 } | 1838 } |
1832 | 1839 |
1833 error::Error GLES2DecoderPassthroughImpl::HandleGenPathsCHROMIUM( | 1840 error::Error GLES2DecoderPassthroughImpl::HandleGenPathsCHROMIUM( |
1834 uint32_t immediate_data_size, | 1841 uint32_t immediate_data_size, |
1835 const volatile void* cmd_data) { | 1842 const volatile void* cmd_data) { |
1836 const volatile gles2::cmds::GenPathsCHROMIUM& c = | 1843 const volatile gles2::cmds::GenPathsCHROMIUM& c = |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2716 reinterpret_cast<const void*>(static_cast<intptr_t>(data_shm_offset)); | 2723 reinterpret_cast<const void*>(static_cast<intptr_t>(data_shm_offset)); |
2717 } | 2724 } |
2718 | 2725 |
2719 return DoCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, | 2726 return DoCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, |
2720 width, height, depth, format, image_size, | 2727 width, height, depth, format, image_size, |
2721 data_size, data); | 2728 data_size, data); |
2722 } | 2729 } |
2723 | 2730 |
2724 } // namespace gles2 | 2731 } // namespace gles2 |
2725 } // namespace gpu | 2732 } // namespace gpu |
OLD | NEW |