Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_srgb_converter.h

Issue 2286593002: [Command Buffer] emulate SRGB color format for BlitFramebuffer in OpenGL (Closed)
Patch Set: addressed piman@'s feedbacks, and rebased code Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698