X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-gl-abstraction.h;h=760f678d5322a8a2f467800fadbdbdd7f58785fa;hp=5679a01d8e4dc1270046013a6595e670297cd25c;hb=c1448536b412d5ee725beb0ae0d90ed1bb9fa787;hpb=b36847fdc20d812852703a99f72d5ddd1f4f79a7 diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h index 5679a01..760f678 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h @@ -38,6 +38,17 @@ namespace Dali { +struct UniformData +{ + std::string name; + Property::Type type; + UniformData(const std::string& name, Property::Type type = Property::Type::NONE) + : name(name), + type(type) + { + } +}; + class DALI_CORE_API TestGlAbstraction : public Dali::Integration::GlAbstraction { public: @@ -157,10 +168,10 @@ public: } std::stringstream out; - out << target << ", " << texture; + out << std::hex << target << ", " << std::dec << texture; TraceCallStack::NamedParams namedParams; - namedParams["target"] << target; + namedParams["target"] << std::hex << target; namedParams["texture"] << texture; mTextureTrace.PushCall("BindTexture", out.str(), namedParams); @@ -610,6 +621,11 @@ public: { mFramebufferStencilAttached = true; } + else if(attachment == GL_DEPTH_STENCIL_ATTACHMENT) + { + mFramebufferStencilAttached = true; + mFramebufferDepthAttached = true; + } } inline void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override @@ -831,6 +847,9 @@ public: case GL_ACTIVE_UNIFORM_MAX_LENGTH: *params = 100; break; + case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: + *params = 100; + break; } } @@ -896,7 +915,7 @@ public: if(it2 == uniformIDs.end()) { // Uniform not found, so add it... - uniformIDs[name] = ++mLastUniformIdUsed; + uniformIDs[name] = mLastUniformIdUsed++; return mLastUniformIdUsed; } @@ -968,9 +987,35 @@ public: mShaderTrace.PushCall("LinkProgram", out.str(), namedParams); mNumberOfActiveUniforms = 3; - GetUniformLocation(program, "sTexture"); + + GetUniformLocation(program, "uRendererColor"); + GetUniformLocation(program, "uCustom"); + GetUniformLocation(program, "uCustom3"); + GetUniformLocation(program, "uFadeColor"); + GetUniformLocation(program, "uUniform1"); + GetUniformLocation(program, "uUniform2"); + GetUniformLocation(program, "uUniform3"); + GetUniformLocation(program, "uFadeProgress"); + GetUniformLocation(program, "uANormalMatrix"); GetUniformLocation(program, "sEffect"); + GetUniformLocation(program, "sTexture"); + GetUniformLocation(program, "sTextureRect"); GetUniformLocation(program, "sGloss"); + GetUniformLocation(program, "uColor"); + GetUniformLocation(program, "uModelMatrix"); + GetUniformLocation(program, "uModelView"); + GetUniformLocation(program, "uMvpMatrix"); + GetUniformLocation(program, "uNormalMatrix"); + GetUniformLocation(program, "uProjection"); + GetUniformLocation(program, "uSize"); + GetUniformLocation(program, "uViewMatrix"); + GetUniformLocation(program, "uLightCameraProjectionMatrix"); + GetUniformLocation(program, "uLightCameraViewMatrix"); + + for(const auto& uniform : mCustomUniformData) + { + GetUniformLocation(program, uniform.name.c_str()); + } } inline void PixelStorei(GLenum pname, GLint param) override @@ -1178,16 +1223,10 @@ public: out << std::hex << target << ", " << pname << ", " << param; std::string params = out.str(); - out.str(""); - out << std::hex << target; TraceCallStack::NamedParams namedParams; - namedParams["target"] << out.str(); - out.str(""); - out << std::hex << pname; - namedParams["pname"] << out.str(); - out.str(""); - out << std::hex << param; - namedParams["param"] << out.str(); + namedParams["target"] << std::hex << target; + namedParams["pname"] << std::hex << pname; + namedParams["param"] << param; mTexParameterTrace.PushCall("TexParameteri", params, namedParams); } @@ -1580,7 +1619,12 @@ public: inline GLboolean UnmapBuffer(GLenum target) override { - return false; + if(mMappedBuffer) + { + free(mMappedBuffer); + mMappedBuffer = nullptr; + } + return true; // false indicates corruption, nothing else. } inline void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override @@ -1629,7 +1673,8 @@ public: inline GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override { - return NULL; + mMappedBuffer = reinterpret_cast(malloc(offset + length)); + return mMappedBuffer; } inline void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override @@ -2267,7 +2312,7 @@ public: // TEST FUNCTIONS } } - fprintf(stderr, "Not found, printing possible values:\n"); + fprintf(stderr, "%s Not found, printing possible values:\n", name); for(ProgramUniformMap::const_iterator program_it = mUniforms.begin(); program_it != mUniforms.end(); ++program_it) @@ -2286,7 +2331,7 @@ public: // TEST FUNCTIONS if(mProgramUniforms.GetUniformValue(programId, uniformId, origValue)) { std::stringstream out; - out << uniform_it->first << ": " << origValue; + out << "Program: " << programId << ", " << uniform_it->first << ": " << origValue; fprintf(stderr, "%s\n", out.str().c_str()); } } @@ -2320,6 +2365,11 @@ public: // TEST FUNCTIONS return false; } + inline void SetCustomUniforms(std::vector& customUniformData) + { + mCustomUniformData = customUniformData; + } + inline GLuint GetLastShaderCompiled() const { return mLastShaderCompiled; @@ -2425,6 +2475,7 @@ private: GLuint mCompileStatus; BufferDataCalls mBufferDataCalls; BufferSubDataCalls mBufferSubDataCalls; + GLvoid* mMappedBuffer{nullptr}; GLuint mLinkStatus; GLint mNumberOfActiveUniforms; GLenum mGetErrorResult; @@ -2496,12 +2547,14 @@ private: // Shaders & Uniforms GLuint mLastShaderIdUsed; - GLuint mLastProgramIdUsed; + GLuint mLastProgramIdUsed{0u}; GLuint mLastUniformIdUsed; typedef std::map UniformIDMap; typedef std::map ProgramUniformMap; ProgramUniformMap mUniforms; + std::vector mCustomUniformData{}; + template struct ProgramUniformValue : public std::map > {