Add initial support for texture views
This commit is contained in:
committed by
Jérôme Leclercq
parent
902dee6121
commit
42f8cdb151
@@ -7,6 +7,19 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline TextureInfo Texture::ApplyView(TextureInfo textureInfo, const TextureViewInfo& viewInfo)
|
||||
{
|
||||
textureInfo.type = viewInfo.viewType;
|
||||
textureInfo.pixelFormat = viewInfo.reinterpretFormat;
|
||||
textureInfo.width = GetLevelSize(textureInfo.width, viewInfo.baseMipLevel);
|
||||
textureInfo.height = GetLevelSize(textureInfo.height, viewInfo.baseMipLevel);
|
||||
textureInfo.depth = GetLevelSize(textureInfo.depth, viewInfo.baseMipLevel);
|
||||
textureInfo.levelCount = (textureInfo.levelCount > viewInfo.baseMipLevel) ? (textureInfo.levelCount - viewInfo.baseMipLevel) : 1;
|
||||
textureInfo.layerCount = (textureInfo.layerCount > viewInfo.baseArrayLayer) ? (textureInfo.layerCount - viewInfo.baseArrayLayer) : 1;
|
||||
|
||||
return textureInfo;
|
||||
}
|
||||
|
||||
inline unsigned int Texture::GetLevelSize(unsigned int size, unsigned int level)
|
||||
{
|
||||
if (size == 0) // Possible dans le cas d'une image invalide
|
||||
|
||||
Reference in New Issue
Block a user