• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
27 namespace deqp
28 {
29 namespace gls
30 {
31 
32 namespace
33 {
34 
35 class CaseFactory : public glu::sl::ShaderCaseFactory
36 {
37 public:
CaseFactory(tcu::TestContext & testCtx,glu::RenderContext & renderCtx,const glu::ContextInfo & contextInfo)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 
createGroup(const std::string & name,const std::string & description,const std::vector<tcu::TestNode * > & children)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 
createCase(const std::string & name,const std::string & description,const glu::sl::ShaderCaseSpecification & spec)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 
55 private:
56 	tcu::TestContext&			m_testCtx;
57 	glu::RenderContext&			m_renderCtx;
58 	const glu::ContextInfo&		m_contextInfo;
59 };
60 
61 } // anonymous
62 
ShaderLibrary(tcu::TestContext & testCtx,glu::RenderContext & renderCtx,const glu::ContextInfo & contextInfo)63 ShaderLibrary::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 
~ShaderLibrary(void)70 ShaderLibrary::~ShaderLibrary (void)
71 {
72 }
73 
loadShaderFile(const char * fileName)74 std::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