Scripting changes for item and added level 1 scene #330

Merged
glencelow merged 10 commits from PlayerController into main 2023-02-02 11:20:20 +08:00
6 changed files with 33 additions and 3 deletions
Showing only changes of commit 0f8e1d6310 - Show all commits

View File

@ -0,0 +1,4 @@
Start Maximized: true
Working Scene ID: 97402985
Window Size: {x: 1920, y: 1013}
Style: 0

View File

@ -10,6 +10,7 @@ namespace SHADE
enum class SH_PHYSICAL_DEVICE_TYPE enum class SH_PHYSICAL_DEVICE_TYPE
{ {
BEST, BEST,
DEDICATED,
}; };
class SHVkPhysicalDevice class SHVkPhysicalDevice

View File

@ -160,9 +160,31 @@ namespace SHADE
} }
} }
return bestDevice; return bestDevice;
} }
vk::PhysicalDevice SHVkPhysicalDeviceLibrary::GetFirstDedicatedDevice(uint32_t apiVersion /*= SHVulkanAPIVersion::V_1_2*/)
{
if (!queried || physicalDevices.empty())
return nullptr;
for (auto const& device : physicalDevices)
{
// Check for API version and device type. Ignore if queried device doesn't support version passed in
if (device.getProperties().apiVersion < static_cast<uint32_t>(apiVersion))
continue;
//VkDeviceSize biggestDeviceHeapSize = device.getMemoryProperties().;
if (device.getProperties().deviceType == vk::PhysicalDeviceType::eDiscreteGpu)
return device;
}
return nullptr;
}
/***************************************************************************/ /***************************************************************************/
/*! /*!
@ -181,10 +203,10 @@ namespace SHADE
} }
#ifdef DEBUG #ifdef DEBUG
SHLOG_TRACE("Successfully queried Physical Devices:"); SHLOG_INFO("Successfully queried Physical Devices:");
for (auto const& device : physicalDevices) for (auto const& device : physicalDevices)
{ {
SHLOG_TRACE(std::string_view (std::string("\t-") + GetDeviceTypeName(device.getProperties().deviceType) + device.getProperties().deviceName.operator std::string())); SHLOG_INFO(std::string_view (std::string("\t-") + GetDeviceTypeName(device.getProperties().deviceType) + device.getProperties().deviceName.operator std::string()));
} }
#endif #endif

View File

@ -26,6 +26,7 @@ namespace SHADE
static void QueryPhysicalDevices(bool printInfo) noexcept; static void QueryPhysicalDevices(bool printInfo) noexcept;
//static std::vector<std::shared_ptr<SHPhysicalDevice>> GetDevicesByType(VkPhysicalDeviceType gpuType, SHVulkanAPIVersion apiVersion = SHVulkanAPIVersion::V_1_2) noexcept; //static std::vector<std::shared_ptr<SHPhysicalDevice>> GetDevicesByType(VkPhysicalDeviceType gpuType, SHVulkanAPIVersion apiVersion = SHVulkanAPIVersion::V_1_2) noexcept;
static vk::PhysicalDevice GetBestDevice(uint32_t apiVersion = VK_API_VERSION_1_3); static vk::PhysicalDevice GetBestDevice(uint32_t apiVersion = VK_API_VERSION_1_3);
static vk::PhysicalDevice GetFirstDedicatedDevice(uint32_t apiVersion = VK_API_VERSION_1_3);
}; };
} }

View File

@ -213,6 +213,8 @@ namespace SHADE
{ {
case SH_PHYSICAL_DEVICE_TYPE::BEST: case SH_PHYSICAL_DEVICE_TYPE::BEST:
return resourceManager.Create<SHVkPhysicalDevice>(SHVkPhysicalDeviceLibrary::GetBestDevice()); return resourceManager.Create<SHVkPhysicalDevice>(SHVkPhysicalDeviceLibrary::GetBestDevice());
case SH_PHYSICAL_DEVICE_TYPE::DEDICATED:
return resourceManager.Create<SHVkPhysicalDevice>(SHVkPhysicalDeviceLibrary::GetFirstDedicatedDevice());
default: default:
return resourceManager.Create<SHVkPhysicalDevice>(SHVkPhysicalDeviceLibrary::GetBestDevice()); return resourceManager.Create<SHVkPhysicalDevice>(SHVkPhysicalDeviceLibrary::GetBestDevice());
} }

View File

@ -65,7 +65,7 @@ namespace SHADE
#endif #endif
// Get Physical Device // Get Physical Device
physicalDevice = SHVkInstance::CreatePhysicalDevice(SH_PHYSICAL_DEVICE_TYPE::BEST); physicalDevice = SHVkInstance::CreatePhysicalDevice(SH_PHYSICAL_DEVICE_TYPE::DEDICATED);
if (!physicalDevice->GetVkPhysicalDevice()) if (!physicalDevice->GetVkPhysicalDevice())
{ {
throw std::runtime_error("[Graphics System] No supported Vulkan 1.3 compatible GPU was detected!"); throw std::runtime_error("[Graphics System] No supported Vulkan 1.3 compatible GPU was detected!");