Merge remote-tracking branch 'origin/1.1' into linux-editor

# Conflicts:
#	Source/FlaxEngine.Gen.cs
#	Source/Tools/Flax.Build/Utilities/Utilities.cs
This commit is contained in:
Wojtek Figat
2021-02-16 18:54:25 +01:00
654 changed files with 19651 additions and 10556 deletions

View File

@@ -1076,7 +1076,7 @@ GPUDeviceVulkan::GPUDeviceVulkan(ShaderProfile shaderProfile, GPUAdapterVulkan*
GPUDevice* GPUDeviceVulkan::Create()
{
#if !USE_EDITOR && (PLATFORM_WINDOWS || PLATFORM_LINUX)
auto settings = PlatformSettings::Instance();
auto settings = PlatformSettings::Get();
if (!settings->SupportVulkan)
{
// Skip if there is no support
@@ -1363,23 +1363,7 @@ PixelFormat GPUDeviceVulkan::GetClosestSupportedPixelFormat(PixelFormat format,
if (flags & GPUTextureFlags::UnorderedAccess)
wantedFeatureFlags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
// Check actual device for format support
const auto isSupported = [&](VkFormat vkFormat)
{
VkFormatProperties props;
vkGetPhysicalDeviceFormatProperties(Adapter->Gpu, vkFormat, &props);
const VkFormatFeatureFlags featureFlags = optimalTiling ? props.optimalTilingFeatures : props.linearTilingFeatures;
if ((featureFlags & wantedFeatureFlags) != wantedFeatureFlags)
return false;
//VkImageFormatProperties imageProps;
//vkGetPhysicalDeviceImageFormatProperties(Adapter->Gpu, vkFormat, , &imageProps);
return true;
};
VkFormat vkFormat = RenderToolsVulkan::ToVulkanFormat(format);
if (!isSupported(vkFormat))
if (!IsVkFormatSupported(RenderToolsVulkan::ToVulkanFormat(format), wantedFeatureFlags, optimalTiling))
{
// Special case for depth-stencil formats
if (flags & GPUTextureFlags::DepthStencil)
@@ -1389,7 +1373,7 @@ PixelFormat GPUDeviceVulkan::GetClosestSupportedPixelFormat(PixelFormat format,
// Spec guarantees at least one depth-only, and one depth-stencil format to be supported
if (hasStencil)
{
if (isSupported(VK_FORMAT_D32_SFLOAT_S8_UINT))
if (IsVkFormatSupported(VK_FORMAT_D32_SFLOAT_S8_UINT, wantedFeatureFlags, optimalTiling))
format = PixelFormat::D32_Float;
else
format = PixelFormat::D24_UNorm_S8_UInt;
@@ -1493,6 +1477,20 @@ bool GPUDeviceVulkan::SaveValidationCache()
#endif
bool GPUDeviceVulkan::IsVkFormatSupported(VkFormat vkFormat, VkFormatFeatureFlags wantedFeatureFlags, bool optimalTiling) const
{
VkFormatProperties props;
vkGetPhysicalDeviceFormatProperties(Adapter->Gpu, vkFormat, &props);
const VkFormatFeatureFlags featureFlags = optimalTiling ? props.optimalTilingFeatures : props.linearTilingFeatures;
if ((featureFlags & wantedFeatureFlags) != wantedFeatureFlags)
return false;
//VkImageFormatProperties imageProps;
//vkGetPhysicalDeviceImageFormatProperties(Adapter->Gpu, vkFormat, , &imageProps);
return true;
}
GPUContext* GPUDeviceVulkan::GetMainContext()
{
return reinterpret_cast<GPUContext*>(MainContext);