How can i reduce buffer size?

I am trying to reduce my buffer size. But in game i always get same buffer size:(

Calculate buffer memory.

uint8_t* bytes = 0x0;
        dmBuffer::GetBytes(buffer, (void**)&bytes, &goChunk.bufferMemory);
const dmBuffer::StreamDeclaration chunk_buffer_decl[] = {
    {HASH_TEXCOORD0, dmBuffer::VALUE_TYPE_FLOAT32, 2},
    {HASH_CHUNK_DATA_POS_X, dmBuffer::VALUE_TYPE_FLOAT32, 1},
    {HASH_CHUNK_DATA_POS_Y, dmBuffer::VALUE_TYPE_FLOAT32, 1},
    {HASH_CHUNK_DATA_POS_Z, dmBuffer::VALUE_TYPE_FLOAT32, 1},
    {HASH_CHUNK_DATA_NORMAL_X, dmBuffer::VALUE_TYPE_FLOAT32, 1},
    {HASH_CHUNK_DATA_NORMAL_Y, dmBuffer::VALUE_TYPE_FLOAT32, 1},
    {HASH_CHUNK_DATA_NORMAL_Z, dmBuffer::VALUE_TYPE_FLOAT32, 1}
};
const dmBuffer::StreamDeclaration chunk_buffer_decl[] = {
    {HASH_TEXCOORD0, dmBuffer::VALUE_TYPE_FLOAT32, 2},
    {HASH_CHUNK_DATA_POS_X, dmBuffer::VALUE_TYPE_UINT8, 1},
    {HASH_CHUNK_DATA_POS_Y, dmBuffer::VALUE_TYPE_UINT16, 1},
    {HASH_CHUNK_DATA_POS_Z, dmBuffer::VALUE_TYPE_UINT8, 1},
    {HASH_CHUNK_DATA_NORMAL_X, dmBuffer::VALUE_TYPE_INT8, 1},
    {HASH_CHUNK_DATA_NORMAL_Y, dmBuffer::VALUE_TYPE_INT8, 1},
    {HASH_CHUNK_DATA_NORMAL_Z, dmBuffer::VALUE_TYPE_INT8, 1}
};

Strides for float.

INFO:GAME: stride uv:8
INFO:GAME: stride pos x:8
INFO:GAME: stride normal x:8

Stride for uint8/int8

INFO:GAME: stride uv:8
INFO:GAME: stride pos x:32
INFO:GAME: stride normal x:32
 dmBuffer::Result textureResult = dmBuffer::GetStream(*buffer, HASH_TEXCOORD0,
                                                         (void **)bufferTextureCoords, NULL, NULL, bufferTextureCoordsStride);
    if (textureResult != dmBuffer::RESULT_OK) {
        dmLogError("can't get buffer texture");
    }
      dmLogInfo("stride uv:%d",*bufferTextureCoordsStride);


    dmBuffer::Result dataResult = dmBuffer::GetStream(*buffer, HASH_CHUNK_DATA_POS_X,
                                                            (void **)bufferDataPosX, NULL, NULL, bufferDataPosXStride);
    if (dataResult != dmBuffer::RESULT_OK) {
        dmLogError("can't get buffer data pos x");
    }
    dmLogInfo("stride pos x:%d",*bufferDataPosXStride);

    dataResult = dmBuffer::GetStream(*buffer, HASH_CHUNK_DATA_NORMAL_X,
                                                            (void **)bufferDataNormalX, NULL, NULL, bufferDataNormalXStride);
    if (dataResult != dmBuffer::RESULT_OK) {
        dmLogError("can't get buffer data normal x");
    }

     dmLogInfo("stride normal x:%d",*bufferDataNormalXStride);

This looks a bit weird. Could you please open a ticket on GH?

1 Like

ANd please supply a small repro case :slight_smile:

2 Likes
1 Like