Hook for d3d device resets?

Whenever the d3d device resets, RTs need to be re-rendered, but I can’t find any hook for this. Is there any way to tell if there has been a device reset?

I might be misreading, do you mean like when your GPU crashes? Or when you install new drivers? How the hell does that happen in the middle of a game, and the game just keeps running?

I don’t know all the causes of it, but changing resolution is one. It’s not a crash, its just the driver re-requesting all of the materials and stuff because it got reset.

I know for an annoying fact that there isn’t a “resolution changed” hook, and that devs who need it create it themselves by keeping track of ScrW/ScrH and watching them for changes.

[lua]
hook.Add( “Initialize”, “Resolution Change”, function()
vgui.CreateFromTable {

	Base = "Panel",

	PerformLayout = function()
		hook.Run( "ResolutionChanged", ScrW(), ScrH() )
	end
	
} : ParentToHUD()

end )

hook.Add( “ResolutionChanged”, “Resolution Change”, function( w, h )
print( "OH NO THE RESOLUTION CHANGED TO " … w … “x” … h )
end )
[/lua]

Sauce

Thx