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 InitializeSRGBConverter(const gles2::GLES2Decoder* decoder); |
| 30 void Destroy(); |
| 31 |
| 32 void Blit( |
| 33 const gles2::GLES2Decoder* decoder, |
| 34 GLint srcX0, |
| 35 GLint srcY0, |
| 36 GLint srcX1, |
| 37 GLint srcY1, |
| 38 GLint dstX0, |
| 39 GLint dstY0, |
| 40 GLint dstX1, |
| 41 GLint dstY1, |
| 42 GLbitfield mask, |
| 43 GLenum filter, |
| 44 const gfx::Size& framebuffer_size, |
| 45 GLuint src_framebuffer, |
| 46 GLenum src_framebuffer_internal_format, |
| 47 GLenum src_framebuffer_format, |
| 48 GLenum src_framebuffer_type, |
| 49 GLuint dst_framebuffer, |
| 50 bool decode, |
| 51 bool encode); |
| 52 |
| 53 private: |
| 54 void InitializeSRGBConverterProgram(); |
| 55 scoped_refptr<const gles2::FeatureInfo> feature_info_; |
| 56 |
| 57 bool srgb_converter_initialized_ = false; |
| 58 |
| 59 GLuint srgb_converter_program_ = 0; |
| 60 |
| 61 std::array<GLuint, 2> srgb_converter_textures_ = {{0, 0}}; |
| 62 GLuint srgb_decoder_fbo_ = 0; |
| 63 GLuint srgb_encoder_fbo_ = 0; |
| 64 |
| 65 GLuint srgb_converter_vao_ = 0; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(SRGBConverter); |
| 68 }; |
| 69 |
| 70 } // namespace gles2. |
| 71 } // namespace gpu. |
| 72 |
| 73 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_SRGB_CONVERTER_H_ |
OLD | NEW |