//#error "Unknown endianness"
#endif
-#if (defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__) || defined(_M_X64) || defined(_WIN64)
+#if (defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__) || defined(_M_X64) || defined(_WIN64) || defined(__LP64__) || defined(__LLP64__)
#if defined(__x86_64__) || defined(_M_X64)
#define CPUCONF_ARCH_AMD64
#ifdef MM_ATOMIC_SUPPORT
value = (int)(( MM_ATOMIC_ACCESS_L( &bitmap->map[index] ) >> shift ) & 0x1);
#else
- value = ( bitmap->map[index] >> shift ) & 0x1;
+ value = (int)(( bitmap->map[index] >> shift ) & 0x1);
#endif
return value;
}
#ifdef MM_ATOMIC_SUPPORT
value = (int)(( MM_ATOMIC_ACCESS_L( &bitmap->map[index] ) >> shift ) & mask);
#else
- value = ( bitmap->map[index] >> shift ) & mask;
+ value = (int)(( bitmap->map[index] >> shift ) & mask);
#endif
return value;
}
value = (int)(( mmAtomicReadL( &bitmap->map[index] ) >> shift ) & 0x1);
#else
mtMutexLock( &bitmap->mutex );
- value = ( bitmap->map[index] >> shift ) & 0x1;
+ value = (int)(( bitmap->map[index] >> shift ) & 0x1);
mtMutexUnlock( &bitmap->mutex );
#endif
return value;
value = (int)(( mmAtomicReadL( &bitmap->map[index] ) >> shift ) & mask);
#else
mtMutexLock( &bitmap->mutex );
- value = ( bitmap->map[index] >> shift ) & mask;
+ value = (int)(( bitmap->map[index] >> shift ) & mask);
mtMutexUnlock( &bitmap->mutex );
#endif
return value;
static inline void mmBitMapMaskSet( mmBitMap *bitmap, size_t entryindex, long value, long mask )
{
size_t index, shift;
- long oldvalue, newvalue;
index = entryindex >> CPUCONF_LONG_BITSHIFT;
shift = entryindex & ( CPUCONF_LONG_BITS - 1 );
#ifdef MM_ATOMIC_SUPPORT
+ long oldvalue, newvalue;
for( ; ; )
{
oldvalue = (int)mmAtomicReadL( &bitmap->map[index] );
Texture texture, bindTexture;
DMDrawBuffer *drawBuffer;
DMDrawVertexFlat *vboVertex = null;
+#if defined(_GLES) || defined(_GLES2)
+ DMDrawVertexFlat *vboStorage = null;
+#endif
DMProgram *program;
ERRORCHECK();
drawBuffer = &this.drawBuffer[drawBufferIndex];
drawBufferIndex = ( drawBufferIndex + 1 ) % DM_CONTEXT_DRAW_BUFFER_COUNT;
glBindBuffer( GL_ARRAY_BUFFER, drawBuffer->vbo );
-#if !defined(_GLES) && !defined(_GLES2) // TODO:
+#if defined(_GLES) || defined(_GLES2)
+ vboVertex = vboStorage = new DMDrawVertexFlat[drawBuffer->vertexAlloc * 1];
+#else
vboVertex = glMapBuffer( GL_ARRAY_BUFFER, GL_WRITE_ONLY );
#endif
vertexCount = 0;
{
if( vertexCount )
{
-#if !defined(_GLES) && !defined(_GLES2) // TODO:
+#if defined(_GLES) || defined(_GLES2)
+ glBufferData( GL_ARRAY_BUFFER, drawBuffer->vertexAlloc * sizeof(DMDrawVertexFlat), vboStorage, GL_DYNAMIC_DRAW );
+#else
glUnmapBuffer( GL_ARRAY_BUFFER );
#endif
// Flush font manager texture updates
drawBuffer = &this.drawBuffer[drawBufferIndex];
drawBufferIndex = ( drawBufferIndex + 1 ) % DM_CONTEXT_DRAW_BUFFER_COUNT;
glBindBuffer( GL_ARRAY_BUFFER, drawBuffer->vbo );
-#if !defined(_GLES) && !defined(_GLES2) // TODO:
+#if defined(_GLES) || defined(_GLES2)
+ vboVertex = vboStorage;
+#else
vboVertex = glMapBuffer( GL_ARRAY_BUFFER, GL_WRITE_ONLY );
#endif
vertexCount = 0;
vertexCount += 6;
}
-#if !defined(_GLES) && !defined(_GLES2) // TODO:
+#if defined(_GLES) || defined(_GLES2) // TODO:
+ glBufferData( GL_ARRAY_BUFFER, drawBuffer->vertexAlloc * sizeof(DMDrawVertexFlat), vboStorage, GL_DYNAMIC_DRAW );
+ delete vboStorage;
+#else
glUnmapBuffer( GL_ARRAY_BUFFER );
#endif
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if !defined(_GLES) && !defined(_GLES2)
glPixelStorei( GL_UNPACK_ROW_LENGTH, textureWidth );
- glPixelStorei( GL_UNPACK_SKIP_PIXELS, rect[0] );
- glPixelStorei( GL_UNPACK_SKIP_ROWS, rect[1] );
+ glTexSubImage2D( GL_TEXTURE_2D, 0, rect[0], rect[1], w, h, glformat, GL_UNSIGNED_BYTE, data + (rect[1] * textureWidth + rect[0]) * channelcount);
+ //glPixelStorei( GL_UNPACK_SKIP_PIXELS, rect[0] );
+ //glPixelStorei( GL_UNPACK_SKIP_ROWS, rect[1] );
+#else
+ {
+ int row = w * channelcount;
+ byte * tmp = new byte[h * row];
+ int y;
+ for(y = 0; y < h; y++)
+ memcpy(tmp + y * row, data + textureWidth * (y + rect[1]) + rect[0], row);
+ glTexSubImage2D( GL_TEXTURE_2D, 0, rect[0], rect[1], w, h, glformat, GL_UNSIGNED_BYTE, tmp);
+ delete tmp;
+ }
#endif
- glTexSubImage2D( GL_TEXTURE_2D, 0, rect[0], rect[1], w, h, glformat, GL_UNSIGNED_BYTE, data );
#if !defined(_GLES) && !defined(_GLES2)
glPopAttrib();
glPopClientAttrib();
+#else
+ glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
#endif
#if 0