forked from Areteic/dsfix
-
Notifications
You must be signed in to change notification settings - Fork 1
/
d3d9query.cpp
37 lines (37 loc) · 1.27 KB
/
d3d9query.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "d3d9.h"
#include "main.h"
#include "RenderstateManager.h"
#include "Settings.h"
hkIDirect3DQuery9::hkIDirect3DQuery9(IDirect3DQuery9 **ppReturnedQueryInterface) {
m_pD3Dquery = *ppReturnedQueryInterface;
*ppReturnedQueryInterface = this;
}
HRESULT APIENTRY hkIDirect3DQuery9::QueryInterface(REFIID riid, void** ppvObj) {
return m_pD3Dquery->QueryInterface(riid, ppvObj);
}
ULONG APIENTRY hkIDirect3DQuery9::AddRef() {
return m_pD3Dquery->AddRef();
}
ULONG APIENTRY hkIDirect3DQuery9::Release() {
return m_pD3Dquery->Release();
}
HRESULT APIENTRY hkIDirect3DQuery9::GetDevice(IDirect3DDevice9** ppDevice) {
return m_pD3Dquery->GetDevice(ppDevice);
}
D3DQUERYTYPE APIENTRY hkIDirect3DQuery9::GetType() {
return m_pD3Dquery->GetType();
}
DWORD APIENTRY hkIDirect3DQuery9::GetDataSize() {
return m_pD3Dquery->GetDataSize();
}
HRESULT APIENTRY hkIDirect3DQuery9::Issue(DWORD dwIssueFlags) {
return m_pD3Dquery->Issue(dwIssueFlags);
}
HRESULT APIENTRY hkIDirect3DQuery9::GetData(void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
auto result = m_pD3Dquery->GetData(pData, dwSize, dwGetDataFlags);
if (SUCCEEDED(result)) {
auto pixelsDrawn = reinterpret_cast<DWORD*>(pData);
pixelsDrawn[0] = static_cast<DWORD>(pixelsDrawn[0] / RSManager::get().getOcclusionScale());
}
return result;
}