Merge pull request #564 from jdswebb/device_name_info

Store active graphics device name and add it to the editor info display.
This commit is contained in:
James Webb
2022-09-11 11:39:44 +01:00
committed by GitHub
6 changed files with 12 additions and 0 deletions
+2
View File
@@ -109,6 +109,7 @@ void OptionsWindow::Create(EditorComponent* _editor)
bool info = editor->main->config.GetSection("options").GetBool("info");
editor->main->infoDisplay.heap_allocation_counter = info;
editor->main->infoDisplay.vram_usage = info;
editor->main->infoDisplay.device_name = info;
editor->main->infoDisplay.colorspace = info;
editor->main->infoDisplay.resolution = info;
editor->main->infoDisplay.logical_size = info;
@@ -117,6 +118,7 @@ void OptionsWindow::Create(EditorComponent* _editor)
otherinfoCheckBox.OnClick([&](wi::gui::EventArgs args) {
editor->main->infoDisplay.heap_allocation_counter = args.bValue;
editor->main->infoDisplay.vram_usage = args.bValue;
editor->main->infoDisplay.device_name = args.bValue;
editor->main->infoDisplay.colorspace = args.bValue;
editor->main->infoDisplay.resolution = args.bValue;
editor->main->infoDisplay.logical_size = args.bValue;
+4
View File
@@ -329,6 +329,10 @@ namespace wi
}
infodisplay_str += "\n";
}
if (infoDisplay.device_name)
{
infodisplay_str += "Device: " + graphicsDevice->GetDeviceName() + "\n";
}
if (infoDisplay.resolution)
{
infodisplay_str += "Resolution: " + std::to_string(canvas.GetPhysicalWidth()) + " x " + std::to_string(canvas.GetPhysicalHeight()) + " (" + std::to_string(int(canvas.GetDPI())) + " dpi)\n";
+2
View File
@@ -99,6 +99,8 @@ namespace wi
bool watermark = true;
// display framerate
bool fpsinfo = false;
// display graphics device name
bool device_name = false;
// display resolution info
bool resolution = false;
// window's size in logical (DPI scaled) units
+2
View File
@@ -56,6 +56,7 @@ namespace wi::graphics
size_t TOPLEVEL_ACCELERATION_STRUCTURE_INSTANCE_SIZE = 0;
uint32_t VARIABLE_RATE_SHADING_TILE_SIZE = 0;
uint64_t TIMESTAMP_FREQUENCY = 0;
std::string deviceName;
public:
virtual ~GraphicsDevice() = default;
@@ -121,6 +122,7 @@ namespace wi::graphics
constexpr size_t GetTopLevelAccelerationStructureInstanceSize() const { return TOPLEVEL_ACCELERATION_STRUCTURE_INSTANCE_SIZE; }
constexpr uint32_t GetVariableRateShadingTileSize() const { return VARIABLE_RATE_SHADING_TILE_SIZE; }
constexpr uint64_t GetTimestampFrequency() const { return TIMESTAMP_FREQUENCY; }
constexpr const std::string& GetDeviceName() const { return deviceName; }
// Get the shader binary format that the underlying graphics API consumes
virtual ShaderFormat GetShaderFormat() const = 0;
+1
View File
@@ -2330,6 +2330,7 @@ using namespace dx12_internal;
{
if (SUCCEEDED(D3D12CreateDevice(dxgiAdapter.Get(), featurelevel, IID_PPV_ARGS(&device))))
{
wi::helper::StringConvert(adapterDesc.Description, deviceName);
break;
}
}
+1
View File
@@ -2568,6 +2568,7 @@ using namespace vulkan_internal;
physicalDevice = dev;
if (discrete)
{
deviceName = properties2.properties.deviceName;
break; // if this is discrete GPU, look no further (prioritize discrete GPU)
}
}