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 InitializeSRGBConverterProgram(); |
| 30 void InitializeSRGBDecoder(const gles2::GLES2Decoder* decoder); |
| 31 void InitializeSRGBEncoder(const gles2::GLES2Decoder* decoder); |
| 32 void Destroy(); |
| 33 |
| 34 void SRGBToLinear( |
| 35 const gles2::GLES2Decoder* decoder, |
| 36 GLint srcX0, |
| 37 GLint srcY0, |
| 38 GLint srcX1, |
| 39 GLint srcY1, |
| 40 GLint dstX0, |
| 41 GLint dstY0, |
| 42 GLint dstX1, |
| 43 GLint dstY1, |
| 44 GLbitfield mask, |
| 45 GLenum filter, |
| 46 const gfx::Size& framebuffer_size, |
| 47 GLuint src_framebuffer, |
| 48 GLenum src_framebuffer_internal_format, |
| 49 GLuint dst_framebuffer); |
| 50 |
| 51 void LinearToSRGB( |
| 52 const gles2::GLES2Decoder* decoder, |
| 53 GLint srcX0, |
| 54 GLint srcY0, |
| 55 GLint srcX1, |
| 56 GLint srcY1, |
| 57 GLint dstX0, |
| 58 GLint dstY0, |
| 59 GLint dstX1, |
| 60 GLint dstY1, |
| 61 GLbitfield mask, |
| 62 GLenum filter, |
| 63 GLuint src_framebuffer, |
| 64 GLenum src_framebuffer_internal_format, |
| 65 GLenum src_framebuffer_format, |
| 66 GLenum src_framebuffer_type, |
| 67 GLuint dst_framebuffer); |
| 68 |
| 69 void SRGBToSRGB( |
| 70 const gles2::GLES2Decoder* decoder, |
| 71 GLint srcX0, |
| 72 GLint srcY0, |
| 73 GLint srcX1, |
| 74 GLint srcY1, |
| 75 GLint dstX0, |
| 76 GLint dstY0, |
| 77 GLint dstX1, |
| 78 GLint dstY1, |
| 79 GLbitfield mask, |
| 80 GLenum filter, |
| 81 const gfx::Size& framebuffer_size, |
| 82 GLuint src_framebuffer, |
| 83 GLenum src_framebuffer_internal_format, |
| 84 GLuint dst_framebuffer); |
| 85 |
| 86 private: |
| 87 scoped_refptr<const gles2::FeatureInfo> feature_info_; |
| 88 |
| 89 bool srgb_decoder_initialized_ = false; |
| 90 bool srgb_encoder_initialized_ = false; |
| 91 |
| 92 GLuint srgb_converter_program_ = 0; |
| 93 |
| 94 std::array<GLuint, 2> srgb_decoder_textures_ = {{0, 0}}; |
| 95 std::array<GLuint, 1> srgb_encoder_textures_ = {{0}}; |
| 96 GLuint srgb_decoder_fbo_ = 0; |
| 97 GLuint srgb_encoder_fbo_ = 0; |
| 98 |
| 99 GLuint srgb_decoder_vao_ = 0; |
| 100 GLuint srgb_encoder_vao_ = 0; |
| 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(SRGBConverter); |
| 103 }; |
| 104 |
| 105 } // namespace gles2. |
| 106 } // namespace gpu. |
| 107 |
| 108 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
OLD | NEW |