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:
}
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);
case GL_ACTIVE_UNIFORM_MAX_LENGTH:
*params = 100;
break;
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ *params = 100;
+ break;
}
}
if(it2 == uniformIDs.end())
{
// Uniform not found, so add it...
- uniformIDs[name] = ++mLastUniformIdUsed;
+ uniformIDs[name] = mLastUniformIdUsed++;
return mLastUniformIdUsed;
}
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
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
inline GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
{
- return NULL;
+ mMappedBuffer = reinterpret_cast<GLvoid*>(malloc(offset + length));
+ return mMappedBuffer;
}
inline void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
}
}
- 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)
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());
}
}
return false;
}
+ inline void SetCustomUniforms(std::vector<UniformData>& customUniformData)
+ {
+ mCustomUniformData = customUniformData;
+ }
+
inline GLuint GetLastShaderCompiled() const
{
return mLastShaderCompiled;
GLuint mCompileStatus;
BufferDataCalls mBufferDataCalls;
BufferSubDataCalls mBufferSubDataCalls;
+ GLvoid* mMappedBuffer{nullptr};
GLuint mLinkStatus;
GLint mNumberOfActiveUniforms;
GLenum mGetErrorResult;
// Shaders & Uniforms
GLuint mLastShaderIdUsed;
- GLuint mLastProgramIdUsed;
+ GLuint mLastProgramIdUsed{0u};
GLuint mLastUniformIdUsed;
typedef std::map<std::string, GLint> UniformIDMap;
typedef std::map<GLuint, UniformIDMap> ProgramUniformMap;
ProgramUniformMap mUniforms;
+ std::vector<UniformData> mCustomUniformData{};
+
template<typename T>
struct ProgramUniformValue : public std::map<GLuint, std::map<GLint, T> >
{