Skip to content

Commit

Permalink
Release 6.4.1
Browse files Browse the repository at this point in the history
* The Vulkan swapchain creation now use more sensible defaults when the app has no preferences.
* Upgraded to FslBuild 3.7.0.1
* Updated the way we build zlib on ubuntu.
  • Loading branch information
ReneThrane committed Sep 3, 2024
1 parent be6c145 commit b590482
Show file tree
Hide file tree
Showing 21 changed files with 355 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .Config/FslBuildGen/Tool/ToolAppMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from FslBuildGen.Xml.Project.XmlProjectRootConfigFile import XmlProjectRootConfigFile


CurrentVersion = Version(3, 7, 0, 0)
CurrentVersion = Version(3, 7, 0, 1)


def __AddDefaultOptions(parser: argparse.ArgumentParser, allowStandaloneMode: bool) -> None:
Expand Down
9 changes: 8 additions & 1 deletion .Config/FslBuildGen/Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,16 @@ def ChangeToDosEnvironmentVariables(path: str) -> str:

def ParseVersionString(version: str, splitChar: str = '.', maxValues: int = 4) -> List[int]:
valueStrings = version.split(splitChar)

if len(valueStrings) > 0 and len(valueStrings[len(valueStrings)-1]) == 0:
valueStrings.pop()
if len(valueStrings) > maxValues:
raise Exception("Version string contained more values than allowed '{0}'".format(version))
return [int(value) for value in valueStrings]
try:
return [int(value) for value in valueStrings]
except ValueError as exc:
print("ERROR: Failed to parse version string: '{0}' split into {1}".format(version, valueStrings))
raise

def GetPackageNames(name: str) -> Tuple[str, str]:
"""
Expand Down
13 changes: 6 additions & 7 deletions .Config/Templates.gen/Scr/SCR-gtec-demo-framework.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ Origin: NXP (BSD-3-clause)
Questquest Game icons - Justin Nichol (CC-BY-SA-4.0) - http://freeforall.cc/works/questquest-game-icons/
piacenti (CC-BY-3.0) - http://opengameart.org/content/knight-2
Third Party Apps Included:
Open Asset Import Library [assimp] (BSD-3-Clause) - https://sourceforge.net/projects/assimp/
DevIL (LGPL-2.1+) - https://sourceforge.net/projects/openil/
G-Truc Creation [GLI] (MIT) - https://www.g-truc.net/
Khronos Group OpenVG (MIT) - https://www.khronos.org/openvg/
Open Asset Import Library 5.4.2 [assimp] (BSD-3-Clause) - https://sourceforge.net/projects/assimp/
DevIL 1.8.0 (LGPL-2.1+) - https://sourceforge.net/projects/openil/
G-Truc Creation 0.8.2.0 [GLI] (MIT) - https://www.g-truc.net/
Khronos Group OpenVG 952aaf2699729203731e8a28eefacd2d47366d50 (MIT) - https://www.khronos.org/openvg/
libpng (libpng) - https://sourceforge.net/projects/libpng/
libjpeg (IJG) - http://www.ijg.org/
OpenGL Mathematics [GLM] (MIT) - https://sourceforge.net/projects/ogl-math/
RapidJSON (MIT) - https://github.com/miloyip/rapidjson/
OpenGL Mathematics 0.9.9.8 [GLM] (MIT) - https://sourceforge.net/projects/ogl-math/
SRA/SKC gettimeofday (MIT) - https://doxygen.postgresql.org/gettimeofday_8c_source.htm
zlib (zlib) - http://www.zlib.net/
zlib 1.3.1 (zlib) - http://www.zlib.net/
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
// to port samples.

#include <FslBase/Log/Log3Fmt.hpp>
#include <FslBase/Span/SpanUtil_Vector.hpp>
#include <FslUtil/Vulkan1_0/DebugStrings.hpp>
#include <FslUtil/Vulkan1_0/TypeConverter.hpp>
#include <FslUtil/Vulkan1_0/Util/PhysicalDeviceKHRUtil.hpp>
#include <FslUtil/Vulkan1_0/Util/SurfaceFormatUtil.hpp>
#include <FslUtil/Vulkan1_0/Util/SwapchainKHRUtil.hpp>
#include <RapidVulkan/Check.hpp>
#include <Shared/VulkanWillemsDemoAppExperimental/Swapchain.hpp>
Expand Down Expand Up @@ -152,23 +154,24 @@ namespace Fsl::Willems
preTransform = surfCaps.currentTransform;
}

const auto surfaceFormats = Vulkan::PhysicalDeviceKHRUtil::GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface);
VkFormat colorFormat = VK_FORMAT_UNDEFINED;
// If the surface format list only includes one entry with VK_FORMAT_UNDEFINED,
// there is no preferred format, so we assume VK_FORMAT_B8G8R8A8_UNORM
if ((surfaceFormats.size() == 1) && (surfaceFormats[0].format == VK_FORMAT_UNDEFINED))
const auto availableSurfaceFormats = Vulkan::PhysicalDeviceKHRUtil::GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface);
if (availableSurfaceFormats.empty())
{
colorFormat = VK_FORMAT_B8G8R8A8_UNORM;
throw RapidVulkan::VulkanException("GetPhysicalDeviceSurfaceFormatsKHR returned no formats");
}
else
{
// For now always select the first available color format
// If you need a specific format (e.g. SRGB) you'd need to
// iterate over the list of available surface format and
// check for it's presence
colorFormat = surfaceFormats[0].format;
VkFormat colorFormat = VK_FORMAT_UNDEFINED;
VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
{ // Format selection
// We want to get a format that best suits our needs, so we try to get one from a set of preferred formats
// Initialize the format to the first one returned by the implementation in case we can't find one of the preferred formats
Vulkan::SurfaceFormatInfo selectedFormat = Vulkan::SurfaceFormatUtil::TryFindSurfaceFormat(SpanUtil::AsReadOnlySpan(availableSurfaceFormats));
if (selectedFormat.Format == VK_FORMAT_UNDEFINED)
{
throw RapidVulkan::VulkanException("TryFindSurfaceFormat failed to locate a suitable surface format");
}
colorFormat = selectedFormat.Format;
colorSpace = selectedFormat.ColorSpace;
}
const auto colorSpace = surfaceFormats[0].colorSpace;

FSLLOG3_INFO("Swapchain present mode: {}", Vulkan::Debug::ToString(swapchainPresentMode));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************************************************************************************
* Copyright 2018, 2022 NXP
* Copyright 2018, 2022, 2024 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -31,6 +31,7 @@

#include <FslBase/Bits/BitsUtil.hpp>
#include <FslBase/Log/Log3Fmt.hpp>
#include <FslBase/Span/SpanUtil_Vector.hpp>
#include <FslDemoApp/Base/FrameInfo.hpp>
#include <FslDemoApp/Base/Overlay/DemoAppProfilerOverlay.hpp>
#include <FslDemoApp/Base/Service/Host/IHostInfo.hpp>
Expand All @@ -48,6 +49,7 @@
#include <FslUtil/Vulkan1_0/TypeConverter.hpp>
#include <FslUtil/Vulkan1_0/Util/CommandBufferUtil.hpp>
#include <FslUtil/Vulkan1_0/Util/PhysicalDeviceKHRUtil.hpp>
#include <FslUtil/Vulkan1_0/Util/SurfaceFormatUtil.hpp>
#include <FslUtil/Vulkan1_0/Util/SwapchainKHRUtil.hpp>
#include <RapidVulkan/CommandBuffer.hpp>
#include <RapidVulkan/Debug/Strings/VkImageUsageFlagBits.hpp>
Expand Down Expand Up @@ -107,27 +109,35 @@ namespace Fsl::VulkanBasic
Vulkan::SurfaceFormatInfo FindPreferredSurfaceInfo(VkPhysicalDevice physicalDevice, const VkSurfaceKHR surface,
const std::deque<Vulkan::SurfaceFormatInfo>& preferredFormats)
{
std::vector<Vulkan::SurfaceFormatInfo> finalPreferredFormats(preferredFormats.begin(), preferredFormats.end());

auto supportedFormats = Vulkan::PhysicalDeviceKHRUtil::GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface);
if (!preferredFormats.empty())
{
for (auto entry : preferredFormats)
auto res = Vulkan::SurfaceFormatUtil::TryFindPreferredFormat(SpanUtil::AsReadOnlySpan(supportedFormats),
SpanUtil::AsReadOnlySpan(finalPreferredFormats));
if (res.Format != VK_FORMAT_UNDEFINED)
{
for (auto candidate : supportedFormats)
{
if (entry.Format == candidate.format && entry.ColorSpace == candidate.colorSpace)
{
return entry;
}
}
return res;
}
FSLLOG3_VERBOSE("None of the preferred surface formats found, using default");
}
if (supportedFormats.empty())
{
throw NotSupportedException("No surface formats found");
}
// Default to the first supported format (not optimal but at least its something)
return {supportedFormats[0].format, supportedFormats[0].colorSpace};

// Try to locate a format
{ // Add the suggested defaults
const ReadOnlySpan<Vulkan::SurfaceFormatInfo> suggestedEntries = Vulkan::SurfaceFormatUtil::GetSuggestedDefaultPreferredSurfaceFormats();
finalPreferredFormats.reserve(finalPreferredFormats.size() + suggestedEntries.size());
for (const auto& suggested : suggestedEntries)
{
finalPreferredFormats.push_back(suggested);
}
}
return Vulkan::SurfaceFormatUtil::TryFindSurfaceFormat(SpanUtil::AsReadOnlySpan(supportedFormats),
SpanUtil::AsReadOnlySpan(finalPreferredFormats), VK_COLOR_SPACE_SRGB_NONLINEAR_KHR);
}

AppDrawResult WaitForFenceAndResetIt(const VkDevice device, const VkFence fence)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,13 @@ namespace Fsl
wl_cursor_image* image = nullptr;


if (pContext->Window->Fullscreen)
{
wl_pointer_set_cursor(pointer, serial, nullptr, 0, 0);
}
else if (cursor != nullptr)
// Disabled the cursor hiding as this should really be requested by the app if it needs it.
// if (pContext->Window->Fullscreen)
// {
// // Hide the cursor
// // wl_pointer_set_cursor(pointer, serial, nullptr, 0, 0);
// } else
if (cursor != nullptr)
{
image = pContext->Handles.DefaultCursor->images[0];
buffer = wl_cursor_image_get_buffer(image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ namespace Fsl
{
if (pVal != nullptr)
{
wl_keyboard_release(pVal);
// wl_keyboard_destroy(pVal);
// wl_keyboard_release(pVal);
wl_keyboard_destroy(pVal);
}
}
};
Expand All @@ -131,8 +131,8 @@ namespace Fsl
{
if (pVal != nullptr)
{
wl_pointer_release(pVal);
// wl_pointer_destroy(pVal);
// wl_pointer_release(pVal);
wl_pointer_destroy(pVal);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,12 +740,15 @@ namespace Fsl::UI::RenderIMBatch
pPerformanceCapture->EndThenBegin(RenderPerformanceCaptureId::UpdateBuffers, RenderPerformanceCaptureId::ScheduleDraw);
}
}
else if (pPerformanceCapture != nullptr)
else
{
// Calculate the stats so they can be shown correctly
uploadStats = CalcUploadStats(batcher);
pPerformanceCapture->Begin(RenderPerformanceCaptureId::UpdateBuffers);
pPerformanceCapture->EndThenBegin(RenderPerformanceCaptureId::UpdateBuffers, RenderPerformanceCaptureId::ScheduleDraw);
if (pPerformanceCapture != nullptr)
{
pPerformanceCapture->Begin(RenderPerformanceCaptureId::UpdateBuffers);
pPerformanceCapture->EndThenBegin(RenderPerformanceCaptureId::UpdateBuffers, RenderPerformanceCaptureId::ScheduleDraw);
}
}

DrawStats drawStats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
****************************************************************************************************************************************************/

#include <FslUtil/Vulkan1_0/EncodedVulkanVersion.hpp>
#include <RapidVulkan/Debug/Strings/VkColorSpaceKHR.hpp>
#include <RapidVulkan/Debug/Strings/VkFormat.hpp>
#include <fmt/format.h>
#include <vulkan/vulkan.h>
Expand Down Expand Up @@ -123,6 +124,29 @@ namespace fmt
return fmt::format_to(ctx.out(), "0x{:x}", static_cast<uint32_t>(value));
}
};

template <>
struct formatter<VkColorSpaceKHR>
{
template <typename ParseContext>
// NOLINTNEXTLINE(readability-identifier-naming)
constexpr auto parse(ParseContext& ctx)
{
return ctx.begin();
}

template <typename FormatContext>
// NOLINTNEXTLINE(readability-identifier-naming)
auto format(const VkColorSpaceKHR& value, FormatContext& ctx)
{
const auto* psz = RapidVulkan::Debug::TryToString(value);
if (psz != nullptr)
{
return fmt::format_to(ctx.out(), "{}", psz);
}
return fmt::format_to(ctx.out(), "0x{:x}", static_cast<uint32_t>(value));
}
};
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ namespace Fsl::Vulkan
VkFormat Format;
VkColorSpaceKHR ColorSpace;

constexpr SurfaceFormatInfo()
constexpr SurfaceFormatInfo() noexcept
: SurfaceFormatInfo(VK_FORMAT_UNDEFINED, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
{
}

explicit constexpr SurfaceFormatInfo(const VkFormat format)
explicit constexpr SurfaceFormatInfo(const VkFormat format) noexcept
: SurfaceFormatInfo(format, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
{
}

constexpr SurfaceFormatInfo(const VkFormat format, const VkColorSpaceKHR colorSpace)
constexpr SurfaceFormatInfo(const VkFormat format, const VkColorSpaceKHR colorSpace) noexcept
: Format(format)
, ColorSpace(colorSpace)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#ifndef FSLUTIL_VULKAN1_0_UTIL_SURFACEFORMATUTIL_HPP
#define FSLUTIL_VULKAN1_0_UTIL_SURFACEFORMATUTIL_HPP
/****************************************************************************************************************************************************
* Copyright 2024 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the NXP. nor the names of
* its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************************************************************************/

// Make sure Common.hpp is the first include file (to make the error message as helpful as possible when disabled)
#include <FslBase/Span/ReadOnlySpan.hpp>
#include <FslUtil/Vulkan1_0/Common.hpp>
#include <FslUtil/Vulkan1_0/SurfaceFormatInfo.hpp>

namespace Fsl::Vulkan::SurfaceFormatUtil
{
//! @brief Find a preferred format of a specific color space
//! @return res.format == VK_FORMAT_UNDEFINED if no format was found
SurfaceFormatInfo TryFindPreferredFormat(const ReadOnlySpan<VkSurfaceFormatKHR> availableSurfaceFormats,
const ReadOnlySpan<SurfaceFormatInfo> preferredSurfaceFormats);

//! @brief Find a preferred format of any color space
//! @return res.format == VK_FORMAT_UNDEFINED if no format was found
SurfaceFormatInfo TryFindPreferredFormatAnyColorspace(ReadOnlySpan<VkSurfaceFormatKHR> availableSurfaceFormats,
const ReadOnlySpan<SurfaceFormatInfo> preferredSurfaceFormats);

//! @brief Find any format with the given color-space
//! @return res.format == VK_FORMAT_UNDEFINED if no format was found
SurfaceFormatInfo TryFindAnyFormatWithColorSpace(ReadOnlySpan<VkSurfaceFormatKHR> availableSurfaceFormats,
const VkColorSpaceKHR requiredColorSpace);


//! @brief Find a surface format using preferred formats and color space as guide but will return format if availableSurfaceFormats contains any.
//! - Find any preferred format with the desired color-space
//! - Find any format with the desired color-space
//! - Find any preferred format with any color-space
//! - use the first entry of the availableSurfaceFormats if not empty
//! - give up and return res.format == VK_FORMAT_UNDEFINED
SurfaceFormatInfo TryFindSurfaceFormat(ReadOnlySpan<VkSurfaceFormatKHR> availableSurfaceFormats,
const ReadOnlySpan<SurfaceFormatInfo> preferredSurfaceFormats,
const VkColorSpaceKHR fallbackDesiredColorSpace);

//! @brief Find a surface format using preferred formats and color space as guide but will return format if availableSurfaceFormats contains any.
//! This method has a baked in preferred format list
//! - Find any preferred format with the desired color-space
//! - Find any format with the desired color-space
//! - Find any preferred format with any color-space
//! - use the first entry of the availableSurfaceFormats if not empty
//! - give up and return res.format == VK_FORMAT_UNDEFINED
SurfaceFormatInfo TryFindSurfaceFormat(ReadOnlySpan<VkSurfaceFormatKHR> availableSurfaceFormats);

//! @brief Get the suggested default preferred surface formats
ReadOnlySpan<SurfaceFormatInfo> GetSuggestedDefaultPreferredSurfaceFormats() noexcept;
}

#endif
Loading

0 comments on commit b590482

Please sign in to comment.