view TaskManager/Test/simple_render/spe/SpuDraw.h @ 102:62679f4cae18

tag:first_render_with_spe fix
author gongo
date Mon, 03 Mar 2008 17:15:28 +0900
parents 57bac9e07662
children 3e331f7576a1
line wrap: on
line source

#ifndef INCLUDED_TASK_SPU_DRAW
#define INCLUDED_TASK_SPU_DRAW

#ifndef INCLUDED_SCHED_TASK
#  include "SchedTask.h"
#endif

//#define IMG_MAX_X 1080
#define IMG_MAX_X 512

#ifndef NULL
#  define NULL (0)
#endif

typedef int8_t          Sint8;
typedef uint8_t         Uint8;
typedef int16_t         Sint16;
typedef uint16_t        Uint16;
typedef int32_t         Sint32;
typedef uint32_t        Uint32;
typedef unsigned short  GLushort;

#if 0
typedef struct{
    Uint8 r;
    Uint8 g;
    Uint8 b;
    Uint8 unused;
} SDL_Color;

typedef struct{
    int ncolors;
    SDL_Color *colors;
} SDL_Palette;

typedef struct{
    SDL_Palette *palette;
    Uint8  BitsPerPixel;
    Uint8  BytesPerPixel;
    Uint32 Rmask, Gmask, Bmask, Amask;
    Uint8  Rshift, Gshift, Bshift, Ashift;
    Uint8  Rloss, Gloss, Bloss, Aloss;
    Uint32 colorkey;
    Uint8  alpha;
} SDL_PixelFormat;
#endif

class SpuDraw : public SchedTask {
public:
    SpuDraw(TaskListPtr _tlist, TaskPtr _task,
	    void* _rbuf, void* _wbuf, DmaManager* _con)
	:SchedTask(_tlist, _task, _rbuf, _wbuf, _con) {}

    ~SpuDraw(void);

    int *linebuf;
    float *zRow;
    unsigned int dma_tags;

    int run(void *readbuf, void *writebuf);
    //void write(void);

private:
    void zRow_init(void);
    void linebuf_init(void);
    void writebuffer(unsigned int fbdev_addr, int y);

    char* get_pixel(int tx, int ty, void *texture_image);
    Uint32 get_rgb(int tx, int ty, void *texture);
    //Uint32 SDL_MapRGB(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b);
    //Uint8 SDL_FindColor(SDL_Palette *pal, Uint8 r, Uint8 g, Uint8 b);
};

#endif