Skip to content

CET with AMD and my camera tools doing viewport resizing causes crashes #975

@FransBouma

Description

@FransBouma

Hi,

I'm the developer of the cyberpunk camera tools used by many people. One of the features is to resize the game's viewport by setting the new resolution in memory, after which the engine will resize the window and viewport to the new resolution. This is called 'Hotsampling' and is often used by virtual photographers to take a screenshot at a higher resolution.

Resizing the viewport of the game that way when CET is used however leads to a specific crash in ffx_backend_dx12_x64.dll:
image

When CET isn't active, no crash occurs.

Looking at your code, it seems you're hooking the engine's resize function instead of the swapchain's ResizeBuffers (d3d12 swapchain VTable[13]).

if (MH_CreateHook(resizeInternal.GetAddr(), reinterpret_cast<void*>(&CRenderGlobal_Resize), reinterpret_cast<void**>(&m_realInternalResize)) != MH_OK ||

My question is: why not hook the swapchain resize buffers to get the callback, then do the cleanup? Could this be changed perhaps in the future so these crashes on AMD cards are avoided?

The resolution struct is interceptible using AOB: 8B 41 7C 39 41 18 75 19 8B 81 80 00 00 00 39 41 1C 75 0E, where rcx contains the structure pointer. offset 0x7C in that struct contains the screen width, offset 0x80 contains the height (in pixels). Changing any of the values there will resize the viewport by the engine and will then trigger the crash on AMD hardware.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions