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 |
| 50 void LinearToSRGB( |
| 51 const gles2::GLES2Decoder* decoder, |
| 52 GLint srcX0, |
| 53 GLint srcY0, |
| 54 GLint srcX1, |
| 55 GLint srcY1, |
| 56 GLint dstX0, |
| 57 GLint dstY0, |
| 58 GLint dstX1, |
| 59 GLint dstY1, |
| 60 GLbitfield mask, |
| 61 GLenum filter, |
| 62 GLuint src_framebuffer, |
| 63 GLenum src_framebuffer_internal_format, |
| 64 GLenum src_framebuffer_format, |
| 65 GLenum src_framebuffer_type, |
| 66 GLuint dst_framebuffer); |
| 67 |
| 68 private: |
| 69 scoped_refptr<const gles2::FeatureInfo> feature_info_; |
| 70 |
| 71 bool srgb_decoder_initialized_ = false; |
| 72 bool srgb_encoder_initialized_ = false; |
| 73 |
| 74 GLuint srgb_decoder_program_ = 0; |
| 75 GLuint srgb_encoder_program_ = 0; |
| 76 |
| 77 std::array<GLuint, 2> srgb_decoder_textures_ = {{0, 0}}; |
| 78 std::array<GLuint, 1> srgb_encoder_textures_ = {{0}}; |
| 79 GLuint srgb_decoder_fbo_ = 0; |
| 80 GLuint srgb_encoder_fbo_ = 0; |
| 81 |
| 82 GLuint srgb_decoder_vao_ = 0; |
| 83 GLuint srgb_encoder_vao_ = 0; |
| 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(SRGBConverter); |
| 86 }; |
| 87 |
| 88 } // namespace gles2. |
| 89 } // namespace gpu. |
| 90 |
| 91 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
OLD | NEW |