Renderer/Texture: Allow to keep the texture format in TextureViewInfo

This commit is contained in:
SirLynix
2023-11-26 21:29:49 +01:00
parent 00935efbe0
commit 962a2e71c7
4 changed files with 5 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ namespace Nz
struct TextureViewInfo
{
ImageType viewType;
PixelFormat reinterpretFormat;
PixelFormat reinterpretFormat = PixelFormat::Undefined;
UInt8 baseMipLevel = 0;
UInt8 levelCount = 1;
unsigned int baseArrayLayer = 0;

View File

@@ -9,7 +9,7 @@ namespace Nz
inline TextureInfo Texture::ApplyView(TextureInfo textureInfo, const TextureViewInfo& viewInfo)
{
textureInfo.type = viewInfo.viewType;
textureInfo.pixelFormat = viewInfo.reinterpretFormat;
textureInfo.pixelFormat = (viewInfo.reinterpretFormat != PixelFormat::Undefined) ? viewInfo.reinterpretFormat : textureInfo.pixelFormat;
textureInfo.width = GetLevelSize(textureInfo.width, viewInfo.baseMipLevel);
textureInfo.height = GetLevelSize(textureInfo.height, viewInfo.baseMipLevel);
textureInfo.depth = GetLevelSize(textureInfo.depth, viewInfo.baseMipLevel);