Chromium Code Reviews| 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 5048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5059 // Therefore if an error occurs we swallow the error and use the | 5059 // Therefore if an error occurs we swallow the error and use the |
| 5060 // internal implementation. | 5060 // internal implementation. |
| 5061 if (params) { | 5061 if (params) { |
| 5062 if (context_->HasExtension("GL_OES_read_format")) { | 5062 if (context_->HasExtension("GL_OES_read_format")) { |
| 5063 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5063 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
| 5064 GetErrorState()); | 5064 GetErrorState()); |
| 5065 glGetIntegerv(pname, params); | 5065 glGetIntegerv(pname, params); |
| 5066 if (glGetError() == GL_NO_ERROR) | 5066 if (glGetError() == GL_NO_ERROR) |
| 5067 return true; | 5067 return true; |
| 5068 } | 5068 } |
| 5069 *params = GLES2Util::GetPreferredGLReadPixelsFormat( | 5069 *params = GLES2Util::GetGLReadPixelsImplementationFormat( |
| 5070 GetBoundReadFrameBufferInternalFormat()); | 5070 GetBoundReadFrameBufferInternalFormat()); |
| 5071 } | 5071 } |
| 5072 return true; | 5072 return true; |
| 5073 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 5073 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
| 5074 *num_written = 1; | 5074 *num_written = 1; |
| 5075 if (params) { | 5075 if (params) { |
| 5076 if (context_->HasExtension("GL_OES_read_format")) { | 5076 if (context_->HasExtension("GL_OES_read_format")) { |
| 5077 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5077 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
| 5078 GetErrorState()); | 5078 GetErrorState()); |
| 5079 glGetIntegerv(pname, params); | 5079 glGetIntegerv(pname, params); |
| 5080 if (glGetError() == GL_NO_ERROR) | 5080 if (glGetError() == GL_NO_ERROR) |
| 5081 return true; | 5081 return true; |
| 5082 } | 5082 } |
| 5083 *params = GLES2Util::GetPreferredGLReadPixelsType( | 5083 *params = GLES2Util::GetGLReadPixelsImplementationType( |
| 5084 GetBoundReadFrameBufferInternalFormat(), | 5084 GetBoundReadFrameBufferInternalFormat(), |
| 5085 GetBoundReadFrameBufferTextureType()); | 5085 GetBoundReadFrameBufferTextureType()); |
| 5086 } | 5086 } |
| 5087 return true; | 5087 return true; |
| 5088 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: | 5088 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: |
| 5089 *num_written = 1; | 5089 *num_written = 1; |
| 5090 if (params) { | 5090 if (params) { |
| 5091 *params = group_->max_fragment_uniform_vectors(); | 5091 *params = group_->max_fragment_uniform_vectors(); |
| 5092 } | 5092 } |
| 5093 return true; | 5093 return true; |
| (...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8745 | 8745 |
| 8746 GLenum src_internal_format = GetBoundReadFrameBufferInternalFormat(); | 8746 GLenum src_internal_format = GetBoundReadFrameBufferInternalFormat(); |
| 8747 if (src_internal_format == 0) { | 8747 if (src_internal_format == 0) { |
| 8748 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", | 8748 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", |
| 8749 "no valid read buffer source"); | 8749 "no valid read buffer source"); |
| 8750 return error::kNoError; | 8750 return error::kNoError; |
| 8751 } | 8751 } |
| 8752 std::vector<GLenum> accepted_formats; | 8752 std::vector<GLenum> accepted_formats; |
| 8753 std::vector<GLenum> accepted_types; | 8753 std::vector<GLenum> accepted_types; |
| 8754 switch (src_internal_format) { | 8754 switch (src_internal_format) { |
| 8755 case GL_RGB10_A2UI: | |
| 8756 accepted_formats.push_back(GL_RGBA); | |
| 8757 accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV); | |
| 8758 case GL_R8UI: | 8755 case GL_R8UI: |
| 8759 case GL_R16UI: | 8756 case GL_R16UI: |
| 8760 case GL_R32UI: | 8757 case GL_R32UI: |
| 8761 case GL_RG8UI: | 8758 case GL_RG8UI: |
| 8762 case GL_RG16UI: | 8759 case GL_RG16UI: |
| 8763 case GL_RG32UI: | 8760 case GL_RG32UI: |
| 8764 // All the RGB_INTEGER formats are not renderable. | 8761 // All the RGB_INTEGER formats are not renderable. |
| 8765 case GL_RGBA8UI: | 8762 case GL_RGBA8UI: |
| 8763 case GL_RGB10_A2UI: | |
| 8766 case GL_RGBA16UI: | 8764 case GL_RGBA16UI: |
| 8767 case GL_RGBA32UI: | 8765 case GL_RGBA32UI: |
| 8768 accepted_formats.push_back(GL_RGBA_INTEGER); | 8766 accepted_formats.push_back(GL_RGBA_INTEGER); |
| 8769 accepted_types.push_back(GL_UNSIGNED_INT); | 8767 accepted_types.push_back(GL_UNSIGNED_INT); |
| 8770 break; | 8768 break; |
| 8771 case GL_R8I: | 8769 case GL_R8I: |
| 8772 case GL_R16I: | 8770 case GL_R16I: |
| 8773 case GL_R32I: | 8771 case GL_R32I: |
| 8774 case GL_RG8I: | 8772 case GL_RG8I: |
| 8775 case GL_RG16I: | 8773 case GL_RG16I: |
| 8776 case GL_RG32I: | 8774 case GL_RG32I: |
| 8777 case GL_RGBA8I: | 8775 case GL_RGBA8I: |
| 8778 case GL_RGBA16I: | 8776 case GL_RGBA16I: |
| 8779 case GL_RGBA32I: | 8777 case GL_RGBA32I: |
| 8780 accepted_formats.push_back(GL_RGBA_INTEGER); | 8778 accepted_formats.push_back(GL_RGBA_INTEGER); |
| 8781 accepted_types.push_back(GL_INT); | 8779 accepted_types.push_back(GL_INT); |
| 8782 break; | 8780 break; |
| 8781 case GL_RGB10_A2: | |
| 8782 accepted_formats.push_back(GL_RGBA); | |
| 8783 accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV); | |
|
bajones
2015/08/26 23:39:48
Don't we need a break right here?
Zhenyao Mo
2015/08/26 23:43:20
No, RGB10_A2 is special. It will supports three f
Zhenyao Mo
2015/08/26 23:48:20
Good point. I will explicitly push the RGBA/UNSIG
| |
| 8783 default: | 8784 default: |
| 8784 accepted_formats.push_back(GL_RGBA); | 8785 accepted_formats.push_back(GL_RGBA); |
| 8785 { | 8786 { |
| 8786 GLenum src_type = GetBoundReadFrameBufferTextureType(); | 8787 GLenum src_type = GetBoundReadFrameBufferTextureType(); |
| 8787 switch (src_type) { | 8788 switch (src_type) { |
| 8788 case GL_HALF_FLOAT: | 8789 case GL_HALF_FLOAT: |
| 8789 case GL_HALF_FLOAT_OES: | 8790 case GL_HALF_FLOAT_OES: |
| 8790 case GL_FLOAT: | 8791 case GL_FLOAT: |
| 8791 case GL_UNSIGNED_INT_10F_11F_11F_REV: | 8792 case GL_UNSIGNED_INT_10F_11F_11F_REV: |
| 8792 accepted_types.push_back(GL_FLOAT); | 8793 accepted_types.push_back(GL_FLOAT); |
| (...skipping 6261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15054 return error::kNoError; | 15055 return error::kNoError; |
| 15055 } | 15056 } |
| 15056 | 15057 |
| 15057 // Include the auto-generated part of this file. We split this because it means | 15058 // Include the auto-generated part of this file. We split this because it means |
| 15058 // we can easily edit the non-auto generated parts right here in this file | 15059 // we can easily edit the non-auto generated parts right here in this file |
| 15059 // instead of having to edit some template or the code generator. | 15060 // instead of having to edit some template or the code generator. |
| 15060 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15061 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15061 | 15062 |
| 15062 } // namespace gles2 | 15063 } // namespace gles2 |
| 15063 } // namespace gpu | 15064 } // namespace gpu |
| OLD | NEW |