[Impeller] Remove transient usage from sampled and stored images (flutter/engine#39957)
This commit is contained in:
@@ -132,12 +132,31 @@ static constexpr vk::ImageUsageFlags ToVKImageUsageFlags(PixelFormat format,
|
||||
|
||||
if (usage & static_cast<TextureUsageMask>(TextureUsage::kShaderRead)) {
|
||||
vk_usage |= vk::ImageUsageFlagBits::eSampled;
|
||||
// Device transient images can only be used as attachments. The caller
|
||||
// specified incorrect usage flags and is attempting to read a device
|
||||
// transient image in a shader. Unset the transient attachment flag. See:
|
||||
// https://github.com/flutter/flutter/issues/121633
|
||||
if (mode == StorageMode::kDeviceTransient) {
|
||||
vk_usage &= ~vk::ImageUsageFlagBits::eTransientAttachment;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage & static_cast<TextureUsageMask>(TextureUsage::kShaderWrite)) {
|
||||
vk_usage |= vk::ImageUsageFlagBits::eStorage;
|
||||
// Device transient images can only be used as attachments. The caller
|
||||
// specified incorrect usage flags and is attempting to read a device
|
||||
// transient image in a shader. Unset the transient attachment flag. See:
|
||||
// https://github.com/flutter/flutter/issues/121633
|
||||
if (mode == StorageMode::kDeviceTransient) {
|
||||
vk_usage &= ~vk::ImageUsageFlagBits::eTransientAttachment;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO (https://github.com/flutter/flutter/issues/121634):
|
||||
// Add transfer usage flags to support blit passes
|
||||
vk_usage |= vk::ImageUsageFlagBits::eTransferSrc |
|
||||
vk::ImageUsageFlagBits::eTransferDst;
|
||||
|
||||
return vk_usage;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,12 +84,19 @@ static std::optional<vk::SurfaceFormatKHR> ChooseSurfaceFormat(
|
||||
|
||||
static std::optional<vk::CompositeAlphaFlagBitsKHR> ChooseAlphaCompositionMode(
|
||||
vk::CompositeAlphaFlagsKHR flags) {
|
||||
if (flags & vk::CompositeAlphaFlagBitsKHR::eInherit) {
|
||||
return vk::CompositeAlphaFlagBitsKHR::eInherit;
|
||||
}
|
||||
if (flags & vk::CompositeAlphaFlagBitsKHR::ePreMultiplied) {
|
||||
return vk::CompositeAlphaFlagBitsKHR::ePreMultiplied;
|
||||
}
|
||||
if (flags & vk::CompositeAlphaFlagBitsKHR::ePostMultiplied) {
|
||||
return vk::CompositeAlphaFlagBitsKHR::ePostMultiplied;
|
||||
}
|
||||
if (flags & vk::CompositeAlphaFlagBitsKHR::eOpaque) {
|
||||
return vk::CompositeAlphaFlagBitsKHR::eOpaque;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user