[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-graphics-program.h
1 #ifndef DALI_TEST_GRAPHICS_PROGRAM_H
2 #define DALI_TEST_GRAPHICS_PROGRAM_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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 #include <dali/graphics-api/graphics-program-create-info.h>
21 #include <dali/graphics-api/graphics-program.h>
22 #include "test-gl-abstraction.h"
23 #include "test-graphics-reflection.h"
24
25 namespace Dali
26 {
27 class TestGraphicsController;
28
29 class TestGraphicsProgramImpl
30 {
31 public:
32   TestGraphicsProgramImpl(TestGraphicsController& controller, TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector<UniformData>& customUniforms, std::vector<TestGraphicsReflection::TestUniformBlockInfo>& customUniformBlocks);
33
34   // For API
35   const TestGraphicsReflection& GetReflection() const
36   {
37     // Build a reflection
38     return mReflection;
39   }
40
41   // For tests
42   TestGraphicsReflection& GetProgramReflection()
43   {
44     return mReflection;
45   }
46
47   bool GetParameter(uint32_t parameterId, void* outData);
48
49 public:
50   TestGraphicsController&     mController;
51   TestGlAbstraction&          mGl;
52   uint32_t                    mId;
53   Graphics::ProgramCreateInfo mCreateInfo;
54   TestGraphicsReflection      mReflection;
55 };
56
57 class TestGraphicsProgram : public Graphics::Program
58 {
59 public:
60   TestGraphicsProgram(TestGraphicsProgramImpl* impl);
61
62   const TestGraphicsReflection& GetReflection() const
63   {
64     return mImpl->GetReflection();
65   }
66   bool GetParameter(uint32_t parameterId, void* outData)
67   {
68     return mImpl->GetParameter(parameterId, outData);
69   }
70
71   TestGraphicsReflection& GetProgamReflection()
72   {
73     return mImpl->GetProgramReflection();
74   }
75
76 public:
77   TestGraphicsProgramImpl* mImpl;
78 };
79
80 } // namespace Dali
81
82 #endif //DALI_TEST_GRAPHICS_PROGRAM_H