| 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_texture_chromium.h" | 44 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 44 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 45 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
| 45 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 46 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| 46 #include "gpu/command_buffer/service/gpu_preferences.h" | 47 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 47 #include "gpu/command_buffer/service/gpu_state_tracer.h" | 48 #include "gpu/command_buffer/service/gpu_state_tracer.h" |
| 48 #include "gpu/command_buffer/service/gpu_tracer.h" | 49 #include "gpu/command_buffer/service/gpu_tracer.h" |
| 49 #include "gpu/command_buffer/service/image_manager.h" | 50 #include "gpu/command_buffer/service/image_manager.h" |
| 50 #include "gpu/command_buffer/service/logger.h" | 51 #include "gpu/command_buffer/service/logger.h" |
| 51 #include "gpu/command_buffer/service/mailbox_manager.h" | 52 #include "gpu/command_buffer/service/mailbox_manager.h" |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 bool lose_context_when_out_of_memory_; | 2167 bool lose_context_when_out_of_memory_; |
| 2167 | 2168 |
| 2168 // Log extra info. | 2169 // Log extra info. |
| 2169 bool service_logging_; | 2170 bool service_logging_; |
| 2170 | 2171 |
| 2171 #if defined(OS_MACOSX) | 2172 #if defined(OS_MACOSX) |
| 2172 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; | 2173 typedef std::map<GLuint, IOSurfaceRef> TextureToIOSurfaceMap; |
| 2173 TextureToIOSurfaceMap texture_to_io_surface_map_; | 2174 TextureToIOSurfaceMap texture_to_io_surface_map_; |
| 2174 #endif | 2175 #endif |
| 2175 | 2176 |
| 2177 std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager> |
| 2178 apply_framebuffer_attachment_cmaa_intel_; |
| 2176 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2179 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
| 2177 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2180 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
| 2178 | 2181 |
| 2179 // Cached values of the currently assigned viewport dimensions. | 2182 // Cached values of the currently assigned viewport dimensions. |
| 2180 GLsizei viewport_max_width_; | 2183 GLsizei viewport_max_width_; |
| 2181 GLsizei viewport_max_height_; | 2184 GLsizei viewport_max_height_; |
| 2182 | 2185 |
| 2183 // Command buffer stats. | 2186 // Command buffer stats. |
| 2184 base::TimeDelta total_processing_commands_time_; | 2187 base::TimeDelta total_processing_commands_time_; |
| 2185 | 2188 |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4230 | 4233 |
| 4231 if (offscreen_saved_color_texture_info_.get()) { | 4234 if (offscreen_saved_color_texture_info_.get()) { |
| 4232 DCHECK(offscreen_saved_color_texture_); | 4235 DCHECK(offscreen_saved_color_texture_); |
| 4233 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), | 4236 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), |
| 4234 offscreen_saved_color_texture_->id()); | 4237 offscreen_saved_color_texture_->id()); |
| 4235 offscreen_saved_color_texture_->Invalidate(); | 4238 offscreen_saved_color_texture_->Invalidate(); |
| 4236 offscreen_saved_color_texture_info_ = NULL; | 4239 offscreen_saved_color_texture_info_ = NULL; |
| 4237 } | 4240 } |
| 4238 ReleaseAllBackTextures(); | 4241 ReleaseAllBackTextures(); |
| 4239 if (have_context) { | 4242 if (have_context) { |
| 4243 if (apply_framebuffer_attachment_cmaa_intel_.get()) { |
| 4244 apply_framebuffer_attachment_cmaa_intel_->Destroy(); |
| 4245 apply_framebuffer_attachment_cmaa_intel_.reset(); |
| 4246 } |
| 4247 |
| 4240 if (copy_texture_CHROMIUM_.get()) { | 4248 if (copy_texture_CHROMIUM_.get()) { |
| 4241 copy_texture_CHROMIUM_->Destroy(); | 4249 copy_texture_CHROMIUM_->Destroy(); |
| 4242 copy_texture_CHROMIUM_.reset(); | 4250 copy_texture_CHROMIUM_.reset(); |
| 4243 } | 4251 } |
| 4244 | 4252 |
| 4245 clear_framebuffer_blit_.reset(); | 4253 clear_framebuffer_blit_.reset(); |
| 4246 | 4254 |
| 4247 if (state_.current_program.get()) { | 4255 if (state_.current_program.get()) { |
| 4248 program_manager()->UnuseProgram(shader_manager(), | 4256 program_manager()->UnuseProgram(shader_manager(), |
| 4249 state_.current_program.get()); | 4257 state_.current_program.get()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4301 offscreen_resolved_color_texture_->Invalidate(); | 4309 offscreen_resolved_color_texture_->Invalidate(); |
| 4302 } | 4310 } |
| 4303 | 4311 |
| 4304 // Current program must be cleared after calling ProgramManager::UnuseProgram. | 4312 // Current program must be cleared after calling ProgramManager::UnuseProgram. |
| 4305 // Otherwise, we can leak objects. http://crbug.com/258772. | 4313 // Otherwise, we can leak objects. http://crbug.com/258772. |
| 4306 // state_.current_program must be reset before group_ is reset because | 4314 // state_.current_program must be reset before group_ is reset because |
| 4307 // the later deletes the ProgramManager object that referred by | 4315 // the later deletes the ProgramManager object that referred by |
| 4308 // state_.current_program object. | 4316 // state_.current_program object. |
| 4309 state_.current_program = NULL; | 4317 state_.current_program = NULL; |
| 4310 | 4318 |
| 4319 apply_framebuffer_attachment_cmaa_intel_.reset(); |
| 4311 copy_texture_CHROMIUM_.reset(); | 4320 copy_texture_CHROMIUM_.reset(); |
| 4312 clear_framebuffer_blit_.reset(); | 4321 clear_framebuffer_blit_.reset(); |
| 4313 | 4322 |
| 4314 if (query_manager_.get()) { | 4323 if (query_manager_.get()) { |
| 4315 query_manager_->Destroy(have_context); | 4324 query_manager_->Destroy(have_context); |
| 4316 query_manager_.reset(); | 4325 query_manager_.reset(); |
| 4317 } | 4326 } |
| 4318 | 4327 |
| 4319 if (vertex_array_manager_ .get()) { | 4328 if (vertex_array_manager_ .get()) { |
| 4320 vertex_array_manager_->Destroy(have_context); | 4329 vertex_array_manager_->Destroy(have_context); |
| (...skipping 10806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15127 return; | 15136 return; |
| 15128 } | 15137 } |
| 15129 | 15138 |
| 15130 texture_ref = texture_manager()->Consume(client_id, texture); | 15139 texture_ref = texture_manager()->Consume(client_id, texture); |
| 15131 } | 15140 } |
| 15132 | 15141 |
| 15133 void GLES2DecoderImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { | 15142 void GLES2DecoderImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { |
| 15134 // Apply CMAA(Conservative Morphological Anti-Aliasing) algorithm to the | 15143 // Apply CMAA(Conservative Morphological Anti-Aliasing) algorithm to the |
| 15135 // color attachments of currently bound draw framebuffer. | 15144 // color attachments of currently bound draw framebuffer. |
| 15136 // Reference GL_INTEL_framebuffer_CMAA for details. | 15145 // Reference GL_INTEL_framebuffer_CMAA for details. |
| 15137 glApplyFramebufferAttachmentCMAAINTEL(); | 15146 // Use platform version if available. |
| 15147 if (!feature_info_->feature_flags() |
| 15148 .use_chromium_screen_space_antialiasing_via_shaders) { |
| 15149 glApplyFramebufferAttachmentCMAAINTEL(); |
| 15150 } else { |
| 15151 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is |
| 15152 // needed because it takes ??s of milliseconds to initialize. |
| 15153 if (!apply_framebuffer_attachment_cmaa_intel_.get()) { |
| 15154 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( |
| 15155 "glApplyFramebufferAttachmentCMAAINTEL"); |
| 15156 apply_framebuffer_attachment_cmaa_intel_.reset( |
| 15157 new ApplyFramebufferAttachmentCMAAINTELResourceManager()); |
| 15158 apply_framebuffer_attachment_cmaa_intel_->Initialize(this); |
| 15159 RestoreCurrentFramebufferBindings(); |
| 15160 if (LOCAL_PEEK_GL_ERROR("glApplyFramebufferAttachmentCMAAINTEL") != |
| 15161 GL_NO_ERROR) |
| 15162 return; |
| 15163 } |
| 15164 apply_framebuffer_attachment_cmaa_intel_ |
| 15165 ->ApplyFramebufferAttachmentCMAAINTEL(this); |
| 15166 } |
| 15138 } | 15167 } |
| 15139 | 15168 |
| 15140 void GLES2DecoderImpl::DoInsertEventMarkerEXT( | 15169 void GLES2DecoderImpl::DoInsertEventMarkerEXT( |
| 15141 GLsizei length, const GLchar* marker) { | 15170 GLsizei length, const GLchar* marker) { |
| 15142 if (!marker) { | 15171 if (!marker) { |
| 15143 marker = ""; | 15172 marker = ""; |
| 15144 } | 15173 } |
| 15145 debug_marker_manager_.SetMarker( | 15174 debug_marker_manager_.SetMarker( |
| 15146 length ? std::string(marker, length) : std::string(marker)); | 15175 length ? std::string(marker, length) : std::string(marker)); |
| 15147 } | 15176 } |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16825 } | 16854 } |
| 16826 | 16855 |
| 16827 // Include the auto-generated part of this file. We split this because it means | 16856 // Include the auto-generated part of this file. We split this because it means |
| 16828 // we can easily edit the non-auto generated parts right here in this file | 16857 // we can easily edit the non-auto generated parts right here in this file |
| 16829 // instead of having to edit some template or the code generator. | 16858 // instead of having to edit some template or the code generator. |
| 16830 #include "base/macros.h" | 16859 #include "base/macros.h" |
| 16831 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16860 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 16832 | 16861 |
| 16833 } // namespace gles2 | 16862 } // namespace gles2 |
| 16834 } // namespace gpu | 16863 } // namespace gpu |
| OLD | NEW |