mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-05 17:15:05 +01:00
Split out guest texture layer size calcs into a seperate func
This commit is contained in:
parent
8fa83fdf13
commit
ad3195e06f
@ -16,15 +16,20 @@ namespace skyline::gpu {
|
|||||||
if (layerStride)
|
if (layerStride)
|
||||||
return layerStride;
|
return layerStride;
|
||||||
|
|
||||||
|
layerStride = CalculateLayerSize();
|
||||||
|
return layerStride;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 GuestTexture::CalculateLayerSize() {
|
||||||
switch (tileConfig.mode) {
|
switch (tileConfig.mode) {
|
||||||
case texture::TileMode::Linear:
|
case texture::TileMode::Linear:
|
||||||
return layerStride = static_cast<u32>(format->GetSize(dimensions));
|
return static_cast<u32>(format->GetSize(dimensions));
|
||||||
|
|
||||||
case texture::TileMode::Pitch:
|
case texture::TileMode::Pitch:
|
||||||
return layerStride = dimensions.height * tileConfig.pitch;
|
return dimensions.height * tileConfig.pitch;
|
||||||
|
|
||||||
case texture::TileMode::Block:
|
case texture::TileMode::Block:
|
||||||
return layerStride = static_cast<u32>(texture::GetBlockLinearLayerSize(dimensions, format->blockHeight, format->blockWidth, format->bpb, tileConfig.blockHeight, tileConfig.blockDepth, mipLevelCount, layerCount > 1));
|
return static_cast<u32>(texture::GetBlockLinearLayerSize(dimensions, format->blockHeight, format->blockWidth, format->bpb, tileConfig.blockHeight, tileConfig.blockDepth, mipLevelCount, layerCount > 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +276,11 @@ namespace skyline::gpu {
|
|||||||
*/
|
*/
|
||||||
u32 GetLayerStride();
|
u32 GetLayerStride();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the size of a single layer in bytes, unlike `GetLayerStride` the returned layer size is always calculated and may not be equal to the actual layer stride
|
||||||
|
*/
|
||||||
|
u32 CalculateLayerSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The most appropriate backing image type for this texture
|
* @return The most appropriate backing image type for this texture
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user