Skip to content

Commit

Permalink
- fixed survey data retrieval for Vulkan.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Aug 11, 2019
1 parent 6cc9434 commit 5e4de10
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/d_anonstats.cpp
Expand Up @@ -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)
{
Expand All @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/rendering/gl/system/gl_framebuffer.cpp
Expand Up @@ -237,6 +237,11 @@ uint32_t OpenGLFrameBuffer::GetCaps()
return (uint32_t)FlagSet;
}

const char* OpenGLFrameBuffer::DeviceName() const
{
return gl.modelstring;
}

//==========================================================================
//
// Swap the buffers
Expand Down
1 change: 1 addition & 0 deletions src/rendering/gl/system/gl_framebuffer.h
Expand Up @@ -27,6 +27,7 @@ class OpenGLFrameBuffer : public SystemGLFrameBuffer
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;
Expand Down
2 changes: 2 additions & 0 deletions src/rendering/v_video.h
Expand Up @@ -475,6 +475,8 @@ class DFrameBuffer
// 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; }

Expand Down
14 changes: 11 additions & 3 deletions src/rendering/vulkan/system/vk_framebuffer.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/rendering/vulkan/system/vk_framebuffer.h
Expand Up @@ -76,6 +76,8 @@ class VulkanFrameBuffer : public SystemBaseFrameBuffer
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;
Expand Down

0 comments on commit 5e4de10

Please sign in to comment.