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 // This file is auto-generated from | 5 // This file is auto-generated from |
6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
7 // It's formatted by clang-format using chromium coding style: | 7 // It's formatted by clang-format using chromium coding style: |
8 // clang-format -i -style=chromium filename | 8 // clang-format -i -style=chromium filename |
9 // DO NOT EDIT! | 9 // DO NOT EDIT! |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (!unsafe_es3_apis_enabled()) | 79 if (!unsafe_es3_apis_enabled()) |
80 return error::kUnknownCommand; | 80 return error::kUnknownCommand; |
81 const gles2::cmds::BindBufferRange& c = | 81 const gles2::cmds::BindBufferRange& c = |
82 *static_cast<const gles2::cmds::BindBufferRange*>(cmd_data); | 82 *static_cast<const gles2::cmds::BindBufferRange*>(cmd_data); |
83 (void)c; | 83 (void)c; |
84 GLenum target = static_cast<GLenum>(c.target); | 84 GLenum target = static_cast<GLenum>(c.target); |
85 GLuint index = static_cast<GLuint>(c.index); | 85 GLuint index = static_cast<GLuint>(c.index); |
86 GLuint buffer = c.buffer; | 86 GLuint buffer = c.buffer; |
87 GLintptr offset = static_cast<GLintptr>(c.offset); | 87 GLintptr offset = static_cast<GLintptr>(c.offset); |
88 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 88 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
89 if (size < 0) { | |
90 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glBindBufferRange", "size < 0"); | |
91 return error::kNoError; | |
92 } | |
93 if (!group_->GetBufferServiceId(buffer, &buffer)) { | 89 if (!group_->GetBufferServiceId(buffer, &buffer)) { |
94 if (!group_->bind_generates_resource()) { | 90 if (!group_->bind_generates_resource()) { |
95 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindBufferRange", | 91 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glBindBufferRange", |
96 "invalid buffer id"); | 92 "invalid buffer id"); |
97 return error::kNoError; | 93 return error::kNoError; |
98 } | 94 } |
99 GLuint client_id = buffer; | 95 GLuint client_id = buffer; |
100 glGenBuffersARB(1, &buffer); | 96 glGenBuffersARB(1, &buffer); |
101 CreateBuffer(client_id, buffer); | 97 CreateBuffer(client_id, buffer); |
102 } | 98 } |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 if (!unsafe_es3_apis_enabled()) | 605 if (!unsafe_es3_apis_enabled()) |
610 return error::kUnknownCommand; | 606 return error::kUnknownCommand; |
611 const gles2::cmds::CopyBufferSubData& c = | 607 const gles2::cmds::CopyBufferSubData& c = |
612 *static_cast<const gles2::cmds::CopyBufferSubData*>(cmd_data); | 608 *static_cast<const gles2::cmds::CopyBufferSubData*>(cmd_data); |
613 (void)c; | 609 (void)c; |
614 GLenum readtarget = static_cast<GLenum>(c.readtarget); | 610 GLenum readtarget = static_cast<GLenum>(c.readtarget); |
615 GLenum writetarget = static_cast<GLenum>(c.writetarget); | 611 GLenum writetarget = static_cast<GLenum>(c.writetarget); |
616 GLintptr readoffset = static_cast<GLintptr>(c.readoffset); | 612 GLintptr readoffset = static_cast<GLintptr>(c.readoffset); |
617 GLintptr writeoffset = static_cast<GLintptr>(c.writeoffset); | 613 GLintptr writeoffset = static_cast<GLintptr>(c.writeoffset); |
618 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 614 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
619 if (size < 0) { | |
620 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyBufferSubData", "size < 0"); | |
621 return error::kNoError; | |
622 } | |
623 glCopyBufferSubData(readtarget, writetarget, readoffset, writeoffset, size); | 615 glCopyBufferSubData(readtarget, writetarget, readoffset, writeoffset, size); |
624 return error::kNoError; | 616 return error::kNoError; |
625 } | 617 } |
626 | 618 |
627 error::Error GLES2DecoderImpl::HandleCopyTexImage2D( | 619 error::Error GLES2DecoderImpl::HandleCopyTexImage2D( |
628 uint32_t immediate_data_size, | 620 uint32_t immediate_data_size, |
629 const void* cmd_data) { | 621 const void* cmd_data) { |
630 const gles2::cmds::CopyTexImage2D& c = | 622 const gles2::cmds::CopyTexImage2D& c = |
631 *static_cast<const gles2::cmds::CopyTexImage2D*>(cmd_data); | 623 *static_cast<const gles2::cmds::CopyTexImage2D*>(cmd_data); |
632 (void)c; | 624 (void)c; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 return error::kNoError; | 682 return error::kNoError; |
691 } | 683 } |
692 if (height < 0) { | 684 if (height < 0) { |
693 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0"); | 685 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0"); |
694 return error::kNoError; | 686 return error::kNoError; |
695 } | 687 } |
696 DoCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); | 688 DoCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
697 return error::kNoError; | 689 return error::kNoError; |
698 } | 690 } |
699 | 691 |
| 692 error::Error GLES2DecoderImpl::HandleCopyTexSubImage3D( |
| 693 uint32_t immediate_data_size, |
| 694 const void* cmd_data) { |
| 695 if (!unsafe_es3_apis_enabled()) |
| 696 return error::kUnknownCommand; |
| 697 const gles2::cmds::CopyTexSubImage3D& c = |
| 698 *static_cast<const gles2::cmds::CopyTexSubImage3D*>(cmd_data); |
| 699 (void)c; |
| 700 error::Error error; |
| 701 error = WillAccessBoundFramebufferForRead(); |
| 702 if (error != error::kNoError) |
| 703 return error; |
| 704 GLenum target = static_cast<GLenum>(c.target); |
| 705 GLint level = static_cast<GLint>(c.level); |
| 706 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 707 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 708 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 709 GLint x = static_cast<GLint>(c.x); |
| 710 GLint y = static_cast<GLint>(c.y); |
| 711 GLsizei width = static_cast<GLsizei>(c.width); |
| 712 GLsizei height = static_cast<GLsizei>(c.height); |
| 713 glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, |
| 714 height); |
| 715 return error::kNoError; |
| 716 } |
| 717 |
700 error::Error GLES2DecoderImpl::HandleCreateProgram(uint32_t immediate_data_size, | 718 error::Error GLES2DecoderImpl::HandleCreateProgram(uint32_t immediate_data_size, |
701 const void* cmd_data) { | 719 const void* cmd_data) { |
702 const gles2::cmds::CreateProgram& c = | 720 const gles2::cmds::CreateProgram& c = |
703 *static_cast<const gles2::cmds::CreateProgram*>(cmd_data); | 721 *static_cast<const gles2::cmds::CreateProgram*>(cmd_data); |
704 (void)c; | 722 (void)c; |
705 uint32_t client_id = c.client_id; | 723 uint32_t client_id = c.client_id; |
706 if (GetProgram(client_id)) { | 724 if (GetProgram(client_id)) { |
707 return error::kInvalidArguments; | 725 return error::kInvalidArguments; |
708 } | 726 } |
709 GLuint service_id = glCreateProgram(); | 727 GLuint service_id = glCreateProgram(); |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 GLenum target = static_cast<GLenum>(c.target); | 1537 GLenum target = static_cast<GLenum>(c.target); |
1520 GLenum format = static_cast<GLenum>(c.format); | 1538 GLenum format = static_cast<GLenum>(c.format); |
1521 GLenum pname = static_cast<GLenum>(c.pname); | 1539 GLenum pname = static_cast<GLenum>(c.pname); |
1522 GLsizei bufSize = static_cast<GLsizei>(c.bufSize); | 1540 GLsizei bufSize = static_cast<GLsizei>(c.bufSize); |
1523 typedef cmds::GetInternalformativ::Result Result; | 1541 typedef cmds::GetInternalformativ::Result Result; |
1524 GLsizei num_values = 0; | 1542 GLsizei num_values = 0; |
1525 GetNumValuesReturnedForGLGet(pname, &num_values); | 1543 GetNumValuesReturnedForGLGet(pname, &num_values); |
1526 Result* result = GetSharedMemoryAs<Result*>( | 1544 Result* result = GetSharedMemoryAs<Result*>( |
1527 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1545 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1528 GLint* params = result ? result->GetData() : NULL; | 1546 GLint* params = result ? result->GetData() : NULL; |
1529 if (bufSize < 0) { | |
1530 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glGetInternalformativ", | |
1531 "bufSize < 0"); | |
1532 return error::kNoError; | |
1533 } | |
1534 if (params == NULL) { | 1547 if (params == NULL) { |
1535 return error::kOutOfBounds; | 1548 return error::kOutOfBounds; |
1536 } | 1549 } |
1537 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetInternalformativ"); | 1550 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetInternalformativ"); |
1538 // Check that the client initialized the result. | 1551 // Check that the client initialized the result. |
1539 if (result->size != 0) { | 1552 if (result->size != 0) { |
1540 return error::kInvalidArguments; | 1553 return error::kInvalidArguments; |
1541 } | 1554 } |
1542 glGetInternalformativ(target, format, pname, bufSize, params); | 1555 glGetInternalformativ(target, format, pname, bufSize, params); |
1543 GLenum error = glGetError(); | 1556 GLenum error = glGetError(); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 } | 1984 } |
1972 const GLenum* attachments = | 1985 const GLenum* attachments = |
1973 GetImmediateDataAs<const GLenum*>(c, data_size, immediate_data_size); | 1986 GetImmediateDataAs<const GLenum*>(c, data_size, immediate_data_size); |
1974 GLint x = static_cast<GLint>(c.x); | 1987 GLint x = static_cast<GLint>(c.x); |
1975 GLint y = static_cast<GLint>(c.y); | 1988 GLint y = static_cast<GLint>(c.y); |
1976 GLsizei width = static_cast<GLsizei>(c.width); | 1989 GLsizei width = static_cast<GLsizei>(c.width); |
1977 GLsizei height = static_cast<GLsizei>(c.height); | 1990 GLsizei height = static_cast<GLsizei>(c.height); |
1978 if (attachments == NULL) { | 1991 if (attachments == NULL) { |
1979 return error::kOutOfBounds; | 1992 return error::kOutOfBounds; |
1980 } | 1993 } |
1981 if (width < 0) { | |
1982 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", | |
1983 "width < 0"); | |
1984 return error::kNoError; | |
1985 } | |
1986 if (height < 0) { | |
1987 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", | |
1988 "height < 0"); | |
1989 return error::kNoError; | |
1990 } | |
1991 glInvalidateSubFramebuffer(target, count, attachments, x, y, width, height); | 1994 glInvalidateSubFramebuffer(target, count, attachments, x, y, width, height); |
1992 return error::kNoError; | 1995 return error::kNoError; |
1993 } | 1996 } |
1994 | 1997 |
1995 error::Error GLES2DecoderImpl::HandleIsBuffer(uint32_t immediate_data_size, | 1998 error::Error GLES2DecoderImpl::HandleIsBuffer(uint32_t immediate_data_size, |
1996 const void* cmd_data) { | 1999 const void* cmd_data) { |
1997 const gles2::cmds::IsBuffer& c = | 2000 const gles2::cmds::IsBuffer& c = |
1998 *static_cast<const gles2::cmds::IsBuffer*>(cmd_data); | 2001 *static_cast<const gles2::cmds::IsBuffer*>(cmd_data); |
1999 (void)c; | 2002 (void)c; |
2000 GLuint buffer = c.buffer; | 2003 GLuint buffer = c.buffer; |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 return error::kUnknownCommand; | 2795 return error::kUnknownCommand; |
2793 const gles2::cmds::TexStorage3D& c = | 2796 const gles2::cmds::TexStorage3D& c = |
2794 *static_cast<const gles2::cmds::TexStorage3D*>(cmd_data); | 2797 *static_cast<const gles2::cmds::TexStorage3D*>(cmd_data); |
2795 (void)c; | 2798 (void)c; |
2796 GLenum target = static_cast<GLenum>(c.target); | 2799 GLenum target = static_cast<GLenum>(c.target); |
2797 GLsizei levels = static_cast<GLsizei>(c.levels); | 2800 GLsizei levels = static_cast<GLsizei>(c.levels); |
2798 GLenum internalFormat = static_cast<GLenum>(c.internalFormat); | 2801 GLenum internalFormat = static_cast<GLenum>(c.internalFormat); |
2799 GLsizei width = static_cast<GLsizei>(c.width); | 2802 GLsizei width = static_cast<GLsizei>(c.width); |
2800 GLsizei height = static_cast<GLsizei>(c.height); | 2803 GLsizei height = static_cast<GLsizei>(c.height); |
2801 GLsizei depth = static_cast<GLsizei>(c.depth); | 2804 GLsizei depth = static_cast<GLsizei>(c.depth); |
2802 if (levels < 0) { | |
2803 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0"); | |
2804 return error::kNoError; | |
2805 } | |
2806 if (width < 0) { | |
2807 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexStorage3D", "width < 0"); | |
2808 return error::kNoError; | |
2809 } | |
2810 if (height < 0) { | |
2811 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexStorage3D", "height < 0"); | |
2812 return error::kNoError; | |
2813 } | |
2814 if (depth < 0) { | |
2815 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0"); | |
2816 return error::kNoError; | |
2817 } | |
2818 glTexStorage3D(target, levels, internalFormat, width, height, depth); | 2805 glTexStorage3D(target, levels, internalFormat, width, height, depth); |
2819 return error::kNoError; | 2806 return error::kNoError; |
2820 } | 2807 } |
2821 | 2808 |
| 2809 error::Error GLES2DecoderImpl::HandleTransformFeedbackVaryingsBucket( |
| 2810 uint32_t immediate_data_size, |
| 2811 const void* cmd_data) { |
| 2812 if (!unsafe_es3_apis_enabled()) |
| 2813 return error::kUnknownCommand; |
| 2814 const gles2::cmds::TransformFeedbackVaryingsBucket& c = |
| 2815 *static_cast<const gles2::cmds::TransformFeedbackVaryingsBucket*>( |
| 2816 cmd_data); |
| 2817 (void)c; |
| 2818 GLuint program = static_cast<GLuint>(c.program); |
| 2819 |
| 2820 const size_t kMinBucketSize = sizeof(GLint); |
| 2821 // Each string has at least |length| in the header and a NUL character. |
| 2822 const size_t kMinStringSize = sizeof(GLint) + 1; |
| 2823 Bucket* bucket = GetBucket(c.varyings_bucket_id); |
| 2824 if (!bucket) { |
| 2825 return error::kInvalidArguments; |
| 2826 } |
| 2827 const size_t bucket_size = bucket->size(); |
| 2828 if (bucket_size < kMinBucketSize) { |
| 2829 return error::kInvalidArguments; |
| 2830 } |
| 2831 const char* bucket_data = bucket->GetDataAs<const char*>(0, bucket_size); |
| 2832 const GLint* header = reinterpret_cast<const GLint*>(bucket_data); |
| 2833 GLsizei count = static_cast<GLsizei>(header[0]); |
| 2834 if (count < 0) { |
| 2835 return error::kInvalidArguments; |
| 2836 } |
| 2837 const size_t max_count = (bucket_size - kMinBucketSize) / kMinStringSize; |
| 2838 if (max_count < static_cast<size_t>(count)) { |
| 2839 return error::kInvalidArguments; |
| 2840 } |
| 2841 const GLint* length = header + 1; |
| 2842 scoped_ptr<const char* []> strs; |
| 2843 if (count > 0) |
| 2844 strs.reset(new const char* [count]); |
| 2845 const char** varyings = strs.get(); |
| 2846 base::CheckedNumeric<size_t> total_size = sizeof(GLint); |
| 2847 total_size *= count + 1; // Header size. |
| 2848 if (!total_size.IsValid()) |
| 2849 return error::kInvalidArguments; |
| 2850 for (GLsizei ii = 0; ii < count; ++ii) { |
| 2851 varyings[ii] = bucket_data + total_size.ValueOrDefault(0); |
| 2852 total_size += length[ii]; |
| 2853 total_size += 1; // NUL char at the end of each char array. |
| 2854 if (!total_size.IsValid() || total_size.ValueOrDefault(0) > bucket_size || |
| 2855 varyings[ii][length[ii]] != 0) { |
| 2856 return error::kInvalidArguments; |
| 2857 } |
| 2858 } |
| 2859 if (total_size.ValueOrDefault(0) != bucket_size) { |
| 2860 return error::kInvalidArguments; |
| 2861 } |
| 2862 GLenum buffermode = static_cast<GLenum>(c.buffermode); |
| 2863 DoTransformFeedbackVaryings(program, count, varyings, buffermode); |
| 2864 return error::kNoError; |
| 2865 } |
| 2866 |
2822 error::Error GLES2DecoderImpl::HandleUniform1f(uint32_t immediate_data_size, | 2867 error::Error GLES2DecoderImpl::HandleUniform1f(uint32_t immediate_data_size, |
2823 const void* cmd_data) { | 2868 const void* cmd_data) { |
2824 const gles2::cmds::Uniform1f& c = | 2869 const gles2::cmds::Uniform1f& c = |
2825 *static_cast<const gles2::cmds::Uniform1f*>(cmd_data); | 2870 *static_cast<const gles2::cmds::Uniform1f*>(cmd_data); |
2826 (void)c; | 2871 (void)c; |
2827 GLint location = static_cast<GLint>(c.location); | 2872 GLint location = static_cast<GLint>(c.location); |
2828 GLfloat x = static_cast<GLfloat>(c.x); | 2873 GLfloat x = static_cast<GLfloat>(c.x); |
2829 GLfloat temp[1] = { | 2874 GLfloat temp[1] = { |
2830 x, | 2875 x, |
2831 }; | 2876 }; |
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4828 state_.ignore_cached_state) { | 4873 state_.ignore_cached_state) { |
4829 framebuffer_state_.clear_state_dirty = true; | 4874 framebuffer_state_.clear_state_dirty = true; |
4830 } | 4875 } |
4831 return false; | 4876 return false; |
4832 default: | 4877 default: |
4833 NOTREACHED(); | 4878 NOTREACHED(); |
4834 return false; | 4879 return false; |
4835 } | 4880 } |
4836 } | 4881 } |
4837 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ | 4882 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ |
OLD | NEW |