Skip to content

Commit

Permalink
Extend GPU context with data for Unreal Engine crash reports
Browse files Browse the repository at this point in the history
1. This commit replaces primary GPU with the one that is actually used for rendering. These two may be different for laptops. Fixes getsentry/sentry#27498
2. This commit adds other available data:
  * Numeric DeviceID
  * Used feature level (SM5, SM6, etc)
  * GPU vendor name
  * GPU driver version
  * RHI type that is used (Metal, Vulkan, DX11, etc)

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
  • Loading branch information
slonopotamus committed Feb 20, 2024
1 parent ef9127a commit eddd7c8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,10 +2,15 @@

## Unreleased

**Features**:

- Extend GPU context with data for Unreal Engine crash reports ([#3144](https://github.com/getsentry/relay/pull/3144))

**Bug Fixes**:

- Forward metrics in proxy mode. ([#3106](https://github.com/getsentry/relay/pull/3106))
- Do not PII-scrub code locations by default. ([#3116](https://github.com/getsentry/relay/pull/3116))
- Use actually used GPU instead of the primary one for Unreal Engine crash reports ([#3144](https://github.com/getsentry/relay/pull/3144))

**Internal**:

Expand Down
52 changes: 51 additions & 1 deletion relay-server/src/utils/unreal.rs
Expand Up @@ -212,11 +212,40 @@ fn merge_unreal_context(event: &mut Event, context: Unreal4Context) {
os_context.name = Annotated::new(os_major);
}

if let Some(gpu_brand) = runtime_props.misc_primary_gpu_brand.take() {
// See https://github.com/EpicGames/UnrealEngine/blob/5.3.2-release/Engine/Source/Runtime/RHI/Private/DynamicRHI.cpp#L368-L376
if let Some(adapter_name) = context.engine_data.get("RHI.AdapterName") {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.name = Annotated::new(adapter_name.into());
} else if let Some(gpu_brand) = runtime_props.misc_primary_gpu_brand {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.name = Annotated::new(gpu_brand);
}

if let Some(device_id) = context.engine_data.get("RHI.DeviceId") {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.id = Annotated::new(Value::String(device_id.into()));
}

if let Some(feature_level) = context.engine_data.get("RHI.FeatureLevel") {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.graphics_shader_level = Annotated::new(feature_level.into());
}

if let Some(vendor_name) = context.engine_data.get("RHI.GPUVendor") {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.vendor_name = Annotated::new(vendor_name.into());
}

if let Some(driver_version) = context.engine_data.get("RHI.UserDriverVersion") {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.version = Annotated::new(driver_version.into());
}

if let Some(rhi_name) = context.engine_data.get("RHI.RHIName") {
let gpu_context = contexts.get_or_default::<GpuContext>();
gpu_context.api_type = Annotated::new(rhi_name.into());
}

if runtime_props.is_assert.unwrap_or(false) {
event.level = Annotated::new(Level::Error)
}
Expand Down Expand Up @@ -338,6 +367,27 @@ mod tests {
<Modules>\\Mac\Home\Desktop\WindowsNoEditor\YetAnother\Binaries\Win64\YetAnother.exe
\\Mac\Home\Desktop\WindowsNoEditor\Engine\Binaries\ThirdParty\PhysX3\Win64\VS2015\PxFoundationPROFILE_x64.dll</Modules>
</RuntimeProperties>
<EngineData>
<MatchingDPStatus>WindowsNo errors</MatchingDPStatus>
<RHI.IntegratedGPU>false</RHI.IntegratedGPU>
<RHI.DriverDenylisted>false</RHI.DriverDenylisted>
<RHI.D3DDebug>false</RHI.D3DDebug>
<RHI.Breadcrumbs>true</RHI.Breadcrumbs>
<RHI.DRED>true</RHI.DRED>
<RHI.DREDMarkersOnly>false</RHI.DREDMarkersOnly>
<RHI.DREDContext>true</RHI.DREDContext>
<RHI.Aftermath>true</RHI.Aftermath>
<RHI.RHIName>D3D12</RHI.RHIName>
<RHI.AdapterName>NVIDIA GeForce RTX 4060 Laptop GPU</RHI.AdapterName>
<RHI.UserDriverVersion>551.52</RHI.UserDriverVersion>
<RHI.InternalDriverVersion>31.0.15.5152</RHI.InternalDriverVersion>
<RHI.DriverDate>2-7-2024</RHI.DriverDate>
<RHI.FeatureLevel>SM5</RHI.FeatureLevel>
<RHI.GPUVendor>NVIDIA</RHI.GPUVendor>
<RHI.DeviceId>28E0</RHI.DeviceId>
<DeviceProfile.Name>Windows</DeviceProfile.Name>
<Platform.AppHasFocus>true</Platform.AppHasFocus>
</EngineData>
<PlatformProperties>
<PlatformIsRunningWindows>1</PlatformIsRunningWindows>
<PlatformCallbackResult>0</PlatformCallbackResult>
Expand Down

0 comments on commit eddd7c8

Please sign in to comment.