local ffi = require 'ffi'
local imgui = require 'mimgui'
local ImVec2 = imgui.ImVec2
ffi.cdef[[
typedef long LONG;
typedef LONG HRESULT;
typedef int INT;
typedef unsigned int UINT;
typedef unsigned int *PUINT;
typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef float FLOAT;
typedef void *HANDLE;
typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
typedef void* IDirect3DPixelShader9;
typedef int D3DFORMAT;
typedef int D3DPOOL;
typedef int D3DBACKBUFFER_TYPE;
typedef int D3DTEXTUREFILTERTYPE;
typedef int D3DSAMPLERSTATETYPE;
typedef struct {
void *QueryInterface;
void *AddRef;
void *Release;
void *TestCooperativeLevel;
void *GetAvailableTextureMem;
void *EvictManagedResources;
void *GetDirect3D;
void *GetDeviceCaps;
void *GetDisplayMode;
void *GetCreationParameters;
void *SetCursorProperties;
void *SetCursorPosition;
void *ShowCursor;
void *CreateAdditionalSwapChain;
void *GetSwapChain;
void *GetNumberOfSwapChains;
void *Reset;
void *Present;
void *GetBackBuffer;
void *GetRasterStatus;
void *SetDialogBoxMode;
void *SetGammaRamp;
void *GetGammaRamp;
void *CreateTexture;
void *CreateVolumeTexture;
void *CreateCubeTexture;
void *CreateVertexBuffer;
void *CreateIndexBuffer;
void *CreateRenderTarget;
void *CreateDepthStencilSurface;
void *UpdateSurface;
void *UpdateTexture;
void *GetRenderTargetData;
void *GetFrontBufferData;
void *StretchRect;
void *ColorFill;
void *CreateOffscreenPlainSurface;
void *SetRenderTarget;
void *GetRenderTarget;
void *SetDepthStencilSurface;
void *GetDepthStencilSurface;
void *BeginScene;
void *EndScene;
void *Clear;
void *SetTransform;
void *GetTransform;
void *MultiplyTransform;
void *SetViewport;
void *GetViewport;
void *SetMaterial;
void *GetMaterial;
void *SetLight;
void *GetLight;
void *LightEnable;
void *GetLightEnable;
void *SetClipPlane;
void *GetClipPlane;
void *SetRenderState;
void *GetRenderState;
void *CreateStateBlock;
void *BeginStateBlock;
void *EndStateBlock;
void *SetClipStatus;
void *GetClipStatus;
void *GetTexture;
void *SetTexture;
void *GetTextureStageState;
void *SetTextureStageState;
void *GetSamplerState;
void *SetSamplerState;
void *ValidateDevice;
void *SetPaletteEntries;
void *GetPaletteEntries;
void *SetCurrentTexturePalette;
void *GetCurrentTexturePalette;
void *SetScissorRect;
void *GetScissorRect;
void *SetSoftwareVertexProcessing;
void *GetSoftwareVertexProcessing;
void *SetNPatchMode;
void *GetNPatchMode;
void *DrawPrimitive;
void *DrawIndexedPrimitive;
void *DrawPrimitiveUP;
void *DrawIndexedPrimitiveUP;
void *ProcessVertices;
void *CreateVertexDeclaration;
void *SetVertexDeclaration;
void *GetVertexDeclaration;
void *SetFVF;
void *GetFVF;
void *CreateVertexShader;
void *SetVertexShader;
void *GetVertexShader;
void *SetVertexShaderConstantF;
void *GetVertexShaderConstantF;
void *SetVertexShaderConstantI;
void *GetVertexShaderConstantI;
void *SetVertexShaderConstantB;
void *GetVertexShaderConstantB;
void *SetStreamSource;
void *GetStreamSource;
void *SetStreamSourceFreq;
void *GetStreamSourceFreq;
void *SetIndices;
void *GetIndices;
void *CreatePixelShader;
void *SetPixelShader;
void *GetPixelShader;
void *SetPixelShaderConstantF;
void *GetPixelShaderConstantF;
void *SetPixelShaderConstantI;
void *GetPixelShaderConstantI;
void *SetPixelShaderConstantB;
void *GetPixelShaderConstantB;
void *DrawRectPatch;
void *DrawTriPatch;
void *DeletePatch;
void *CreateQuery;
} IDirect3DDevice9_vtbl;
typedef struct {
IDirect3DDevice9_vtbl* vtbl;
} IDirect3DDevice9;
typedef struct {
void *QueryInterface;
void *AddRef;
HRESULT(__stdcall* Release)(void *This);
void *GetDevice;
void *SetPrivateData;
void *GetPrivateData;
void *FreePrivateData;
void *SetPriority;
void *GetPriority;
void *PreLoad;
void *GetType;
void *SetLOD;
void *GetLOD;
void *GetLevelCount;
void *SetAutoGenFilterType;
void *GetAutoGenFilterType;
void *GenerateMipSubLevels;
void *GetLevelDesc;
void *GetSurfaceLevel;
void *LockRect;
void *UnlockRect;
void *AddDirtyRect;
} IDirect3DTexture9_vtbl;
typedef struct {
IDirect3DTexture9_vtbl* vtbl;
} IDirect3DTexture9;
typedef struct {
void *QueryInterface;
void *AddRef;
HRESULT(__stdcall* Release)(void *This);
void *GetDevice;
void *SetPrivateData;
void *GetPrivateData;
void *FreePrivateData;
void *SetPriority;
void *GetPriority;
void *PreLoad;
void *GetType;
void *GetContainer;
void *GetDesc;
void *LockRect;
void *UnlockRect;
void *GetDC;
void *ReleaseDC;
} IDirect3DSurface9_vtbl;
typedef struct {
IDirect3DSurface9_vtbl* vtbl;
} IDirect3DSurface9;
typedef HRESULT(__stdcall* IDirect3DDevice9_CreatePixelShader)(IDirect3DDevice9* This, const DWORD* pFunction, IDirect3DPixelShader9** ppShader);
typedef HRESULT(__stdcall* IDirect3DDevice9_CreateTexture)(IDirect3DDevice9* This, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
typedef HRESULT(__stdcall* IDirect3DDevice9_GetRenderTarget)(IDirect3DDevice9* This, DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget);
typedef HRESULT(__stdcall* IDirect3DDevice9_GetBackBuffer)(IDirect3DDevice9* This, UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer);
typedef HRESULT(__stdcall* IDirect3DDevice9_StretchRect)(IDirect3DDevice9* This, IDirect3DSurface9* pSourceSurface, const RECT* pSourceRect, IDirect3DSurface9* pDestSurface, const RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter);
typedef HRESULT(__stdcall* IDirect3DDevice9_SetRenderTarget)(IDirect3DDevice9* This, DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget);
typedef HRESULT(__stdcall* IDirect3DDevice9_SetSamplerState)(IDirect3DDevice9* This, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
typedef HRESULT(__stdcall* IDirect3DDevice9_SetPixelShader)(IDirect3DDevice9* This, IDirect3DPixelShader9* pShader);
typedef HRESULT(__stdcall* IDirect3DDevice9_SetPixelShaderConstantF)(IDirect3DDevice9* This, UINT StartRegister, const float* pConstantData, UINT Vector4fCount);
typedef HRESULT(__stdcall* IDirect3DTexture9_GetSurfaceLevel)(IDirect3DTexture9* This, UINT Level, IDirect3DSurface9** ppSurfaceLevel);
typedef HRESULT(__stdcall* IDirect3DTexture9_Release)(IDirect3DTexture9* This);
typedef HRESULT(__stdcall* IDirect3DSurface9_Release)(IDirect3DSurface9* This);
]]
local shader_binary_x = "\x00\x02\xff\xff\xfe\xff\x2e\x00\x43\x54\x41\x42\x1c\x00\x00\x00\x83\x00\x00\x00\x00\x02\xff\xff\x02\x00\x00\x00\x1c\x00\x00\x00\x00\x01\x00\x00\x7c\x00\x00\x00\x44\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x50\x00\x00\x00\x00\x00\x00\x00\x60\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x6c\x00\x00\x00\x00\x00\x00\x00\x74\x65\x78\x53\x61\x6d\x70\x6c\x65\x72\x00\xab\x04\x00\x0c\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x74\x65\x78\x65\x6c\x57\x69\x64\x74\x68\x00\xab\x00\x00\x03\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x70\x73\x5f\x32\x5f\x30\x00\x4d\x69\x63\x72\x6f\x73\x6f\x66\x74\x20\x28\x52\x29\x20\x48\x4c\x53\x4c\x20\x53\x68\x61\x64\x65\x72\x20\x43\x6f\x6d\x70\x69\x6c\x65\x72\x20\x39\x2e\x32\x39\x2e\x39\x35\x32\x2e\x33\x31\x31\x31\x00\x51\x00\x00\x05\x01\x00\x0f\xa0\x14\x3b\xb1\x3f\x00\x00\x00\x00\x18\xe7\xa1\x3e\xc6\x79\x68\x3e\x51\x00\x00\x05\x02\x00\x0f\xa0\xec\xc4\x4e\x40\xdc\xe9\x8f\x3d\x00\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x02\x00\x00\x00\x80\x00\x00\x03\xb0\x1f\x00\x00\x02\x00\x00\x00\x90\x00\x08\x0f\xa0\x42\x00\x00\x03\x00\x00\x0f\x80\x00\x00\xe4\xb0\x00\x08\xe4\xa0\x01\x00\x00\x02\x01\x00\x08\x80\x01\x00\x00\xa0\x05\x00\x00\x03\x01\x00\x01\x80\x01\x00\xff\x80\x00\x00\x00\xa0\x01\x00\x00\x02\x01\x00\x02\x80\x01\x00\x55\xa0\x02\x00\x00\x03\x02\x00\x03\x80\x01\x00\xe4\x81\x00\x00\xe4\xb0\x02\x00\x00\x03\x01\x00\x03\x80\x01\x00\xe4\x80\x00\x00\xe4\xb0\x01\x00\x00\x02\x03\x00\x08\x80\x02\x00\x00\xa0\x05\x00\x00\x03\x03\x00\x01\x80\x03\x00\xff\x80\x00\x00\x00\xa0\x01\x00\x00\x02\x03\x00\x02\x80\x01\x00\x55\xa0\x02\x00\x00\x03\x04\x00\x03\x80\x03\x00\xe4\x81\x00\x00\xe4\xb0\x02\x00\x00\x03\x03\x00\x03\x80\x03\x00\xe4\x80\x00\x00\xe4\xb0\x42\x00\x00\x03\x01\x00\x0f\x80\x01\x00\xe4\x80\x00\x08\xe4\xa0\x42\x00\x00\x03\x02\x00\x0f\x80\x02\x00\xe4\x80\x00\x08\xe4\xa0\x42\x00\x00\x03\x03\x00\x0f\x80\x03\x00\xe4\x80\x00\x08\xe4\xa0\x42\x00\x00\x03\x04\x00\x0f\x80\x04\x00\xe4\x80\x00\x08\xe4\xa0\x05\x00\x00\x03\x02\x00\x07\x80\x02\x00\xe4\x80\x01\x00\xaa\xa0\x04\x00\x00\x04\x02\x00\x07\x80\x00\x00\xe4\x80\x01\x00\xff\xa0\x02\x00\xe4\x80\x04\x00\x00\x04\x01\x00\x07\x80\x01\x00\xe4\x80\x01\x00\xaa\xa0\x02\x00\xe4\x80\x04\x00\x00\x04\x01\x00\x07\x80\x04\x00\xe4\x80\x02\x00\x55\xa0\x01\x00\xe4\x80\x04\x00\x00\x04\x00\x00\x07\x80\x03\x00\xe4\x80\x02\x00\x55\xa0\x01\x00\xe4\x80\x01\x00\x00\x02\x00\x08\x0f\x80\x00\x00\xe4\x80\xff\xff\x00\x00"
local shader_binary_y = "\x00\x02\xff\xff\xfe\xff\x2e\x00\x43\x54\x41\x42\x1c\x00\x00\x00\x83\x00\x00\x00\x00\x02\xff\xff\x02\x00\x00\x00\x1c\x00\x00\x00\x00\x01\x00\x00\x7c\x00\x00\x00\x44\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x50\x00\x00\x00\x00\x00\x00\x00\x60\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x6c\x00\x00\x00\x00\x00\x00\x00\x74\x65\x78\x53\x61\x6d\x70\x6c\x65\x72\x00\xab\x04\x00\x0c\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x74\x65\x78\x65\x6c\x48\x65\x69\x67\x68\x74\x00\x00\x00\x03\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x70\x73\x5f\x32\x5f\x30\x00\x4d\x69\x63\x72\x6f\x73\x6f\x66\x74\x20\x28\x52\x29\x20\x48\x4c\x53\x4c\x20\x53\x68\x61\x64\x65\x72\x20\x43\x6f\x6d\x70\x69\x6c\x65\x72\x20\x39\x2e\x32\x39\x2e\x39\x35\x32\x2e\x33\x31\x31\x31\x00\x51\x00\x00\x05\x01\x00\x0f\xa0\x14\x3b\xb1\x3f\x00\x00\x00\x80\x18\xe7\xa1\x3e\xc6\x79\x68\x3e\x51\x00\x00\x05\x02\x00\x0f\xa0\xec\xc4\x4e\x40\xdc\xe9\x8f\x3d\x00\x00\x00\x00\x00\x00\x00\x00\x1f\x00\x00\x02\x00\x00\x00\x80\x00\x00\x03\xb0\x1f\x00\x00\x02\x00\x00\x00\x90\x00\x08\x0f\xa0\x42\x00\x00\x03\x00\x00\x0f\x80\x00\x00\xe4\xb0\x00\x08\xe4\xa0\x01\x00\x00\x02\x01\x00\x08\x80\x01\x00\x00\xa0\x05\x00\x00\x03\x01\x00\x01\x80\x01\x00\xff\x80\x00\x00\x00\xa0\x01\x00\x00\x02\x01\x00\x02\x80\x01\x00\x00\x81\x01\x00\x00\x02\x01\x00\x01\x80\x01\x00\x55\xa0\x02\x00\x00\x03\x01\x00\x03\x80\x01\x00\xe4\x80\x00\x00\xe4\xb0\x01\x00\x00\x02\x02\x00\x01\x80\x00\x00\x00\xb0\x04\x00\x00\x04\x02\x00\x02\x80\x00\x00\x00\xa0\x01\x00\xff\x80\x00\x00\x55\xb0\x01\x00\x00\x02\x03\x00\x08\x80\x02\x00\x00\xa0\x05\x00\x00\x03\x01\x00\x04\x80\x03\x00\xff\x80\x00\x00\x00\xa0\x01\x00\x00\x02\x03\x00\x02\x80\x01\x00\xaa\x81\x01\x00\x00\x02\x03\x00\x01\x80\x01\x00\x55\xa0\x02\x00\x00\x03\x03\x00\x03\x80\x03\x00\xe4\x80\x00\x00\xe4\xb0\x01\x00\x00\x02\x04\x00\x01\x80\x00\x00\x00\xb0\x04\x00\x00\x04\x04\x00\x02\x80\x00\x00\x00\xa0\x03\x00\xff\x80\x00\x00\x55\xb0\x42\x00\x00\x03\x01\x00\x0f\x80\x01\x00\xe4\x80\x00\x08\xe4\xa0\x42\x00\x00\x03\x02\x00\x0f\x80\x02\x00\xe4\x80\x00\x08\xe4\xa0\x42\x00\x00\x03\x03\x00\x0f\x80\x03\x00\xe4\x80\x00\x08\xe4\xa0\x42\x00\x00\x03\x04\x00\x0f\x80\x04\x00\xe4\x80\x00\x08\xe4\xa0\x05\x00\x00\x03\x01\x00\x07\x80\x01\x00\xe4\x80\x01\x00\xaa\xa0\x04\x00\x00\x04\x01\x00\x07\x80\x00\x00\xe4\x80\x01\x00\xff\xa0\x01\x00\xe4\x80\x04\x00\x00\x04\x01\x00\x07\x80\x02\x00\xe4\x80\x01\x00\xaa\xa0\x01\x00\xe4\x80\x04\x00\x00\x04\x01\x00\x07\x80\x03\x00\xe4\x80\x02\x00\x55\xa0\x01\x00\xe4\x80\x04\x00\x00\x04\x00\x00\x07\x80\x04\x00\xe4\x80\x02\x00\x55\xa0\x01\x00\xe4\x80\x01\x00\x00\x02\x00\x08\x0f\x80\x00\x00\xe4\x80\xff\xff\x00\x00"
local width, height = 0, 0
local shader_x, shader_y = ffi.new('IDirect3DPixelShader9*[1]'), ffi.new('IDirect3DPixelShader9*[1]')
local blur_texture, rt_backup = ffi.new('IDirect3DTexture9*[1]'), ffi.new('IDirect3DSurface9*[1]')
local function release_resource(resource)
if resource[0] ~= nil then
-- local fn = ffi.cast('HRESULT (__stdcall*)(void*)', resource[0].vtbl.Release)
-- local item = ffi.cast('void*', resource[0])
-- fn(item)
resource[0].vtbl.Release(resource[0])
resource[0] = nil
return true
end
return false
end
local function begin(parent_list, cmd)
print('begin')
do return end
local device = ffi.cast('IDirect3DDevice9*', cmd.UserCallbackData)
local IDirect3DDevice9_CreatePixelShader = ffi.cast('IDirect3DDevice9_CreatePixelShader', device.vtbl.CreatePixelShader)
local IDirect3DDevice9_CreateTexture = ffi.cast('IDirect3DDevice9_CreateTexture', device.vtbl.CreateTexture)
local IDirect3DDevice9_GetRenderTarget = ffi.cast('IDirect3DDevice9_GetRenderTarget', device.vtbl.GetRenderTarget)
local IDirect3DDevice9_GetBackBuffer = ffi.cast('IDirect3DDevice9_GetBackBuffer', device.vtbl.GetBackBuffer)
local IDirect3DDevice9_StretchRect = ffi.cast('IDirect3DDevice9_StretchRect', device.vtbl.StretchRect)
local IDirect3DDevice9_SetRenderTarget = ffi.cast('IDirect3DDevice9_SetRenderTarget', device.vtbl.SetRenderTarget)
local IDirect3DDevice9_SetSamplerState = ffi.cast('IDirect3DDevice9_SetSamplerState', device.vtbl.SetSamplerState)
if shader_x[0] == nil then
IDirect3DDevice9_CreatePixelShader(device, ffi.cast('DWORD*', shader_binary_x), shader_x)
end
if shader_y[0] == nil then
IDirect3DDevice9_CreatePixelShader(device, ffi.cast('DWORD*', shader_binary_y), shader_y)
end
local display_size = imgui.GetIO().DisplaySize
local current_width = display_size.x
local current_height = display_size.y
if width ~= current_width or height ~= current_height or blur_texture[0] == nil then
release_resource(blur_texture)
width = current_width
height = current_height
IDirect3DDevice9_CreateTexture(device, width, height, 1, 0x00000001, 21, 0, blur_texture, nil)
end
IDirect3DDevice9_GetRenderTarget(device, 0, rt_backup)
do
local IDirect3DTexture9_GetSurfaceLevel = ffi.cast('IDirect3DTexture9_GetSurfaceLevel', blur_texture[0].vtbl.GetSurfaceLevel)
local back_buffer = ffi.new('IDirect3DSurface9*[1]')
IDirect3DDevice9_GetBackBuffer(device, 0, 0, 0, back_buffer)
local surface = ffi.new('IDirect3DSurface9*[1]')
IDirect3DTexture9_GetSurfaceLevel(blur_texture[0], 0, surface)
IDirect3DDevice9_StretchRect(device, back_buffer[0], nil, surface[0], nil, 0)
IDirect3DDevice9_SetRenderTarget(device, 0, surface[0])
release_resource(surface)
release_resource(back_buffer)
end
IDirect3DDevice9_SetSamplerState(device, 0, 1, 3)
IDirect3DDevice9_SetSamplerState(device, 0, 2, 3)
end
local function process_x(parent_list, cmd)
print('process_x')
do return end
local device = ffi.cast('IDirect3DDevice9*', cmd.UserCallbackData)
local IDirect3DDevice9_SetPixelShader = ffi.cast('IDirect3DDevice9_SetPixelShader', device.vtbl.SetPixelShader)
local IDirect3DDevice9_SetPixelShaderConstantF = ffi.cast('IDirect3DDevice9_SetPixelShaderConstantF', device.vtbl.SetPixelShaderConstantF)
IDirect3DDevice9_SetPixelShader(device, shader_x[0])
local params = ffi.new('float[4]')
params[0] = 1.0 / width
IDirect3DDevice9_SetPixelShaderConstantF(device, 0, params, 1)
end
local function process_y(parent_list, cmd)
print('process_y')
do return end
local device = ffi.cast('IDirect3DDevice9*', cmd.UserCallbackData)
local IDirect3DDevice9_SetPixelShader = ffi.cast('IDirect3DDevice9_SetPixelShader', device.vtbl.SetPixelShader)
local IDirect3DDevice9_SetPixelShaderConstantF = ffi.cast('IDirect3DDevice9_SetPixelShaderConstantF', device.vtbl.SetPixelShaderConstantF)
IDirect3DDevice9_SetPixelShader(device, shader_y[0])
local params = ffi.new('float[4]')
params[0] = 1.0 / height
IDirect3DDevice9_SetPixelShaderConstantF(device, 0, params, 1)
end
local function end_(parent_list, cmd)
print('end_')
do return end
local device = ffi.cast('IDirect3DDevice9*', cmd.UserCallbackData)
local IDirect3DDevice9_SetRenderTarget = ffi.cast('IDirect3DDevice9_SetRenderTarget', device.vtbl.SetRenderTarget)
local IDirect3DDevice9_SetPixelShader = ffi.cast('IDirect3DDevice9_SetPixelShader', device.vtbl.SetPixelShader)
local IDirect3DDevice9_SetSamplerState = ffi.cast('IDirect3DDevice9_SetSamplerState', device.vtbl.SetSamplerState)
IDirect3DDevice9_SetRenderTarget(device, 0, rt_backup[0])
release_resource(rt_backup)
IDirect3DDevice9_SetPixelShader(device, nil)
IDirect3DDevice9_SetSamplerState(device, 0, 1, 1)
IDirect3DDevice9_SetSamplerState(device, 0, 2, 1)
end
local begin_callback = ffi.cast('ImDrawCallback', begin)
local process_x_callback = ffi.cast('ImDrawCallback', process_x)
local process_y_callback = ffi.cast('ImDrawCallback', process_y)
local end_callback = ffi.cast('ImDrawCallback', end_)
local mimgui_blur = {}
local noone = true
function mimgui_blur.apply(draw_list, radius, rounding, flags)
if noone then noone = false return end
rounding = rounding or 0
flags = flags or 0
local device = ffi.cast('IDirect3DDevice9*', getD3DDevicePtr())
print(begin_callback)
print(process_x_callback)
print(process_y_callback)
print(end_callback)
draw_list:AddCallback(ffi.cast('void*', -1), nil)
draw_list:AddCallback(begin_callback, device)
local texture_valid = blur_texture[0] ~= nil
if texture_valid then
for i = 1, radius do
draw_list:AddCallback(process_x_callback, device)
draw_list:AddImageRounded(blur_texture[0], ImVec2(0, 0), ImVec2(width, height), ImVec2(0, 0), ImVec2(1, 1), -1, rounding, flags)
draw_list:AddCallback(process_y_callback, device)
draw_list:AddImageRounded(blur_texture[0], ImVec2(0, 0), ImVec2(width, height), ImVec2(0, 0), ImVec2(1, 1), -1, rounding, flags)
end
end
draw_list:AddCallback(end_callback, device)
if texture_valid then
draw_list:AddImageRounded(blur_texture[0], ImVec2(0, 0), ImVec2(width, height), ImVec2(0, 0), ImVec2(1, 1), -1, rounding, flags)
end
end
addEventHandler('onD3DDeviceLost', function()
release_resource(blur_texture)
release_resource(rt_backup)
end)
return mimgui_blur