Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1308313008: Fix ReadPixels implementation specific read format/type on desktop GL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clear
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8734 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698