| OLD | NEW |
| 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/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 const DisallowedFeatures& disallowed_features, | 339 const DisallowedFeatures& disallowed_features, |
| 340 const char* extensions, | 340 const char* extensions, |
| 341 const char* gl_version, | 341 const char* gl_version, |
| 342 ContextType context_type, | 342 ContextType context_type, |
| 343 bool bind_generates_resource) { | 343 bool bind_generates_resource) { |
| 344 InSequence sequence; | 344 InSequence sequence; |
| 345 | 345 |
| 346 gl::GLVersionInfo gl_info(gl_version, "", extensions); | 346 gl::GLVersionInfo gl_info(gl_version, "", extensions); |
| 347 | 347 |
| 348 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version, | 348 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version, |
| 349 context_type, | |
| 350 context_type == CONTEXT_TYPE_WEBGL2 || | 349 context_type == CONTEXT_TYPE_WEBGL2 || |
| 351 context_type == CONTEXT_TYPE_OPENGLES3); | 350 context_type == CONTEXT_TYPE_OPENGLES3); |
| 352 | 351 |
| 353 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _)) | 352 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _)) |
| 354 .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize)) | 353 .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize)) |
| 355 .RetiresOnSaturation(); | 354 .RetiresOnSaturation(); |
| 356 if (strstr(extensions, "GL_EXT_framebuffer_multisample") || | 355 if (strstr(extensions, "GL_EXT_framebuffer_multisample") || |
| 357 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || | 356 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || |
| 358 gl_info.is_es3 || gl_info.is_desktop_core_profile) { | 357 gl_info.is_es3 || gl_info.is_desktop_core_profile) { |
| 359 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) | 358 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 .RetiresOnSaturation(); | 472 .RetiresOnSaturation(); |
| 474 | 473 |
| 475 bool use_default_textures = bind_generates_resource; | 474 bool use_default_textures = bind_generates_resource; |
| 476 SetupTextureManagerInitExpectations( | 475 SetupTextureManagerInitExpectations( |
| 477 gl, false, gl_info.is_es3_capable, gl_info.is_desktop_core_profile, | 476 gl, false, gl_info.is_es3_capable, gl_info.is_desktop_core_profile, |
| 478 extensions, use_default_textures); | 477 extensions, use_default_textures); |
| 479 } | 478 } |
| 480 | 479 |
| 481 void TestHelper::SetupFeatureInfoInitExpectations(::gl::MockGLInterface* gl, | 480 void TestHelper::SetupFeatureInfoInitExpectations(::gl::MockGLInterface* gl, |
| 482 const char* extensions) { | 481 const char* extensions) { |
| 483 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", "", | 482 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", ""); |
| 484 CONTEXT_TYPE_OPENGLES2); | |
| 485 } | 483 } |
| 486 | 484 |
| 487 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 485 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 488 ::gl::MockGLInterface* gl, | 486 ::gl::MockGLInterface* gl, |
| 489 const char* extensions, | 487 const char* extensions, |
| 490 const char* gl_renderer, | 488 const char* gl_renderer, |
| 491 const char* gl_version, | 489 const char* gl_version, |
| 492 ContextType context_type, | |
| 493 bool enable_es3) { | 490 bool enable_es3) { |
| 494 InSequence sequence; | 491 InSequence sequence; |
| 495 | 492 |
| 496 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 493 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
| 497 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) | 494 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) |
| 498 .RetiresOnSaturation(); | 495 .RetiresOnSaturation(); |
| 499 | 496 |
| 500 // Persistent storage is needed for the split extension string. | 497 // Persistent storage is needed for the split extension string. |
| 501 split_extensions_.clear(); | 498 split_extensions_.clear(); |
| 502 if (extensions) { | 499 if (extensions) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 521 .RetiresOnSaturation(); | 518 .RetiresOnSaturation(); |
| 522 } | 519 } |
| 523 | 520 |
| 524 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 521 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
| 525 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) | 522 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version))) |
| 526 .RetiresOnSaturation(); | 523 .RetiresOnSaturation(); |
| 527 EXPECT_CALL(*gl, GetString(GL_RENDERER)) | 524 EXPECT_CALL(*gl, GetString(GL_RENDERER)) |
| 528 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_renderer))) | 525 .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_renderer))) |
| 529 .RetiresOnSaturation(); | 526 .RetiresOnSaturation(); |
| 530 | 527 |
| 531 if (!(context_type == CONTEXT_TYPE_WEBGL1 || | 528 if (gl_info.is_es3_capable && enable_es3) { |
| 532 context_type == CONTEXT_TYPE_OPENGLES2) && | |
| 533 gl_info.is_es3_capable && enable_es3) { | |
| 534 EXPECT_CALL(*gl, GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, _)) | 529 EXPECT_CALL(*gl, GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, _)) |
| 535 .WillOnce(SetArgPointee<1>(0)) | 530 .WillOnce(SetArgPointee<1>(0)) |
| 536 .RetiresOnSaturation(); | 531 .RetiresOnSaturation(); |
| 537 } | 532 } |
| 538 | 533 |
| 539 if ((strstr(extensions, "GL_ARB_texture_float") || | 534 if ((strstr(extensions, "GL_ARB_texture_float") || |
| 540 gl_info.is_desktop_core_profile) || | 535 gl_info.is_desktop_core_profile) || |
| 541 (gl_info.is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) { | 536 (gl_info.is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) { |
| 542 static const GLuint tx_ids[] = {101, 102}; | 537 static const GLuint tx_ids[] = {101, 102}; |
| 543 static const GLuint fb_ids[] = {103, 104}; | 538 static const GLuint fb_ids[] = {103, 104}; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 568 EXPECT_CALL(*gl, BindFramebufferEXT(GL_FRAMEBUFFER, fb_ids[1])) | 563 EXPECT_CALL(*gl, BindFramebufferEXT(GL_FRAMEBUFFER, fb_ids[1])) |
| 569 .Times(1) | 564 .Times(1) |
| 570 .RetiresOnSaturation(); | 565 .RetiresOnSaturation(); |
| 571 EXPECT_CALL(*gl, FramebufferTexture2DEXT(GL_FRAMEBUFFER, | 566 EXPECT_CALL(*gl, FramebufferTexture2DEXT(GL_FRAMEBUFFER, |
| 572 GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tx_ids[1], 0)) | 567 GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tx_ids[1], 0)) |
| 573 .Times(1) | 568 .Times(1) |
| 574 .RetiresOnSaturation(); | 569 .RetiresOnSaturation(); |
| 575 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) | 570 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 576 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 571 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 577 .RetiresOnSaturation(); | 572 .RetiresOnSaturation(); |
| 573 GLenum status_rgba = GL_FRAMEBUFFER_COMPLETE; |
| 578 EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, | 574 EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, |
| 579 GL_RGB, GL_FLOAT, _)) | 575 GL_RGB, GL_FLOAT, _)) |
| 580 .Times(1) | 576 .Times(1) |
| 581 .RetiresOnSaturation(); | 577 .RetiresOnSaturation(); |
| 582 if (gl_info.is_es3) { | 578 if (gl_info.is_es3) { |
| 583 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) | 579 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 584 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)) | 580 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)) |
| 585 .RetiresOnSaturation(); | 581 .RetiresOnSaturation(); |
| 586 } else { | 582 } else { |
| 587 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) | 583 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 588 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 584 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 589 .RetiresOnSaturation(); | 585 .RetiresOnSaturation(); |
| 586 } |
| 590 | 587 |
| 588 if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { |
| 591 if (enable_es3 && gl_info.is_es3_capable) { | 589 if (enable_es3 && gl_info.is_es3_capable) { |
| 592 EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, | 590 EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, |
| 593 0, GL_RED, GL_FLOAT, _)) | 591 0, GL_RED, GL_FLOAT, _)) |
| 594 .Times(1) | 592 .Times(1) |
| 595 .RetiresOnSaturation(); | 593 .RetiresOnSaturation(); |
| 596 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) | 594 EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER)) |
| 597 .Times(1) | 595 .Times(1) |
| 598 .RetiresOnSaturation(); | 596 .RetiresOnSaturation(); |
| 599 EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, | 597 EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, |
| 600 0, GL_RG, GL_FLOAT, _)) | 598 0, GL_RG, GL_FLOAT, _)) |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 GLenum precision, | 1200 GLenum precision, |
| 1203 bool static_use, | 1201 bool static_use, |
| 1204 const std::string& name) { | 1202 const std::string& name) { |
| 1205 return ConstructShaderVariable<sh::OutputVariable>( | 1203 return ConstructShaderVariable<sh::OutputVariable>( |
| 1206 type, array_size, precision, static_use, name); | 1204 type, array_size, precision, static_use, name); |
| 1207 } | 1205 } |
| 1208 | 1206 |
| 1209 } // namespace gles2 | 1207 } // namespace gles2 |
| 1210 } // namespace gpu | 1208 } // namespace gpu |
| 1211 | 1209 |
| OLD | NEW |