| 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 22 matching lines...) Expand all Loading... |
| 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_clear_framebuffer.h" | 42 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
| 43 #include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.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" |
| 52 #include "gpu/command_buffer/service/memory_tracking.h" | 53 #include "gpu/command_buffer/service/memory_tracking.h" |
| (...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1966 | 1967 |
| 1967 // copyTexImage2D doesn't work on OSX under very specific conditions. | 1968 // copyTexImage2D doesn't work on OSX under very specific conditions. |
| 1968 // Returns whether those conditions have been met. If this method returns | 1969 // Returns whether those conditions have been met. If this method returns |
| 1969 // true, |source_texture_service_id| and |source_texture_target| are also | 1970 // true, |source_texture_service_id| and |source_texture_target| are also |
| 1970 // populated, since they are needed to implement the workaround. | 1971 // populated, since they are needed to implement the workaround. |
| 1971 bool NeedsCopyTextureImageWorkaround(GLenum internal_format, | 1972 bool NeedsCopyTextureImageWorkaround(GLenum internal_format, |
| 1972 int32_t channels_exist, | 1973 int32_t channels_exist, |
| 1973 GLuint* source_texture_service_id, | 1974 GLuint* source_texture_service_id, |
| 1974 GLenum* source_texture_target); | 1975 GLenum* source_texture_target); |
| 1975 | 1976 |
| 1977 bool InitializeCopyTexImageBlitter(const char* function_name); |
| 1976 bool InitializeCopyTextureCHROMIUM(const char* function_name); | 1978 bool InitializeCopyTextureCHROMIUM(const char* function_name); |
| 1977 // Generate a member function prototype for each command in an automated and | 1979 // Generate a member function prototype for each command in an automated and |
| 1978 // typesafe way. | 1980 // typesafe way. |
| 1979 #define GLES2_CMD_OP(name) \ | 1981 #define GLES2_CMD_OP(name) \ |
| 1980 Error Handle##name(uint32_t immediate_data_size, const void* data); | 1982 Error Handle##name(uint32_t immediate_data_size, const void* data); |
| 1981 | 1983 |
| 1982 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 1984 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
| 1983 | 1985 |
| 1984 #undef GLES2_CMD_OP | 1986 #undef GLES2_CMD_OP |
| 1985 | 1987 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 bool shader_texture_lod_explicitly_enabled_; | 2150 bool shader_texture_lod_explicitly_enabled_; |
| 2149 | 2151 |
| 2150 bool compile_shader_always_succeeds_; | 2152 bool compile_shader_always_succeeds_; |
| 2151 | 2153 |
| 2152 // An optional behaviour to lose the context and group when OOM. | 2154 // An optional behaviour to lose the context and group when OOM. |
| 2153 bool lose_context_when_out_of_memory_; | 2155 bool lose_context_when_out_of_memory_; |
| 2154 | 2156 |
| 2155 // Log extra info. | 2157 // Log extra info. |
| 2156 bool service_logging_; | 2158 bool service_logging_; |
| 2157 | 2159 |
| 2160 std::unique_ptr<CopyTexImageResourceManager> copy_tex_image_blit_; |
| 2158 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 2161 std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
| 2159 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; | 2162 std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
| 2160 | 2163 |
| 2161 // Cached values of the currently assigned viewport dimensions. | 2164 // Cached values of the currently assigned viewport dimensions. |
| 2162 GLsizei viewport_max_width_; | 2165 GLsizei viewport_max_width_; |
| 2163 GLsizei viewport_max_height_; | 2166 GLsizei viewport_max_height_; |
| 2164 | 2167 |
| 2165 // Command buffer stats. | 2168 // Command buffer stats. |
| 2166 base::TimeDelta total_processing_commands_time_; | 2169 base::TimeDelta total_processing_commands_time_; |
| 2167 | 2170 |
| (...skipping 2101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4269 | 4272 |
| 4270 if (offscreen_saved_color_texture_info_.get()) { | 4273 if (offscreen_saved_color_texture_info_.get()) { |
| 4271 DCHECK(offscreen_saved_color_texture_); | 4274 DCHECK(offscreen_saved_color_texture_); |
| 4272 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), | 4275 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), |
| 4273 offscreen_saved_color_texture_->id()); | 4276 offscreen_saved_color_texture_->id()); |
| 4274 offscreen_saved_color_texture_->Invalidate(); | 4277 offscreen_saved_color_texture_->Invalidate(); |
| 4275 offscreen_saved_color_texture_info_ = NULL; | 4278 offscreen_saved_color_texture_info_ = NULL; |
| 4276 } | 4279 } |
| 4277 ReleaseAllBackTextures(); | 4280 ReleaseAllBackTextures(); |
| 4278 if (have_context) { | 4281 if (have_context) { |
| 4282 if (copy_tex_image_blit_.get()) { |
| 4283 copy_tex_image_blit_->Destroy(); |
| 4284 copy_tex_image_blit_.reset(); |
| 4285 } |
| 4286 |
| 4279 if (copy_texture_CHROMIUM_.get()) { | 4287 if (copy_texture_CHROMIUM_.get()) { |
| 4280 copy_texture_CHROMIUM_->Destroy(); | 4288 copy_texture_CHROMIUM_->Destroy(); |
| 4281 copy_texture_CHROMIUM_.reset(); | 4289 copy_texture_CHROMIUM_.reset(); |
| 4282 } | 4290 } |
| 4283 | 4291 |
| 4284 clear_framebuffer_blit_.reset(); | 4292 clear_framebuffer_blit_.reset(); |
| 4285 | 4293 |
| 4286 if (state_.current_program.get()) { | 4294 if (state_.current_program.get()) { |
| 4287 program_manager()->UnuseProgram(shader_manager(), | 4295 program_manager()->UnuseProgram(shader_manager(), |
| 4288 state_.current_program.get()); | 4296 state_.current_program.get()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4340 offscreen_resolved_color_texture_->Invalidate(); | 4348 offscreen_resolved_color_texture_->Invalidate(); |
| 4341 } | 4349 } |
| 4342 | 4350 |
| 4343 // Current program must be cleared after calling ProgramManager::UnuseProgram. | 4351 // Current program must be cleared after calling ProgramManager::UnuseProgram. |
| 4344 // Otherwise, we can leak objects. http://crbug.com/258772. | 4352 // Otherwise, we can leak objects. http://crbug.com/258772. |
| 4345 // state_.current_program must be reset before group_ is reset because | 4353 // state_.current_program must be reset before group_ is reset because |
| 4346 // the later deletes the ProgramManager object that referred by | 4354 // the later deletes the ProgramManager object that referred by |
| 4347 // state_.current_program object. | 4355 // state_.current_program object. |
| 4348 state_.current_program = NULL; | 4356 state_.current_program = NULL; |
| 4349 | 4357 |
| 4358 copy_tex_image_blit_.reset(); |
| 4350 copy_texture_CHROMIUM_.reset(); | 4359 copy_texture_CHROMIUM_.reset(); |
| 4351 clear_framebuffer_blit_.reset(); | 4360 clear_framebuffer_blit_.reset(); |
| 4352 | 4361 |
| 4353 if (query_manager_.get()) { | 4362 if (query_manager_.get()) { |
| 4354 query_manager_->Destroy(have_context); | 4363 query_manager_->Destroy(have_context); |
| 4355 query_manager_.reset(); | 4364 query_manager_.reset(); |
| 4356 } | 4365 } |
| 4357 | 4366 |
| 4358 if (vertex_array_manager_ .get()) { | 4367 if (vertex_array_manager_ .get()) { |
| 4359 vertex_array_manager_->Destroy(have_context); | 4368 vertex_array_manager_->Destroy(have_context); |
| (...skipping 8007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12367 } | 12376 } |
| 12368 | 12377 |
| 12369 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); | 12378 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); |
| 12370 ScopedResolvedFrameBufferBinder binder(this, false, true); | 12379 ScopedResolvedFrameBufferBinder binder(this, false, true); |
| 12371 gfx::Size size = GetBoundReadFrameBufferSize(); | 12380 gfx::Size size = GetBoundReadFrameBufferSize(); |
| 12372 | 12381 |
| 12373 if (texture->IsAttachedToFramebuffer()) { | 12382 if (texture->IsAttachedToFramebuffer()) { |
| 12374 framebuffer_state_.clear_state_dirty = true; | 12383 framebuffer_state_.clear_state_dirty = true; |
| 12375 } | 12384 } |
| 12376 | 12385 |
| 12386 bool requires_luma_blit = |
| 12387 CopyTexImageResourceManager::CopyTexImageRequiresBlit(feature_info_.get(), |
| 12388 format); |
| 12389 if (requires_luma_blit && |
| 12390 !InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { |
| 12391 return; |
| 12392 } |
| 12393 |
| 12377 // Clip to size to source dimensions | 12394 // Clip to size to source dimensions |
| 12378 GLint copyX = 0; | 12395 GLint copyX = 0; |
| 12379 GLint copyY = 0; | 12396 GLint copyY = 0; |
| 12380 GLint copyWidth = 0; | 12397 GLint copyWidth = 0; |
| 12381 GLint copyHeight = 0; | 12398 GLint copyHeight = 0; |
| 12382 Clip(x, width, size.width(), ©X, ©Width); | 12399 Clip(x, width, size.width(), ©X, ©Width); |
| 12383 Clip(y, height, size.height(), ©Y, ©Height); | 12400 Clip(y, height, size.height(), ©Y, ©Height); |
| 12384 | 12401 |
| 12385 if (copyX != x || | 12402 if (copyX != x || |
| 12386 copyY != y || | 12403 copyY != y || |
| 12387 copyWidth != width || | 12404 copyWidth != width || |
| 12388 copyHeight != height) { | 12405 copyHeight != height) { |
| 12389 // some part was clipped so clear the rect. | 12406 // some part was clipped so clear the rect. |
| 12390 std::unique_ptr<char[]> zero(new char[pixels_size]); | 12407 std::unique_ptr<char[]> zero(new char[pixels_size]); |
| 12391 memset(zero.get(), 0, pixels_size); | 12408 memset(zero.get(), 0, pixels_size); |
| 12392 glTexImage2D(target, level, | 12409 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( |
| 12393 texture_manager()->AdjustTexInternalFormat(internal_format), | 12410 feature_info_.get(), internal_format), |
| 12394 width, height, border, format, type, zero.get()); | 12411 width, height, border, format, type, zero.get()); |
| 12395 if (copyHeight > 0 && copyWidth > 0) { | 12412 if (copyHeight > 0 && copyWidth > 0) { |
| 12396 GLint dx = copyX - x; | 12413 GLint dx = copyX - x; |
| 12397 GLint dy = copyY - y; | 12414 GLint dy = copyY - y; |
| 12398 GLint destX = dx; | 12415 GLint destX = dx; |
| 12399 GLint destY = dy; | 12416 GLint destY = dy; |
| 12400 glCopyTexSubImage2D(target, level, | 12417 if (requires_luma_blit) { |
| 12401 destX, destY, copyX, copyY, | 12418 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( |
| 12402 copyWidth, copyHeight); | 12419 this, texture->service_id(), texture->target(), target, format, |
| 12420 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, |
| 12421 framebuffer_state_.bound_read_framebuffer->service_id(), |
| 12422 framebuffer_state_.bound_read_framebuffer |
| 12423 ->GetReadBufferInternalFormat()); |
| 12424 } else { |
| 12425 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, |
| 12426 copyWidth, copyHeight); |
| 12427 } |
| 12403 } | 12428 } |
| 12404 } else { | 12429 } else { |
| 12405 GLenum final_internal_format = | 12430 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( |
| 12406 texture_manager()->AdjustTexInternalFormat(internal_format); | 12431 feature_info_.get(), internal_format); |
| 12407 | 12432 |
| 12408 // The service id and target of the texture attached to READ_FRAMEBUFFER. | 12433 // The service id and target of the texture attached to READ_FRAMEBUFFER. |
| 12409 GLuint source_texture_service_id = 0; | 12434 GLuint source_texture_service_id = 0; |
| 12410 GLenum source_texture_target = 0; | 12435 GLenum source_texture_target = 0; |
| 12411 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 12436 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 12412 bool use_workaround = NeedsCopyTextureImageWorkaround( | 12437 bool use_workaround = NeedsCopyTextureImageWorkaround( |
| 12413 final_internal_format, channels_exist, &source_texture_service_id, | 12438 final_internal_format, channels_exist, &source_texture_service_id, |
| 12414 &source_texture_target); | 12439 &source_texture_target); |
| 12415 if (use_workaround) { | 12440 if (use_workaround) { |
| 12441 DCHECK(!requires_luma_blit); |
| 12416 GLenum dest_texture_target = target; | 12442 GLenum dest_texture_target = target; |
| 12417 GLenum framebuffer_target = features().chromium_framebuffer_multisample | 12443 GLenum framebuffer_target = features().chromium_framebuffer_multisample |
| 12418 ? GL_READ_FRAMEBUFFER_EXT | 12444 ? GL_READ_FRAMEBUFFER_EXT |
| 12419 : GL_FRAMEBUFFER; | 12445 : GL_FRAMEBUFFER; |
| 12420 | 12446 |
| 12421 GLenum temp_internal_format = 0; | 12447 GLenum temp_internal_format = 0; |
| 12422 if (channels_exist == GLES2Util::kRGBA) { | 12448 if (channels_exist == GLES2Util::kRGBA) { |
| 12423 temp_internal_format = GL_RGBA; | 12449 temp_internal_format = GL_RGBA; |
| 12424 } else if (channels_exist == GLES2Util::kRGB) { | 12450 } else if (channels_exist == GLES2Util::kRGB) { |
| 12425 temp_internal_format = GL_RGB; | 12451 temp_internal_format = GL_RGB; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 12446 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, | 12472 glCopyTexImage2D(dest_texture_target, level, final_internal_format, 0, 0, |
| 12447 copyWidth, copyHeight, 0); | 12473 copyWidth, copyHeight, 0); |
| 12448 | 12474 |
| 12449 // Rebind source texture. | 12475 // Rebind source texture. |
| 12450 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, | 12476 glFramebufferTexture2DEXT(framebuffer_target, GL_COLOR_ATTACHMENT0, |
| 12451 source_texture_target, | 12477 source_texture_target, |
| 12452 source_texture_service_id, 0); | 12478 source_texture_service_id, 0); |
| 12453 | 12479 |
| 12454 glDeleteTextures(1, &temp_texture); | 12480 glDeleteTextures(1, &temp_texture); |
| 12455 } else { | 12481 } else { |
| 12456 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, | 12482 if (requires_luma_blit) { |
| 12457 copyWidth, copyHeight, border); | 12483 copy_tex_image_blit_->DoCopyTexImage2DToLUMAComatabilityTexture( |
| 12484 this, texture->service_id(), texture->target(), target, format, |
| 12485 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, |
| 12486 framebuffer_state_.bound_read_framebuffer->service_id(), |
| 12487 framebuffer_state_.bound_read_framebuffer |
| 12488 ->GetReadBufferInternalFormat()); |
| 12489 } else { |
| 12490 glCopyTexImage2D(target, level, final_internal_format, copyX, copyY, |
| 12491 copyWidth, copyHeight, border); |
| 12492 } |
| 12458 } | 12493 } |
| 12459 } | 12494 } |
| 12460 GLenum error = LOCAL_PEEK_GL_ERROR(func_name); | 12495 GLenum error = LOCAL_PEEK_GL_ERROR(func_name); |
| 12461 if (error == GL_NO_ERROR) { | 12496 if (error == GL_NO_ERROR) { |
| 12462 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, | 12497 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, |
| 12463 width, height, 1, border, format, | 12498 width, height, 1, border, format, |
| 12464 type, gfx::Rect(width, height)); | 12499 type, gfx::Rect(width, height)); |
| 12465 texture->ApplyFormatWorkarounds(feature_info_.get()); | 12500 texture->ApplyFormatWorkarounds(feature_info_.get()); |
| 12466 } | 12501 } |
| 12467 | 12502 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12547 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); | 12582 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); |
| 12548 return; | 12583 return; |
| 12549 } | 12584 } |
| 12550 } | 12585 } |
| 12551 } else { | 12586 } else { |
| 12552 // Write all pixels in below. | 12587 // Write all pixels in below. |
| 12553 texture_manager()->SetLevelCleared(texture_ref, target, level, true); | 12588 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 12554 } | 12589 } |
| 12555 | 12590 |
| 12556 if (copyHeight > 0 && copyWidth > 0) { | 12591 if (copyHeight > 0 && copyWidth > 0) { |
| 12557 glCopyTexSubImage2D(target, level, | 12592 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( |
| 12558 destX, destY, copyX, copyY, | 12593 feature_info_.get(), internal_format)) { |
| 12559 copyWidth, copyHeight); | 12594 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { |
| 12595 return; |
| 12596 } |
| 12597 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( |
| 12598 this, texture->service_id(), texture->target(), target, |
| 12599 internal_format, type, level, xoffset, yoffset, x, y, width, height, |
| 12600 framebuffer_state_.bound_read_framebuffer->service_id(), |
| 12601 framebuffer_state_.bound_read_framebuffer |
| 12602 ->GetReadBufferInternalFormat()); |
| 12603 } else { |
| 12604 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, |
| 12605 copyHeight); |
| 12606 } |
| 12560 } | 12607 } |
| 12561 | 12608 |
| 12562 // This may be a slow command. Exit command processing to allow for | 12609 // This may be a slow command. Exit command processing to allow for |
| 12563 // context preemption and GPU watchdog checks. | 12610 // context preemption and GPU watchdog checks. |
| 12564 ExitCommandProcessingEarly(); | 12611 ExitCommandProcessingEarly(); |
| 12565 } | 12612 } |
| 12566 | 12613 |
| 12567 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, | 12614 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, |
| 12568 const void* cmd_data) { | 12615 const void* cmd_data) { |
| 12569 const gles2::cmds::TexSubImage2D& c = | 12616 const gles2::cmds::TexSubImage2D& c = |
| (...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14441 } | 14488 } |
| 14442 | 14489 |
| 14443 // Resize the destination texture to the dimensions of the source texture. | 14490 // Resize the destination texture to the dimensions of the source texture. |
| 14444 if (!dest_level_defined || dest_width != source_width || | 14491 if (!dest_level_defined || dest_width != source_width || |
| 14445 dest_height != source_height || | 14492 dest_height != source_height || |
| 14446 dest_internal_format != internal_format || | 14493 dest_internal_format != internal_format || |
| 14447 dest_type_previous != dest_type) { | 14494 dest_type_previous != dest_type) { |
| 14448 // Ensure that the glTexImage2D succeeds. | 14495 // Ensure that the glTexImage2D succeeds. |
| 14449 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); | 14496 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); |
| 14450 glBindTexture(dest_target, dest_texture->service_id()); | 14497 glBindTexture(dest_target, dest_texture->service_id()); |
| 14451 glTexImage2D(dest_target, 0, | 14498 glTexImage2D( |
| 14452 texture_manager()->AdjustTexInternalFormat(internal_format), | 14499 dest_target, 0, TextureManager::AdjustTexInternalFormat( |
| 14453 source_width, source_height, 0, | 14500 feature_info_.get(), internal_format), |
| 14454 texture_manager()->AdjustTexFormat(internal_format), dest_type, | 14501 source_width, source_height, 0, |
| 14455 NULL); | 14502 TextureManager::AdjustTexFormat(feature_info_.get(), internal_format), |
| 14503 dest_type, NULL); |
| 14456 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); | 14504 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); |
| 14457 if (error != GL_NO_ERROR) { | 14505 if (error != GL_NO_ERROR) { |
| 14458 RestoreCurrentTextureBindings(&state_, dest_target); | 14506 RestoreCurrentTextureBindings(&state_, dest_target); |
| 14459 return; | 14507 return; |
| 14460 } | 14508 } |
| 14461 | 14509 |
| 14462 texture_manager()->SetLevelInfo( | 14510 texture_manager()->SetLevelInfo( |
| 14463 dest_texture_ref, dest_target, 0, internal_format, source_width, | 14511 dest_texture_ref, dest_target, 0, internal_format, source_width, |
| 14464 source_height, 1, 0, internal_format, dest_type, | 14512 source_height, 1, 0, internal_format, dest_type, |
| 14465 gfx::Rect(source_width, source_height)); | 14513 gfx::Rect(source_width, source_height)); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14686 } | 14734 } |
| 14687 } | 14735 } |
| 14688 copy_texture_CHROMIUM_->DoCopySubTexture( | 14736 copy_texture_CHROMIUM_->DoCopySubTexture( |
| 14689 this, source_target, source_texture->service_id(), source_internal_format, | 14737 this, source_target, source_texture->service_id(), source_internal_format, |
| 14690 dest_target, dest_texture->service_id(), dest_internal_format, xoffset, | 14738 dest_target, dest_texture->service_id(), dest_internal_format, xoffset, |
| 14691 yoffset, x, y, width, height, dest_width, dest_height, source_width, | 14739 yoffset, x, y, width, height, dest_width, dest_height, source_width, |
| 14692 source_height, unpack_flip_y == GL_TRUE, | 14740 source_height, unpack_flip_y == GL_TRUE, |
| 14693 unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE); | 14741 unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE); |
| 14694 } | 14742 } |
| 14695 | 14743 |
| 14744 bool GLES2DecoderImpl::InitializeCopyTexImageBlitter( |
| 14745 const char* function_name) { |
| 14746 if (!copy_tex_image_blit_.get()) { |
| 14747 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 14748 copy_tex_image_blit_.reset( |
| 14749 new CopyTexImageResourceManager(feature_info_.get())); |
| 14750 copy_tex_image_blit_->Initialize(this); |
| 14751 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) |
| 14752 return false; |
| 14753 } |
| 14754 return true; |
| 14755 } |
| 14756 |
| 14696 bool GLES2DecoderImpl::InitializeCopyTextureCHROMIUM( | 14757 bool GLES2DecoderImpl::InitializeCopyTextureCHROMIUM( |
| 14697 const char* function_name) { | 14758 const char* function_name) { |
| 14698 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is | 14759 // Defer initializing the CopyTextureCHROMIUMResourceManager until it is |
| 14699 // needed because it takes 10s of milliseconds to initialize. | 14760 // needed because it takes 10s of milliseconds to initialize. |
| 14700 if (!copy_texture_CHROMIUM_.get()) { | 14761 if (!copy_texture_CHROMIUM_.get()) { |
| 14701 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); | 14762 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 14702 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); | 14763 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); |
| 14703 copy_texture_CHROMIUM_->Initialize(this, features()); | 14764 copy_texture_CHROMIUM_->Initialize(this, features()); |
| 14704 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) | 14765 if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR) |
| 14705 return false; | 14766 return false; |
| (...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16884 } | 16945 } |
| 16885 | 16946 |
| 16886 // Include the auto-generated part of this file. We split this because it means | 16947 // Include the auto-generated part of this file. We split this because it means |
| 16887 // we can easily edit the non-auto generated parts right here in this file | 16948 // we can easily edit the non-auto generated parts right here in this file |
| 16888 // instead of having to edit some template or the code generator. | 16949 // instead of having to edit some template or the code generator. |
| 16889 #include "base/macros.h" | 16950 #include "base/macros.h" |
| 16890 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16951 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 16891 | 16952 |
| 16892 } // namespace gles2 | 16953 } // namespace gles2 |
| 16893 } // namespace gpu | 16954 } // namespace gpu |
| OLD | NEW |