RSX: Create a rsx namespace.

Put get_address inside.
This commit is contained in:
Vincent Lejeune 2015-10-08 15:53:21 +02:00
parent e3e5b46cbf
commit 3de47c201c
13 changed files with 781 additions and 745 deletions

View file

@ -263,12 +263,12 @@ write16bX4TexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t
}
size_t getPlacedTextureStorageSpace(const RSXTexture &texture, size_t rowPitchAlignement)
size_t getPlacedTextureStorageSpace(const rsx::texture &texture, size_t rowPitchAlignement)
{
size_t w = texture.GetWidth(), h = texture.GetHeight();
size_t w = texture.width(), h = texture.height();
size_t blockSizeInByte, blockWidthInPixel, blockHeightInPixel;
int format = texture.GetFormat() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
switch (format)
{
@ -390,11 +390,11 @@ size_t getPlacedTextureStorageSpace(const RSXTexture &texture, size_t rowPitchAl
return rowPitch * heightInBlocks * 2; // * 2 for mipmap levels
}
std::vector<MipmapLevelInfo> uploadPlacedTexture(const RSXTexture &texture, size_t rowPitchAlignement, void* textureData)
std::vector<MipmapLevelInfo> uploadPlacedTexture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData)
{
size_t w = texture.GetWidth(), h = texture.GetHeight();
size_t w = texture.width(), h = texture.height();
int format = texture.GetFormat() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
size_t blockSizeInByte, blockWidthInPixel, blockHeightInPixel;
switch (format)
@ -514,31 +514,31 @@ std::vector<MipmapLevelInfo> uploadPlacedTexture(const RSXTexture &texture, size
std::vector<MipmapLevelInfo> mipInfos;
const u32 texaddr = GetAddress(texture.GetOffset(), texture.GetLocation());
const u32 texaddr = rsx::get_address(texture.offset(), texture.location());
auto pixels = vm::get_ptr<const u8>(texaddr);
bool is_swizzled = !(texture.GetFormat() & CELL_GCM_TEXTURE_LN);
bool is_swizzled = !(texture.format() & CELL_GCM_TEXTURE_LN);
switch (format)
{
case CELL_GCM_TEXTURE_A8R8G8B8:
if (is_swizzled)
return writeTexelsSwizzled((char*)pixels, (char*)textureData, w, h, 4, texture.GetMipmap());
return writeTexelsSwizzled((char*)pixels, (char*)textureData, w, h, 4, texture.mipmap());
else
return writeTexelsGeneric((char*)pixels, (char*)textureData, w, h, 4, texture.GetMipmap());
return writeTexelsGeneric((char*)pixels, (char*)textureData, w, h, 4, texture.mipmap());
case CELL_GCM_TEXTURE_A1R5G5B5:
case CELL_GCM_TEXTURE_A4R4G4B4:
case CELL_GCM_TEXTURE_R5G6B5:
if (is_swizzled)
return write16bTexelsSwizzled((char*)pixels, (char*)textureData, w, h, 2, texture.GetMipmap());
return write16bTexelsSwizzled((char*)pixels, (char*)textureData, w, h, 2, texture.mipmap());
else
return write16bTexelsGeneric((char*)pixels, (char*)textureData, w, h, 2, texture.GetMipmap());
return write16bTexelsGeneric((char*)pixels, (char*)textureData, w, h, 2, texture.mipmap());
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
return write16bX4TexelsGeneric((char*)pixels, (char*)textureData, w, h, 8, texture.GetMipmap());
return write16bX4TexelsGeneric((char*)pixels, (char*)textureData, w, h, 8, texture.mipmap());
case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
return writeCompressedTexel((char*)pixels, (char*)textureData, widthInBlocks, blockWidthInPixel, heightInBlocks, blockHeightInPixel, blockSizeInByte, texture.GetMipmap());
return writeCompressedTexel((char*)pixels, (char*)textureData, widthInBlocks, blockWidthInPixel, heightInBlocks, blockHeightInPixel, blockSizeInByte, texture.mipmap());
default:
return writeTexelsGeneric((char*)pixels, (char*)textureData, w, h, blockSizeInByte, texture.GetMipmap());
return writeTexelsGeneric((char*)pixels, (char*)textureData, w, h, blockSizeInByte, texture.mipmap());
}
}