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

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

Issue 18246005: Add EXT_color_buffer_half_float extension support in GPU commandbuffer service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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 <list> 10 #include <list>
(...skipping 6790 matching lines...) Expand 10 before | Expand all | Expand 10 after
6801 } 6801 }
6802 break; 6802 break;
6803 } 6803 }
6804 default: 6804 default:
6805 break; 6805 break;
6806 } 6806 }
6807 } 6807 }
6808 } 6808 }
6809 6809
6810 6810
6811 static inline GLenum GetTexType(GLenum type) {
6812 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
6813 if (type == GL_HALF_FLOAT_OES)
6814 return GL_HALF_FLOAT_ARB;
6815 }
6816 return type;
6817 }
6818
6811 error::Error GLES2DecoderImpl::HandleReadPixels( 6819 error::Error GLES2DecoderImpl::HandleReadPixels(
6812 uint32 immediate_data_size, const cmds::ReadPixels& c) { 6820 uint32 immediate_data_size, const cmds::ReadPixels& c) {
6813 if (ShouldDeferReads()) 6821 if (ShouldDeferReads())
6814 return error::kDeferCommandUntilLater; 6822 return error::kDeferCommandUntilLater;
6815 GLint x = c.x; 6823 GLint x = c.x;
6816 GLint y = c.y; 6824 GLint y = c.y;
6817 GLsizei width = c.width; 6825 GLsizei width = c.width;
6818 GLsizei height = c.height; 6826 GLsizei height = c.height;
6819 GLenum format = c.format; 6827 GLenum format = c.format;
6820 GLenum type = c.type; 6828 GLenum type = c.type;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
6906 GLint read_width = read_end_x - read_x; 6914 GLint read_width = read_end_x - read_x;
6907 for (GLint yy = 0; yy < height; ++yy) { 6915 for (GLint yy = 0; yy < height; ++yy) {
6908 GLint ry = y + yy; 6916 GLint ry = y + yy;
6909 6917
6910 // Clear the row. 6918 // Clear the row.
6911 memset(dst, 0, unpadded_row_size); 6919 memset(dst, 0, unpadded_row_size);
6912 6920
6913 // If the row is in range, copy it. 6921 // If the row is in range, copy it.
6914 if (ry >= 0 && ry < max_size.height() && read_width > 0) { 6922 if (ry >= 0 && ry < max_size.height() && read_width > 0) {
6915 glReadPixels( 6923 glReadPixels(
6916 read_x, ry, read_width, 1, format, type, dst + dest_row_offset); 6924 read_x, ry, read_width, 1, format, GetTexType(type),
6925 dst + dest_row_offset);
6917 } 6926 }
6918 dst += padded_row_size; 6927 dst += padded_row_size;
6919 } 6928 }
6920 } else { 6929 } else {
6921 if (async && features().use_async_readpixels) { 6930 if (async && features().use_async_readpixels) {
6922 GLuint buffer; 6931 GLuint buffer;
6923 glGenBuffersARB(1, &buffer); 6932 glGenBuffersARB(1, &buffer);
6924 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); 6933 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer);
6925 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, GL_STREAM_READ); 6934 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, GL_STREAM_READ);
6926 GLenum error = glGetError(); 6935 GLenum error = glGetError();
6927 if (error == GL_NO_ERROR) { 6936 if (error == GL_NO_ERROR) {
6928 glReadPixels(x, y, width, height, format, type, 0); 6937 glReadPixels(x, y, width, height, format, GetTexType(type), 0);
6929 pending_readpixel_fences_.push(linked_ptr<FenceCallback>( 6938 pending_readpixel_fences_.push(linked_ptr<FenceCallback>(
6930 new FenceCallback())); 6939 new FenceCallback()));
6931 WaitForReadPixels(base::Bind( 6940 WaitForReadPixels(base::Bind(
6932 &GLES2DecoderImpl::FinishReadPixels, 6941 &GLES2DecoderImpl::FinishReadPixels,
6933 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr 6942 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
6934 <GLES2DecoderImpl>(this), 6943 <GLES2DecoderImpl>(this),
6935 c, buffer)); 6944 c, buffer));
6936 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0); 6945 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0);
6937 return error::kNoError; 6946 return error::kNoError;
6938 } 6947 }
6939 } 6948 }
6940 glReadPixels(x, y, width, height, format, type, pixels); 6949 glReadPixels(x, y, width, height, format, GetTexType(type), pixels);
6941 } 6950 }
6942 GLenum error = LOCAL_PEEK_GL_ERROR("glReadPixels"); 6951 GLenum error = LOCAL_PEEK_GL_ERROR("glReadPixels");
6943 if (error == GL_NO_ERROR) { 6952 if (error == GL_NO_ERROR) {
6944 if (result != NULL) { 6953 if (result != NULL) {
6945 *result = true; 6954 *result = true;
6946 } 6955 }
6947 FinishReadPixels(c, 0); 6956 FinishReadPixels(c, 0);
6948 } 6957 }
6949 6958
6950 return error::kNoError; 6959 return error::kNoError;
(...skipping 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after
10449 return error::kNoError; 10458 return error::kNoError;
10450 } 10459 }
10451 10460
10452 // Include the auto-generated part of this file. We split this because it means 10461 // Include the auto-generated part of this file. We split this because it means
10453 // we can easily edit the non-auto generated parts right here in this file 10462 // we can easily edit the non-auto generated parts right here in this file
10454 // instead of having to edit some template or the code generator. 10463 // instead of having to edit some template or the code generator.
10455 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10464 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10456 10465
10457 } // namespace gles2 10466 } // namespace gles2
10458 } // namespace gpu 10467 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698