Remove deprecated DawnNative Adapter getters.
Bug: dawn:824 Change-Id: I4e73598ccd8eb5ce85c8a0ed86629daef4b575c6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75584 Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
98b6b73ac0
commit
f07477a1ce
|
@ -33,14 +33,12 @@ namespace dawn_native {
|
||||||
InitializeSupportedFeaturesImpl(),
|
InitializeSupportedFeaturesImpl(),
|
||||||
"gathering supported features for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
|
"gathering supported features for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
|
||||||
"backend=%s type=%s)",
|
"backend=%s type=%s)",
|
||||||
mPCIInfo.name, mDriverDescription, mPCIInfo.vendorId, mPCIInfo.deviceId, mBackend,
|
mName, mDriverDescription, mVendorId, mDeviceId, mBackend, mAdapterType);
|
||||||
mAdapterType);
|
|
||||||
DAWN_TRY_CONTEXT(
|
DAWN_TRY_CONTEXT(
|
||||||
InitializeSupportedLimitsImpl(&mLimits),
|
InitializeSupportedLimitsImpl(&mLimits),
|
||||||
"gathering supported limits for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
|
"gathering supported limits for \"%s\" - \"%s\" (vendorId=%#06x deviceId=%#06x "
|
||||||
"backend=%s type=%s)",
|
"backend=%s type=%s)",
|
||||||
mPCIInfo.name, mDriverDescription, mPCIInfo.vendorId, mPCIInfo.deviceId, mBackend,
|
mName, mDriverDescription, mVendorId, mDeviceId, mBackend, mAdapterType);
|
||||||
mAdapterType);
|
|
||||||
|
|
||||||
// Enforce internal Dawn constants.
|
// Enforce internal Dawn constants.
|
||||||
mLimits.v1.maxVertexBufferArrayStride =
|
mLimits.v1.maxVertexBufferArrayStride =
|
||||||
|
@ -77,9 +75,9 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdapterBase::APIGetProperties(AdapterProperties* properties) const {
|
void AdapterBase::APIGetProperties(AdapterProperties* properties) const {
|
||||||
properties->vendorID = mPCIInfo.vendorId;
|
properties->vendorID = mVendorId;
|
||||||
properties->deviceID = mPCIInfo.deviceId;
|
properties->deviceID = mDeviceId;
|
||||||
properties->name = mPCIInfo.name.c_str();
|
properties->name = mName.c_str();
|
||||||
properties->driverDescription = mDriverDescription.c_str();
|
properties->driverDescription = mDriverDescription.c_str();
|
||||||
properties->adapterType = mAdapterType;
|
properties->adapterType = mAdapterType;
|
||||||
properties->backendType = mBackend;
|
properties->backendType = mBackend;
|
||||||
|
@ -125,22 +123,18 @@ namespace dawn_native {
|
||||||
callback(status, ToAPI(device.Detach()), nullptr, userdata);
|
callback(status, ToAPI(device.Detach()), nullptr, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t AdapterBase::GetVendorId() const {
|
||||||
|
return mVendorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AdapterBase::GetDeviceId() const {
|
||||||
|
return mDeviceId;
|
||||||
|
}
|
||||||
|
|
||||||
wgpu::BackendType AdapterBase::GetBackendType() const {
|
wgpu::BackendType AdapterBase::GetBackendType() const {
|
||||||
return mBackend;
|
return mBackend;
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::AdapterType AdapterBase::GetAdapterType() const {
|
|
||||||
return mAdapterType;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& AdapterBase::GetDriverDescription() const {
|
|
||||||
return mDriverDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
const PCIInfo& AdapterBase::GetPCIInfo() const {
|
|
||||||
return mPCIInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
InstanceBase* AdapterBase::GetInstance() const {
|
InstanceBase* AdapterBase::GetInstance() const {
|
||||||
return mInstance;
|
return mInstance;
|
||||||
}
|
}
|
||||||
|
@ -161,8 +155,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
WGPUDeviceProperties AdapterBase::GetAdapterProperties() const {
|
WGPUDeviceProperties AdapterBase::GetAdapterProperties() const {
|
||||||
WGPUDeviceProperties adapterProperties = {};
|
WGPUDeviceProperties adapterProperties = {};
|
||||||
adapterProperties.deviceID = mPCIInfo.deviceId;
|
adapterProperties.deviceID = mDeviceId;
|
||||||
adapterProperties.vendorID = mPCIInfo.vendorId;
|
adapterProperties.vendorID = mVendorId;
|
||||||
adapterProperties.adapterType = static_cast<WGPUAdapterType>(mAdapterType);
|
adapterProperties.adapterType = static_cast<WGPUAdapterType>(mAdapterType);
|
||||||
|
|
||||||
mSupportedFeatures.InitializeDeviceProperties(&adapterProperties);
|
mSupportedFeatures.InitializeDeviceProperties(&adapterProperties);
|
||||||
|
|
|
@ -47,10 +47,9 @@ namespace dawn_native {
|
||||||
void* userdata);
|
void* userdata);
|
||||||
DeviceBase* APICreateDevice(const DeviceDescriptor* descriptor = nullptr);
|
DeviceBase* APICreateDevice(const DeviceDescriptor* descriptor = nullptr);
|
||||||
|
|
||||||
|
uint32_t GetVendorId() const;
|
||||||
|
uint32_t GetDeviceId() const;
|
||||||
wgpu::BackendType GetBackendType() const;
|
wgpu::BackendType GetBackendType() const;
|
||||||
wgpu::AdapterType GetAdapterType() const;
|
|
||||||
const std::string& GetDriverDescription() const;
|
|
||||||
const PCIInfo& GetPCIInfo() const;
|
|
||||||
InstanceBase* GetInstance() const;
|
InstanceBase* GetInstance() const;
|
||||||
|
|
||||||
void ResetInternalDeviceForTesting();
|
void ResetInternalDeviceForTesting();
|
||||||
|
@ -67,7 +66,9 @@ namespace dawn_native {
|
||||||
virtual bool SupportsExternalImages() const = 0;
|
virtual bool SupportsExternalImages() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PCIInfo mPCIInfo = {};
|
uint32_t mVendorId = 0xFFFFFFFF;
|
||||||
|
uint32_t mDeviceId = 0xFFFFFFFF;
|
||||||
|
std::string mName;
|
||||||
wgpu::AdapterType mAdapterType = wgpu::AdapterType::Unknown;
|
wgpu::AdapterType mAdapterType = wgpu::AdapterType::Unknown;
|
||||||
std::string mDriverDescription;
|
std::string mDriverDescription;
|
||||||
FeaturesSet mSupportedFeatures;
|
FeaturesSet mSupportedFeatures;
|
||||||
|
|
|
@ -86,56 +86,11 @@ namespace dawn_native {
|
||||||
Adapter& Adapter::operator=(const Adapter& other) = default;
|
Adapter& Adapter::operator=(const Adapter& other) = default;
|
||||||
|
|
||||||
void Adapter::GetProperties(wgpu::AdapterProperties* properties) const {
|
void Adapter::GetProperties(wgpu::AdapterProperties* properties) const {
|
||||||
properties->backendType = mImpl->GetBackendType();
|
GetProperties(reinterpret_cast<WGPUAdapterProperties*>(properties));
|
||||||
properties->adapterType = mImpl->GetAdapterType();
|
|
||||||
properties->driverDescription = mImpl->GetDriverDescription().c_str();
|
|
||||||
properties->deviceID = mImpl->GetPCIInfo().deviceId;
|
|
||||||
properties->vendorID = mImpl->GetPCIInfo().vendorId;
|
|
||||||
properties->name = mImpl->GetPCIInfo().name.c_str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adapter::GetProperties(WGPUAdapterProperties* properties) const {
|
void Adapter::GetProperties(WGPUAdapterProperties* properties) const {
|
||||||
GetProperties(reinterpret_cast<wgpu::AdapterProperties*>(properties));
|
mImpl->APIGetProperties(FromAPI(properties));
|
||||||
}
|
|
||||||
|
|
||||||
BackendType Adapter::GetBackendType() const {
|
|
||||||
switch (mImpl->GetBackendType()) {
|
|
||||||
case wgpu::BackendType::D3D12:
|
|
||||||
return BackendType::D3D12;
|
|
||||||
case wgpu::BackendType::Metal:
|
|
||||||
return BackendType::Metal;
|
|
||||||
case wgpu::BackendType::Null:
|
|
||||||
return BackendType::Null;
|
|
||||||
case wgpu::BackendType::OpenGL:
|
|
||||||
return BackendType::OpenGL;
|
|
||||||
case wgpu::BackendType::Vulkan:
|
|
||||||
return BackendType::Vulkan;
|
|
||||||
case wgpu::BackendType::OpenGLES:
|
|
||||||
return BackendType::OpenGLES;
|
|
||||||
|
|
||||||
case wgpu::BackendType::D3D11:
|
|
||||||
case wgpu::BackendType::WebGPU:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceType Adapter::GetDeviceType() const {
|
|
||||||
switch (mImpl->GetAdapterType()) {
|
|
||||||
case wgpu::AdapterType::DiscreteGPU:
|
|
||||||
return DeviceType::DiscreteGPU;
|
|
||||||
case wgpu::AdapterType::IntegratedGPU:
|
|
||||||
return DeviceType::IntegratedGPU;
|
|
||||||
case wgpu::AdapterType::CPU:
|
|
||||||
return DeviceType::CPU;
|
|
||||||
case wgpu::AdapterType::Unknown:
|
|
||||||
return DeviceType::Unknown;
|
|
||||||
}
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
const PCIInfo& Adapter::GetPCIInfo() const {
|
|
||||||
return mImpl->GetPCIInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WGPUAdapter Adapter::Get() const {
|
WGPUAdapter Adapter::Get() const {
|
||||||
|
|
|
@ -76,9 +76,9 @@ namespace dawn_native::d3d12 {
|
||||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||||
mHardwareAdapter->GetDesc1(&adapterDesc);
|
mHardwareAdapter->GetDesc1(&adapterDesc);
|
||||||
|
|
||||||
mPCIInfo.deviceId = adapterDesc.DeviceId;
|
mDeviceId = adapterDesc.DeviceId;
|
||||||
mPCIInfo.vendorId = adapterDesc.VendorId;
|
mVendorId = adapterDesc.VendorId;
|
||||||
mPCIInfo.name = WCharToUTF8(adapterDesc.Description);
|
mName = WCharToUTF8(adapterDesc.Description);
|
||||||
|
|
||||||
DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this));
|
DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this));
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace dawn_native::d3d12 {
|
||||||
// with RENDER_PASS_TIER_1 available, so fall back to a software emulated render
|
// with RENDER_PASS_TIER_1 available, so fall back to a software emulated render
|
||||||
// pass on these platforms.
|
// pass on these platforms.
|
||||||
if (featureOptions5.RenderPassesTier < D3D12_RENDER_PASS_TIER_1 ||
|
if (featureOptions5.RenderPassesTier < D3D12_RENDER_PASS_TIER_1 ||
|
||||||
!gpu_info::IsIntel(adapter.GetPCIInfo().vendorId)) {
|
!gpu_info::IsIntel(adapter.GetVendorId())) {
|
||||||
info.supportsRenderPass = true;
|
info.supportsRenderPass = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -584,15 +584,16 @@ namespace dawn_native::d3d12 {
|
||||||
// By default use the maximum shader-visible heap size allowed.
|
// By default use the maximum shader-visible heap size allowed.
|
||||||
SetToggle(Toggle::UseD3D12SmallShaderVisibleHeapForTesting, false);
|
SetToggle(Toggle::UseD3D12SmallShaderVisibleHeapForTesting, false);
|
||||||
|
|
||||||
PCIInfo pciInfo = GetAdapter()->GetPCIInfo();
|
uint32_t deviceId = GetAdapter()->GetDeviceId();
|
||||||
|
uint32_t vendorId = GetAdapter()->GetVendorId();
|
||||||
|
|
||||||
// Currently this workaround is only needed on Intel Gen9 and Gen9.5 GPUs.
|
// Currently this workaround is only needed on Intel Gen9 and Gen9.5 GPUs.
|
||||||
// See http://crbug.com/1161355 for more information.
|
// See http://crbug.com/1161355 for more information.
|
||||||
if (gpu_info::IsIntel(pciInfo.vendorId) &&
|
if (gpu_info::IsIntel(vendorId) &&
|
||||||
(gpu_info::IsSkylake(pciInfo.deviceId) || gpu_info::IsKabylake(pciInfo.deviceId) ||
|
(gpu_info::IsSkylake(deviceId) || gpu_info::IsKabylake(deviceId) ||
|
||||||
gpu_info::IsCoffeelake(pciInfo.deviceId))) {
|
gpu_info::IsCoffeelake(deviceId))) {
|
||||||
constexpr gpu_info::D3DDriverVersion kFirstDriverVersionWithFix = {30, 0, 100, 9864};
|
constexpr gpu_info::D3DDriverVersion kFirstDriverVersionWithFix = {30, 0, 100, 9864};
|
||||||
if (gpu_info::CompareD3DDriverVersion(pciInfo.vendorId,
|
if (gpu_info::CompareD3DDriverVersion(vendorId,
|
||||||
ToBackend(GetAdapter())->GetDriverVersion(),
|
ToBackend(GetAdapter())->GetDriverVersion(),
|
||||||
kFirstDriverVersionWithFix) < 0) {
|
kFirstDriverVersionWithFix) < 0) {
|
||||||
SetToggle(
|
SetToggle(
|
||||||
|
|
|
@ -243,12 +243,12 @@ namespace dawn_native::metal {
|
||||||
public:
|
public:
|
||||||
Adapter(InstanceBase* instance, id<MTLDevice> device)
|
Adapter(InstanceBase* instance, id<MTLDevice> device)
|
||||||
: AdapterBase(instance, wgpu::BackendType::Metal), mDevice(device) {
|
: AdapterBase(instance, wgpu::BackendType::Metal), mDevice(device) {
|
||||||
mPCIInfo.name = std::string([[*mDevice name] UTF8String]);
|
mName = std::string([[*mDevice name] UTF8String]);
|
||||||
|
|
||||||
PCIIDs ids;
|
PCIIDs ids;
|
||||||
if (!instance->ConsumedError(GetDevicePCIInfo(device, &ids))) {
|
if (!instance->ConsumedError(GetDevicePCIInfo(device, &ids))) {
|
||||||
mPCIInfo.vendorId = ids.vendorId;
|
mVendorId = ids.vendorId;
|
||||||
mPCIInfo.deviceId = ids.deviceId;
|
mDeviceId = ids.deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DAWN_PLATFORM_IOS)
|
#if defined(DAWN_PLATFORM_IOS)
|
||||||
|
@ -311,7 +311,7 @@ namespace dawn_native::metal {
|
||||||
// fails to call without any copy commands on MTLBlitCommandEncoder. This issue
|
// fails to call without any copy commands on MTLBlitCommandEncoder. This issue
|
||||||
// has been fixed on macOS 11.0. See crbug.com/dawn/545
|
// has been fixed on macOS 11.0. See crbug.com/dawn/545
|
||||||
enableTimestampQuery &=
|
enableTimestampQuery &=
|
||||||
!(gpu_info::IsAMD(GetPCIInfo().vendorId) && IsMacOSVersionAtLeast(11));
|
!(gpu_info::IsAMD(mVendorId) && IsMacOSVersionAtLeast(11));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (enableTimestampQuery) {
|
if (enableTimestampQuery) {
|
||||||
|
|
|
@ -137,8 +137,7 @@ namespace dawn_native::metal {
|
||||||
if (IsFeatureEnabled(Feature::TimestampQuery)) {
|
if (IsFeatureEnabled(Feature::TimestampQuery)) {
|
||||||
// Make a best guess of timestamp period based on device vendor info, and converge it to
|
// Make a best guess of timestamp period based on device vendor info, and converge it to
|
||||||
// an accurate value by the following calculations.
|
// an accurate value by the following calculations.
|
||||||
mTimestampPeriod =
|
mTimestampPeriod = gpu_info::IsIntel(GetAdapter()->GetVendorId()) ? 83.333f : 1.0f;
|
||||||
gpu_info::IsIntel(GetAdapter()->GetPCIInfo().vendorId) ? 83.333f : 1.0f;
|
|
||||||
|
|
||||||
// Initialize kalman filter parameters
|
// Initialize kalman filter parameters
|
||||||
mKalmanInfo = std::make_unique<KalmanInfo>();
|
mKalmanInfo = std::make_unique<KalmanInfo>();
|
||||||
|
@ -199,27 +198,28 @@ namespace dawn_native::metal {
|
||||||
// TODO(crbug.com/dawn/846): tighten this workaround when the driver bug is fixed.
|
// TODO(crbug.com/dawn/846): tighten this workaround when the driver bug is fixed.
|
||||||
SetToggle(Toggle::AlwaysResolveIntoZeroLevelAndLayer, true);
|
SetToggle(Toggle::AlwaysResolveIntoZeroLevelAndLayer, true);
|
||||||
|
|
||||||
const PCIInfo& pciInfo = GetAdapter()->GetPCIInfo();
|
uint32_t deviceId = GetAdapter()->GetDeviceId();
|
||||||
|
uint32_t vendorId = GetAdapter()->GetVendorId();
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/847): Use MTLStorageModeShared instead of MTLStorageModePrivate when
|
// TODO(crbug.com/dawn/847): Use MTLStorageModeShared instead of MTLStorageModePrivate when
|
||||||
// creating MTLCounterSampleBuffer in QuerySet on Intel platforms, otherwise it fails to
|
// creating MTLCounterSampleBuffer in QuerySet on Intel platforms, otherwise it fails to
|
||||||
// create the buffer. Change to use MTLStorageModePrivate when the bug is fixed.
|
// create the buffer. Change to use MTLStorageModePrivate when the bug is fixed.
|
||||||
if (@available(macOS 10.15, iOS 14.0, *)) {
|
if (@available(macOS 10.15, iOS 14.0, *)) {
|
||||||
bool useSharedMode = gpu_info::IsIntel(pciInfo.vendorId);
|
bool useSharedMode = gpu_info::IsIntel(vendorId);
|
||||||
SetToggle(Toggle::MetalUseSharedModeForCounterSampleBuffer, useSharedMode);
|
SetToggle(Toggle::MetalUseSharedModeForCounterSampleBuffer, useSharedMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/1071): r8unorm and rg8unorm textures with multiple mip levels don't
|
// TODO(crbug.com/dawn/1071): r8unorm and rg8unorm textures with multiple mip levels don't
|
||||||
// clear properly on Intel Macs.
|
// clear properly on Intel Macs.
|
||||||
if (gpu_info::IsIntel(pciInfo.vendorId)) {
|
if (gpu_info::IsIntel(vendorId)) {
|
||||||
SetToggle(Toggle::DisableR8RG8Mipmaps, true);
|
SetToggle(Toggle::DisableR8RG8Mipmaps, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On some Intel GPU vertex only render pipeline get wrong depth result if no fragment
|
// On some Intel GPU vertex only render pipeline get wrong depth result if no fragment
|
||||||
// shader provided. Create a dummy fragment shader module to work around this issue.
|
// shader provided. Create a dummy fragment shader module to work around this issue.
|
||||||
if (gpu_info::IsIntel(this->GetAdapter()->GetPCIInfo().vendorId)) {
|
if (gpu_info::IsIntel(vendorId)) {
|
||||||
bool useDummyFragmentShader = true;
|
bool useDummyFragmentShader = true;
|
||||||
if (gpu_info::IsSkylake(this->GetAdapter()->GetPCIInfo().deviceId)) {
|
if (gpu_info::IsSkylake(deviceId)) {
|
||||||
useDummyFragmentShader = false;
|
useDummyFragmentShader = false;
|
||||||
}
|
}
|
||||||
SetToggle(Toggle::UseDummyFragmentInVertexOnlyPipeline, useDummyFragmentShader);
|
SetToggle(Toggle::UseDummyFragmentInVertexOnlyPipeline, useDummyFragmentShader);
|
||||||
|
|
|
@ -25,7 +25,9 @@ namespace dawn_native::null {
|
||||||
// Implementation of pre-Device objects: the null adapter, null backend connection and Connect()
|
// Implementation of pre-Device objects: the null adapter, null backend connection and Connect()
|
||||||
|
|
||||||
Adapter::Adapter(InstanceBase* instance) : AdapterBase(instance, wgpu::BackendType::Null) {
|
Adapter::Adapter(InstanceBase* instance) : AdapterBase(instance, wgpu::BackendType::Null) {
|
||||||
mPCIInfo.name = "Null backend";
|
mVendorId = 0;
|
||||||
|
mDeviceId = 0;
|
||||||
|
mName = "Null backend";
|
||||||
mAdapterType = wgpu::AdapterType::CPU;
|
mAdapterType = wgpu::AdapterType::CPU;
|
||||||
MaybeError err = Initialize();
|
MaybeError err = Initialize();
|
||||||
ASSERT(err.IsSuccess());
|
ASSERT(err.IsSuccess());
|
||||||
|
|
|
@ -186,16 +186,16 @@ namespace dawn_native::opengl {
|
||||||
}
|
}
|
||||||
mFunctions.Enable(GL_SAMPLE_MASK);
|
mFunctions.Enable(GL_SAMPLE_MASK);
|
||||||
|
|
||||||
mPCIInfo.name = reinterpret_cast<const char*>(mFunctions.GetString(GL_RENDERER));
|
mName = reinterpret_cast<const char*>(mFunctions.GetString(GL_RENDERER));
|
||||||
|
|
||||||
// Workaroud to find vendor id from vendor name
|
// Workaroud to find vendor id from vendor name
|
||||||
const char* vendor = reinterpret_cast<const char*>(mFunctions.GetString(GL_VENDOR));
|
const char* vendor = reinterpret_cast<const char*>(mFunctions.GetString(GL_VENDOR));
|
||||||
mPCIInfo.vendorId = GetVendorIdFromVendors(vendor);
|
mVendorId = GetVendorIdFromVendors(vendor);
|
||||||
|
|
||||||
mDriverDescription = std::string("OpenGL version ") +
|
mDriverDescription = std::string("OpenGL version ") +
|
||||||
reinterpret_cast<const char*>(mFunctions.GetString(GL_VERSION));
|
reinterpret_cast<const char*>(mFunctions.GetString(GL_VERSION));
|
||||||
|
|
||||||
if (mPCIInfo.name.find("SwiftShader") != std::string::npos) {
|
if (mName.find("SwiftShader") != std::string::npos) {
|
||||||
mAdapterType = wgpu::AdapterType::CPU;
|
mAdapterType = wgpu::AdapterType::CPU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,9 @@ namespace dawn_native::vulkan {
|
||||||
"Vulkan driver version: " + std::to_string(mDeviceInfo.properties.driverVersion);
|
"Vulkan driver version: " + std::to_string(mDeviceInfo.properties.driverVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPCIInfo.deviceId = mDeviceInfo.properties.deviceID;
|
mDeviceId = mDeviceInfo.properties.deviceID;
|
||||||
mPCIInfo.vendorId = mDeviceInfo.properties.vendorID;
|
mVendorId = mDeviceInfo.properties.vendorID;
|
||||||
mPCIInfo.name = mDeviceInfo.properties.deviceName;
|
mName = mDeviceInfo.properties.deviceName;
|
||||||
|
|
||||||
switch (mDeviceInfo.properties.deviceType) {
|
switch (mDeviceInfo.properties.deviceType) {
|
||||||
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
|
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
|
||||||
|
|
|
@ -33,31 +33,6 @@ namespace wgpu {
|
||||||
|
|
||||||
namespace dawn_native {
|
namespace dawn_native {
|
||||||
|
|
||||||
// DEPRECATED: use WGPUAdapterProperties instead.
|
|
||||||
struct PCIInfo {
|
|
||||||
uint32_t deviceId = 0;
|
|
||||||
uint32_t vendorId = 0;
|
|
||||||
std::string name;
|
|
||||||
};
|
|
||||||
|
|
||||||
// DEPRECATED: use WGPUBackendType instead.
|
|
||||||
enum class BackendType {
|
|
||||||
D3D12,
|
|
||||||
Metal,
|
|
||||||
Null,
|
|
||||||
OpenGL,
|
|
||||||
OpenGLES,
|
|
||||||
Vulkan,
|
|
||||||
};
|
|
||||||
|
|
||||||
// DEPRECATED: use WGPUAdapterType instead.
|
|
||||||
enum class DeviceType {
|
|
||||||
DiscreteGPU,
|
|
||||||
IntegratedGPU,
|
|
||||||
CPU,
|
|
||||||
Unknown,
|
|
||||||
};
|
|
||||||
|
|
||||||
class InstanceBase;
|
class InstanceBase;
|
||||||
class AdapterBase;
|
class AdapterBase;
|
||||||
|
|
||||||
|
@ -100,11 +75,6 @@ namespace dawn_native {
|
||||||
Adapter(const Adapter& other);
|
Adapter(const Adapter& other);
|
||||||
Adapter& operator=(const Adapter& other);
|
Adapter& operator=(const Adapter& other);
|
||||||
|
|
||||||
// DEPRECATED: use GetProperties instead.
|
|
||||||
BackendType GetBackendType() const;
|
|
||||||
DeviceType GetDeviceType() const;
|
|
||||||
const PCIInfo& GetPCIInfo() const;
|
|
||||||
|
|
||||||
// Essentially webgpu.h's wgpuAdapterGetProperties while we don't have WGPUAdapter in
|
// Essentially webgpu.h's wgpuAdapterGetProperties while we don't have WGPUAdapter in
|
||||||
// dawn.json
|
// dawn.json
|
||||||
void GetProperties(wgpu::AdapterProperties* properties) const;
|
void GetProperties(wgpu::AdapterProperties* properties) const;
|
||||||
|
|
|
@ -323,11 +323,11 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) {
|
||||||
std::string type;
|
std::string type;
|
||||||
while (std::getline(ss, type, ',')) {
|
while (std::getline(ss, type, ',')) {
|
||||||
if (strcmp(type.c_str(), "discrete") == 0) {
|
if (strcmp(type.c_str(), "discrete") == 0) {
|
||||||
mDevicePreferences.push_back(dawn_native::DeviceType::DiscreteGPU);
|
mDevicePreferences.push_back(wgpu::AdapterType::DiscreteGPU);
|
||||||
} else if (strcmp(type.c_str(), "integrated") == 0) {
|
} else if (strcmp(type.c_str(), "integrated") == 0) {
|
||||||
mDevicePreferences.push_back(dawn_native::DeviceType::IntegratedGPU);
|
mDevicePreferences.push_back(wgpu::AdapterType::IntegratedGPU);
|
||||||
} else if (strcmp(type.c_str(), "cpu") == 0) {
|
} else if (strcmp(type.c_str(), "cpu") == 0) {
|
||||||
mDevicePreferences.push_back(dawn_native::DeviceType::CPU);
|
mDevicePreferences.push_back(wgpu::AdapterType::CPU);
|
||||||
} else {
|
} else {
|
||||||
dawn::ErrorLog() << "Invalid device type preference: " << type;
|
dawn::ErrorLog() << "Invalid device type preference: " << type;
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -474,14 +474,14 @@ GLFWwindow* DawnTestEnvironment::GetOpenGLESWindow() const {
|
||||||
|
|
||||||
void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::Instance* instance) {
|
void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::Instance* instance) {
|
||||||
// Get the first available preferred device type.
|
// Get the first available preferred device type.
|
||||||
dawn_native::DeviceType preferredDeviceType = static_cast<dawn_native::DeviceType>(-1);
|
wgpu::AdapterType preferredDeviceType = static_cast<wgpu::AdapterType>(-1);
|
||||||
bool hasDevicePreference = false;
|
bool hasDevicePreference = false;
|
||||||
for (dawn_native::DeviceType devicePreference : mDevicePreferences) {
|
for (wgpu::AdapterType devicePreference : mDevicePreferences) {
|
||||||
for (const dawn_native::Adapter& adapter : instance->GetAdapters()) {
|
for (const dawn_native::Adapter& adapter : instance->GetAdapters()) {
|
||||||
wgpu::AdapterProperties properties;
|
wgpu::AdapterProperties properties;
|
||||||
adapter.GetProperties(&properties);
|
adapter.GetProperties(&properties);
|
||||||
|
|
||||||
if (adapter.GetDeviceType() == devicePreference) {
|
if (properties.adapterType == devicePreference) {
|
||||||
preferredDeviceType = devicePreference;
|
preferredDeviceType = devicePreference;
|
||||||
hasDevicePreference = true;
|
hasDevicePreference = true;
|
||||||
break;
|
break;
|
||||||
|
@ -517,12 +517,12 @@ void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::In
|
||||||
selected &=
|
selected &=
|
||||||
// The device type doesn't match the first available preferred type for that
|
// The device type doesn't match the first available preferred type for that
|
||||||
// backend, if present.
|
// backend, if present.
|
||||||
(adapter.GetDeviceType() == preferredDeviceType) ||
|
(properties.adapterType == preferredDeviceType) ||
|
||||||
// Always select Unknown OpenGL adapters if we don't want a CPU adapter.
|
// Always select Unknown OpenGL adapters if we don't want a CPU adapter.
|
||||||
// OpenGL will usually be unknown because we can't query the device type.
|
// OpenGL will usually be unknown because we can't query the device type.
|
||||||
// If we ever have Swiftshader GL (unlikely), we could set the DeviceType properly.
|
// If we ever have Swiftshader GL (unlikely), we could set the DeviceType properly.
|
||||||
(preferredDeviceType != dawn_native::DeviceType::CPU &&
|
(preferredDeviceType != wgpu::AdapterType::CPU &&
|
||||||
adapter.GetDeviceType() == dawn_native::DeviceType::Unknown &&
|
properties.adapterType == wgpu::AdapterType::Unknown &&
|
||||||
(properties.backendType == wgpu::BackendType::OpenGL ||
|
(properties.backendType == wgpu::BackendType::OpenGL ||
|
||||||
properties.backendType == wgpu::BackendType::OpenGLES)) ||
|
properties.backendType == wgpu::BackendType::OpenGLES)) ||
|
||||||
// Always select the Null backend. There are few tests on this backend, and they run
|
// Always select the Null backend. There are few tests on this backend, and they run
|
||||||
|
|
|
@ -261,7 +261,7 @@ class DawnTestEnvironment : public testing::Environment {
|
||||||
|
|
||||||
ToggleParser mToggleParser;
|
ToggleParser mToggleParser;
|
||||||
|
|
||||||
std::vector<dawn_native::DeviceType> mDevicePreferences;
|
std::vector<wgpu::AdapterType> mDevicePreferences;
|
||||||
std::vector<TestAdapterProperties> mAdapterProperties;
|
std::vector<TestAdapterProperties> mAdapterProperties;
|
||||||
|
|
||||||
std::unique_ptr<utils::PlatformDebugLogger> mPlatformDebugLogger;
|
std::unique_ptr<utils::PlatformDebugLogger> mPlatformDebugLogger;
|
||||||
|
|
Loading…
Reference in New Issue