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

Side by Side Diff: gpu/command_buffer/tests/gl_texture_storage_unittest.cc

Issue 1301053002: gpu: introduce DISABLE_TEXTURE_STORAGE workaround for mesa (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: match CommandLine pattern to other gl_tests Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 7
8 #include "base/command_line.h"
9 #include "base/strings/string_number_conversions.h"
8 #include "gpu/command_buffer/tests/gl_manager.h" 10 #include "gpu/command_buffer/tests/gl_manager.h"
9 #include "gpu/command_buffer/tests/gl_test_utils.h" 11 #include "gpu/command_buffer/tests/gl_test_utils.h"
12 #include "gpu/config/gpu_switches.h"
10 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 15
13 namespace gpu { 16 namespace gpu {
14 17
15 class TextureStorageTest : public testing::Test { 18 class TextureStorageTest : public testing::Test {
16 protected: 19 protected:
17 static const GLsizei kResolution = 64; 20 static const GLsizei kResolution = 64;
18 void SetUp() override { 21 void SetUp() override {
22 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
23 command_line.AppendSwitchASCII(
24 switches::kGpuDriverBugWorkarounds,
25 base::IntToString(gpu::DISABLE_TEXTURE_STORAGE));
26
19 GLManager::Options options; 27 GLManager::Options options;
20 options.size = gfx::Size(kResolution, kResolution); 28 options.size = gfx::Size(kResolution, kResolution);
21 gl_.Initialize(options); 29
30 gl_.InitializeWithCommandLine(options, &command_line);
31 DCHECK(gl_.workarounds().disable_texture_storage);
22 gl_.MakeCurrent(); 32 gl_.MakeCurrent();
23 33
24 glGenTextures(1, &tex_); 34 glGenTextures(1, &tex_);
25 glBindTexture(GL_TEXTURE_2D, tex_); 35 glBindTexture(GL_TEXTURE_2D, tex_);
26 36
27 glGenFramebuffers(1, &fbo_); 37 glGenFramebuffers(1, &fbo_);
28 glBindFramebuffer(GL_FRAMEBUFFER, fbo_); 38 glBindFramebuffer(GL_FRAMEBUFFER, fbo_);
29 glFramebufferTexture2D(GL_FRAMEBUFFER, 39 glFramebufferTexture2D(GL_FRAMEBUFFER,
30 GL_COLOR_ATTACHMENT0, 40 GL_COLOR_ATTACHMENT0,
31 GL_TEXTURE_2D, 41 GL_TEXTURE_2D,
(...skipping 21 matching lines...) Expand all
53 63
54 uint8 source_pixels[16] = { 64 uint8 source_pixels[16] = {
55 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 65 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4
56 }; 66 };
57 glTexSubImage2D(GL_TEXTURE_2D, 67 glTexSubImage2D(GL_TEXTURE_2D,
58 0, 68 0,
59 0, 0, 69 0, 0,
60 2, 2, 70 2, 2,
61 GL_RGBA, GL_UNSIGNED_BYTE, 71 GL_RGBA, GL_UNSIGNED_BYTE,
62 source_pixels); 72 source_pixels);
73
74 // Mesa dirvers crash without DISABLE_TEXTURE_STORAGE workaround.
75 // crbug.com/521904
63 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 2, 2, 0, source_pixels)); 76 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 2, 2, 0, source_pixels));
64 } 77 }
65 78
66 TEST_F(TextureStorageTest, IsImmutable) { 79 TEST_F(TextureStorageTest, IsImmutable) {
67 if (!extension_available_) 80 if (!extension_available_)
68 return; 81 return;
69 82
70 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 4, 4); 83 glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, 4, 4);
71 84
72 GLint param = 0; 85 GLint param = 0;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 GL_RGBA, 162 GL_RGBA,
150 GL_UNSIGNED_BYTE, 163 GL_UNSIGNED_BYTE,
151 NULL); 164 NULL);
152 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); 165 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError());
153 } 166 }
154 167
155 } // namespace gpu 168 } // namespace gpu
156 169
157 170
158 171
OLDNEW
« no previous file with comments | « no previous file | gpu/config/gpu_driver_bug_list_json.cc » ('j') | gpu/config/gpu_driver_bug_workaround_type.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698