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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(uniformCount)); | 296 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(uniformCount)); |
297 GLint* params = result ? result->GetData() : NULL; | 297 GLint* params = result ? result->GetData() : NULL; |
298 if (params == NULL) { | 298 if (params == NULL) { |
299 return error::kOutOfBounds; | 299 return error::kOutOfBounds; |
300 } | 300 } |
301 // Check that the client initialized the result. | 301 // Check that the client initialized the result. |
302 if (result->size != 0) { | 302 if (result->size != 0) { |
303 return error::kInvalidArguments; | 303 return error::kInvalidArguments; |
304 } | 304 } |
305 | 305 |
306 GLsizei bufsize = uniformCount; | 306 error::Error error = |
307 GLsizei length = 0; | 307 DoGetActiveUniformsiv(program, uniformCount, indices, pname, params); |
308 error::Error error = DoGetActiveUniformsiv(program, uniformCount, indices, | |
309 pname, bufsize, &length, params); | |
310 if (error != error::kNoError) { | 308 if (error != error::kNoError) { |
311 return error; | 309 return error; |
312 } | 310 } |
313 | 311 |
314 result->SetNumResults(length); | 312 result->SetNumResults(uniformCount); |
315 return error::kNoError; | 313 return error::kNoError; |
316 } | 314 } |
317 | 315 |
318 error::Error GLES2DecoderPassthroughImpl::HandleGetAttachedShaders( | 316 error::Error GLES2DecoderPassthroughImpl::HandleGetAttachedShaders( |
319 uint32_t immediate_data_size, | 317 uint32_t immediate_data_size, |
320 const volatile void* cmd_data) { | 318 const volatile void* cmd_data) { |
321 const volatile gles2::cmds::GetAttachedShaders& c = | 319 const volatile gles2::cmds::GetAttachedShaders& c = |
322 *static_cast<const volatile gles2::cmds::GetAttachedShaders*>(cmd_data); | 320 *static_cast<const volatile gles2::cmds::GetAttachedShaders*>(cmd_data); |
323 GLuint program = static_cast<GLuint>(c.program); | 321 GLuint program = static_cast<GLuint>(c.program); |
324 typedef cmds::GetAttachedShaders::Result Result; | 322 typedef cmds::GetAttachedShaders::Result Result; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 c.indices_shm_id, c.indices_shm_offset, | 745 c.indices_shm_id, c.indices_shm_offset, |
748 Result::ComputeSize(static_cast<size_t>(count))); | 746 Result::ComputeSize(static_cast<size_t>(count))); |
749 GLuint* indices = result ? result->GetData() : NULL; | 747 GLuint* indices = result ? result->GetData() : NULL; |
750 if (indices == NULL) { | 748 if (indices == NULL) { |
751 return error::kOutOfBounds; | 749 return error::kOutOfBounds; |
752 } | 750 } |
753 // Check that the client initialized the result. | 751 // Check that the client initialized the result. |
754 if (result->size != 0) { | 752 if (result->size != 0) { |
755 return error::kInvalidArguments; | 753 return error::kInvalidArguments; |
756 } | 754 } |
757 GLsizei length = 0; | |
758 error::Error error = | 755 error::Error error = |
759 DoGetUniformIndices(program, count, &names[0], count, &length, indices); | 756 DoGetUniformIndices(program, count, &names[0], count, indices); |
760 if (error != error::kNoError) { | 757 if (error != error::kNoError) { |
761 return error; | 758 return error; |
762 } | 759 } |
763 if (length != count) { | 760 result->SetNumResults(count); |
764 return error::kOutOfBounds; | |
765 } | |
766 result->SetNumResults(length); | |
767 return error::kNoError; | 761 return error::kNoError; |
768 } | 762 } |
769 | 763 |
770 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformLocation( | 764 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformLocation( |
771 uint32_t immediate_data_size, | 765 uint32_t immediate_data_size, |
772 const volatile void* cmd_data) { | 766 const volatile void* cmd_data) { |
773 const volatile gles2::cmds::GetUniformLocation& c = | 767 const volatile gles2::cmds::GetUniformLocation& c = |
774 *static_cast<const volatile gles2::cmds::GetUniformLocation*>(cmd_data); | 768 *static_cast<const volatile gles2::cmds::GetUniformLocation*>(cmd_data); |
775 GLuint program = static_cast<GLuint>(c.program); | 769 GLuint program = static_cast<GLuint>(c.program); |
776 Bucket* bucket = GetBucket(c.name_bucket_id); | 770 Bucket* bucket = GetBucket(c.name_bucket_id); |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2667 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. |
2674 const void* data = GetSharedMemoryAs<const void*>( | 2668 const void* data = GetSharedMemoryAs<const void*>( |
2675 c.data_shm_id, c.data_shm_offset, image_size); | 2669 c.data_shm_id, c.data_shm_offset, image_size); |
2676 return DoCompressedTexSubImage3D( | 2670 return DoCompressedTexSubImage3D( |
2677 target, level, xoffset, yoffset, zoffset, width, height, depth, | 2671 target, level, xoffset, yoffset, zoffset, width, height, depth, |
2678 format, image_size, data); | 2672 format, image_size, data); |
2679 } | 2673 } |
2680 | 2674 |
2681 } // namespace gles2 | 2675 } // namespace gles2 |
2682 } // namespace gpu | 2676 } // namespace gpu |
OLD | NEW |