OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 32 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
33 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
34 #include "gpu/command_buffer/service/buffer_manager.h" | 34 #include "gpu/command_buffer/service/buffer_manager.h" |
35 #include "gpu/command_buffer/service/context_group.h" | 35 #include "gpu/command_buffer/service/context_group.h" |
36 #include "gpu/command_buffer/service/context_state.h" | 36 #include "gpu/command_buffer/service/context_state.h" |
37 #include "gpu/command_buffer/service/error_state.h" | 37 #include "gpu/command_buffer/service/error_state.h" |
38 #include "gpu/command_buffer/service/feature_info.h" | 38 #include "gpu/command_buffer/service/feature_info.h" |
39 #include "gpu/command_buffer/service/framebuffer_manager.h" | 39 #include "gpu/command_buffer/service/framebuffer_manager.h" |
40 #include "gpu/command_buffer/service/gl_stream_texture_image.h" | 40 #include "gpu/command_buffer/service/gl_stream_texture_image.h" |
41 #include "gpu/command_buffer/service/gl_utils.h" | 41 #include "gpu/command_buffer/service/gl_utils.h" |
| 42 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa
_intel.h" |
42 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" | 43 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
43 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h" | 44 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h" |
44 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 45 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
45 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 46 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
46 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 47 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
47 #include "gpu/command_buffer/service/gpu_preferences.h" | 48 #include "gpu/command_buffer/service/gpu_preferences.h" |
48 #include "gpu/command_buffer/service/gpu_state_tracer.h" | 49 #include "gpu/command_buffer/service/gpu_state_tracer.h" |
49 #include "gpu/command_buffer/service/gpu_tracer.h" | 50 #include "gpu/command_buffer/service/gpu_tracer.h" |
50 #include "gpu/command_buffer/service/image_manager.h" | 51 #include "gpu/command_buffer/service/image_manager.h" |
51 #include "gpu/command_buffer/service/logger.h" | 52 #include "gpu/command_buffer/service/logger.h" |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 bool shader_texture_lod_explicitly_enabled_; | 2153 bool shader_texture_lod_explicitly_enabled_; |
2153 | 2154 |
2154 bool compile_shader_always_succeeds_; | 2155 bool compile_shader_always_succeeds_; |
2155 | 2156 |
2156 // An optional behaviour to lose the context and group when OOM. | 2157 // An optional behaviour to lose the context and group when OOM. |
2157 bool lose_context_when_out_of_memory_; | 2158 bool lose_context_when_out_of_memory_; |
2158 | 2159 |
2159 // Log extra info. | 2160 // Log extra info. |
2160 bool service_logging_; | 2161 bool service_logging_; |
2161 | 2162 |
| 2163 std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager> |
| 2164 apply_framebuffer_attachment_cmaa_intel_; |
2162 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_; | 2165 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_; |
2163 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2166 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
2164 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2167 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
2165 | 2168 |
2166 // Cached values of the currently assigned viewport dimensions. | 2169 // Cached values of the currently assigned viewport dimensions. |
2167 GLsizei viewport_max_width_; | 2170 GLsizei viewport_max_width_; |
2168 GLsizei viewport_max_height_; | 2171 GLsizei viewport_max_height_; |
2169 | 2172 |
2170 // Command buffer stats. | 2173 // Command buffer stats. |
2171 base::TimeDelta total_processing_commands_time_; | 2174 base::TimeDelta total_processing_commands_time_; |
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4274 | 4277 |
4275 if (offscreen_saved_color_texture_info_.get()) { | 4278 if (offscreen_saved_color_texture_info_.get()) { |
4276 DCHECK(offscreen_saved_color_texture_); | 4279 DCHECK(offscreen_saved_color_texture_); |
4277 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), | 4280 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), |
4278 offscreen_saved_color_texture_->id()); | 4281 offscreen_saved_color_texture_->id()); |
4279 offscreen_saved_color_texture_->Invalidate(); | 4282 offscreen_saved_color_texture_->Invalidate(); |
4280 offscreen_saved_color_texture_info_ = NULL; | 4283 offscreen_saved_color_texture_info_ = NULL; |
4281 } | 4284 } |
4282 ReleaseAllBackTextures(); | 4285 ReleaseAllBackTextures(); |
4283 if (have_context) { | 4286 if (have_context) { |
| 4287 if (apply_framebuffer_attachment_cmaa_intel_.get()) { |
| 4288 apply_framebuffer_attachment_cmaa_intel_->Destroy(); |
| 4289 apply_framebuffer_attachment_cmaa_intel_.reset(); |
| 4290 } |
| 4291 |
4284 if (copy_tex_image_blit_.get()) { | 4292 if (copy_tex_image_blit_.get()) { |
4285 copy_tex_image_blit_->Destroy(); | 4293 copy_tex_image_blit_->Destroy(); |
4286 copy_tex_image_blit_.reset(); | 4294 copy_tex_image_blit_.reset(); |
4287 } | 4295 } |
4288 | 4296 |
4289 if (copy_texture_CHROMIUM_.get()) { | 4297 if (copy_texture_CHROMIUM_.get()) { |
4290 copy_texture_CHROMIUM_->Destroy(); | 4298 copy_texture_CHROMIUM_->Destroy(); |
4291 copy_texture_CHROMIUM_.reset(); | 4299 copy_texture_CHROMIUM_.reset(); |
4292 } | 4300 } |
4293 | 4301 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4350 offscreen_resolved_color_texture_->Invalidate(); | 4358 offscreen_resolved_color_texture_->Invalidate(); |
4351 } | 4359 } |
4352 | 4360 |
4353 // Current program must be cleared after calling ProgramManager::UnuseProgram. | 4361 // Current program must be cleared after calling ProgramManager::UnuseProgram. |
4354 // Otherwise, we can leak objects. http://crbug.com/258772. | 4362 // Otherwise, we can leak objects. http://crbug.com/258772. |
4355 // state_.current_program must be reset before group_ is reset because | 4363 // state_.current_program must be reset before group_ is reset because |
4356 // the later deletes the ProgramManager object that referred by | 4364 // the later deletes the ProgramManager object that referred by |
4357 // state_.current_program object. | 4365 // state_.current_program object. |
4358 state_.current_program = NULL; | 4366 state_.current_program = NULL; |
4359 | 4367 |
| 4368 apply_framebuffer_attachment_cmaa_intel_.reset(); |
4360 copy_tex_image_blit_.reset(); | 4369 copy_tex_image_blit_.reset(); |
4361 copy_texture_CHROMIUM_.reset(); | 4370 copy_texture_CHROMIUM_.reset(); |
4362 clear_framebuffer_blit_.reset(); | 4371 clear_framebuffer_blit_.reset(); |
4363 | 4372 |
4364 if (query_manager_.get()) { | 4373 if (query_manager_.get()) { |
4365 query_manager_->Destroy(have_context); | 4374 query_manager_->Destroy(have_context); |
4366 query_manager_.reset(); | 4375 query_manager_.reset(); |
4367 } | 4376 } |
4368 | 4377 |
4369 if (vertex_array_manager_ .get()) { | 4378 if (vertex_array_manager_ .get()) { |
(...skipping 10917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15287 return; | 15296 return; |
15288 } | 15297 } |
15289 | 15298 |
15290 texture_ref = texture_manager()->Consume(client_id, texture); | 15299 texture_ref = texture_manager()->Consume(client_id, texture); |
15291 } | 15300 } |
15292 | 15301 |
15293 void GLES2DecoderImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { | 15302 void GLES2DecoderImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { |
15294 // Apply CMAA(Conservative Morphological Anti-Aliasing) algorithm to the | 15303 // Apply CMAA(Conservative Morphological Anti-Aliasing) algorithm to the |
15295 // color attachments of currently bound draw framebuffer. | 15304 // color attachments of currently bound draw framebuffer. |
15296 // Reference GL_INTEL_framebuffer_CMAA for details. | 15305 // Reference GL_INTEL_framebuffer_CMAA for details. |
15297 glApplyFramebufferAttachmentCMAAINTEL(); | 15306 // Use platform version if available. |
| 15307 if (!feature_info_->feature_flags() |
| 15308 .use_chromium_screen_space_antialiasing_via_shaders) { |
| 15309 glApplyFramebufferAttachmentCMAAINTEL(); |
| 15310 } else { |
| 15311 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is |
| 15312 // needed because it takes ??s of milliseconds to initialize. |
| 15313 if (!apply_framebuffer_attachment_cmaa_intel_.get()) { |
| 15314 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( |
| 15315 "glApplyFramebufferAttachmentCMAAINTEL"); |
| 15316 apply_framebuffer_attachment_cmaa_intel_.reset( |
| 15317 new ApplyFramebufferAttachmentCMAAINTELResourceManager()); |
| 15318 apply_framebuffer_attachment_cmaa_intel_->Initialize(this); |
| 15319 RestoreCurrentFramebufferBindings(); |
| 15320 if (LOCAL_PEEK_GL_ERROR("glApplyFramebufferAttachmentCMAAINTEL") != |
| 15321 GL_NO_ERROR) |
| 15322 return; |
| 15323 } |
| 15324 apply_framebuffer_attachment_cmaa_intel_ |
| 15325 ->ApplyFramebufferAttachmentCMAAINTEL( |
| 15326 this, GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER)); |
| 15327 } |
15298 } | 15328 } |
15299 | 15329 |
15300 void GLES2DecoderImpl::DoInsertEventMarkerEXT( | 15330 void GLES2DecoderImpl::DoInsertEventMarkerEXT( |
15301 GLsizei length, const GLchar* marker) { | 15331 GLsizei length, const GLchar* marker) { |
15302 if (!marker) { | 15332 if (!marker) { |
15303 marker = ""; | 15333 marker = ""; |
15304 } | 15334 } |
15305 debug_marker_manager_.SetMarker( | 15335 debug_marker_manager_.SetMarker( |
15306 length ? std::string(marker, length) : std::string(marker)); | 15336 length ? std::string(marker, length) : std::string(marker)); |
15307 } | 15337 } |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16973 } | 17003 } |
16974 | 17004 |
16975 // Include the auto-generated part of this file. We split this because it means | 17005 // Include the auto-generated part of this file. We split this because it means |
16976 // we can easily edit the non-auto generated parts right here in this file | 17006 // we can easily edit the non-auto generated parts right here in this file |
16977 // instead of having to edit some template or the code generator. | 17007 // instead of having to edit some template or the code generator. |
16978 #include "base/macros.h" | 17008 #include "base/macros.h" |
16979 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17009 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16980 | 17010 |
16981 } // namespace gles2 | 17011 } // namespace gles2 |
16982 } // namespace gpu | 17012 } // namespace gpu |
OLD | NEW |