Test sync with adaptor 02/293202/4
authorDavid Steele <david.steele@samsung.com>
Thu, 27 Apr 2023 11:11:01 +0000 (12:11 +0100)
committerDavid Steele <david.steele@samsung.com>
Wed, 31 May 2023 11:11:49 +0000 (12:11 +0100)
Adaptor changes for integer attribute

Change-Id: I89471ca98179d1ca9a9e19db6110585d7231378a

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-actor-utils.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h

index bf62bb8..40388b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -131,4 +131,11 @@ Texture CreateTexture(TextureType::Type type, Pixel::Format format, int width, i
   return texture;
 }
 
+TextureSet CreateTextureSet(Pixel::Format format, int width, int height)
+{
+  TextureSet textureSet = TextureSet::New();
+  textureSet.SetTexture(0u, CreateTexture(TextureType::TEXTURE_2D, format, width, height));
+  return textureSet;
+}
+
 } // namespace Dali
index 0dbe07e..94f1493 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_ACTOR_UTILS_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -60,7 +60,8 @@ Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, co
  */
 Actor CreateRenderableActor2(TextureSet textures, const std::string& vertexShader, const std::string& fragmentShader);
 
-Texture CreateTexture(TextureType::Type type, Pixel::Format format, int width, int height);
+Texture    CreateTexture(TextureType::Type type, Pixel::Format format, int width, int height);
+TextureSet CreateTextureSet(Pixel::Format format, int width, int height);
 
 } // namespace Dali
 
index 6021026..1d20a6a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -101,9 +101,9 @@ void TestGlAbstraction::Initialize()
   mProgramUniforms3f.clear();
   mProgramUniforms4f.clear();
 
-  mAttribLocs.clear();
-  mAttribLocs.push_back("aPosition");
-  mAttribLocs.push_back("aTexCoord");
+  mAttribLocs  = {"aPosition", "aTexCoord"};
+  mAttribTypes = {GL_FLOAT, GL_FLOAT};
+
   mCullFaceTrace.Reset();
   mDepthFunctionTrace.Reset();
   mEnableDisableTrace.Reset();
index 834ae6f..cc27d9e 100644 (file)
@@ -796,6 +796,8 @@ public:
 
   inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
   {
+    strncpy(name, mAttribLocs[index].c_str(), 99);
+    *type = mAttribTypes[index];
   }
 
   inline void SetActiveUniforms(const std::vector<ActiveUniform>& uniforms)
@@ -1590,6 +1592,18 @@ public:
     mBufferTrace.PushCall("VertexAttribPointer", namedParams.str(), namedParams);
   }
 
+  inline void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
+  {
+    TraceCallStack::NamedParams namedParams;
+    namedParams["index"] << index;
+    namedParams["size"] << size;
+    namedParams["type"] << std::hex << type;
+    namedParams["stride"] << stride;
+    namedParams["offset"] << std::to_string(reinterpret_cast<unsigned long>(pointer));
+
+    mBufferTrace.PushCall("VertexAttribIPointer", namedParams.str(), namedParams);
+  }
+
   inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
   {
     std::string commaString(", ");
@@ -1772,10 +1786,6 @@ public:
   {
   }
 
-  inline void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
-  {
-  }
-
   inline void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
   {
   }
@@ -2099,10 +2109,14 @@ public: // TEST FUNCTIONS
   {
     mLinkStatus = value;
   }
-  inline void SetAttribLocations(std::vector<std::string> locs)
+  inline void SetAttribLocations(std::vector<std::string>& locs)
   {
     mAttribLocs = locs;
   }
+  inline void SetAttribTypes(std::vector<GLenum>& types)
+  {
+    mAttribTypes = types;
+  }
   inline void SetGetErrorResult(GLenum result)
   {
     mGetErrorResult = result;
@@ -2573,7 +2587,8 @@ public:
   bool                                  mGetProgramBinaryCalled;
   typedef std::map<GLuint, std::string> ShaderSourceMap;
   ShaderSourceMap                       mShaderSources;
-  std::vector<std::string>              mAttribLocs; // should be bound to shader
+  std::vector<std::string>              mAttribLocs;  // should be bound to shader
+  std::vector<GLenum>                   mAttribTypes; // should be bound to shader
   GLuint                                mLastShaderCompiled;
   GLbitfield                            mLastClearBitMask;
   Vector4                               mLastClearColor;