| 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 27 matching lines...) Expand all Loading... |
| 38 using ::testing::SetArgPointee; | 38 using ::testing::SetArgPointee; |
| 39 using ::testing::StrEq; | 39 using ::testing::StrEq; |
| 40 | 40 |
| 41 namespace gpu { | 41 namespace gpu { |
| 42 namespace gles2 { | 42 namespace gles2 { |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 const uint32_t kMaxVaryingVectors = 8; | 45 const uint32_t kMaxVaryingVectors = 8; |
| 46 const uint32_t kMaxDrawBuffers = 8; | 46 const uint32_t kMaxDrawBuffers = 8; |
| 47 const uint32_t kMaxDualSourceDrawBuffers = 8; | 47 const uint32_t kMaxDualSourceDrawBuffers = 8; |
| 48 const uint32_t kMaxVertexAttribs = 8; |
| 48 | 49 |
| 49 void ShaderCacheCb(const std::string& key, const std::string& shader) {} | 50 void ShaderCacheCb(const std::string& key, const std::string& shader) {} |
| 50 | 51 |
| 51 uint32_t ComputeOffset(const void* start, const void* position) { | 52 uint32_t ComputeOffset(const void* start, const void* position) { |
| 52 return static_cast<const uint8_t*>(position) - | 53 return static_cast<const uint8_t*>(position) - |
| 53 static_cast<const uint8_t*>(start); | 54 static_cast<const uint8_t*>(start); |
| 54 } | 55 } |
| 55 | 56 |
| 56 } // namespace anonymous | 57 } // namespace anonymous |
| 57 | 58 |
| 58 class ProgramManagerTestBase : public GpuServiceTest { | 59 class ProgramManagerTestBase : public GpuServiceTest { |
| 59 protected: | 60 protected: |
| 60 virtual void SetupProgramManager() { | 61 virtual void SetupProgramManager() { |
| 61 manager_.reset(new ProgramManager(nullptr, kMaxVaryingVectors, | 62 manager_.reset(new ProgramManager(nullptr, kMaxVaryingVectors, |
| 62 kMaxDrawBuffers, | 63 kMaxDrawBuffers, |
| 63 kMaxDualSourceDrawBuffers, | 64 kMaxDualSourceDrawBuffers, |
| 65 kMaxVertexAttribs, |
| 64 gpu_preferences_, | 66 gpu_preferences_, |
| 65 feature_info_.get())); | 67 feature_info_.get())); |
| 66 } | 68 } |
| 67 void SetUpBase(const char* gl_version, | 69 void SetUpBase(const char* gl_version, |
| 68 const char* gl_extensions, | 70 const char* gl_extensions, |
| 69 FeatureInfo* feature_info = nullptr) { | 71 FeatureInfo* feature_info = nullptr) { |
| 70 GpuServiceTest::SetUpWithGLVersion(gl_version, gl_extensions); | 72 GpuServiceTest::SetUpWithGLVersion(gl_version, gl_extensions); |
| 71 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 73 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 72 gl_.get(), gl_extensions, "", gl_version); | 74 gl_.get(), gl_extensions, "", gl_version); |
| 73 if (!feature_info) | 75 if (!feature_info) |
| (...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2065 vertex_shader_(NULL), | 2067 vertex_shader_(NULL), |
| 2066 fragment_shader_(NULL), | 2068 fragment_shader_(NULL), |
| 2067 program_(NULL) { | 2069 program_(NULL) { |
| 2068 } | 2070 } |
| 2069 | 2071 |
| 2070 protected: | 2072 protected: |
| 2071 void SetupProgramManager() override { | 2073 void SetupProgramManager() override { |
| 2072 manager_.reset(new ProgramManager(cache_.get(), kMaxVaryingVectors, | 2074 manager_.reset(new ProgramManager(cache_.get(), kMaxVaryingVectors, |
| 2073 kMaxDrawBuffers, | 2075 kMaxDrawBuffers, |
| 2074 kMaxDualSourceDrawBuffers, | 2076 kMaxDualSourceDrawBuffers, |
| 2077 kMaxVertexAttribs, |
| 2075 gpu_preferences_, | 2078 gpu_preferences_, |
| 2076 feature_info_.get())); | 2079 feature_info_.get())); |
| 2077 } | 2080 } |
| 2078 | 2081 |
| 2079 void SetUp() override { | 2082 void SetUp() override { |
| 2080 ProgramManagerTestBase::SetUp(); | 2083 ProgramManagerTestBase::SetUp(); |
| 2081 | 2084 |
| 2082 vertex_shader_ = shader_manager_.CreateShader( | 2085 vertex_shader_ = shader_manager_.CreateShader( |
| 2083 kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER); | 2086 kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER); |
| 2084 fragment_shader_ = shader_manager_.CreateShader( | 2087 fragment_shader_ = shader_manager_.CreateShader( |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2518 ProgramManagerDualSourceBlendingES2Test, | 2521 ProgramManagerDualSourceBlendingES2Test, |
| 2519 testing::Values( | 2522 testing::Values( |
| 2520 make_gl_ext_tuple("3.2", | 2523 make_gl_ext_tuple("3.2", |
| 2521 "GL_ARB_draw_buffers GL_ARB_blend_func_extended " | 2524 "GL_ARB_draw_buffers GL_ARB_blend_func_extended " |
| 2522 "GL_ARB_program_interface_query"), | 2525 "GL_ARB_program_interface_query"), |
| 2523 make_gl_ext_tuple("opengl es 3.1", | 2526 make_gl_ext_tuple("opengl es 3.1", |
| 2524 "GL_EXT_draw_buffers GL_EXT_blend_func_extended"))); | 2527 "GL_EXT_draw_buffers GL_EXT_blend_func_extended"))); |
| 2525 | 2528 |
| 2526 } // namespace gles2 | 2529 } // namespace gles2 |
| 2527 } // namespace gpu | 2530 } // namespace gpu |
| OLD | NEW |