Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Color Stream Crash #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:


BuildWindows:
name: Build For Windows
name: Compile Check for Windows
needs: [ReleaseJob, VersionJob]
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:


BuildWindows:
name: Build and Create Installer for Windows
name: Compile Check for Windows
needs: [VersionJob]
runs-on: windows-2022
steps:
Expand Down
28 changes: 14 additions & 14 deletions Assets/Tools/Windows/build_installer_locally.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ Write-Host "You provided the version: $version"
cmake -B . -DCMAKE_BUILD_TYPE=Release -DWARNINGS_AS_ERRORS=FALSE -DGIT_SUBMODULE=OFF $path
cmake --build . --config Release --target install -- /m:10

mkdir files
Copy-Item -Recurse ".\multisense_${version}_amd64\*" .\files\

mv .\files\Assets\Tools\Windows\inno_setup_script.iss .\
mv .\files\Assets\Tools\compile.sh .\
mv .\files\Assets\Tools\install_spirv_compiler.sh .\
mv .\files\Assets\Tools\monitor_memory_usage.py .\
mv .\files\Assets\Tools\Windows\build_installer.ps1 .\
mv .\files\Assets\Tools\Windows\build_installer_locally.ps1 .\
mv .\files\Assets\Tools\how_to_release .\
rm -R .\files\Assets\Tools\Ubuntu
rm -R .\files\bin
rm -R .\files\include
rm -R .\files\lib
mkdir MultiSense-Viewer
Copy-Item -Recurse ".\multisense_${version}_amd64\*" .\MultiSense-Viewer\

mv .\MultiSense-Viewer\Assets\Tools\Windows\inno_setup_script.iss .\ -Force
mv .\MultiSense-Viewer\Assets\Tools\compile.sh .\ -Force
mv .\MultiSense-Viewer\Assets\Tools\install_spirv_compiler.sh .\ -Force
mv .\MultiSense-Viewer\Assets\Tools\monitor_memory_usage.py .\ -Force
mv .\MultiSense-Viewer\Assets\Tools\Windows\build_installer.ps1 .\ -Force
mv .\MultiSense-Viewer\Assets\Tools\Windows\build_installer_locally.ps1 .\ -Force
mv .\MultiSense-Viewer\Assets\Tools\how_to_release.md .\ -Force
rm -R .\MultiSense-Viewer\Assets\Tools\Ubuntu
rm -R .\MultiSense-Viewer\bin
rm -R .\MultiSense-Viewer\include
rm -R .\MultiSense-Viewer\lib

& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" .\inno_setup_script.iss
12 changes: 6 additions & 6 deletions Assets/Tools/Windows/inno_setup_script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ OutputBaseFilename=MultiSenseSetup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
SetupIconFile=.\MultiSense_viewer\Assets\Tools\Windows\{#MyAppSetupIcoName}
UninstallDisplayIcon=.\MultiSense_viewer\Assets\Tools\Windows\{#MyAppSetupIcoName}
SetupIconFile=.\MultiSense-Viewer\Assets\Tools\Windows\{#MyAppSetupIcoName}
UninstallDisplayIcon=.\MultiSense-Viewer\Assets\Tools\Windows\{#MyAppSetupIcoName}
UsePreviousAppDir=no

[Languages]
Expand All @@ -43,10 +43,10 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "MultiSense_viewer\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "MultiSense_viewer\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "MultiSense_viewer\AutoConnect.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system MultiSense_viewer
Source: "MultiSense-Viewer\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "MultiSense-Viewer\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "MultiSense-Viewer\AutoConnect.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system MultiSense-Viewer

[Registry]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set application version. Remember that it should always match the pushed tag in the form of v1.*-*
set(VERSION_MAJOR "1")
set(VERSION_MINOR "1")
set(VERSION_PATCH "5")
set(VERSION_PATCH "6")
set(ARCHITECTURE "amd64")

# Set install directory. Used to generate installers for both Windows and Ubuntu using their native approaches
Expand Down
2 changes: 1 addition & 1 deletion include/Viewer/Core/RenderResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ namespace RenderResource {
VkResult res = vkCreateGraphicsPipelines(device->m_LogicalDevice, nullptr, 1, &pipelineCI, nullptr,
&data.pipeline);
if (res != VK_SUCCESS)
throw std::runtime_error("Failed to create graphics m_Pipeline");
throw std::runtime_error("Failed to create graphics pipeline: RenderResource");
}
};
}
Expand Down
121 changes: 62 additions & 59 deletions src/CRLCamera/CameraConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,10 +833,11 @@ namespace VkRender::MultiSense {

app->updateUIDataBlock(*dev, app->camPtr);

/*
Log::Logger::getInstance()->info("Attempting to restore last session from .ini runtime config file");
if (!isRemoteHead)
app->getProfileFromIni(*dev);

*/
// Set the resolution read from config file
const auto &info = app->camPtr.getCameraInfo(dev->channelConnections.front()).devInfo;
dev->cameraName = info.name;
Expand Down Expand Up @@ -903,71 +904,73 @@ namespace VkRender::MultiSense {
Log::Logger::getInstance()->info("Disconnecting profile {} using camera {}", dev->name.c_str(),
dev->cameraName.c_str());
// Save settings to file. Attempt to create a new file if it doesn't exist
CSimpleIniA ini;
ini.SetUnicode();
auto filePath = (Utils::getSystemCachePath() / "crl.ini");
SI_Error rc = ini.LoadFile(filePath.c_str());
if (rc < 0) {
// File doesn't exist error, then create one
if (rc == SI_FILE && errno == ENOENT) {
std::ofstream output(filePath.c_str());
output.close();
rc = ini.LoadFile(filePath.c_str());
} else
Log::Logger::getInstance()->error("Failed to create profile configuration file\n");
}
std::string CRLSerialNumber = dev->serialName;
// If sidebar is empty or we dont recognize any serial numbers in the crl.ini file then clear it.
// new m_Entry given we have a valid ini file m_Entry
if (rc >= 0 && !CRLSerialNumber.empty()) {
// Profile Data
addIniEntry(&ini, CRLSerialNumber, "ProfileName", dev->name);
addIniEntry(&ini, CRLSerialNumber, "AdapterName", dev->interfaceName);
addIniEntry(&ini, CRLSerialNumber, "CameraName", dev->cameraName);
addIniEntry(&ini, CRLSerialNumber, "IP", dev->IP);
addIniEntry(&ini, CRLSerialNumber, "AdapterIndex", std::to_string(dev->interfaceIndex));
addIniEntry(&ini, CRLSerialNumber, "State", std::to_string(dev->state));
// Preview Data per channel
for (const auto &ch: dev->channelConnections) {
std::string mode = "Mode" + std::to_string(ch);
if (dev->channelInfo.empty() || dev->channelInfo[ch].modes.empty())
continue;

auto resMode = dev->channelInfo[ch].modes[dev->channelInfo[ch].selectedModeIndex];
if (Utils::stringToCameraResolution(resMode) == CRL_RESOLUTION_NONE)
resMode = "0";

addIniEntry(&ini, CRLSerialNumber, mode,
std::to_string(static_cast<int>(Utils::stringToCameraResolution(
resMode))
));
addIniEntry(&ini, CRLSerialNumber, "Layout", std::to_string(static_cast<int>(dev->layout)));
for (int i = 0; i <= CRL_PREVIEW_FOUR; ++i) {
std::string source = dev->win[static_cast<StreamWindowIndex>(i)].selectedSource;
std::string remoteHead = std::to_string(
dev->win[static_cast<StreamWindowIndex>(i)].selectedRemoteHeadIndex);
std::string key = "Preview" + std::to_string(i + 1);
std::string value = (source.append(":" + remoteHead));
addIniEntry(&ini, CRLSerialNumber, key, value);
}
}
}
// delete m_Entry if we gave the disconnect and reset flag Otherwise just normal disconnect
// save the m_DataPtr back to the file

/*
CSimpleIniA ini;
ini.SetUnicode();

auto filePath = (Utils::getSystemCachePath() / "crl.ini");
SI_Error rc = ini.LoadFile(filePath.c_str());
if (rc < 0) {
// File doesn't exist error, then create one
if (rc == SI_FILE && errno == ENOENT) {
std::ofstream output(filePath.c_str());
output.close();
rc = ini.LoadFile(filePath.c_str());
} else
Log::Logger::getInstance()->error("Failed to create profile configuration file\n");
}
std::string CRLSerialNumber = dev->serialName;
// If sidebar is empty or we dont recognize any serial numbers in the crl.ini file then clear it.
// new m_Entry given we have a valid ini file m_Entry
if (rc >= 0 && !CRLSerialNumber.empty()) {
// Profile Data
addIniEntry(&ini, CRLSerialNumber, "ProfileName", dev->name);
addIniEntry(&ini, CRLSerialNumber, "AdapterName", dev->interfaceName);
addIniEntry(&ini, CRLSerialNumber, "CameraName", dev->cameraName);
addIniEntry(&ini, CRLSerialNumber, "IP", dev->IP);
addIniEntry(&ini, CRLSerialNumber, "AdapterIndex", std::to_string(dev->interfaceIndex));
addIniEntry(&ini, CRLSerialNumber, "State", std::to_string(dev->state));
// Preview Data per channel
for (const auto &ch: dev->channelConnections) {
std::string mode = "Mode" + std::to_string(ch);
if (dev->channelInfo.empty() || dev->channelInfo[ch].modes.empty())
continue;

auto resMode = dev->channelInfo[ch].modes[dev->channelInfo[ch].selectedModeIndex];
if (Utils::stringToCameraResolution(resMode) == CRL_RESOLUTION_NONE)
resMode = "0";

addIniEntry(&ini, CRLSerialNumber, mode,
std::to_string(static_cast<int>(Utils::stringToCameraResolution(
resMode))
));
addIniEntry(&ini, CRLSerialNumber, "Layout", std::to_string(static_cast<int>(dev->layout)));
for (int i = 0; i <= CRL_PREVIEW_FOUR; ++i) {
std::string source = dev->win[static_cast<StreamWindowIndex>(i)].selectedSource;
std::string remoteHead = std::to_string(
dev->win[static_cast<StreamWindowIndex>(i)].selectedRemoteHeadIndex);
std::string key = "Preview" + std::to_string(i + 1);
std::string value = (source.append(":" + remoteHead));
addIniEntry(&ini, CRLSerialNumber, key, value);
}
}
}
// delete m_Entry if we gave the disconnect and reset flag Otherwise just normal disconnect
// save the m_DataPtr back to the file
*/
if (dev->state == CRL_STATE_DISCONNECT_AND_FORGET || dev->state == CRL_STATE_INTERRUPT_CONNECTION) {
ini.Delete(CRLSerialNumber.c_str(), nullptr);
//ini.Delete(CRLSerialNumber.c_str(), nullptr);
dev->state = CRL_STATE_REMOVE_FROM_LIST;
Log::Logger::getInstance()->info("Set dev {}'s state to CRL_STATE_REMOVE_FROM_LIST ", dev->name);
Log::Logger::getInstance()->info("Deleted saved profile for serial: {}", CRLSerialNumber);
//Log::Logger::getInstance()->info("Deleted saved profile for serial: {}", CRLSerialNumber);
} else {
dev->state = CRL_STATE_DISCONNECTED;
Log::Logger::getInstance()->info("Set dev {}'s state to CRL_STATE_DISCONNECTED ", dev->name);
}
rc = ini.SaveFile(filePath.c_str());
if (rc < 0) {
Log::Logger::getInstance()->info("Failed to save crl.ini file. Err: {}", rc);
}
//rc = ini.SaveFile(filePath.c_str());
//if (rc < 0) {
// Log::Logger::getInstance()->info("Failed to save crl.ini file. Err: {}", rc);
//}

dev->channelInfo.clear();
}
Expand Down
3 changes: 3 additions & 0 deletions src/Core/VulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ VulkanDevice::createLogicalDevice(VkPhysicalDeviceFeatures enabled, std::vector<
* @return True if the extension is supported (present in the list read at m_Device creation time)
*/
bool VulkanDevice::extensionSupported(std::string extension) const {
if (VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME == extension)
return false;

return (std::find(m_SupportedExtensions.begin(), m_SupportedExtensions.end(), extension) !=
m_SupportedExtensions.end());
}
Expand Down
2 changes: 1 addition & 1 deletion src/ImGui/GuiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ namespace VkRender {

if (vkCreateGraphicsPipelines(device->m_LogicalDevice, pipelineCache, 1, &pipelineCreateInfo, nullptr,
&pipeline) != VK_SUCCESS)
throw std::runtime_error("Failed to create graphics m_Pipeline");
throw std::runtime_error("Failed to create graphics pipeline: GuiManager");

}

Expand Down
2 changes: 1 addition & 1 deletion src/ModelLoaders/CRLCameraModels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ CRLCameraModels::createPipeline(VkRenderPass pT, std::vector<VkPipelineShaderSta
VkResult res = vkCreateGraphicsPipelines(vulkanDevice->m_LogicalDevice, VK_NULL_HANDLE, 1, &pipelineCI, nullptr,
pPipelineT);
if (res != VK_SUCCESS)
throw std::runtime_error("Failed to create graphics m_Pipeline");
throw std::runtime_error("Failed to create graphics pipeline: CRLCameraModels");


}
Expand Down
4 changes: 2 additions & 2 deletions src/ModelLoaders/CustomModels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ void CustomModels::createGraphicsPipeline(std::vector<VkPipelineShaderStageCreat
VkResult res = vkCreateGraphicsPipelines(vulkanDevice->m_LogicalDevice, nullptr, 1, &pipelineCI, nullptr,
&pipelines[i]);
if (res != VK_SUCCESS)
throw std::runtime_error("Failed to create graphics m_Pipeline");
throw std::runtime_error("Failed to create graphics pipeline: CustomModels 1/2");

pipelineCI.renderPass = (*renderer->secondaryRenderPasses)[0].renderPass;
res = vkCreateGraphicsPipelines(vulkanDevice->m_LogicalDevice, nullptr, 1, &pipelineCI, nullptr,
&pipelinesSecondary[i]);
if (res != VK_SUCCESS)
throw std::runtime_error("Failed to create graphics m_Pipeline");
throw std::runtime_error("Failed to create graphics pipeline: CustomModels 2/2");

}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ModelLoaders/ImageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void ImageView::createGraphicsPipeline() {
nullptr,
&m_model->resources[j].pipeline[i]);
if (res != VK_SUCCESS)
throw std::runtime_error("Failed to create graphics m_Pipeline");
throw std::runtime_error("Failed to create graphics pipeline: ImageView");
}
}
}
Expand Down
Loading