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

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

Issue 653203004: Disallow drawing feedback loops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 .Times(1) 307 .Times(1)
308 .RetiresOnSaturation(); 308 .RetiresOnSaturation();
309 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); 309 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd));
310 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 310 EXPECT_EQ(GL_NO_ERROR, GetGLError());
311 311
312 // Setup Frame buffer. 312 // Setup Frame buffer.
313 // needs to be 1x1 or else it's not renderable. 313 // needs to be 1x1 or else it's not renderable.
314 const GLsizei kWidth = 1; 314 const GLsizei kWidth = 1;
315 const GLsizei kHeight = 1; 315 const GLsizei kHeight = 1;
316 const GLenum kFormat = GL_RGB; 316 const GLenum kFormat = GL_RGB;
317 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 317 // Use a different texture for framebuffer to avoid drawing feedback loops.
318 EXPECT_CALL(*gl_, GenTextures(_, _))
319 .WillOnce(SetArgumentPointee<1>(kNewServiceId))
320 .RetiresOnSaturation();
321 GenHelper<cmds::GenTexturesImmediate>(kNewClientId);
322 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kNewServiceId);
318 // Pass some data so the texture will be marked as cleared. 323 // Pass some data so the texture will be marked as cleared.
319 DoTexImage2D(GL_TEXTURE_2D, 324 DoTexImage2D(GL_TEXTURE_2D,
320 0, 325 0,
321 kFormat, 326 kFormat,
322 kWidth, 327 kWidth,
323 kHeight, 328 kHeight,
324 0, 329 0,
325 kFormat, 330 kFormat,
326 GL_UNSIGNED_BYTE, 331 GL_UNSIGNED_BYTE,
327 kSharedMemoryId, 332 kSharedMemoryId,
328 kSharedMemoryOffset); 333 kSharedMemoryOffset);
329 DoBindFramebuffer( 334 DoBindFramebuffer(
330 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 335 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
331 DoFramebufferTexture2D(GL_FRAMEBUFFER, 336 DoFramebufferTexture2D(GL_FRAMEBUFFER,
332 GL_COLOR_ATTACHMENT0, 337 GL_COLOR_ATTACHMENT0,
333 GL_TEXTURE_2D, 338 GL_TEXTURE_2D,
334 client_texture_id_, 339 kNewClientId,
335 kServiceTextureId, 340 kNewServiceId,
336 0, 341 0,
337 GL_NO_ERROR); 342 GL_NO_ERROR);
343 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
338 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) 344 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
339 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 345 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
340 .RetiresOnSaturation(); 346 .RetiresOnSaturation();
341 347
342 // This time state needs to be set. 348 // This time state needs to be set.
343 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB 349 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB
344 false, // Framebuffer has depth 350 false, // Framebuffer has depth
345 false, // Framebuffer has stencil 351 false, // Framebuffer has stencil
346 0x1110, // color bits 352 0x1110, // color bits
347 false, // depth mask 353 false, // depth mask
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 .Times(1) 2387 .Times(1)
2382 .RetiresOnSaturation(); 2388 .RetiresOnSaturation();
2383 DrawArrays cmd; 2389 DrawArrays cmd;
2384 cmd.Init(GL_TRIANGLES, 0, kNumVertices); 2390 cmd.Init(GL_TRIANGLES, 0, kNumVertices);
2385 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2391 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2386 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2392 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2387 } 2393 }
2388 2394
2389 } // namespace gles2 2395 } // namespace gles2
2390 } // namespace gpu 2396 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698