yum-archive/TaSTT-Whisper
High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model
git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper
8c4603c
master
1#include "stdafx.h" 2#include "renderDoc.h" 3#include "renderdoc_app.h" 4#include "../device.h" 5 6#define ENABLE_RENDERDOC_DEBUGGER 1 7 8#if ENABLE_RENDERDOC_DEBUGGER 9namespace 10{ 11static HMODULE hmRenderDoc = nullptr ; 12static RENDERDOC_API_1_6_0 * api = nullptr ; 13} 14 15bool DirectCompute ::initializeRenderDoc () 16{ 17hmRenderDoc = GetModuleHandleW (L"renderdoc.dll" ); 18if (nullptr == hmRenderDoc ) 19return false; 20 21pRENDERDOC_GetAPI getApi = (pRENDERDOC_GetAPI )GetProcAddress (hmRenderDoc ,"RENDERDOC_GetAPI" ); 22if (nullptr == getApi ) 23return false; 24if (1 != getApi (eRENDERDOC_API_Version_1_6_0 , (void ** )& api ) ) 25return false; 26if (nullptr == api ) 27return false; 28 29return true; 30} 31 32namespace 33{ 34using namespace DirectCompute ; 35inline bool isKeyPressed (int vKey ) 36 { 37return 0 != (GetAsyncKeyState (vKey )& 0x8000 ); 38 } 39} 40 41CaptureRaii ::CaptureRaii () :capturing ( false ) 42{ 43if (nullptr == api ) 44return ; 45if ( !isKeyPressed (VK_F12 ) ) 46return ; 47ID3D11Device * const dev = device (); 48if (nullptr == dev ) 49return ; 50 51api -> StartFrameCapture (dev ,nullptr ); 52capturing = true; 53} 54 55CaptureRaii ::~CaptureRaii () 56{ 57if ( !capturing ) 58return ; 59api -> EndFrameCapture (device (),nullptr ); 60} 61#else // !ENABLE_RENDERDOC_DEBUGGER 62bool DirectCompute ::initializeRenderDoc () 63{ 64return false; 65} 66DirectCompute ::CaptureRaii ::CaptureRaii () :capturing ( false ) 67{ 68} 69DirectCompute ::CaptureRaii ::~CaptureRaii () 70{ 71} 72#endif