Index: gpu/command_buffer/service/gles2_cmd_srgb_converter.h |
diff --git a/gpu/command_buffer/service/gles2_cmd_srgb_converter.h b/gpu/command_buffer/service/gles2_cmd_srgb_converter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9d4c72290fc983b2ec2bb9811a3c22652b49f64 |
--- /dev/null |
+++ b/gpu/command_buffer/service/gles2_cmd_srgb_converter.h |
@@ -0,0 +1,97 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
+#define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
+ |
+#include <array> |
+ |
+#include "base/containers/hash_tables.h" |
+#include "base/macros.h" |
+#include "gpu/command_buffer/service/feature_info.h" |
+#include "gpu/command_buffer/service/gl_utils.h" |
+#include "gpu/gpu_export.h" |
+ |
+namespace gpu { |
+namespace gles2 { |
yunchao
2016/08/29 14:33:47
I wonder that why some classes are not under the g
Zhenyao Mo
2016/08/29 23:36:50
I think they should be under gpu/gles2, including
yunchao
2016/08/31 09:18:45
Done.
|
+ |
+class GLES2Decoder; |
+ |
+} // namespace gles2. |
+ |
+// This class encapsulates the resources required to implement the |
+// glBlitFramebuffer command, which somtimes requires to convert sRGB |
+// to linear (RGBA) color format, or vice versa. |
+class GPU_EXPORT SRGBConverter { |
+ public: |
+ explicit SRGBConverter(const gles2::FeatureInfo* feature_info); |
+ ~SRGBConverter(); |
+ |
+ void InitializeSRGBDecoder(const gles2::GLES2Decoder* decoder); |
+ void InitializeSRGBEncoder(const gles2::GLES2Decoder* decoder); |
+ void Destroy(); |
+ |
+ void SRGBToLinear( |
+ const gles2::GLES2Decoder* decoder, |
+ GLint srcX0, |
+ GLint srcY0, |
+ GLint srcX1, |
+ GLint srcY1, |
+ GLint dstX0, |
+ GLint dstY0, |
+ GLint dstX1, |
+ GLint dstY1, |
+ GLbitfield mask, |
+ GLenum filter, |
+ const gfx::Size& framebuffer_size, |
+ GLuint src_framebuffer, |
+ GLenum src_framebuffer_internal_format, |
+ GLuint dst_framebuffer, |
+ GLenum dst_framebuffer_internal_format, |
+ GLenum dst_framebuffer_format, |
+ GLenum dst_framebuffer_type); |
+ |
+ void LinearToSRGB( |
+ const gles2::GLES2Decoder* decoder, |
+ GLint srcX0, |
+ GLint srcY0, |
+ GLint srcX1, |
+ GLint srcY1, |
+ GLint dstX0, |
+ GLint dstY0, |
+ GLint dstX1, |
+ GLint dstY1, |
+ GLbitfield mask, |
+ GLenum filter, |
+ const gfx::Size& framebuffer_size, |
+ GLuint src_framebuffer, |
+ GLenum src_framebuffer_internal_format, |
+ GLuint dst_framebuffer, |
+ GLenum dst_framebuffer_internal_format, |
+ GLenum dst_framebuffer_format, |
+ GLenum dst_framebuffer_type); |
+ |
+ private: |
+ scoped_refptr<const gles2::FeatureInfo> feature_info_; |
+ |
+ bool srgb_decoder_initialized_ = false; |
+ bool srgb_encoder_initialized_ = false; |
+ |
+ GLuint srgb_decoder_program_ = 0; |
+ GLuint srgb_encoder_program_ = 0; |
+ |
+ std::array<GLuint, 2> srgb_decoder_textures_ = {{0, 0}}; |
+ std::array<GLuint, 2> srgb_encoder_textures_ = {{0, 0}}; |
+ GLuint srgb_decoder_fbo_ = 0; |
+ GLuint srgb_encoder_fbo_ = 0; |
+ |
+ GLuint srgb_decoder_vao_ = 0; |
+ GLuint srgb_encoder_vao_ = 0; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SRGBConverter); |
+}; |
+ |
+} // namespace gpu. |
+ |
+#endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |