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/program_manager.h" | 5 #include "gpu/command_buffer/service/program_manager.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 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 nullptr, 0, service_program_id); | 2068 nullptr, 0, service_program_id); |
2069 } | 2069 } |
2070 | 2070 |
2071 void SetExpectationsForProgramLink() { | 2071 void SetExpectationsForProgramLink() { |
2072 SetExpectationsForProgramLink(kServiceProgramId); | 2072 SetExpectationsForProgramLink(kServiceProgramId); |
2073 } | 2073 } |
2074 | 2074 |
2075 void SetExpectationsForProgramLink(GLuint service_program_id) { | 2075 void SetExpectationsForProgramLink(GLuint service_program_id) { |
2076 TestHelper::SetupShaderExpectations(gl_.get(), feature_info_.get(), nullptr, | 2076 TestHelper::SetupShaderExpectations(gl_.get(), feature_info_.get(), nullptr, |
2077 0, nullptr, 0, service_program_id); | 2077 0, nullptr, 0, service_program_id); |
2078 if (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary) { | 2078 if (gl::g_driver_gl.ext.b_GL_ARB_get_program_binary) { |
2079 EXPECT_CALL(*gl_.get(), | 2079 EXPECT_CALL(*gl_.get(), |
2080 ProgramParameteri(service_program_id, | 2080 ProgramParameteri(service_program_id, |
2081 PROGRAM_BINARY_RETRIEVABLE_HINT, | 2081 PROGRAM_BINARY_RETRIEVABLE_HINT, |
2082 GL_TRUE)).Times(1); | 2082 GL_TRUE)).Times(1); |
2083 } | 2083 } |
2084 } | 2084 } |
2085 | 2085 |
2086 void SetExpectationsForSuccessCompile( | 2086 void SetExpectationsForSuccessCompile( |
2087 const Shader* shader) { | 2087 const Shader* shader) { |
2088 const GLuint shader_id = shader->service_id(); | 2088 const GLuint shader_id = shader->service_id(); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 {GL_FLOAT_VEC4, 0, GL_MEDIUM_FLOAT, true, "gl_SecondaryFragColorEXT", | 2344 {GL_FLOAT_VEC4, 0, GL_MEDIUM_FLOAT, true, "gl_SecondaryFragColorEXT", |
2345 kVarOutput}, | 2345 kVarOutput}, |
2346 {GL_FLOAT_VEC4, 0, GL_MEDIUM_FLOAT, true, "gl_FragColor", kVarOutput}, | 2346 {GL_FLOAT_VEC4, 0, GL_MEDIUM_FLOAT, true, "gl_FragColor", kVarOutput}, |
2347 }; | 2347 }; |
2348 | 2348 |
2349 int shader_version = 100; | 2349 int shader_version = 100; |
2350 Program* program = | 2350 Program* program = |
2351 SetupProgramForVariables(nullptr, 0, kFragmentVaryings, | 2351 SetupProgramForVariables(nullptr, 0, kFragmentVaryings, |
2352 arraysize(kFragmentVaryings), &shader_version); | 2352 arraysize(kFragmentVaryings), &shader_version); |
2353 | 2353 |
2354 const gfx::GLVersionInfo& gl_version = feature_info_->gl_version_info(); | 2354 const gl::GLVersionInfo& gl_version = feature_info_->gl_version_info(); |
2355 if (!gl_version.is_es) { | 2355 if (!gl_version.is_es) { |
2356 // The call is expected only for OpenGL. OpenGL ES expects to | 2356 // The call is expected only for OpenGL. OpenGL ES expects to |
2357 // output GLES SL 1.00, which does not bind. | 2357 // output GLES SL 1.00, which does not bind. |
2358 EXPECT_CALL(*(gl_.get()), | 2358 EXPECT_CALL(*(gl_.get()), |
2359 BindFragDataLocationIndexed(kServiceProgramId, 0, 1, | 2359 BindFragDataLocationIndexed(kServiceProgramId, 0, 1, |
2360 StrEq("angle_SecondaryFragColor"))) | 2360 StrEq("angle_SecondaryFragColor"))) |
2361 .Times(1) | 2361 .Times(1) |
2362 .RetiresOnSaturation(); | 2362 .RetiresOnSaturation(); |
2363 } | 2363 } |
2364 | 2364 |
2365 EXPECT_TRUE(LinkAsExpected(program, true)); | 2365 EXPECT_TRUE(LinkAsExpected(program, true)); |
2366 } | 2366 } |
2367 | 2367 |
2368 TEST_P(ProgramManagerDualSourceBlendingES2Test, UseSecondaryFragData) { | 2368 TEST_P(ProgramManagerDualSourceBlendingES2Test, UseSecondaryFragData) { |
2369 const VarInfo kFragmentVaryings[] = { | 2369 const VarInfo kFragmentVaryings[] = { |
2370 {GL_FLOAT_VEC4, kMaxDualSourceDrawBuffers, GL_MEDIUM_FLOAT, true, | 2370 {GL_FLOAT_VEC4, kMaxDualSourceDrawBuffers, GL_MEDIUM_FLOAT, true, |
2371 "gl_SecondaryFragDataEXT", kVarOutput}, | 2371 "gl_SecondaryFragDataEXT", kVarOutput}, |
2372 {GL_FLOAT_VEC4, kMaxDrawBuffers, GL_MEDIUM_FLOAT, true, "gl_FragData", | 2372 {GL_FLOAT_VEC4, kMaxDrawBuffers, GL_MEDIUM_FLOAT, true, "gl_FragData", |
2373 kVarOutput}, | 2373 kVarOutput}, |
2374 }; | 2374 }; |
2375 | 2375 |
2376 int shader_version = 100; | 2376 int shader_version = 100; |
2377 Program* program = | 2377 Program* program = |
2378 SetupProgramForVariables(nullptr, 0, kFragmentVaryings, | 2378 SetupProgramForVariables(nullptr, 0, kFragmentVaryings, |
2379 arraysize(kFragmentVaryings), &shader_version); | 2379 arraysize(kFragmentVaryings), &shader_version); |
2380 | 2380 |
2381 const gfx::GLVersionInfo& gl_version = feature_info_->gl_version_info(); | 2381 const gl::GLVersionInfo& gl_version = feature_info_->gl_version_info(); |
2382 if (!gl_version.is_es) { | 2382 if (!gl_version.is_es) { |
2383 // The call is expected only for OpenGL. OpenGL ES expects to | 2383 // The call is expected only for OpenGL. OpenGL ES expects to |
2384 // output GLES SL 1.00, which does not bind. | 2384 // output GLES SL 1.00, which does not bind. |
2385 EXPECT_CALL(*(gl_.get()), | 2385 EXPECT_CALL(*(gl_.get()), |
2386 BindFragDataLocationIndexed(kServiceProgramId, 0, 1, | 2386 BindFragDataLocationIndexed(kServiceProgramId, 0, 1, |
2387 StrEq("angle_SecondaryFragData"))) | 2387 StrEq("angle_SecondaryFragData"))) |
2388 .Times(1) | 2388 .Times(1) |
2389 .RetiresOnSaturation(); | 2389 .RetiresOnSaturation(); |
2390 } | 2390 } |
2391 | 2391 |
2392 EXPECT_TRUE(LinkAsExpected(program, true)); | 2392 EXPECT_TRUE(LinkAsExpected(program, true)); |
2393 } | 2393 } |
2394 | 2394 |
2395 INSTANTIATE_TEST_CASE_P( | 2395 INSTANTIATE_TEST_CASE_P( |
2396 SupportedContexts, | 2396 SupportedContexts, |
2397 ProgramManagerDualSourceBlendingES2Test, | 2397 ProgramManagerDualSourceBlendingES2Test, |
2398 testing::Values( | 2398 testing::Values( |
2399 make_gl_ext_tuple("3.2", | 2399 make_gl_ext_tuple("3.2", |
2400 "GL_ARB_draw_buffers GL_ARB_blend_func_extended " | 2400 "GL_ARB_draw_buffers GL_ARB_blend_func_extended " |
2401 "GL_ARB_program_interface_query"), | 2401 "GL_ARB_program_interface_query"), |
2402 make_gl_ext_tuple("opengl es 3.1", | 2402 make_gl_ext_tuple("opengl es 3.1", |
2403 "GL_EXT_draw_buffers GL_EXT_blend_func_extended"))); | 2403 "GL_EXT_draw_buffers GL_EXT_blend_func_extended"))); |
2404 | 2404 |
2405 } // namespace gles2 | 2405 } // namespace gles2 |
2406 } // namespace gpu | 2406 } // namespace gpu |
OLD | NEW |