OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 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_APPLY_FRAMEBUFFER_ATTACHMENT_CMAA_I NTEL_H_ | |
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_APPLY_FRAMEBUFFER_ATTACHMENT_CMAA_I NTEL_H_ | |
7 | |
8 #include "gpu/command_buffer/service/gl_utils.h" | |
9 #include "gpu/gpu_export.h" | |
10 | |
11 namespace { | |
12 class CMAAEffect; | |
13 } | |
14 | |
15 namespace gpu { | |
16 namespace gles2 { | |
17 class GLES2Decoder; | |
18 } | |
19 | |
20 // This class encapsulates the resources required to implement the | |
21 // GL_INTEL_framebuffer_CMAA extension via shaders. | |
22 // | |
23 // The CMAA Conservative Morphological Anti-Aliasing) algorithm is applied to | |
24 // all color attachments of the currently bound draw framebuffer. | |
25 // | |
26 // Reference GL_INTEL_framebuffer_CMAA for details. | |
27 class GPU_EXPORT ApplyFramebufferAttachmentCMAAINTELResourceManager { | |
28 public: | |
29 ApplyFramebufferAttachmentCMAAINTELResourceManager(); | |
30 ~ApplyFramebufferAttachmentCMAAINTELResourceManager(); | |
31 | |
32 void Initialize(const gles2::GLES2Decoder* decoder); | |
33 void Destroy(); | |
34 | |
35 // Applies the algorithm to the color attachments of the currently bound draw | |
36 // framebuffer. | |
37 void ApplyFramebufferAttachmentCMAAINTEL(const gles2::GLES2Decoder* decoder); | |
38 | |
39 private: | |
40 // Applies the CMAA algorithm to a texture. | |
41 void ApplyCMMAEffectTexture(float edge_detection_threshold, | |
42 GLuint source_texture, | |
43 GLuint dest_texture); | |
44 | |
45 void OnSize(GLint width, GLint height); | |
46 void ReleaseTextures(); | |
47 | |
48 void CopyTexture(GLint source, GLint dest, bool via_fbo); | |
49 GLuint CreateProgram(const char* defines, | |
50 const char* vs_source, | |
51 const char* fs_source); | |
52 GLuint CreateShader(GLenum type, const char* defines, const char* source); | |
53 | |
54 bool initialized_; | |
55 bool textures_initialized_; | |
56 bool is_in_gamma_correct_mode_; | |
57 bool supports_usampler_; | |
58 bool supports_r8_image_; | |
59 bool supports_r8_read_format_; | |
60 bool is_gles31_compatible; | |
piman
2016/06/13 22:24:43
nit: is_gles31_compatible_
adrian.belgun
2016/06/16 14:53:15
Done.
| |
61 | |
62 int frame_id_; | |
63 | |
64 GLint width_; | |
65 GLint height_; | |
66 | |
67 GLuint copy_to_framebuffer_shader_; | |
68 GLuint copy_to_image_shader_; | |
69 GLuint edges0_shader_; | |
70 GLuint edges1_shader_; | |
71 GLuint edges_combine_shader_; | |
72 GLuint process_and_apply_shader_; | |
73 GLuint debug_display_edges_shader_; | |
74 | |
75 GLuint cmaa_framebuffer_; | |
76 GLuint copy_framebuffer_; | |
77 | |
78 GLuint rgba8_texture_; | |
79 GLuint working_color_texture_; | |
80 GLuint edges0_texture_; | |
81 GLuint edges1_texture_; | |
82 GLuint mini4_edge_texture_; | |
83 GLuint mini4_edge_depth_texture_; | |
84 | |
85 GLuint edges1_shader_result_texture_float4_slot1_; | |
86 GLuint edges1_shader_result_texture_; | |
87 GLuint edges_combine_shader_result_texture_float4_slot1_; | |
88 GLuint process_and_apply_shader_result_texture_float4_slot1_; | |
89 GLuint edges_combine_shader_result_texture_slot2_; | |
90 GLuint copy_to_image_shader_outTexture_; | |
91 | |
92 static const char* vert_str_; | |
piman
2016/06/13 22:24:43
nit: static const char vert_str_[] here and below.
adrian.belgun
2016/06/16 14:53:14
Done.
| |
93 static const char* cmaa_frag_str_; | |
94 static const char* copy_frag_str_; | |
95 | |
96 DISALLOW_COPY_AND_ASSIGN(ApplyFramebufferAttachmentCMAAINTELResourceManager); | |
97 }; | |
98 | |
99 } // namespace gpu | |
100 | |
101 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_APPLY_FRAMEBUFFER_ATTACHMENT_CMA A_INTEL_H_ | |
OLD | NEW |