Skip to content

Commit 73fa50a

Browse files
committed
Extend GPU context with data for Unreal Engine crash reports
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 <[email protected]>
1 parent ef9127a commit 73fa50a

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
## Unreleased
44

5+
**Features**:
6+
7+
- Extend GPU context with data for Unreal Engine crash reports ([#3144](https://github.com/getsentry/relay/pull/3144))
8+
59
**Bug Fixes**:
610

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

1015
**Internal**:
1116

relay-server/src/utils/unreal.rs

+51-1
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,40 @@ fn merge_unreal_context(event: &mut Event, context: Unreal4Context) {
212212
os_context.name = Annotated::new(os_major);
213213
}
214214

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

224+
if let Some(device_id) = context.engine_data.get("RHI.DeviceId") {
225+
let gpu_context = contexts.get_or_default::<GpuContext>();
226+
gpu_context.id = Annotated::new(Value::String(device_id.into()));
227+
}
228+
229+
if let Some(feature_level) = context.engine_data.get("RHI.FeatureLevel") {
230+
let gpu_context = contexts.get_or_default::<GpuContext>();
231+
gpu_context.graphics_shader_level = Annotated::new(feature_level.into());
232+
}
233+
234+
if let Some(vendor_name) = context.engine_data.get("RHI.GPUVendor") {
235+
let gpu_context = contexts.get_or_default::<GpuContext>();
236+
gpu_context.vendor_name = Annotated::new(vendor_name.into());
237+
}
238+
239+
if let Some(driver_version) = context.engine_data.get("RHI.UserDriverVersion") {
240+
let gpu_context = contexts.get_or_default::<GpuContext>();
241+
gpu_context.version = Annotated::new(driver_version.into());
242+
}
243+
244+
if let Some(rhi_name) = context.engine_data.get("RHI.RHIName") {
245+
let gpu_context = contexts.get_or_default::<GpuContext>();
246+
gpu_context.api_type = Annotated::new(rhi_name.into());
247+
}
248+
220249
if runtime_props.is_assert.unwrap_or(false) {
221250
event.level = Annotated::new(Level::Error)
222251
}
@@ -338,6 +367,27 @@ mod tests {
338367
<Modules>\\Mac\Home\Desktop\WindowsNoEditor\YetAnother\Binaries\Win64\YetAnother.exe
339368
\\Mac\Home\Desktop\WindowsNoEditor\Engine\Binaries\ThirdParty\PhysX3\Win64\VS2015\PxFoundationPROFILE_x64.dll</Modules>
340369
</RuntimeProperties>
370+
<EngineData>
371+
<MatchingDPStatus>WindowsNo errors</MatchingDPStatus>
372+
<RHI.IntegratedGPU>false</RHI.IntegratedGPU>
373+
<RHI.DriverDenylisted>false</RHI.DriverDenylisted>
374+
<RHI.D3DDebug>false</RHI.D3DDebug>
375+
<RHI.Breadcrumbs>true</RHI.Breadcrumbs>
376+
<RHI.DRED>true</RHI.DRED>
377+
<RHI.DREDMarkersOnly>false</RHI.DREDMarkersOnly>
378+
<RHI.DREDContext>true</RHI.DREDContext>
379+
<RHI.Aftermath>true</RHI.Aftermath>
380+
<RHI.RHIName>D3D12</RHI.RHIName>
381+
<RHI.AdapterName>NVIDIA GeForce RTX 4060 Laptop GPU</RHI.AdapterName>
382+
<RHI.UserDriverVersion>551.52</RHI.UserDriverVersion>
383+
<RHI.InternalDriverVersion>31.0.15.5152</RHI.InternalDriverVersion>
384+
<RHI.DriverDate>2-7-2024</RHI.DriverDate>
385+
<RHI.FeatureLevel>SM5</RHI.FeatureLevel>
386+
<RHI.GPUVendor>NVIDIA</RHI.GPUVendor>
387+
<RHI.DeviceId>28E0</RHI.DeviceId>
388+
<DeviceProfile.Name>Windows</DeviceProfile.Name>
389+
<Platform.AppHasFocus>true</Platform.AppHasFocus>
390+
</EngineData>
341391
<PlatformProperties>
342392
<PlatformIsRunningWindows>1</PlatformIsRunningWindows>
343393
<PlatformCallbackResult>0</PlatformCallbackResult>

0 commit comments

Comments
 (0)