From dc8a944382a81c92b2a2d11574b57f22207fcfdf Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 4 Jun 2019 12:42:01 +0300 Subject: [PATCH] - implemented GPU vendor string assingment in Vulkan backend --- src/rendering/gl/system/gl_framebuffer.cpp | 2 +- src/rendering/hwrenderer/dynlights/hw_lightbuffer.cpp | 2 +- src/rendering/vulkan/system/vk_framebuffer.cpp | 9 ++++++++- src/v_video.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/rendering/gl/system/gl_framebuffer.cpp b/src/rendering/gl/system/gl_framebuffer.cpp index 5c2afa931..68c3da58d 100644 --- a/src/rendering/gl/system/gl_framebuffer.cpp +++ b/src/rendering/gl/system/gl_framebuffer.cpp @@ -126,7 +126,7 @@ void OpenGLFrameBuffer::InitializeState() glslversion = gl.glslversion; uniformblockalignment = gl.uniformblockalignment; maxuniformblock = gl.maxuniformblock; - gl_vendorstring = gl.vendorstring; + vendorstring = gl.vendorstring; if (first) { diff --git a/src/rendering/hwrenderer/dynlights/hw_lightbuffer.cpp b/src/rendering/hwrenderer/dynlights/hw_lightbuffer.cpp index 2298cb9f5..1cb9b0d3c 100644 --- a/src/rendering/hwrenderer/dynlights/hw_lightbuffer.cpp +++ b/src/rendering/hwrenderer/dynlights/hw_lightbuffer.cpp @@ -44,7 +44,7 @@ FLightBuffer::FLightBuffer() // Hack alert: On Intel's GL driver SSBO's perform quite worse than UBOs. // We only want to disable using SSBOs for lights but not disable the feature entirely. // Note that using an uniform buffer here will limit the number of lights per surface so it isn't done for NVidia and AMD. - if (screen->IsVulkan() || ((screen->hwcaps & RFL_SHADER_STORAGE_BUFFER) && !strstr(screen->gl_vendorstring, "Intel"))) + if (screen->IsVulkan() || ((screen->hwcaps & RFL_SHADER_STORAGE_BUFFER) && !strstr(screen->vendorstring, "Intel"))) { mBufferType = true; mBlockAlign = 0; diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 0d0ee23a8..29a13cc89 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -128,7 +128,14 @@ void VulkanFrameBuffer::InitializeState() first = false; } - gl_vendorstring = "Vulkan"; + switch (device->PhysicalDevice.Properties.vendorID) + { + case 0x1002: vendorstring = "AMD"; break; + case 0x10DE: vendorstring = "NVIDIA"; break; + case 0x8086: vendorstring = "Intel"; break; + default: vendorstring = "Unknown"; break; + } + hwcaps = RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE; glslversion = 4.50f; uniformblockalignment = (unsigned int)device->PhysicalDevice.Properties.limits.minUniformBufferOffsetAlignment; diff --git a/src/v_video.h b/src/v_video.h index 4c0597c4f..bd5fcc4d8 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -375,7 +375,7 @@ public: int stencilValue = 0; // Global stencil test value unsigned int uniformblockalignment = 256; // Hardware dependent uniform buffer alignment. unsigned int maxuniformblock = 65536; - const char *gl_vendorstring; // On OpenGL (not Vulkan) we have to account for some issues with Intel. + const char *vendorstring; // We have to account for some issues with particular vendors. FPortalSceneState *mPortalState; // global portal state. FSkyVertexBuffer *mSkyData = nullptr; // the sky vertex buffer FFlatVertexBuffer *mVertexData = nullptr; // Global vertex data