Test harness updates 44/254344/2 graphics-backend-pre-release-2
authorDavid Steele <david.steele@samsung.com>
Fri, 26 Feb 2021 17:27:49 +0000 (17:27 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Sat, 27 Feb 2021 00:18:48 +0000 (00:18 +0000)
Change-Id: I512d0933dacdfbd4f21085e7495d3bc0dd906c68

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/mesh-builder.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-program.h

index e678074..3a4e127 100644 (file)
@@ -72,4 +72,46 @@ Geometry CreateQuadGeometry(void)
   return geometry;
 }
 
+Property::Map CreateModelVertexFormat()
+{
+  Property::Map modelVF;
+  modelVF["aPosition"]       = Property::VECTOR3;
+  modelVF["aNormal"]         = Property::VECTOR3;
+  modelVF["aTexCoord1"]      = Property::VECTOR3;
+  modelVF["aTexCoord2"]      = Property::VECTOR3;
+  modelVF["aBoneIndex[0]"]   = Property::INTEGER;
+  modelVF["aBoneIndex[1]"]   = Property::INTEGER;
+  modelVF["aBoneIndex[2]"]   = Property::INTEGER;
+  modelVF["aBoneIndex[3]"]   = Property::INTEGER;
+  modelVF["aBoneWeights[0]"] = Property::FLOAT;
+  modelVF["aBoneWeights[1]"] = Property::FLOAT;
+  modelVF["aBoneWeights[2]"] = Property::FLOAT;
+  modelVF["aBoneWeights[3]"] = Property::FLOAT;
+  return modelVF;
+}
+
+Geometry CreateModelGeometry(Property::Map& vf)
+{
+  VertexBuffer vertexData = VertexBuffer::New(vf);
+
+  struct Vertex
+  {
+    Vector3 position;
+    Vector3 diffuseTexCoords;
+    Vector3 metalRoughTexCoords;
+    int     boneIndices[4];
+    float   boneWeights[4];
+  };
+
+  Vertex verts[30];
+  vertexData.SetData(verts, 30);
+  unsigned short indexData[40];
+
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer(vertexData);
+  geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
+
+  return geometry;
+}
+
 } // namespace Dali
index d5c61b0..adcf78e 100644 (file)
@@ -2,7 +2,7 @@
 #define MESH_BUILDER_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 namespace Dali
 {
-Shader       CreateShader();
-TextureSet   CreateTextureSet();
-TextureSet   CreateTextureSet(Texture texture);
-Geometry     CreateQuadGeometry();
-VertexBuffer CreateVertexBuffer();
+Shader        CreateShader();
+TextureSet    CreateTextureSet();
+TextureSet    CreateTextureSet(Texture texture);
+Geometry      CreateQuadGeometry();
+Geometry      CreateModelGeometry(Property::Map& vf);
+VertexBuffer  CreateVertexBuffer();
+Property::Map CreateModelVertexFormat();
 
 } // namespace Dali
 
index 220e5e5..adacc11 100644 (file)
@@ -21,7 +21,6 @@
 #include "test-graphics-reflection.h"
 #include "test-graphics-sampler.h"
 #include "test-graphics-shader.h"
-#include "test-graphics-program.h"
 #include "test-graphics-texture.h"
 
 #include <dali/integration-api/gl-defines.h>
@@ -793,7 +792,8 @@ bool TestGraphicsController::PipelineEquals(const Graphics::Pipeline& pipeline0,
 bool TestGraphicsController::GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData )
 {
   mCallStack.PushCall("GetProgramParameter", "");
-  return false;
+  auto graphicsProgram = Uncast<TestGraphicsProgram>(&program);
+  return graphicsProgram->GetParameter(parameterId, outData);
 }
 
 } // namespace Dali
index db5a9f7..1b23380 100644 (file)
@@ -23,6 +23,15 @@ TestGraphicsProgram::TestGraphicsProgram(TestGlAbstraction& gl, const Graphics::
   mCreateInfo(createInfo),
   mReflection(gl, vertexFormats)
 {
+  mId = 0;//mGl.CreateProgram();
 }
 
+bool TestGraphicsProgram::GetParameter(uint32_t parameterId, void* outData )
+{
+  reinterpret_cast<uint32_t*>(outData)[0] = mId;
+  return true;
+}
+
+
+
 } // namespace Dali
index 2bd04de..d5f5b85 100644 (file)
@@ -42,8 +42,11 @@ public:
     return mReflection;
   }
 
+  bool GetParameter(uint32_t parameterId, void* outData );
+
 public:
   TestGlAbstraction&          mGl;
+  uint32_t                    mId;
   Graphics::ProgramCreateInfo mCreateInfo;
   TestGraphicsReflection      mReflection;
 };