glsShaderLibrary.cpp revision fb19324168dd35ccbb7fca74e5426f1a3fbc03a2
1/*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL (ES) Module 3 * ----------------------------------------------- 4 * 5 * Copyright 2014 The Android Open Source Project 6 * 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 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 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. 18 * 19 *//*! 20 * \file 21 * \brief Compiler test case. 22 *//*--------------------------------------------------------------------*/ 23 24#include "glsShaderLibrary.hpp" 25#include "glsShaderLibraryCase.hpp" 26 27namespace deqp 28{ 29namespace gls 30{ 31 32namespace 33{ 34 35class CaseFactory : public glu::sl::ShaderCaseFactory 36{ 37public: 38 CaseFactory (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& contextInfo) 39 : m_testCtx (testCtx) 40 , m_renderCtx (renderCtx) 41 , m_contextInfo (contextInfo) 42 { 43 } 44 45 tcu::TestCaseGroup* createGroup (const std::string& name, const std::string& description, const std::vector<tcu::TestNode*>& children) 46 { 47 return new tcu::TestCaseGroup(m_testCtx, name.c_str(), description.c_str(), children); 48 } 49 50 tcu::TestCase* createCase (const std::string& name, const std::string& description, const glu::sl::ShaderCaseSpecification& spec) 51 { 52 return new ShaderLibraryCase(m_testCtx, m_renderCtx, m_contextInfo, name.c_str(), description.c_str(), spec); 53 } 54 55private: 56 tcu::TestContext& m_testCtx; 57 glu::RenderContext& m_renderCtx; 58 const glu::ContextInfo& m_contextInfo; 59}; 60 61} // anonymous 62 63ShaderLibrary::ShaderLibrary (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& contextInfo) 64 : m_testCtx (testCtx) 65 , m_renderCtx (renderCtx) 66 , m_contextInfo (contextInfo) 67{ 68} 69 70ShaderLibrary::~ShaderLibrary (void) 71{ 72} 73 74std::vector<tcu::TestNode*> ShaderLibrary::loadShaderFile (const char* fileName) 75{ 76 CaseFactory caseFactory (m_testCtx, m_renderCtx, m_contextInfo); 77 78 return glu::sl::parseFile(m_testCtx.getArchive(), fileName, &caseFactory); 79} 80 81} // gls 82} // deqp 83