Skip to content

Commit

Permalink
Import fmtlib as submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbucchia committed Nov 20, 2023
1 parent 00abc0b commit da5b680
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "external/Vulkan-SDK"]
path = external/Vulkan-SDK
url = https://github.com/mbucchia/Vulkan-SDK.git
[submodule "external/fmt"]
path = external/fmt
url = https://github.com/fmtlib/fmt.git
1 change: 1 addition & 0 deletions external/fmt
Submodule fmt added at f5e543
2 changes: 1 addition & 1 deletion pimax-openxr/d3d11_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ namespace pimax_openxr {
ResetEvent(eventHandle.get());
}

// Serialize commands from the D3D12 queue to the D3D11 context used by PVR.
// Serialize commands from the application context to the D3D11 context used by PVR.
void OpenXrRuntime::serializeD3D11Frame() {
if (m_pvrSubmissionDevice != m_d3d11Device) {
m_fenceValue++;
Expand Down
25 changes: 11 additions & 14 deletions pimax-openxr/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ namespace pimax_openxr {
const int batteryPercent =
pvr_getTrackedDeviceIntProperty(m_pvrSession, device, pvrTrackedDeviceProp_BatteryPercent_int, -1);
if (batteryPercent >= 0) {
if (batteryPercent > 20) {
return fmt::format(L"{}%", batteryPercent);
} else {
return fmt::format(L"{}% \x26A0", batteryPercent);
}
return xr::utf8_to_wide(fmt::format("{}%", batteryPercent)) + (batteryPercent > 20 ? L"" : L" \x26A0");
} else {
const int batteryLevel =
pvr_getTrackedDeviceIntProperty(m_pvrSession, device, pvrTrackedDeviceProp_BatteryLevel_int, -1);
Expand Down Expand Up @@ -150,7 +146,7 @@ namespace pimax_openxr {
std::strftime(buf, sizeof(buf), "%H:%M", std::localtime(&now));

m_fontNormal->DrawString(m_pvrSubmissionContext.Get(),
std::wstring(buf, buf + strlen(buf)).c_str(),
xr::utf8_to_wide(buf).c_str(),
200.f,
600.f,
12.f,
Expand Down Expand Up @@ -182,7 +178,7 @@ namespace pimax_openxr {

const auto fps = m_frameTimes.size();
m_fontNormal->DrawString(m_pvrSubmissionContext.Get(),
fmt::format(L"{}", fps).c_str(),
xr::utf8_to_wide(fmt::format("{}", fps)).c_str(),
150.f,
1400.f,
1098.f,
Expand All @@ -198,13 +194,14 @@ namespace pimax_openxr {
color,
FW1_RIGHT | FW1_NOFLUSH);

m_fontNormal->DrawString(m_pvrSubmissionContext.Get(),
fmt::format(L"{}x{}", m_proj0Extent.width, m_proj0Extent.height).c_str(),
150.f,
1400.f,
1754.f,
color,
FW1_RIGHT | FW1_NOFLUSH);
m_fontNormal->DrawString(
m_pvrSubmissionContext.Get(),
xr::utf8_to_wide(fmt::format("{}x{}", m_proj0Extent.width, m_proj0Extent.height)).c_str(),
150.f,
1400.f,
1754.f,
color,
FW1_RIGHT | FW1_NOFLUSH);

m_fontNormal->Flush(m_pvrSubmissionContext.Get());

Expand Down
1 change: 0 additions & 1 deletion pimax-openxr/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
<packages>
<package id="Detours" version="4.0.1" targetFramework="native" developmentDependency="true" />
<package id="directxtex_desktop_win10" version="2023.10.31.1" targetFramework="native" />
<package id="fmt" version="7.0.1" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231028.1" targetFramework="native" />
</packages>
1 change: 1 addition & 0 deletions pimax-openxr/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ using Microsoft::WRL::ComPtr;
#include <detours.h>

// FMT formatter.
#define FMT_HEADER_ONLY
#include <fmt/format.h>

#ifndef NOASEEVRCLIENT
Expand Down
10 changes: 4 additions & 6 deletions pimax-openxr/pimax-openxr.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;$(SolutionDir)\external\aSeeVRClient\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;$(SolutionDir)\external\fmt\include;$(SolutionDir)\external\aSeeVRClient\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand Down Expand Up @@ -169,7 +169,7 @@ $(SolutionDir)\scripts\sed.exe -i "s/VALUE \"ProductVersion\", \".*\"$/VALUE \"P
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;$(SolutionDir)\external\fmt\include;</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand Down Expand Up @@ -233,7 +233,7 @@ $(SolutionDir)\scripts\sed.exe -i "s/VALUE \"ProductVersion\", \".*\"$/VALUE \"P
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;$(SolutionDir)\external\aSeeVRClient\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;$(SolutionDir)\external\fmt\include;$(SolutionDir)\external\aSeeVRClient\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand Down Expand Up @@ -301,7 +301,7 @@ $(SolutionDir)\scripts\sed.exe -i "s/VALUE \"ProductVersion\", \".*\"$/VALUE \"P
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(IntDir);$(ProjectDir);$(SolutionDir)\external\OpenXR-SDK\include;$(SolutionDir)\external\OpenXR-SDK\src\common;$(SolutionDir)\external\OpenXR-MixedReality\Shared;$(SolutionDir)\external\OpenXR-MixedReality\Shared\XrUtility;$(SolutionDir)\external\OpenXR-MixedReality\Shared\SampleShared;$(SolutionDir)\external\PVR;$(SolutionDir)\external\Vulkan-SDK\include;$(SolutionDir)\external\OpenGL;$(SolutionDir)\external\FW1FontWrapper\FW1FontWrapper\Source;$(SolutionDir)\external\fmt\include;</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
Expand Down Expand Up @@ -529,7 +529,6 @@ $(SolutionDir)\scripts\sed.exe -i "s/VALUE \"ProductVersion\", \".*\"$/VALUE \"P
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\fmt.7.0.1\build\fmt.targets" Condition="Exists('..\packages\fmt.7.0.1\build\fmt.targets')" />
<Import Project="..\packages\Detours.4.0.1\build\native\Detours.targets" Condition="Exists('..\packages\Detours.4.0.1\build\native\Detours.targets')" />
<Import Project="..\packages\directxtex_desktop_win10.2023.10.31.1\build\native\directxtex_desktop_win10.targets" Condition="Exists('..\packages\directxtex_desktop_win10.2023.10.31.1\build\native\directxtex_desktop_win10.targets')" />
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231028.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231028.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
Expand All @@ -538,7 +537,6 @@ $(SolutionDir)\scripts\sed.exe -i "s/VALUE \"ProductVersion\", \".*\"$/VALUE \"P
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\fmt.7.0.1\build\fmt.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\fmt.7.0.1\build\fmt.targets'))" />
<Error Condition="!Exists('..\packages\Detours.4.0.1\build\native\Detours.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Detours.4.0.1\build\native\Detours.targets'))" />
<Error Condition="!Exists('..\packages\directxtex_desktop_win10.2023.10.31.1\build\native\directxtex_desktop_win10.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\directxtex_desktop_win10.2023.10.31.1\build\native\directxtex_desktop_win10.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231028.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231028.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
Expand Down
4 changes: 2 additions & 2 deletions pimax-openxr/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace xr {
return "Not Supported";

default:
return fmt::format("pvrResult_{}", result);
return fmt::format("pvrResult_{}", (int)result);
}
}

Expand All @@ -136,7 +136,7 @@ namespace xr {
return "Failed";

default:
return fmt::format("aSeeVRReturnCode_{}", result);
return fmt::format("aSeeVRReturnCode_{}", (int)result);
}
}
#endif
Expand Down

0 comments on commit da5b680

Please sign in to comment.