diff options
author | leviw <leviw@chromium.org> | 2015-08-18 13:30:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-18 20:31:02 +0000 |
commit | 992f0cc257cfc54806ce99032404e826f622fe39 (patch) | |
tree | 0d5a809bda895764b636261ee4aeea27495a1d3c /gpu/command_buffer | |
parent | 7f6df1cd2dd744a2a9ed3f96298bf9a84375d848 (diff) | |
download | chromium_src-992f0cc257cfc54806ce99032404e826f622fe39.zip chromium_src-992f0cc257cfc54806ce99032404e826f622fe39.tar.gz chromium_src-992f0cc257cfc54806ce99032404e826f622fe39.tar.bz2 |
Revert of "gpu: Nexus5 and ANGLE crashes with GL_TEXTURE_CUBE_MAP_NEGATIVE_X" (patchset #1 id:1 of https://codereview.chromium.org/1290053004/ )
Reason for revert:
Broke virtual/gpu/fast/canvas/quadraticCurveTo.xml on Linux MSAN
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showExpectations=true&tests=virtual%2Fgpu%2Ffast%2Fcanvas%2FquadraticCurveTo.xml
Original issue's description:
> Reland of "gpu: Nexus5 and ANGLE crashes with GL_TEXTURE_CUBE_MAP_NEGATIVE_X"
>
> Original CL: https://codereview.chromium.org/1280163004
> Revert: https://codereview.chromium.org/1293123002
>
> Linux ATI drivers have a crash bug similar to Android's, so workaround ATI also.
>
> BUG=517548
>
> Committed: https://crrev.com/383c134c011b52705e4f2cd8bed1e3303ba98729
> Cr-Commit-Position: refs/heads/master@{#343834}
TBR=sievers@chromium.org,dongseong.hwang@intel.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=517548
Review URL: https://codereview.chromium.org/1298263002
Cr-Commit-Position: refs/heads/master@{#344017}
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_manager.cc | 42 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_manager.h | 17 | ||||
-rw-r--r-- | gpu/command_buffer/tests/gl_cube_map_texture_unittest.cc | 138 |
4 files changed, 5 insertions, 196 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 1f72f24..e918b2e 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2577,7 +2577,9 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) : false), viewport_max_width_(0), viewport_max_height_(0), - texture_state_(group_->feature_info()->workarounds()), + texture_state_(group_->feature_info() + ->workarounds() + .texsubimage_faster_than_teximage), cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( TRACE_DISABLED_BY_DEFAULT("cb_command"))), gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc index 6ef54d9..ed0fd10 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc @@ -1939,12 +1939,6 @@ void TextureManager::ValidateAndDoTexImage( return; } - if (texture_state->force_cube_map_positive_x_allocation) { - DoTexImage2DCubeMapPositiveXIfNeeded(texture_state, state->GetErrorState(), - framebuffer_state, function_name, - texture_ref, args); - } - DoTexImage(texture_state, state->GetErrorState(), framebuffer_state, function_name, texture_ref, args); } @@ -1961,42 +1955,6 @@ GLenum TextureManager::AdjustTexFormat(GLenum format) const { return format; } -// Nexus 5 crashes on allocating a cube map texture bound to FBO, if -// the CUBE_MAP_POSITIVE_X texture is not allocated yet. -void TextureManager::DoTexImage2DCubeMapPositiveXIfNeeded( - DecoderTextureState* texture_state, - ErrorState* error_state, - DecoderFramebufferState* framebuffer_state, - const char* function_name, - TextureRef* texture_ref, - const DoTexImageArguments& args) { - switch (args.target) { - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - break; - default: - return; - } - - // ValidateTexImage is passed already. - Texture* texture = texture_ref->texture(); - int width = 0; - int height = 0; - bool positive_x_level_defined = texture->GetLevelSize( - GL_TEXTURE_CUBE_MAP_POSITIVE_X, args.level, &width, &height, nullptr); - if (!positive_x_level_defined) { - DoTexImageArguments positive_x_args = args; - positive_x_args.target = GL_TEXTURE_CUBE_MAP_POSITIVE_X; - positive_x_args.pixels = nullptr; - positive_x_args.pixels_size = 0; - DoTexImage(texture_state, error_state, framebuffer_state, function_name, - texture_ref, positive_x_args); - } -} - void TextureManager::DoTexImage( DecoderTextureState* texture_state, ErrorState* error_state, diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h index 595f035..e97feb3 100644 --- a/gpu/command_buffer/service/texture_manager.h +++ b/gpu/command_buffer/service/texture_manager.h @@ -14,7 +14,6 @@ #include "base/containers/hash_tables.h" #include "base/memory/ref_counted.h" #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" -#include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/gpu_export.h" @@ -533,13 +532,10 @@ class GPU_EXPORT TextureRef : public base::RefCounted<TextureRef> { struct DecoderTextureState { // total_texture_upload_time automatically initialized to 0 in default // constructor. - explicit DecoderTextureState(const FeatureInfo::Workarounds& workarounds) + explicit DecoderTextureState(bool texsubimage_faster_than_teximage) : tex_image_failed(false), texture_upload_count(0), - texsubimage_faster_than_teximage( - workarounds.texsubimage_faster_than_teximage), - force_cube_map_positive_x_allocation( - workarounds.force_cube_map_positive_x_allocation) {} + texsubimage_faster_than_teximage(texsubimage_faster_than_teximage) {} // This indicates all the following texSubImage*D calls that are part of the // failed texImage*D call should be ignored. The client calls have a lock @@ -552,7 +548,6 @@ struct DecoderTextureState { base::TimeDelta total_texture_upload_time; bool texsubimage_faster_than_teximage; - bool force_cube_map_positive_x_allocation; }; // This class keeps track of the textures and their sizes so we can do NPOT and @@ -893,14 +888,6 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { TextureRef* texture_ref, const DoTexImageArguments& args); - void DoTexImage2DCubeMapPositiveXIfNeeded( - DecoderTextureState* texture_state, - ErrorState* error_state, - DecoderFramebufferState* framebuffer_state, - const char* function_name, - TextureRef* texture_ref, - const DoTexImageArguments& args); - void StartTracking(TextureRef* texture); void StopTracking(TextureRef* texture); diff --git a/gpu/command_buffer/tests/gl_cube_map_texture_unittest.cc b/gpu/command_buffer/tests/gl_cube_map_texture_unittest.cc deleted file mode 100644 index 2f052ac..0000000 --- a/gpu/command_buffer/tests/gl_cube_map_texture_unittest.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <GLES2/gl2.h> - -#include "gpu/command_buffer/tests/gl_manager.h" -#include "gpu/command_buffer/tests/gl_test_utils.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace gpu { - -namespace { -const GLenum kCubeMapTextureTargets[] = { - GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, -}; -} // namespace - -// A collection of tests that exercise the cube map texture. -class GLCubeMapTextureTest : public testing::TestWithParam<GLenum> { - protected: - void SetUp() override { - gl_.Initialize(GLManager::Options()); - for (int i = 0; i < 256; i++) { - pixels_[i * 4] = 255u; - pixels_[(i * 4) + 1] = 0; - pixels_[(i * 4) + 2] = 0; - pixels_[(i * 4) + 3] = 255u; - } - - glGenTextures(1, &texture_); - glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glGenFramebuffers(1, &framebuffer_id_); - } - - void TearDown() override { - glDeleteTextures(1, &texture_); - glDeleteFramebuffers(1, &framebuffer_id_); - gl_.Destroy(); - } - - GLManager gl_; - uint8 pixels_[256 * 4]; - const int width_ = 16; - GLuint texture_; - GLuint framebuffer_id_; -}; - -INSTANTIATE_TEST_CASE_P(GLCubeMapTextureTests, - GLCubeMapTextureTest, - ::testing::ValuesIn(kCubeMapTextureTargets)); - -TEST_P(GLCubeMapTextureTest, TexImage2DAfterFBOBinding) { - GLenum cube_map_target = GetParam(); - - glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, - texture_, 0); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); - // force_gl_finish_after_compositing workaround prevents Nexus 5 crash. - // TODO(dshwang): remove the workaround when it's fixed. crbug.com/518889 - glTexImage2D(cube_map_target, 0, GL_RGBA, width_, width_, 0, GL_RGBA, - GL_UNSIGNED_BYTE, pixels_); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); -} - -TEST_P(GLCubeMapTextureTest, ReadPixels) { - GLenum cube_map_target = GetParam(); - - glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - // Make a cube texture complete - for (unsigned i = 0; i < arraysize(kCubeMapTextureTargets); i++) { - glTexImage2D(kCubeMapTextureTargets[i], 0, GL_RGBA, width_, width_, 0, - GL_RGBA, GL_UNSIGNED_BYTE, pixels_); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - } - - glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, - texture_, 0); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - // Check that FB is complete. - EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), - glCheckFramebufferStatus(GL_FRAMEBUFFER)); - - GLTestHelper::CheckPixels(0, 0, width_, width_, 0, pixels_); - EXPECT_TRUE(GL_NO_ERROR == glGetError()); -} - -#if defined(OS_WIN) -// TODO(dshwang): ANGLE crashes. crbug.com/518889 -TEST_P(GLCubeMapTextureTest, DISABLED_ReadPixelsFromIncompleteFBO) { -#else -TEST_P(GLCubeMapTextureTest, ReadPixelsFromIncompleteFBO) { -#endif - GLenum cube_map_target = GetParam(); - - glBindTexture(GL_TEXTURE_CUBE_MAP, texture_); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glTexImage2D(cube_map_target, 0, GL_RGBA, width_, width_, 0, GL_RGBA, - GL_UNSIGNED_BYTE, pixels_); - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, cube_map_target, - texture_, 0); - - // force_gl_finish_after_compositing workaround prevents Nexus 5 crash. - // TODO(dshwang): remove the workaround when it's fixed. crbug.com/518889 - EXPECT_TRUE(glGetError() == GL_NO_ERROR); - - GLsizei size = width_ * width_ * 4; - scoped_ptr<uint8[]> pixels(new uint8[size]); - // ANGLE crashes on glReadPixels() from incomplete FBO. - glReadPixels(0, 0, width_, width_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); - // According to spec, above glReadPixels() should fail and glGetError() - // should report an error, but some drivers are fine to bind incomplete cube - // map texture to FBO. - glGetError(); -} - -} // namespace gpu |