ComputeTest: Fix Vulkan error

This commit is contained in:
SirLynix 2023-07-21 08:57:07 +02:00 committed by Jérôme Leclercq
parent dee47c6f15
commit e3da81dff4
3 changed files with 6 additions and 2 deletions

View File

@ -83,6 +83,9 @@ namespace Nz
break;
}
if (!params.buildMipmaps)
texParams.levelCount = image.GetLevelCount();
std::shared_ptr<Texture> texture = params.renderDevice->InstantiateTexture(texParams, image.GetConstPixels(), params.buildMipmaps);
texture->SetFilePath(image.GetFilePath());

View File

@ -19,10 +19,10 @@ namespace Nz
m_device(device),
m_image(VK_NULL_HANDLE),
m_allocation(nullptr),
m_textureInfo(textureInfo),
m_textureViewInfo(textureInfo)
m_textureInfo(textureInfo)
{
m_textureInfo.levelCount = std::min(m_textureInfo.levelCount, Image::GetMaxLevel(m_textureInfo.type, m_textureInfo.width, m_textureInfo.height, m_textureInfo.depth));
m_textureViewInfo = m_textureInfo;
VkImageViewCreateInfo createInfoView = {};
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;

View File

@ -54,6 +54,7 @@ int main()
texParams.renderDevice = device;
texParams.loadFormat = Nz::PixelFormat::RGBA8;
texParams.usageFlags = Nz::TextureUsage::ShaderReadWrite | Nz::TextureUsage::ShaderSampling | Nz::TextureUsage::TransferDestination;
texParams.buildMipmaps = false;
std::shared_ptr<Nz::Texture> texture = Nz::Texture::LoadFromFile(resourceDir / "lynix.jpg", texParams);