DirectRendering:
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-graphics-command-buffer.h
index 3df3219..407dade 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_GRAPHICS_COMMAND_BUFFER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -65,6 +65,7 @@ enum class CommandType
   SET_DEPTH_COMPARE_OP    = 1 << 24,
   SET_DEPTH_TEST_ENABLE   = 1 << 25,
   SET_DEPTH_WRITE_ENABLE  = 1 << 26,
+  DRAW_NATIVE             = 1 << 27,
 };
 
 std::ostream& operator<<(std::ostream& os, Graphics::StencilOp op);
@@ -123,7 +124,8 @@ struct DrawCallDescriptor
   {
     DRAW,
     DRAW_INDEXED,
-    DRAW_INDEXED_INDIRECT
+    DRAW_INDEXED_INDIRECT,
+    DRAW_NATIVE
   };
 
   Type type{}; ///< Type of the draw call
@@ -166,6 +168,11 @@ struct DrawCallDescriptor
       uint32_t                  drawCount;
       uint32_t                  stride;
     } drawIndexedIndirect;
+
+    struct
+    {
+      Graphics::DrawNativeInfo drawNativeInfo;
+    } drawNative;
   };
 };
 
@@ -265,6 +272,12 @@ struct Command
         data.bindUniformBuffers = rhs.data.bindUniformBuffers;
         break;
       }
+      case CommandType::DRAW_NATIVE:
+      {
+        data.draw.type       = rhs.data.draw.type;
+        data.draw.drawNative = rhs.data.draw.drawNative;
+        break;
+      }
       case CommandType::DRAW:
       {
         data.draw.type = rhs.data.draw.type;
@@ -418,6 +431,12 @@ struct Command
         data.bindPipeline = rhs.data.bindPipeline;
         break;
       }
+      case CommandType::DRAW_NATIVE:
+      {
+        data.draw.type       = rhs.data.draw.type;
+        data.draw.drawNative = rhs.data.draw.drawNative;
+        break;
+      }
       case CommandType::DRAW:
       {
         data.draw.type = rhs.data.draw.type;
@@ -647,9 +666,9 @@ public:
   {
   }
 
-  void BindVertexBuffers(uint32_t                             firstBinding,
-                         std::vector<const Graphics::Buffer*> buffers,
-                         std::vector<uint32_t>                offsets) override
+  void BindVertexBuffers(uint32_t                                    firstBinding,
+                         const std::vector<const Graphics::Buffer*>& buffers,
+                         const std::vector<uint32_t>&                offsets) override
   {
     mCommands.emplace_back();
     mCommands.back().type = CommandType::BIND_VERTEX_BUFFERS;
@@ -712,7 +731,7 @@ public:
     mCallStack.PushCall("BindPipeline", "");
   }
 
-  void BindTextures(std::vector<Graphics::TextureBinding>& textureBindings) override
+  void BindTextures(const std::vector<Graphics::TextureBinding>& textureBindings) override
   {
     mCommands.emplace_back();
     mCommands.back().type                              = CommandType::BIND_TEXTURES;
@@ -720,7 +739,7 @@ public:
     mCallStack.PushCall("BindTextures", "");
   }
 
-  void BindSamplers(std::vector<Graphics::SamplerBinding>& samplerBindings) override
+  void BindSamplers(const std::vector<Graphics::SamplerBinding>& samplerBindings) override
   {
     mCommands.emplace_back();
     mCommands.back().data.bindSamplers.samplerBindings = std::move(samplerBindings);
@@ -747,10 +766,10 @@ public:
   }
 
   void BeginRenderPass(
-    Graphics::RenderPass*             renderPass,
-    Graphics::RenderTarget*           renderTarget,
-    Graphics::Rect2D                  renderArea,
-    std::vector<Graphics::ClearValue> clearValues) override
+    Graphics::RenderPass*                    renderPass,
+    Graphics::RenderTarget*                  renderTarget,
+    Graphics::Rect2D                         renderArea,
+    const std::vector<Graphics::ClearValue>& clearValues) override
   {
     mCommands.emplace_back(CommandType::BEGIN_RENDER_PASS);
     auto& cmd                             = mCommands.back();
@@ -800,6 +819,16 @@ public:
     mCallStack.PushCall("ExecuteCommandBuffers", "");
   }
 
+  void DrawNative(const Graphics::DrawNativeInfo* drawInfo)
+  {
+    mCommands.emplace_back();
+    mCommands.back().type         = CommandType::DRAW_NATIVE;
+    auto& cmd                     = mCommands.back().data.draw;
+    cmd.type                      = DrawCallDescriptor::Type::DRAW_NATIVE;
+    cmd.drawNative.drawNativeInfo = *drawInfo;
+    mCallStack.PushCall("DrawNative", "");
+  }
+
   void Draw(
     uint32_t vertexCount,
     uint32_t instanceCount,