Skip to content

Commit

Permalink
disabled ycbcr shader sampling extension
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Gjerde committed Nov 24, 2024
1 parent b9f0241 commit 6db5472
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 65 deletions.
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

0 comments on commit 6db5472

Please sign in to comment.