12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "gpu/command_buffer/service/program_cache.h" 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/memory/scoped_ptr.h" 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "gpu/command_buffer/service/mocks.h" 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h" 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 11eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochusing ::testing::Return; 122385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace gpu { 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace gles2 { 152385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class NoBackendProgramCache : public ProgramCache { 1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public: 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ProgramLoadResult LoadLinkedProgram( 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GLuint /* program */, 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) Shader* /* shader_a */, 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* /* translator_a */, 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) Shader* /* shader_b */, 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* /* translator_b */, 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const LocationMap* /* bind_attrib_location_map */, 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderCacheCallback& /* callback */) OVERRIDE { 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return PROGRAM_LOAD_SUCCESS; 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void SaveLinkedProgram( 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GLuint /* program */, 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const Shader* /* shader_a */, 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* /* translator_b */, 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const Shader* /* shader_b */, 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* /* translator_b */, 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const LocationMap* /* bind_attrib_location_map */, 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderCacheCallback& /* callback */) OVERRIDE { } 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void LoadProgram(const std::string& /* program */) OVERRIDE {} 38424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void ClearBackend() OVERRIDE {} 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void SaySuccessfullyCached(const std::string& shader1, 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* translator_1, 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& shader2, 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* translator_2, 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::map<std::string, GLint>* attrib_map) { 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char a_sha[kHashLength]; 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char b_sha[kHashLength]; 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ComputeShaderHash(shader1, translator_1, a_sha); 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ComputeShaderHash(shader2, translator_2, b_sha); 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char sha[kHashLength]; 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ComputeProgramHash(a_sha, 531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci b_sha, 541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci attrib_map, 551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci sha); 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shaString(sha, kHashLength); 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) LinkedProgramCacheSuccess(shaString); 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void ComputeShaderHash(const std::string& shader, 622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ShaderTranslatorInterface* translator, 632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char* result) const { 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ProgramCache::ComputeShaderHash(shader, translator, result); 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void ComputeProgramHash(const char* hashed_shader_0, 682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const char* hashed_shader_1, 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const LocationMap* bind_attrib_location_map, 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char* result) const { 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ProgramCache::ComputeProgramHash(hashed_shader_0, 722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) hashed_shader_1, 732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bind_attrib_location_map, 742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) result); 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void Evict(const std::string& program_hash) { 782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ProgramCache::Evict(program_hash); 792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ProgramCacheTest : public testing::Test { 832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ProgramCacheTest() : 852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_(new NoBackendProgramCache()) { } 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) protected: 882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) scoped_ptr<NoBackendProgramCache> cache_; 892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)TEST_F(ProgramCacheTest, LinkStatusSave) { 922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader1 = "abcd1234"; 932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; 942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) { 952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string shader_a = shader1; 962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string shader_b = shader2; 972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus( 992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shader_a, NULL, shader_b, NULL, NULL)); 1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->SaySuccessfullyCached(shader_a, NULL, shader_b, NULL, NULL); 1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shader_a.clear(); 1032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shader_b.clear(); 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // make sure it was copied 1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_SUCCEEDED, 1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus( 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) shader1, NULL, shader2, NULL, NULL)); 109a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)} 110a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)TEST_F(ProgramCacheTest, LinkUnknownOnFragmentSourceChange) { 1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader1 = "abcd1234"; 1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string shader2 = "abcda sda b1~#4 bbbbb1234"; 1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->SaySuccessfullyCached(shader1, NULL, shader2, NULL, NULL); 1152385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 1162385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch shader2 = "different!"; 1172385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1182385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch cache_->GetLinkedProgramStatus(shader1, NULL, shader2, NULL, NULL)); 1192385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch} 1202385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 1212385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen MurdochTEST_F(ProgramCacheTest, LinkUnknownOnVertexSourceChange) { 1222385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch std::string shader1 = "abcd1234"; 1232385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; 1242385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch cache_->SaySuccessfullyCached(shader1, NULL, shader2, NULL, NULL); 1252385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 1262385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch shader1 = "different!"; 1272385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1282385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch cache_->GetLinkedProgramStatus(shader1, NULL, shader2, NULL, NULL)); 1292385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch} 1302385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 1312385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen MurdochTEST_F(ProgramCacheTest, StatusEviction) { 132a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) const std::string shader1 = "abcd1234"; 1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; 1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->SaySuccessfullyCached(shader1, NULL, shader2, NULL, NULL); 1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char a_sha[ProgramCache::kHashLength]; 1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char b_sha[ProgramCache::kHashLength]; 1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeShaderHash(shader1, NULL, a_sha); 1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeShaderHash(shader2, NULL, b_sha); 1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char sha[ProgramCache::kHashLength]; 1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeProgramHash(a_sha, 1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) b_sha, 1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) NULL, 1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) sha); 1452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->Evict(std::string(sha, ProgramCache::kHashLength)); 1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader2, NULL, NULL)); 1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)TEST_F(ProgramCacheTest, EvictionWithReusedShader) { 1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader1 = "abcd1234"; 1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; 1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader3 = "asbjbbjj239a"; 1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->SaySuccessfullyCached(shader1, NULL, shader2, NULL, NULL); 1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->SaySuccessfullyCached(shader1, NULL, shader3, NULL, NULL); 1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char a_sha[ProgramCache::kHashLength]; 1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char b_sha[ProgramCache::kHashLength]; 1592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char c_sha[ProgramCache::kHashLength]; 1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeShaderHash(shader1, NULL, a_sha); 1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeShaderHash(shader2, NULL, b_sha); 1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeShaderHash(shader3, NULL, c_sha); 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) char sha[ProgramCache::kHashLength]; 1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeProgramHash(a_sha, 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) b_sha, 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) NULL, 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) sha); 1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->Evict(std::string(sha, ProgramCache::kHashLength)); 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 17190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader2, NULL, NULL)); 1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_SUCCEEDED, 1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader3, NULL, NULL)); 1742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->ComputeProgramHash(a_sha, 1772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) c_sha, 1782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) NULL, 1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) sha); 1802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->Evict(std::string(sha, ProgramCache::kHashLength)); 1812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader2, NULL, NULL)); 1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader3, NULL, NULL)); 1852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)TEST_F(ProgramCacheTest, StatusClear) { 1882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string shader1 = "abcd1234"; 189424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; 190424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const std::string shader3 = "asbjbbjj239a"; 191424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) cache_->SaySuccessfullyCached(shader1, NULL, shader2, NULL, NULL); 1922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->SaySuccessfullyCached(shader1, NULL, shader3, NULL, NULL); 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->Clear(); 1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader2, NULL, NULL)); 1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) EXPECT_EQ(ProgramCache::LINK_UNKNOWN, 1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cache_->GetLinkedProgramStatus(shader1, NULL, shader3, NULL, NULL)); 1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace gles2 2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace gpu 2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)