13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL (ES) Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ----------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Compiler test case. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsShaderLibrary.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsShaderLibraryCase.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 32fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulosnamespace 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 35fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulosclass CaseFactory : public glu::sl::ShaderCaseFactory 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 38fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos CaseFactory (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& contextInfo) 39fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos : m_testCtx (testCtx) 40fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos , m_renderCtx (renderCtx) 41fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos , m_contextInfo (contextInfo) 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 45fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos tcu::TestCaseGroup* createGroup (const std::string& name, const std::string& description, const std::vector<tcu::TestNode*>& children) 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 47fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos return new tcu::TestCaseGroup(m_testCtx, name.c_str(), description.c_str(), children); 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 50fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos tcu::TestCase* createCase (const std::string& name, const std::string& description, const glu::sl::ShaderCaseSpecification& spec) 510024f5512d4e3796b42bb2afe5449e3adac6a137Pyry Haulos { 52fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos return new ShaderLibraryCase(m_testCtx, m_renderCtx, m_contextInfo, name.c_str(), description.c_str(), spec); 530024f5512d4e3796b42bb2afe5449e3adac6a137Pyry Haulos } 540024f5512d4e3796b42bb2afe5449e3adac6a137Pyry Haulos 55fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulosprivate: 56fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos tcu::TestContext& m_testCtx; 57fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos glu::RenderContext& m_renderCtx; 58fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos const glu::ContextInfo& m_contextInfo; 59fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos}; 600024f5512d4e3796b42bb2afe5449e3adac6a137Pyry Haulos 61fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos} // anonymous 620024f5512d4e3796b42bb2afe5449e3adac6a137Pyry Haulos 63fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry HaulosShaderLibrary::ShaderLibrary (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const glu::ContextInfo& contextInfo) 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : m_testCtx (testCtx) 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_renderCtx (renderCtx) 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_contextInfo (contextInfo) 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 703c827367444ee418f129b2c238299f49d3264554Jarkko PoyryShaderLibrary::~ShaderLibrary (void) 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 74fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulosstd::vector<tcu::TestNode*> ShaderLibrary::loadShaderFile (const char* fileName) 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 76fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos CaseFactory caseFactory (m_testCtx, m_renderCtx, m_contextInfo); 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 78fb19324168dd35ccbb7fca74e5426f1a3fbc03a2Pyry Haulos return glu::sl::parseFile(m_testCtx.getArchive(), fileName, &caseFactory); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 83