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 <cmath> | 10 #include <cmath> |
(...skipping 5050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5061 // Therefore if an error occurs we swallow the error and use the | 5061 // Therefore if an error occurs we swallow the error and use the |
5062 // internal implementation. | 5062 // internal implementation. |
5063 if (params) { | 5063 if (params) { |
5064 if (context_->HasExtension("GL_OES_read_format")) { | 5064 if (context_->HasExtension("GL_OES_read_format")) { |
5065 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5065 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
5066 GetErrorState()); | 5066 GetErrorState()); |
5067 glGetIntegerv(pname, params); | 5067 glGetIntegerv(pname, params); |
5068 if (glGetError() == GL_NO_ERROR) | 5068 if (glGetError() == GL_NO_ERROR) |
5069 return true; | 5069 return true; |
5070 } | 5070 } |
5071 *params = GLES2Util::GetPreferredGLReadPixelsFormat( | 5071 *params = GLES2Util::GetGLReadPixelsImplementationFormat( |
5072 GetBoundReadFrameBufferInternalFormat()); | 5072 GetBoundReadFrameBufferInternalFormat()); |
5073 } | 5073 } |
5074 return true; | 5074 return true; |
5075 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 5075 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
5076 *num_written = 1; | 5076 *num_written = 1; |
5077 if (params) { | 5077 if (params) { |
5078 if (context_->HasExtension("GL_OES_read_format")) { | 5078 if (context_->HasExtension("GL_OES_read_format")) { |
5079 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5079 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
5080 GetErrorState()); | 5080 GetErrorState()); |
5081 glGetIntegerv(pname, params); | 5081 glGetIntegerv(pname, params); |
5082 if (glGetError() == GL_NO_ERROR) | 5082 if (glGetError() == GL_NO_ERROR) |
5083 return true; | 5083 return true; |
5084 } | 5084 } |
5085 *params = GLES2Util::GetPreferredGLReadPixelsType( | 5085 *params = GLES2Util::GetGLReadPixelsImplementationType( |
5086 GetBoundReadFrameBufferInternalFormat(), | 5086 GetBoundReadFrameBufferInternalFormat(), |
5087 GetBoundReadFrameBufferTextureType()); | 5087 GetBoundReadFrameBufferTextureType()); |
5088 } | 5088 } |
5089 return true; | 5089 return true; |
5090 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: | 5090 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: |
5091 *num_written = 1; | 5091 *num_written = 1; |
5092 if (params) { | 5092 if (params) { |
5093 *params = group_->max_fragment_uniform_vectors(); | 5093 *params = group_->max_fragment_uniform_vectors(); |
5094 } | 5094 } |
5095 return true; | 5095 return true; |
(...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8747 | 8747 |
8748 GLenum src_internal_format = GetBoundReadFrameBufferInternalFormat(); | 8748 GLenum src_internal_format = GetBoundReadFrameBufferInternalFormat(); |
8749 if (src_internal_format == 0) { | 8749 if (src_internal_format == 0) { |
8750 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", | 8750 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", |
8751 "no valid read buffer source"); | 8751 "no valid read buffer source"); |
8752 return error::kNoError; | 8752 return error::kNoError; |
8753 } | 8753 } |
8754 std::vector<GLenum> accepted_formats; | 8754 std::vector<GLenum> accepted_formats; |
8755 std::vector<GLenum> accepted_types; | 8755 std::vector<GLenum> accepted_types; |
8756 switch (src_internal_format) { | 8756 switch (src_internal_format) { |
8757 case GL_RGB10_A2UI: | |
8758 accepted_formats.push_back(GL_RGBA); | |
8759 accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV); | |
8760 case GL_R8UI: | 8757 case GL_R8UI: |
8761 case GL_R16UI: | 8758 case GL_R16UI: |
8762 case GL_R32UI: | 8759 case GL_R32UI: |
8763 case GL_RG8UI: | 8760 case GL_RG8UI: |
8764 case GL_RG16UI: | 8761 case GL_RG16UI: |
8765 case GL_RG32UI: | 8762 case GL_RG32UI: |
8766 // All the RGB_INTEGER formats are not renderable. | 8763 // All the RGB_INTEGER formats are not renderable. |
8767 case GL_RGBA8UI: | 8764 case GL_RGBA8UI: |
| 8765 case GL_RGB10_A2UI: |
8768 case GL_RGBA16UI: | 8766 case GL_RGBA16UI: |
8769 case GL_RGBA32UI: | 8767 case GL_RGBA32UI: |
8770 accepted_formats.push_back(GL_RGBA_INTEGER); | 8768 accepted_formats.push_back(GL_RGBA_INTEGER); |
8771 accepted_types.push_back(GL_UNSIGNED_INT); | 8769 accepted_types.push_back(GL_UNSIGNED_INT); |
8772 break; | 8770 break; |
8773 case GL_R8I: | 8771 case GL_R8I: |
8774 case GL_R16I: | 8772 case GL_R16I: |
8775 case GL_R32I: | 8773 case GL_R32I: |
8776 case GL_RG8I: | 8774 case GL_RG8I: |
8777 case GL_RG16I: | 8775 case GL_RG16I: |
8778 case GL_RG32I: | 8776 case GL_RG32I: |
8779 case GL_RGBA8I: | 8777 case GL_RGBA8I: |
8780 case GL_RGBA16I: | 8778 case GL_RGBA16I: |
8781 case GL_RGBA32I: | 8779 case GL_RGBA32I: |
8782 accepted_formats.push_back(GL_RGBA_INTEGER); | 8780 accepted_formats.push_back(GL_RGBA_INTEGER); |
8783 accepted_types.push_back(GL_INT); | 8781 accepted_types.push_back(GL_INT); |
8784 break; | 8782 break; |
| 8783 case GL_RGB10_A2: |
| 8784 accepted_formats.push_back(GL_RGBA); |
| 8785 accepted_types.push_back(GL_UNSIGNED_BYTE); |
| 8786 // Special case with an extra supported format/type. |
| 8787 accepted_formats.push_back(GL_RGBA); |
| 8788 accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV); |
| 8789 break; |
8785 default: | 8790 default: |
8786 accepted_formats.push_back(GL_RGBA); | 8791 accepted_formats.push_back(GL_RGBA); |
8787 { | 8792 { |
8788 GLenum src_type = GetBoundReadFrameBufferTextureType(); | 8793 GLenum src_type = GetBoundReadFrameBufferTextureType(); |
8789 switch (src_type) { | 8794 switch (src_type) { |
8790 case GL_HALF_FLOAT: | 8795 case GL_HALF_FLOAT: |
8791 case GL_HALF_FLOAT_OES: | 8796 case GL_HALF_FLOAT_OES: |
8792 case GL_FLOAT: | 8797 case GL_FLOAT: |
8793 case GL_UNSIGNED_INT_10F_11F_11F_REV: | 8798 case GL_UNSIGNED_INT_10F_11F_11F_REV: |
8794 accepted_types.push_back(GL_FLOAT); | 8799 if (!feature_info_->IsES3Enabled()) { |
| 8800 accepted_types.push_back(GL_UNSIGNED_BYTE); |
| 8801 } else { |
| 8802 accepted_types.push_back(GL_FLOAT); |
| 8803 } |
8795 break; | 8804 break; |
8796 default: | 8805 default: |
8797 accepted_types.push_back(GL_UNSIGNED_BYTE); | 8806 accepted_types.push_back(GL_UNSIGNED_BYTE); |
8798 break; | 8807 break; |
8799 } | 8808 } |
8800 } | 8809 } |
8801 break; | 8810 break; |
8802 } | 8811 } |
8803 if (!IsWebGLContext()) { | 8812 if (!IsWebGLContext()) { |
8804 accepted_formats.push_back(GL_BGRA_EXT); | 8813 accepted_formats.push_back(GL_BGRA_EXT); |
(...skipping 6253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15058 return error::kNoError; | 15067 return error::kNoError; |
15059 } | 15068 } |
15060 | 15069 |
15061 // Include the auto-generated part of this file. We split this because it means | 15070 // Include the auto-generated part of this file. We split this because it means |
15062 // we can easily edit the non-auto generated parts right here in this file | 15071 // we can easily edit the non-auto generated parts right here in this file |
15063 // instead of having to edit some template or the code generator. | 15072 // instead of having to edit some template or the code generator. |
15064 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15073 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15065 | 15074 |
15066 } // namespace gles2 | 15075 } // namespace gles2 |
15067 } // namespace gpu | 15076 } // namespace gpu |
OLD | NEW |