OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
| 7 |
| 8 #include <array> |
| 9 |
| 10 #include "base/containers/hash_tables.h" |
| 11 #include "base/macros.h" |
| 12 #include "gpu/command_buffer/service/feature_info.h" |
| 13 #include "gpu/command_buffer/service/gl_utils.h" |
| 14 #include "gpu/gpu_export.h" |
| 15 |
| 16 namespace gpu { |
| 17 namespace gles2 { |
| 18 |
| 19 class GLES2Decoder; |
| 20 |
| 21 // This class encapsulates the resources required to implement the |
| 22 // glBlitFramebuffer command, which somtimes requires to convert sRGB |
| 23 // to linear (RGBA) color format, or vice versa. |
| 24 class GPU_EXPORT SRGBConverter { |
| 25 public: |
| 26 explicit SRGBConverter(const gles2::FeatureInfo* feature_info); |
| 27 ~SRGBConverter(); |
| 28 |
| 29 void InitializeSRGBDecoder(const gles2::GLES2Decoder* decoder); |
| 30 void InitializeSRGBEncoder(const gles2::GLES2Decoder* decoder); |
| 31 void Destroy(); |
| 32 |
| 33 void SRGBToLinear( |
| 34 const gles2::GLES2Decoder* decoder, |
| 35 GLint srcX0, |
| 36 GLint srcY0, |
| 37 GLint srcX1, |
| 38 GLint srcY1, |
| 39 GLint dstX0, |
| 40 GLint dstY0, |
| 41 GLint dstX1, |
| 42 GLint dstY1, |
| 43 GLbitfield mask, |
| 44 GLenum filter, |
| 45 const gfx::Size& framebuffer_size, |
| 46 GLuint src_framebuffer, |
| 47 GLenum src_framebuffer_internal_format, |
| 48 GLuint dst_framebuffer, |
| 49 GLenum dst_framebuffer_internal_format, |
| 50 GLenum dst_framebuffer_format, |
| 51 GLenum dst_framebuffer_type); |
| 52 |
| 53 void LinearToSRGB( |
| 54 const gles2::GLES2Decoder* decoder, |
| 55 GLint srcX0, |
| 56 GLint srcY0, |
| 57 GLint srcX1, |
| 58 GLint srcY1, |
| 59 GLint dstX0, |
| 60 GLint dstY0, |
| 61 GLint dstX1, |
| 62 GLint dstY1, |
| 63 GLbitfield mask, |
| 64 GLenum filter, |
| 65 const gfx::Size& framebuffer_size, |
| 66 GLuint src_framebuffer, |
| 67 GLenum src_framebuffer_internal_format, |
| 68 GLuint dst_framebuffer, |
| 69 GLenum dst_framebuffer_internal_format, |
| 70 GLenum dst_framebuffer_format, |
| 71 GLenum dst_framebuffer_type); |
| 72 |
| 73 private: |
| 74 scoped_refptr<const gles2::FeatureInfo> feature_info_; |
| 75 |
| 76 bool srgb_decoder_initialized_ = false; |
| 77 bool srgb_encoder_initialized_ = false; |
| 78 |
| 79 GLuint srgb_decoder_program_ = 0; |
| 80 GLuint srgb_encoder_program_ = 0; |
| 81 |
| 82 std::array<GLuint, 2> srgb_decoder_textures_ = {{0, 0}}; |
| 83 std::array<GLuint, 2> srgb_encoder_textures_ = {{0, 0}}; |
| 84 GLuint srgb_decoder_fbo_ = 0; |
| 85 GLuint srgb_encoder_fbo_ = 0; |
| 86 |
| 87 GLuint srgb_decoder_vao_ = 0; |
| 88 GLuint srgb_encoder_vao_ = 0; |
| 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(SRGBConverter); |
| 91 }; |
| 92 |
| 93 } // namespace gles2. |
| 94 } // namespace gpu. |
| 95 |
| 96 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
OLD | NEW |