ComputeTest: Fix Vulkan error
This commit is contained in:
parent
dee47c6f15
commit
e3da81dff4
|
|
@ -83,6 +83,9 @@ namespace Nz
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!params.buildMipmaps)
|
||||||
|
texParams.levelCount = image.GetLevelCount();
|
||||||
|
|
||||||
std::shared_ptr<Texture> texture = params.renderDevice->InstantiateTexture(texParams, image.GetConstPixels(), params.buildMipmaps);
|
std::shared_ptr<Texture> texture = params.renderDevice->InstantiateTexture(texParams, image.GetConstPixels(), params.buildMipmaps);
|
||||||
|
|
||||||
texture->SetFilePath(image.GetFilePath());
|
texture->SetFilePath(image.GetFilePath());
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ namespace Nz
|
||||||
m_device(device),
|
m_device(device),
|
||||||
m_image(VK_NULL_HANDLE),
|
m_image(VK_NULL_HANDLE),
|
||||||
m_allocation(nullptr),
|
m_allocation(nullptr),
|
||||||
m_textureInfo(textureInfo),
|
m_textureInfo(textureInfo)
|
||||||
m_textureViewInfo(textureInfo)
|
|
||||||
{
|
{
|
||||||
m_textureInfo.levelCount = std::min(m_textureInfo.levelCount, Image::GetMaxLevel(m_textureInfo.type, m_textureInfo.width, m_textureInfo.height, m_textureInfo.depth));
|
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 = {};
|
VkImageViewCreateInfo createInfoView = {};
|
||||||
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ int main()
|
||||||
texParams.renderDevice = device;
|
texParams.renderDevice = device;
|
||||||
texParams.loadFormat = Nz::PixelFormat::RGBA8;
|
texParams.loadFormat = Nz::PixelFormat::RGBA8;
|
||||||
texParams.usageFlags = Nz::TextureUsage::ShaderReadWrite | Nz::TextureUsage::ShaderSampling | Nz::TextureUsage::TransferDestination;
|
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);
|
std::shared_ptr<Nz::Texture> texture = Nz::Texture::LoadFromFile(resourceDir / "lynix.jpg", texParams);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue