view TaskManager/Test/test_render/spe/ChainInit.cpp @ 395:8c5fa57128cb

chain on SPE
author game@localhost.localdomain
date Thu, 17 Sep 2009 16:55:18 +0900
parents
children
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include "ChainInit.h"
#include "Func.h"

/* これは必須 */
SchedDefineTask(ChainInit);

/*
  spe の global 領域に MemList を生成する
 */

typedef struct {
    double x, y, next_x, next_y;
    double vx, vy, next_vx, next_vy;
    int can_move;
    uint32 parent;
} CHAIN_VARS;

CHAIN_VARS* property;

int
ChainInit::run(void *rbuf, void *wbuf)
{
    CHAIN_VARS* idata = (CHAIN_VARS*)get_input(rbuf, 0);
    uint32 chain_len = get_param(0);

    // property は spe 上で allocate している(global)
    property = (CHAIN_VARS*)global_alloc(DATA_ID, sizeof(CHAIN_VARS)*chain_len);
    memcpy(property, idata, sizeof(CHAIN_VARS)*chain_len);

    return 0;
}