diff options
| author | David 'Digit' Turner <digit@google.com> | 2011-09-20 15:19:42 +0200 |
|---|---|---|
| committer | David 'Digit' Turner <digit@google.com> | 2011-09-20 15:58:54 +0200 |
| commit | 894a63dd6eb8a1c675c21a8a10eff8c0118890c8 (patch) | |
| tree | bb3ea6c47fe46cb229bc5862172b2ef2d3aeb508 /tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp | |
| parent | 5d7f0875e9cda2d6ab37b49f0b6ceed8f0d16f45 (diff) | |
emulator: opengl: Add custom_write optimization to encoder.
This patch allows an auto-generated GLES encoder function to write
'isLarge' buffers with a custom writer, instead of calling stream->readFully()
directly.
This is intended to allow writing pixel or vertex data that is stored
with a specific stride.
Another patch will introduce the corresponding changes to the .attrib files
Change-Id: I6ca86b968cd3f4db91676bc485ee1e84419e50e0
Diffstat (limited to 'tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp')
| -rw-r--r-- | tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp index b0702a76d..ae70598a3 100644 --- a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp +++ b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp @@ -16,6 +16,7 @@ #include "glUtils.h" #include <string.h> #include "ErrorLog.h" +#include <IOStream.h> size_t glSizeof(GLenum type) { @@ -344,6 +345,25 @@ void glUtilsPackPointerData(unsigned char *dst, unsigned char *src, } } +void glUtilsWritePackPointerData(void* _stream, unsigned char *src, + int size, GLenum type, unsigned int stride, + unsigned int datalen) +{ + IOStream* stream = reinterpret_cast<IOStream*>(_stream); + + unsigned int vsize = size * glSizeof(type); + if (stride == 0) stride = vsize; + + if (stride == vsize) { + stream->writeFully(src, datalen); + } else { + for (unsigned int i = 0; i < datalen; i += vsize) { + stream->writeFully(src, (size_t)vsize); + src += stride; + } + } +} + int glUtilsPixelBitSize(GLenum format, GLenum type) { int components = 0; |
