From 6a9f9bd1ff3565a8c191a721ba39bdc4034fd0f6 Mon Sep 17 00:00:00 2001 From: Yang Gu Date: Fri, 25 Feb 2022 18:30:47 +0000 Subject: [PATCH] Skip the check of maxFragmentCombinedOutputResources for Mesa llvmpipe driver The Mesa Gallium llvmpipe driver is a software rasterizer that uses LLVM to do runtime code generation. It seems to put incorrect value for maxFragmentCombinedOutputResources, like we see on desktop GPUs. Some relative values are as below. vkLimits.maxFragmentCombinedOutputResources: 8 kMaxColorAttachments: 8 baseLimits.v1.maxStorageTexturesPerShaderStage: 4 baseLimits.v1.maxStorageBuffersPerShaderStage: 8 This CL will skip the check of this limit on llvmpipe, like we did for desktop GPUs. BUG=dawn:1311 Change-Id: I1698f6e26dd62b56f3819980fa2dcc986c9c5ba3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/81941 Reviewed-by: Jiawei Shao Reviewed-by: Hao Li Reviewed-by: Austin Eng Commit-Queue: Austin Eng --- src/dawn/common/GPUInfo.cpp | 3 +++ src/dawn/common/GPUInfo.h | 2 ++ src/dawn/native/vulkan/AdapterVk.cpp | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dawn/common/GPUInfo.cpp b/src/dawn/common/GPUInfo.cpp index 97068ff6ca..ddd8459703 100644 --- a/src/dawn/common/GPUInfo.cpp +++ b/src/dawn/common/GPUInfo.cpp @@ -63,6 +63,9 @@ namespace gpu_info { bool IsIntel(PCIVendorID vendorId) { return vendorId == kVendorID_Intel; } + bool IsMesa(PCIVendorID vendorId) { + return vendorId == kVendorID_Mesa; + } bool IsNvidia(PCIVendorID vendorId) { return vendorId == kVendorID_Nvidia; } diff --git a/src/dawn/common/GPUInfo.h b/src/dawn/common/GPUInfo.h index 2b30d96662..26c91036e6 100644 --- a/src/dawn/common/GPUInfo.h +++ b/src/dawn/common/GPUInfo.h @@ -27,6 +27,7 @@ namespace gpu_info { static constexpr PCIVendorID kVendorID_ARM = 0x13B5; static constexpr PCIVendorID kVendorID_ImgTec = 0x1010; static constexpr PCIVendorID kVendorID_Intel = 0x8086; + static constexpr PCIVendorID kVendorID_Mesa = 0x10005; static constexpr PCIVendorID kVendorID_Nvidia = 0x10DE; static constexpr PCIVendorID kVendorID_Qualcomm = 0x5143; static constexpr PCIVendorID kVendorID_Google = 0x1AE0; @@ -39,6 +40,7 @@ namespace gpu_info { bool IsARM(PCIVendorID vendorId); bool IsImgTec(PCIVendorID vendorId); bool IsIntel(PCIVendorID vendorId); + bool IsMesa(PCIVendorID vendorId); bool IsNvidia(PCIVendorID vendorId); bool IsQualcomm(PCIVendorID vendorId); bool IsSwiftshader(PCIVendorID vendorId, PCIDeviceID deviceId); diff --git a/src/dawn/native/vulkan/AdapterVk.cpp b/src/dawn/native/vulkan/AdapterVk.cpp index 6957a39406..4437882295 100644 --- a/src/dawn/native/vulkan/AdapterVk.cpp +++ b/src/dawn/native/vulkan/AdapterVk.cpp @@ -285,10 +285,10 @@ namespace dawn::native::vulkan { // Only check maxFragmentCombinedOutputResources on mobile GPUs. Desktop GPUs drivers seem // to put incorrect values for this limit with things like 8 or 16 when they can do bindless - // storage buffers. + // storage buffers. Mesa llvmpipe driver also puts 8 here. uint32_t vendorId = mDeviceInfo.properties.vendorID; if (!gpu_info::IsAMD(vendorId) && !gpu_info::IsIntel(vendorId) && - !gpu_info::IsNvidia(vendorId)) { + !gpu_info::IsMesa(vendorId) && !gpu_info::IsNvidia(vendorId)) { if (vkLimits.maxFragmentCombinedOutputResources < kMaxColorAttachments + baseLimits.v1.maxStorageTexturesPerShaderStage + baseLimits.v1.maxStorageBuffersPerShaderStage) {