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

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

Issue 2786963002: Revert of Make gl_clear_broken workaround support core profile and use it under AMD Linux Catalyst driver (Closed)
Patch Set: Created 3 years, 8 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 #ifndef GL_GLEXT_PROTOTYPES 5 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES 6 #define GL_GLEXT_PROTOTYPES
7 #endif 7 #endif
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 27 matching lines...) Expand all
38 command_line.AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, 38 command_line.AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
39 base::IntToString(gpu::GL_CLEAR_BROKEN)); 39 base::IntToString(gpu::GL_CLEAR_BROKEN));
40 gl_.InitializeWithCommandLine(GLManager::Options(), command_line); 40 gl_.InitializeWithCommandLine(GLManager::Options(), command_line);
41 DCHECK(gl_.workarounds().gl_clear_broken); 41 DCHECK(gl_.workarounds().gl_clear_broken);
42 } else { 42 } else {
43 gl_.Initialize(GLManager::Options()); 43 gl_.Initialize(GLManager::Options());
44 DCHECK(!gl_.workarounds().gl_clear_broken); 44 DCHECK(!gl_.workarounds().gl_clear_broken);
45 } 45 }
46 } 46 }
47 47
48 bool IsApplicable() {
49 // The workaround doesn't use VAOs which would cause a failure on a core
50 // context and the hardware for each the workaround is necessary has a buggy
51 // VAO implementation. So we skip testing the workaround on core profiles.
52 return !GetParam() ||
53 !gl_.context()->GetVersionInfo()->is_desktop_core_profile;
54 }
55
48 void InitDraw(); 56 void InitDraw();
49 void SetDrawColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); 57 void SetDrawColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
50 void SetDrawDepth(GLfloat depth); 58 void SetDrawDepth(GLfloat depth);
51 void DrawQuad(); 59 void DrawQuad();
52 60
53 void TearDown() override { 61 void TearDown() override {
54 GLTestHelper::CheckGLError("no errors", __LINE__); 62 GLTestHelper::CheckGLError("no errors", __LINE__);
55 gl_.Destroy(); 63 gl_.Destroy();
56 } 64 }
57 65
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 111
104 void GLClearFramebufferTest::DrawQuad() { 112 void GLClearFramebufferTest::DrawQuad() {
105 glDrawArrays(GL_TRIANGLES, 0, 6); 113 glDrawArrays(GL_TRIANGLES, 0, 6);
106 } 114 }
107 115
108 INSTANTIATE_TEST_CASE_P(GLClearFramebufferTestWithParam, 116 INSTANTIATE_TEST_CASE_P(GLClearFramebufferTestWithParam,
109 GLClearFramebufferTest, 117 GLClearFramebufferTest,
110 ::testing::Values(true, false)); 118 ::testing::Values(true, false));
111 119
112 TEST_P(GLClearFramebufferTest, ClearColor) { 120 TEST_P(GLClearFramebufferTest, ClearColor) {
121 if (!IsApplicable()) {
122 return;
123 }
124
113 glClearColor(1.0f, 0.5f, 0.25f, 0.5f); 125 glClearColor(1.0f, 0.5f, 0.25f, 0.5f);
114 glClear(GL_COLOR_BUFFER_BIT); 126 glClear(GL_COLOR_BUFFER_BIT);
115 127
116 // Verify. 128 // Verify.
117 const uint8_t expected[] = {255, 128, 64, 128}; 129 const uint8_t expected[] = {255, 128, 64, 128};
118 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1 /* tolerance */, expected, 130 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1 /* tolerance */, expected,
119 nullptr)); 131 nullptr));
120 } 132 }
121 133
122 TEST_P(GLClearFramebufferTest, ClearColorWithMask) { 134 TEST_P(GLClearFramebufferTest, ClearColorWithMask) {
135 if (!IsApplicable()) {
136 return;
137 }
138
123 glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 139 glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
124 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 140 glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
125 glClear(GL_COLOR_BUFFER_BIT); 141 glClear(GL_COLOR_BUFFER_BIT);
126 142
127 // Verify. 143 // Verify.
128 const uint8_t expected[] = {255, 0, 0, 0}; 144 const uint8_t expected[] = {255, 0, 0, 0};
129 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, expected, 145 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, expected,
130 nullptr)); 146 nullptr));
131 } 147 }
132 148
133 // crbug.com/434094 149 // crbug.com/434094
134 #if !defined(OS_MACOSX) 150 #if !defined(OS_MACOSX)
135 TEST_P(GLClearFramebufferTest, ClearColorWithScissor) { 151 TEST_P(GLClearFramebufferTest, ClearColorWithScissor) {
152 if (!IsApplicable()) {
153 return;
154 }
155
136 glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 156 glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
137 glClear(GL_COLOR_BUFFER_BIT); 157 glClear(GL_COLOR_BUFFER_BIT);
138 158
139 // Verify. 159 // Verify.
140 const uint8_t expected[] = {255, 255, 255, 255}; 160 const uint8_t expected[] = {255, 255, 255, 255};
141 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, expected, 161 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, expected,
142 nullptr)); 162 nullptr));
143 163
144 glScissor(0, 0, 0, 0); 164 glScissor(0, 0, 0, 0);
145 glEnable(GL_SCISSOR_TEST); 165 glEnable(GL_SCISSOR_TEST);
146 glClearColor(0, 0, 0, 0); 166 glClearColor(0, 0, 0, 0);
147 glClear(GL_COLOR_BUFFER_BIT); 167 glClear(GL_COLOR_BUFFER_BIT);
148 168
149 // Verify - no changes. 169 // Verify - no changes.
150 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, expected, 170 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, expected,
151 nullptr)); 171 nullptr));
152 } 172 }
153 #endif 173 #endif
154 174
155 TEST_P(GLClearFramebufferTest, ClearDepthStencil) { 175 TEST_P(GLClearFramebufferTest, ClearDepthStencil) {
176 if (!IsApplicable()) {
177 return;
178 }
179
156 const GLuint kStencilRef = 1 << 2; 180 const GLuint kStencilRef = 1 << 2;
157 InitDraw(); 181 InitDraw();
158 SetDrawColor(1.0f, 0.0f, 0.0f, 1.0f); 182 SetDrawColor(1.0f, 0.0f, 0.0f, 1.0f);
159 DrawQuad(); 183 DrawQuad();
160 // Verify. 184 // Verify.
161 const uint8_t kRed[] = {255, 0, 0, 255}; 185 const uint8_t kRed[] = {255, 0, 0, 255};
162 const uint8_t kGreen[] = {0, 255, 0, 255}; 186 const uint8_t kGreen[] = {0, 255, 0, 255};
163 EXPECT_TRUE( 187 EXPECT_TRUE(
164 GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, kRed, nullptr)); 188 GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, kRed, nullptr));
165 189
(...skipping 28 matching lines...) Expand all
194 218
195 glClearDepthf(0.9f); 219 glClearDepthf(0.9f);
196 glClear(GL_DEPTH_BUFFER_BIT); 220 glClear(GL_DEPTH_BUFFER_BIT);
197 DrawQuad(); 221 DrawQuad();
198 // Verify - depth test should have passed, so red. 222 // Verify - depth test should have passed, so red.
199 EXPECT_TRUE( 223 EXPECT_TRUE(
200 GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, kRed, nullptr)); 224 GLTestHelper::CheckPixels(0, 0, 1, 1, 0 /* tolerance */, kRed, nullptr));
201 } 225 }
202 226
203 } // namespace gpu 227 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698