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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 6409 matching lines...) Expand 10 before | Expand all | Expand 10 after
6420 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; 6420 TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
6421 TextureRef* texture_ref = 6421 TextureRef* texture_ref =
6422 texture_unit.GetInfoForSamplerType(uniform_info->type).get(); 6422 texture_unit.GetInfoForSamplerType(uniform_info->type).get();
6423 GLenum textarget = GetBindTargetForSamplerType(uniform_info->type); 6423 GLenum textarget = GetBindTargetForSamplerType(uniform_info->type);
6424 if (!texture_ref || !texture_manager()->CanRender(texture_ref)) { 6424 if (!texture_ref || !texture_manager()->CanRender(texture_ref)) {
6425 textures_set = true; 6425 textures_set = true;
6426 glActiveTexture(GL_TEXTURE0 + texture_unit_index); 6426 glActiveTexture(GL_TEXTURE0 + texture_unit_index);
6427 glBindTexture( 6427 glBindTexture(
6428 textarget, 6428 textarget,
6429 texture_manager()->black_texture_id(uniform_info->type)); 6429 texture_manager()->black_texture_id(uniform_info->type));
6430 LOCAL_RENDER_WARNING( 6430 if (!texture_ref) {
6431 std::string("texture bound to texture unit ") + 6431 LOCAL_RENDER_WARNING(
6432 base::IntToString(texture_unit_index) + 6432 std::string("there is no texture bound to the unit ") +
6433 " is not renderable. It maybe non-power-of-2 and have" 6433 base::IntToString(texture_unit_index));
6434 " incompatible texture filtering or is not" 6434 } else {
6435 " 'texture complete'"); 6435 LOCAL_RENDER_WARNING(
6436 std::string("texture bound to texture unit ") +
6437 base::IntToString(texture_unit_index) +
6438 " is not renderable. It maybe non-power-of-2 and have"
6439 " incompatible texture filtering.");
6440 }
6436 continue; 6441 continue;
6437 } 6442 }
6438 6443
6439 if (textarget != GL_TEXTURE_CUBE_MAP) { 6444 if (textarget != GL_TEXTURE_CUBE_MAP) {
6440 Texture* texture = texture_ref->texture(); 6445 Texture* texture = texture_ref->texture();
6441 gfx::GLImage* image = texture->GetLevelImage(textarget, 0); 6446 gfx::GLImage* image = texture->GetLevelImage(textarget, 0);
6442 if (image && !texture->IsAttachedToFramebuffer()) { 6447 if (image && !texture->IsAttachedToFramebuffer()) {
6443 ScopedGLErrorSuppressor suppressor( 6448 ScopedGLErrorSuppressor suppressor(
6444 "GLES2DecoderImpl::PrepareTexturesForRender", GetErrorState()); 6449 "GLES2DecoderImpl::PrepareTexturesForRender", GetErrorState());
6445 textures_set = true; 6450 textures_set = true;
(...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after
9133 9138
9134 ScopedResolvedFrameBufferBinder binder(this, false, true); 9139 ScopedResolvedFrameBufferBinder binder(this, false, true);
9135 gfx::Size size = GetBoundReadFrameBufferSize(); 9140 gfx::Size size = GetBoundReadFrameBufferSize();
9136 GLint copyX = 0; 9141 GLint copyX = 0;
9137 GLint copyY = 0; 9142 GLint copyY = 0;
9138 GLint copyWidth = 0; 9143 GLint copyWidth = 0;
9139 GLint copyHeight = 0; 9144 GLint copyHeight = 0;
9140 Clip(x, width, size.width(), &copyX, &copyWidth); 9145 Clip(x, width, size.width(), &copyX, &copyWidth);
9141 Clip(y, height, size.height(), &copyY, &copyHeight); 9146 Clip(y, height, size.height(), &copyY, &copyHeight);
9142 9147
9143 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, level)) { 9148 if (xoffset != 0 || yoffset != 0 || width != size.width() ||
9144 LOCAL_SET_GL_ERROR( 9149 height != size.height()) {
9145 GL_OUT_OF_MEMORY, "glCopyTexSubImage2D", "dimensions too big"); 9150 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target,
9146 return; 9151 level)) {
9152 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, "glCopyTexSubImage2D",
9153 "dimensions too big");
9154 return;
9155 }
9156 } else {
9157 // Write all pixels in below.
9158 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
9147 } 9159 }
9148 9160
9149 if (copyX != x || 9161 if (copyX != x ||
9150 copyY != y || 9162 copyY != y ||
9151 copyWidth != width || 9163 copyWidth != width ||
9152 copyHeight != height) { 9164 copyHeight != height) {
9153 // some part was clipped so clear the sub rect. 9165 // some part was clipped so clear the sub rect.
9154 uint32 pixels_size = 0; 9166 uint32 pixels_size = 0;
9155 if (!GLES2Util::ComputeImageDataSizes( 9167 if (!GLES2Util::ComputeImageDataSizes(
9156 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, 9168 width, height, 1, format, type, state_.unpack_alignment, &pixels_size,
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
9741 "GLImpl", static_cast<int>(gfx::GetGLImplementation()), 9753 "GLImpl", static_cast<int>(gfx::GetGLImplementation()),
9742 "width", (is_offscreen ? offscreen_size_.width() : 9754 "width", (is_offscreen ? offscreen_size_.width() :
9743 surface_->GetSize().width())); 9755 surface_->GetSize().width()));
9744 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", 9756 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers",
9745 "offscreen", is_offscreen, 9757 "offscreen", is_offscreen,
9746 "frame", this_frame_number); 9758 "frame", this_frame_number);
9747 { 9759 {
9748 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); 9760 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame");
9749 } 9761 }
9750 9762
9763 ScopedGPUTrace scoped_gpu_trace(gpu_tracer_.get(), kTraceDecoder,
9764 "gpu_toplevel", "SwapBuffer");
9765
9751 bool is_tracing; 9766 bool is_tracing;
9752 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), 9767 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"),
9753 &is_tracing); 9768 &is_tracing);
9754 if (is_tracing) { 9769 if (is_tracing) {
9755 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); 9770 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId());
9756 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( 9771 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer(
9757 is_offscreen ? offscreen_size_ : surface_->GetSize()); 9772 is_offscreen ? offscreen_size_ : surface_->GetSize());
9758 } 9773 }
9759 9774
9760 // If offscreen then don't actually SwapBuffers to the display. Just copy 9775 // If offscreen then don't actually SwapBuffers to the display. Just copy
(...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after
11635 } 11650 }
11636 } 11651 }
11637 11652
11638 // Include the auto-generated part of this file. We split this because it means 11653 // Include the auto-generated part of this file. We split this because it means
11639 // we can easily edit the non-auto generated parts right here in this file 11654 // we can easily edit the non-auto generated parts right here in this file
11640 // instead of having to edit some template or the code generator. 11655 // instead of having to edit some template or the code generator.
11641 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11656 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11642 11657
11643 } // namespace gles2 11658 } // namespace gles2
11644 } // namespace gpu 11659 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698