view TaskManager/Test/test_render/spe/Load_Texture.cpp @ 389:016d45583994

MemHash for Cell
author kono@localhost.localdomain
date Thu, 06 Aug 2009 23:43:28 +0900
parents b4b8345b5366
children 136ff78c9e74
line wrap: on
line source

// #define DEBUG
#include "error.h"

#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"

SchedDefineTask(LoadTexture);

/**
 * 「Load」といいながら、結局 DrawSpan で使う
 * Hash の準備だけなので、名前変えないとなー
 */
int
LoadTexture::run(void *rbuf , void *wbuf)
{
    __debug_spe("LoadTexture\n");

#if !USE_MEMHASH
    /**
     * 現在 global_alloc() では new をサポートしてないので
     * コンストラクタ呼ぶために placement new してます。
     */
    void *hash_tmp
        = smanager->global_alloc(GLOBAL_TEXTURE_HASH, sizeof(TileHash));
    new(hash_tmp) TileHash;
#endif

#ifdef 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;
}