From 5e4de10f9708d11265cdda8f7c6def3d392c5f14 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Aug 2019 21:16:09 +0200 Subject: [PATCH] - fixed survey data retrieval for Vulkan. --- src/d_anonstats.cpp | 6 +++--- src/rendering/gl/system/gl_framebuffer.cpp | 5 +++++ src/rendering/gl/system/gl_framebuffer.h | 1 + src/rendering/v_video.h | 2 ++ src/rendering/vulkan/system/vk_framebuffer.cpp | 14 +++++++++++--- src/rendering/vulkan/system/vk_framebuffer.h | 2 ++ 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/d_anonstats.cpp b/src/d_anonstats.cpp index 6fb9a83691..92846b0c11 100644 --- a/src/d_anonstats.cpp +++ b/src/d_anonstats.cpp @@ -257,11 +257,10 @@ static int GetCoreInfo() } #endif -EXTERN_CVAR(Int, vid_enablevulkan) static int GetRenderInfo() { - if (vid_enablevulkan == 1) return 4; + if (screen->Backend() == 1) return 4; auto info = gl_getInfo(); if (!info.second) { @@ -273,6 +272,7 @@ static int GetRenderInfo() static int GetGLVersion() { + if (screen->Backend() == 1) return 50; auto info = gl_getInfo(); return int(info.first * 10); } @@ -302,7 +302,7 @@ void D_DoAnonStats() static char requeststring[1024]; mysnprintf(requeststring, sizeof requeststring, "GET /stats_201903.py?render=%i&cores=%i&os=%i&glversion=%i&vendor=%s&model=%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nUser-Agent: %s %s\r\n\r\n", - GetRenderInfo(), GetCoreInfo(), GetOSVersion(), GetGLVersion(), URLencode(gl.vendorstring).GetChars(), URLencode(gl.modelstring).GetChars(), sys_statshost.GetHumanString(), GAMENAME, VERSIONSTR); + GetRenderInfo(), GetCoreInfo(), GetOSVersion(), GetGLVersion(), URLencode(screen->vendorstring).GetChars(), URLencode(screen->DeviceName()).GetChars(), sys_statshost.GetHumanString(), GAMENAME, VERSIONSTR); DPrintf(DMSG_NOTIFY, "Sending %s", requeststring); #ifndef _DEBUG // Don't send info in debug builds diff --git a/src/rendering/gl/system/gl_framebuffer.cpp b/src/rendering/gl/system/gl_framebuffer.cpp index eacb6eeb1e..f28383e232 100644 --- a/src/rendering/gl/system/gl_framebuffer.cpp +++ b/src/rendering/gl/system/gl_framebuffer.cpp @@ -237,6 +237,11 @@ uint32_t OpenGLFrameBuffer::GetCaps() return (uint32_t)FlagSet; } +const char* OpenGLFrameBuffer::DeviceName() const +{ + return gl.modelstring; +} + //========================================================================== // // Swap the buffers diff --git a/src/rendering/gl/system/gl_framebuffer.h b/src/rendering/gl/system/gl_framebuffer.h index f20c796d1c..512ea037b3 100644 --- a/src/rendering/gl/system/gl_framebuffer.h +++ b/src/rendering/gl/system/gl_framebuffer.h @@ -27,6 +27,7 @@ public: void CleanForRestart() override; void UpdatePalette() override; uint32_t GetCaps() override; + const char* DeviceName() const override; void WriteSavePic(player_t *player, FileWriter *file, int width, int height) override; sector_t *RenderView(player_t *player) override; void SetTextureFilterMode() override; diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index 68d742d17f..e1472cd831 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -475,6 +475,8 @@ public: // Report a game restart void SetClearColor(int color); virtual uint32_t GetCaps(); + virtual int Backend() { return 0; } + virtual const char* DeviceName() const { return "Unknown"; } virtual void WriteSavePic(player_t *player, FileWriter *file, int width, int height); virtual sector_t *RenderView(player_t *player) { return nullptr; } diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 9bed26c842..ac79f022e1 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -131,10 +131,11 @@ void VulkanFrameBuffer::InitializeState() first = false; } + // Use the same names here as OpenGL returns. switch (device->PhysicalDevice.Properties.vendorID) { - case 0x1002: vendorstring = "AMD"; break; - case 0x10DE: vendorstring = "NVIDIA"; break; + case 0x1002: vendorstring = "ATI Technologies Inc."; break; + case 0x10DE: vendorstring = "NVIDIA Corporation"; break; case 0x8086: vendorstring = "Intel"; break; default: vendorstring = "Unknown"; break; } @@ -623,6 +624,13 @@ uint32_t VulkanFrameBuffer::GetCaps() return (uint32_t)FlagSet; } +const char* VulkanFrameBuffer::DeviceName() const +{ + const auto &props = device->PhysicalDevice.Properties; + return props.deviceName; +} + + void VulkanFrameBuffer::SetVSync(bool vsync) { // This is handled in VulkanSwapChain::AcquireImage. @@ -924,7 +932,7 @@ unsigned int VulkanFrameBuffer::GetLightBufferBlockSize() const void VulkanFrameBuffer::PrintStartupLog() { - const auto props = device->PhysicalDevice.Properties; + const auto &props = device->PhysicalDevice.Properties; FString deviceType; switch (props.deviceType) diff --git a/src/rendering/vulkan/system/vk_framebuffer.h b/src/rendering/vulkan/system/vk_framebuffer.h index 9843851bfa..a2c8e0f5e6 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.h +++ b/src/rendering/vulkan/system/vk_framebuffer.h @@ -76,6 +76,8 @@ public: void PrecacheMaterial(FMaterial *mat, int translation) override; void UpdatePalette() override; uint32_t GetCaps() override; + const char* DeviceName() const override; + int Backend() override { return 1; } void WriteSavePic(player_t *player, FileWriter *file, int width, int height) override; sector_t *RenderView(player_t *player) override; void SetTextureFilterMode() override;