jpark37 dad861b036 win-capture: Fix D3D leaks on swap chain release
For game capture, hook DXGI release function to release D3D objects if
the related swap chain is also being destroyed.

An added bonus is that the game capture hook will handle swap chain
recreation for applications that don't use ResizeBuffers.
2020-10-13 18:47:35 -07:00

32 lines
700 B
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "../graphics-hook-info.h"
#define DUMMY_WNDCLASS "get_addrs_wndclass"
#ifdef __cplusplus
extern "C" {
#else
#if defined(_MSC_VER) && !defined(inline)
#define inline __inline
#endif
#endif
static inline uint32_t vtable_offset(HMODULE module, void *cls,
unsigned int offset)
{
uintptr_t *vtable = *(uintptr_t **)cls;
return (uint32_t)(vtable[offset] - (uintptr_t)module);
}
extern void get_dxgi_offsets(struct dxgi_offsets *offsets,
struct dxgi_offsets2 *offsets2);
extern void get_d3d9_offsets(struct d3d9_offsets *offsets);
extern void get_d3d8_offsets(struct d3d8_offsets *offsets);
#ifdef __cplusplus
}
#endif