mipmap allocation for ps2 rasters

This commit is contained in:
aap 2017-08-18 19:28:01 +02:00
parent 7280647085
commit 75435b8934
7 changed files with 946 additions and 205 deletions

View File

@ -146,3 +146,12 @@ project "ps2test"
links { "librw" }
-- "c -lc" is a hack because we need -lc twice for some reason
links { "c -lc", "kernel", "mf" }
project "ps2rastertest"
kind "ConsoleApp"
targetdir (Bindir)
removeplatforms { "*gl3", "*d3d9" }
files { "tools/ps2rastertest/*.cpp" }
includedirs { "." }
libdirs { Libdir }
links { "librw" }

View File

@ -16,3 +16,5 @@ ECODE(ERR_ENGINEOPEN,
"Engine could not be opened")
ECODE(ERR_ENGINESTART,
"Engine could not be started")
ECODE(ERR_INVRASTER,
"Invalid raster format")

View File

@ -908,6 +908,7 @@ Image::getFilename(const char *name)
Raster*
Raster::create(int32 width, int32 height, int32 depth, int32 format, int32 platform)
{
// TODO: pass arguments through to the driver and create the raster there
Raster *raster = (Raster*)malloc(s_plglist.size);
assert(raster != nil);
raster->platform = platform ? platform : rw::platform;

View File

@ -688,8 +688,10 @@ MatPipeline::instance(Geometry *g, InstanceData *inst, Mesh *m)
if(this->instanceCB)
this->instanceCB(this, g, m, datap);
#ifdef RW_PS2
if(im.numBrokenAttribs)
fixDmaOffsets(inst);
#endif
}
uint8*

File diff suppressed because it is too large Load Diff

View File

@ -188,17 +188,16 @@ struct Ps2Raster
SWIZZLED4 = 0x4,
};
uint32 tex0[2];
uint32 paletteOffset; // from beginning of GS data;
// in words/64
uint64 tex0;
uint32 paletteBase; // block address from beginning of GS data (words/64)
uint16 kl;
uint8 tex1low; // MXL and LCM of TEX1
uint8 unk2;
uint32 miptbp1[2];
uint32 miptbp2[2];
uint32 texelSize;
uint32 paletteSize;
uint32 gsSize;
uint64 miptbp1;
uint64 miptbp2;
uint32 pixelSize; // in bytes
uint32 paletteSize; // in bytes
uint32 totalSize; // total size of texture on GS in words
int8 flags;
uint8 *data; //tmp

View File

@ -221,13 +221,17 @@ struct Raster
PLUGINBASE
int32 platform;
int32 type; // hardly used
// TODO: use bytes
int32 type;
int32 flags;
int32 format;
int32 width, height, depth;
int32 stride;
uint8 *texels;
uint8 *palette;
// TODO:
// original pixels, width, height, stride (used for locking)
// parent raster and offset
static Raster *create(int32 width, int32 height, int32 depth,
int32 format, int32 platform = 0);