am 153c35f3: am d8bbe0ce: Merge "emulator Opengl - number of supported vertex attributes"

* commit '153c35f3354e7283c2e2f4071b7788eb33132af2':
  emulator Opengl - number of supported vertex attributes
This commit is contained in:
David Turner
2011-05-03 13:42:52 -07:00
committed by Android Git Automerger
4 changed files with 22 additions and 9 deletions

View File

@@ -25,10 +25,8 @@ public:
} }
~FixedBuffer() { ~FixedBuffer() {
if (m_buffer != NULL) { delete m_buffer;
delete m_buffer; m_bufferLen = 0;
m_bufferLen = 0;
}
} }
void * alloc(size_t size) { void * alloc(size_t size) {

View File

@@ -30,6 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "ErrorLog.h" #include "ErrorLog.h"
#include "codec_defs.h"
class GLClientState { class GLClientState {
public: public:
@@ -70,7 +71,7 @@ public:
} PixelStoreState; } PixelStoreState;
public: public:
GLClientState(int nLocations = 32); GLClientState(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES);
~GLClientState(); ~GLClientState();
int nLocations() { return m_nLocations; } int nLocations() { return m_nLocations; }
const PixelStoreState *pixelStoreState() { return &m_pixelStore; } const PixelStoreState *pixelStoreState() { return &m_pixelStore; }

View File

@@ -19,6 +19,7 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "FixedBuffer.h" #include "FixedBuffer.h"
#include "codec_defs.h"
class GLDecoderContextData { class GLDecoderContextData {
public: public:
@@ -40,18 +41,29 @@ public:
LAST_LOCATION = 14 LAST_LOCATION = 14
} PointerDataLocation; } PointerDataLocation;
void storePointerData(PointerDataLocation loc, void *data, size_t len) { GLDecoderContextData(int nLocations = CODEC_MAX_VERTEX_ATTRIBUTES) :
assert(loc < LAST_LOCATION); m_nLocations(nLocations)
{
m_pointerData = new FixedBuffer(m_nLocations);
}
~GLDecoderContextData() {
delete m_pointerData;
}
void storePointerData(PointerDataLocation loc, void *data, size_t len) {
assert(loc < m_nLocations);
m_pointerData[loc].alloc(len); m_pointerData[loc].alloc(len);
memcpy(m_pointerData[loc].ptr(), data, len); memcpy(m_pointerData[loc].ptr(), data, len);
} }
void *pointerData(PointerDataLocation loc) { void *pointerData(PointerDataLocation loc) {
assert(loc < LAST_LOCATION); assert(loc < m_nLocations);
return m_pointerData[loc].ptr(); return m_pointerData[loc].ptr();
} }
private: private:
FixedBuffer m_pointerData[LAST_LOCATION]; FixedBuffer *m_pointerData;
int m_nLocations;
}; };
#endif #endif

View File

@@ -18,4 +18,6 @@
#define CODEC_SERVER_PORT 22468 #define CODEC_SERVER_PORT 22468
#define CODEC_MAX_VERTEX_ATTRIBUTES 64
#endif #endif