From a25282ce20250e4cfb32c2c461081954fab156e4 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 7 Nov 2023 17:25:17 +0000 Subject: [PATCH] Test harness sync Change-Id: Ib6cb5b6c7af71ab81727b2de7cbf40f822bf42f5 --- .../dali-test-suite-utils/test-graphics-controller.cpp | 2 +- .../dali-test-suite-utils/test-graphics-controller.h | 15 ++++++++++++--- .../dali-test-suite-utils/test-graphics-program.cpp | 7 ++++--- .../dali-test-suite-utils/test-graphics-program.h | 5 ++++- .../dali-test-suite-utils/test-graphics-reflection.cpp | 12 +++++++----- .../dali-test-suite-utils/test-graphics-reflection.h | 5 ++++- 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp index 527b9f4..24bb51e 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp @@ -1289,7 +1289,7 @@ Graphics::UniquePtr TestGraphicsController::CreateProgram(con } mProgramCache.emplace_back(); - mProgramCache.back().programImpl = new TestGraphicsProgramImpl(mGl, programCreateInfo, mVertexFormats, mCustomUniforms, mCustomUniformBlocks); + mProgramCache.back().programImpl = new TestGraphicsProgramImpl(*this, mGl, programCreateInfo, mVertexFormats, mCustomUniforms, mCustomUniformBlocks); for(auto& shader : *(programCreateInfo.shaderState)) { diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h index 9540c3e..e14499b 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.h @@ -424,6 +424,15 @@ public: // ResourceId relative API. Graphics::UniquePtr ReleaseTextureFromResourceId(uint32_t resourceId) override; public: // Test Functions + void SetAutoAttrCreation(bool v) + { + mAutoAttrCreation = v; + } + bool AutoAttrCreation() + { + return mAutoAttrCreation; + } + void SetVertexFormats(Property::Array& vfs) { mVertexFormats = vfs; @@ -458,9 +467,9 @@ public: TestGraphicsSyncImplementation mGraphicsSyncImpl; TestGlContextHelperAbstraction mGlContextHelperAbstraction; - bool isDiscardQueueEmptyResult{true}; - bool isDrawOnResumeRequiredResult{true}; - + bool isDiscardQueueEmptyResult{true}; + bool isDrawOnResumeRequiredResult{true}; + bool mAutoAttrCreation{true}; Property::Array mVertexFormats; struct ProgramCache diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.cpp index 2706305..3c8418e 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.cpp @@ -18,11 +18,12 @@ namespace Dali { -TestGraphicsProgramImpl::TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector& customUniforms, std::vector& customUniformBlocks) -: mGl(gl), +TestGraphicsProgramImpl::TestGraphicsProgramImpl(TestGraphicsController& controller, TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector& customUniforms, std::vector& customUniformBlocks) +: mController(controller), + mGl(gl), mId(gl.CreateProgram()), mCreateInfo(createInfo), - mReflection(gl, mId, vertexFormats, createInfo, customUniforms, customUniformBlocks) + mReflection(controller, gl, mId, vertexFormats, createInfo, customUniforms, customUniformBlocks) { // Ensure active sampler uniforms are set mGl.SetCustomUniforms(customUniforms); diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.h index 8641800..b81185a 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-program.h @@ -24,10 +24,12 @@ namespace Dali { +class TestGraphicsController; + class TestGraphicsProgramImpl { public: - TestGraphicsProgramImpl(TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector& customUniforms, std::vector& customUniformBlocks); + TestGraphicsProgramImpl(TestGraphicsController& controller, TestGlAbstraction& gl, const Graphics::ProgramCreateInfo& createInfo, Property::Array& vertexFormats, std::vector& customUniforms, std::vector& customUniformBlocks); // For API const TestGraphicsReflection& GetReflection() const @@ -45,6 +47,7 @@ public: bool GetParameter(uint32_t parameterId, void* outData); public: + TestGraphicsController& mController; TestGlAbstraction& mGl; uint32_t mId; Graphics::ProgramCreateInfo mCreateInfo; diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.cpp index 2822c0a..7b3e6c8 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.cpp @@ -15,6 +15,7 @@ */ #include "test-graphics-reflection.h" +#include "test-graphics-controller.h" #include "test-graphics-shader.h" #include @@ -110,8 +111,9 @@ constexpr int GetSizeForType(Property::Type type) } // namespace -TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, uint32_t programId, Property::Array& vfs, const Graphics::ProgramCreateInfo& createInfo, std::vector& customUniforms, std::vector& customUniformBlocks) -: mGl(gl), +TestGraphicsReflection::TestGraphicsReflection(TestGraphicsController& controller, TestGlAbstraction& gl, uint32_t programId, Property::Array& vfs, const Graphics::ProgramCreateInfo& createInfo, std::vector& customUniforms, std::vector& customUniformBlocks) +: mController(controller), + mGl(gl), mCustomUniforms(customUniforms) { for(Property::Array::SizeType i = 0; i < vfs.Count(); ++i) @@ -241,19 +243,19 @@ TestGraphicsReflection::TestGraphicsReflection(TestGlAbstraction& gl, uint32_t p uint32_t TestGraphicsReflection::GetVertexAttributeLocation(const std::string& name) const { - // Automatically assign locations to named attributes when requested auto iter = std::find(mAttributes.begin(), mAttributes.end(), name); if(iter != mAttributes.end()) { return iter - mAttributes.begin(); } - else + else if(mController.AutoAttrCreation()) { uint32_t location = mAttributes.size(); mAttributes.push_back(name); return location; } - return 0u; + + return -1; } Dali::Graphics::VertexInputAttributeFormat TestGraphicsReflection::GetVertexAttributeFormat(uint32_t location) const diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.h index e701e17..b598435 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-reflection.h @@ -23,12 +23,14 @@ namespace Dali { +class TestGraphicsController; + class TestGraphicsReflection : public Graphics::Reflection { public: class TestUniformBlockInfo; - TestGraphicsReflection(TestGlAbstraction& gl, uint32_t program_id, Property::Array& vertexFormats, const Graphics::ProgramCreateInfo& createInfo, std::vector& customUniforms, std::vector& customUniformBlocks); + TestGraphicsReflection(TestGraphicsController& controller, TestGlAbstraction& gl, uint32_t program_id, Property::Array& vertexFormats, const Graphics::ProgramCreateInfo& createInfo, std::vector& customUniforms, std::vector& customUniformBlocks); uint32_t GetVertexAttributeLocation(const std::string& name) const override; Dali::Graphics::VertexInputAttributeFormat GetVertexAttributeFormat(uint32_t location) const override; @@ -84,6 +86,7 @@ public: // Test methods return mUniformBlocks[index]; } + TestGraphicsController& mController; TestGlAbstraction& mGl; mutable std::vector mAttributes; std::vector mCustomUniforms; -- 2.7.4