1 #ifndef DALI_TEST_GRAPHICS_COMMAND_BUFFER_H
2 #define DALI_TEST_GRAPHICS_COMMAND_BUFFER_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali/graphics-api/graphics-command-buffer-create-info.h>
21 #include <dali/graphics-api/graphics-command-buffer.h>
22 #include <dali/graphics-api/graphics-pipeline.h>
23 #include <dali/graphics-api/graphics-types.h>
26 #include "test-gl-abstraction.h"
27 #include "test-graphics-pipeline.h"
28 #include "test-trace-call-stack.h"
32 class TestGraphicsCommandBuffer : public Graphics::CommandBuffer
35 TestGraphicsCommandBuffer(TraceCallStack& callstack, TestGlAbstraction& glAbstraction);
37 void BindVertexBuffers(uint32_t firstBinding,
38 std::vector<const Graphics::Buffer*> buffers,
39 std::vector<uint32_t> offsets);
41 void BindUniformBuffers(const std::vector<Graphics::UniformBufferBinding>& bindings);
43 void BindPipeline(const Graphics::Pipeline& pipeline);
45 void BindTextures(std::vector<Graphics::TextureBinding>& textureBindings);
47 void BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings);
49 void BindPushConstants(void* data,
53 void BindIndexBuffer(const Graphics::Buffer& buffer,
55 Graphics::Format format);
57 void BeginRenderPass(Graphics::RenderPass& renderPass,
58 Graphics::RenderTarget& renderTarget,
59 Graphics::Extent2D renderArea,
60 std::vector<Graphics::ClearValue> clearValues);
66 uint32_t instanceCount,
68 uint32_t firstInstance);
72 uint32_t instanceCount,
75 uint32_t firstInstance);
77 void DrawIndexedIndirect(
78 Graphics::Buffer& buffer,
83 void Reset(Graphics::CommandBuffer& commandBuffer);
85 void SetScissor(Graphics::Extent2D value);
87 void SetScissorTestEnable(bool value);
89 void SetViewport(Graphics::Viewport value);
91 void SetViewportEnable(bool value);
94 TraceCallStack& mCallStack;
95 TestGlAbstraction& mGlAbstraction;
96 TestGraphicsPipeline* mPipeline{nullptr};
97 std::vector<Graphics::TextureBinding> mTextureBindings{};
99 struct VertexBuffersBinding
101 uint32_t firstBinding;
102 std::vector<const Graphics::Buffer*> buffers;
103 std::vector<uint32_t> offsets;
105 VertexBuffersBinding mVertexBufferBindings{};
107 struct IndexBufferBinding
109 const Graphics::Buffer* buffer;
111 Graphics::Format format;
113 IndexBufferBinding mIndexBufferBinding{};
127 uint32_t instanceCount;
129 int32_t vertexOffset;
130 uint32_t firstInstance;
134 uint32_t vertexCount;
135 uint32_t instanceCount;
136 uint32_t firstVertex;
137 uint32_t firstInstance;
145 #endif //DALI_TEST_GRAPHICS_COMMAND_BUFFER_H