Test harness for UBO
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-graphics-program.cpp
index 1b23380..0bf698a 100644 (file)
 
 namespace Dali
 {
-TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats)
+TestGraphicsProgramImpl::TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms)
 : mGl(gl),
   mCreateInfo(createInfo),
-  mReflection(gl, vertexFormats)
+  mReflection(gl, vertexFormats, createInfo, customUniforms)
 {
-  mId = 0;//mGl.CreateProgram();
+  mId = mGl.CreateProgram();
+
+  // Ensure active sampler uniforms are set
+  mGl.SetCustomUniforms(customUniforms);
+  mGl.LinkProgram(mId);
 }
 
-bool TestGraphicsProgram::GetParameter(uint32_t parameterId, void* outData )
+bool TestGraphicsProgramImpl::GetParameter(uint32_t parameterId, void* outData)
 {
   reinterpret_cast<uint32_t*>(outData)[0] = mId;
   return true;
 }
 
+TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms)
+{
+  mImpl = new TestGraphicsProgramImpl(gl, createInfo, vertexFormats, customUniforms);
+}
 
+TestGraphicsProgram::TestGraphicsProgram(TestGraphicsProgramImpl* impl)
+{
+  mImpl = impl;
+}
 
 } // namespace Dali