view TaskManager/Test/test_render/task/Load_Texture.cpp @ 386:6113af8f183b

MemHash...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 06 Aug 2009 19:31:51 +0900
parents 5f9311458791
children 136ff78c9e74
line wrap: on
line source

#include <stdlib.h>
#include <string.h>
#include "Load_Texture.h"
#include "texture.h"
#if !USE_MEMHASH
#include "TileHash.h"
#endif
#include "Func.h"
#include "global_alloc.h"
#include "Tapestry.h"

SchedDefineTask(LoadTexture);

/**
 * 「Load」といいながら、結局 DrawSpan で使う
 * Hash の準備だけなので、名前変えないとなー
 */
int
LoadTexture::run(void *rbuf , void *wbuf)
{
#if USE_MEMHASH
#else
    /**
     * 現在 global_alloc() では new をサポートしてないので
     * コンストラクタ呼ぶために placement new してます。
     */
    void *hash_tmp
        = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash));
    new(hash_tmp) TileHash;
#endif

#if USE_MEMLIST
    MemList *ml = smanager->createMemList(sizeof(uint32) * TEXTURE_BLOCK_SIZE, MAX_TILE);
    smanager->global_set(GLOBAL_TILE_LIST, (void *)ml);

#else
    void *tileList_tmp
        = smanager->global_alloc(GLOBAL_TILE_LIST, sizeof(TileList));
    new(tileList_tmp) TileList;
#endif
    return 0;
}