EmuGL: GLESv2 support for OES_EGL_image_external
Change-Id: I8911328d5dcccdf4731bd2d8fd953c12fdec5f1b
This commit is contained in:
@@ -31,8 +31,9 @@
|
||||
#include <stdlib.h>
|
||||
#include "ErrorLog.h"
|
||||
#include <utils/KeyedVector.h>
|
||||
#include <utils/threads.h>
|
||||
#include <utils/List.h>
|
||||
#include <utils/String8.h>
|
||||
#include <utils/threads.h>
|
||||
#include "FixedBuffer.h"
|
||||
#include "SmartPtr.h"
|
||||
|
||||
@@ -51,18 +52,28 @@ private:
|
||||
GLenum type;
|
||||
GLint appBase;
|
||||
GLint hostLocsPerElement;
|
||||
GLuint flags;
|
||||
GLint samplerValue; // only set for sampler uniforms
|
||||
} IndexInfo;
|
||||
|
||||
GLuint m_numIndexes;
|
||||
IndexInfo* m_Indexes;
|
||||
bool m_initialized;
|
||||
bool m_locShiftWAR;
|
||||
|
||||
android::Vector<GLuint> m_shaders;
|
||||
|
||||
public:
|
||||
enum {
|
||||
INDEX_FLAG_SAMPLER_EXTERNAL = 0x00000001,
|
||||
};
|
||||
|
||||
ProgramData();
|
||||
void initProgramData(GLuint numIndexes);
|
||||
bool isInitialized();
|
||||
virtual ~ProgramData();
|
||||
void setIndexInfo(GLuint index, GLint base, GLint size, GLenum type);
|
||||
void setIndexFlags(GLuint index, GLuint flags);
|
||||
GLuint getIndexForLocation(GLint location);
|
||||
GLenum getTypeForLocation(GLint location);
|
||||
|
||||
@@ -70,15 +81,32 @@ public:
|
||||
void setupLocationShiftWAR();
|
||||
GLint locationWARHostToApp(GLint hostLoc, GLint arrIndex);
|
||||
GLint locationWARAppToHost(GLint appLoc);
|
||||
|
||||
|
||||
GLint getNextSamplerUniform(GLint index, GLint* val, GLenum* target);
|
||||
bool setSamplerUniform(GLint appLoc, GLint val, GLenum* target);
|
||||
|
||||
bool attachShader(GLuint shader);
|
||||
bool detachShader(GLuint shader);
|
||||
size_t getNumShaders() const { return m_shaders.size(); }
|
||||
GLuint getShader(size_t i) const { return m_shaders[i]; }
|
||||
};
|
||||
|
||||
struct ShaderData {
|
||||
typedef android::List<android::String8> StringList;
|
||||
StringList samplerExternalNames;
|
||||
int refcount;
|
||||
};
|
||||
|
||||
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;
|
||||
android::DefaultKeyedVector<GLuint, BufferData*> m_buffers;
|
||||
android::DefaultKeyedVector<GLuint, ProgramData*> m_programs;
|
||||
android::DefaultKeyedVector<GLuint, ShaderData*> m_shaders;
|
||||
mutable android::Mutex m_lock;
|
||||
|
||||
void refShaderDataLocked(ssize_t shaderIdx);
|
||||
void unrefShaderDataLocked(ssize_t shaderIdx);
|
||||
|
||||
public:
|
||||
GLSharedGroup();
|
||||
~GLSharedGroup();
|
||||
@@ -92,18 +120,22 @@ public:
|
||||
bool isProgramInitialized(GLuint program);
|
||||
void addProgramData(GLuint program);
|
||||
void initProgramData(GLuint program, GLuint numIndexes);
|
||||
void attachShader(GLuint program, GLuint shader);
|
||||
void detachShader(GLuint program, GLuint shader);
|
||||
void deleteProgramData(GLuint program);
|
||||
void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type);
|
||||
void setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name);
|
||||
GLenum getProgramUniformType(GLuint program, GLint location);
|
||||
void setupLocationShiftWAR(GLuint program);
|
||||
GLint locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex);
|
||||
GLint locationWARAppToHost(GLuint program, GLint appLoc);
|
||||
bool needUniformLocationWAR(GLuint program);
|
||||
GLint getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const;
|
||||
bool setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target);
|
||||
|
||||
void addShaderData(GLuint shader);
|
||||
bool isShader(GLuint shader);
|
||||
void deleteShaderData(GLuint shader);
|
||||
|
||||
bool addShaderData(GLuint shader);
|
||||
// caller must hold a reference to the shader as long as it holds the pointer
|
||||
ShaderData* getShaderData(GLuint shader);
|
||||
void unrefShaderData(GLuint shader);
|
||||
};
|
||||
|
||||
typedef SmartPtr<GLSharedGroup> GLSharedGroupPtr;
|
||||
|
||||
Reference in New Issue
Block a user