1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL (ES) Module
3 * -----------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Compiler test case.
22 *//*--------------------------------------------------------------------*/
24 #include "glsShaderLibrary.hpp"
25 #include "glsShaderLibraryCase.hpp"
35 class CaseFactory : public glu::sl::ShaderCaseFactory
38 CaseFactory (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& contextInfo)
40 , m_renderCtx (renderCtx)
41 , m_contextInfo (contextInfo)
45 tcu::TestCaseGroup* createGroup (const std::string& name, const std::string& description, const std::vector<tcu::TestNode*>& children)
47 return new tcu::TestCaseGroup(m_testCtx, name.c_str(), description.c_str(), children);
50 tcu::TestCase* createCase (const std::string& name, const std::string& description, const glu::sl::ShaderCaseSpecification& spec)
52 return new ShaderLibraryCase(m_testCtx, m_renderCtx, m_contextInfo, name.c_str(), description.c_str(), spec);
56 tcu::TestContext& m_testCtx;
57 glu::RenderContext& m_renderCtx;
58 const glu::ContextInfo& m_contextInfo;
63 ShaderLibrary::ShaderLibrary (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& contextInfo)
65 , m_renderCtx (renderCtx)
66 , m_contextInfo (contextInfo)
70 ShaderLibrary::~ShaderLibrary (void)
74 std::vector<tcu::TestNode*> ShaderLibrary::loadShaderFile (const char* fileName)
76 CaseFactory caseFactory (m_testCtx, m_renderCtx, m_contextInfo);
78 return glu::sl::parseFile(m_testCtx.getArchive(), fileName, &caseFactory);