opengles emulator: fix glGetUnifrom

added state tracking for uniforms in program objects
for each active uniform in index i we will save its starting location
,size and type, so when calling glGetUniform on its location,
we can tell how many bytes we should read from the stream according to
the uniform's type

add some type and size definitions to functions
that calculate size from enum

some other fixes to the codec

Change-Id: I4ecdf41e752454a908d131e76bab113a616f2bc8
This commit is contained in:
Liran
2011-08-01 10:01:54 +03:00
committed by David 'Digit' Turner
parent d2fae7055e
commit 8ee217f9cc
9 changed files with 381 additions and 4 deletions

View File

@@ -32,6 +32,7 @@
#include "ErrorLog.h"
#include <utils/KeyedVector.h>
#include <utils/threads.h>
#include <utils/List.h>
#include "FixedBuffer.h"
#include "SmartPtr.h"
@@ -42,10 +43,32 @@ struct BufferData {
FixedBuffer m_fixedBuffer;
};
class ProgramData {
private:
typedef struct _IndexInfo {
GLint base;
GLint size;
GLenum type;
}IndexInfo;
GLuint m_numIndexes;
IndexInfo* m_Indexes;
bool m_initialized;
public:
ProgramData();
void initProgramData(GLuint numIndexes);
bool isInitialized();
virtual ~ProgramData();
void setIndexInfo(GLuint index, GLint base, GLint size, GLenum type);
GLuint getIndexForLocation(GLint location);
GLenum getTypeForLocation(GLint location);
};
class GLSharedGroup {
private:
android::DefaultKeyedVector<GLuint, BufferData*> m_buffers;
android::DefaultKeyedVector<GLuint, ProgramData*> m_programs;
android::List<GLuint> m_shaders;
mutable android::Mutex m_lock;
public:
GLSharedGroup();
@@ -55,6 +78,19 @@ public:
void updateBufferData(GLuint bufferId, GLsizeiptr size, void * data);
GLenum subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsizeiptr size, void * data);
void deleteBufferData(GLuint);
bool isProgram(GLuint program);
bool isProgramInitialized(GLuint program);
void addProgramData(GLuint program);
void initProgramData(GLuint program, GLuint numIndexes);
void deleteProgramData(GLuint program);
void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type);
GLenum getProgramUniformType(GLuint program, GLint location);
void addShaderData(GLuint shader);
bool isShader(GLuint shader);
void deleteShaderData(GLuint shader);
};
typedef SmartPtr<GLSharedGroup> GLSharedGroupPtr;