Example #1
0
bool Graphics::initOcclusionQuery(uint* occlusionQuery) {
	// check if the runtime supports queries
	HRESULT result = device->CreateQuery(D3DQUERYTYPE_OCCLUSION, NULL);
	if (FAILED(result)) {
		Kore::log(Kore::LogLevel::Warning, "Internal query creation failed, result: 0x%X.", result);
		return false;
	}

	IDirect3DQuery9* pQuery = nullptr;
	device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &pQuery);

	queryPool.push_back(pQuery);
	*occlusionQuery = queryCount;
	++queryCount;

	return true;
}
Example #2
0
int Application::Check()
{
	//	リリースコンパイルのときはDirect3Dランタイムがリテールモードのときのみ実行可能とする
	//	ランタイムモードをチェックする
	IDirect3DQuery9** ppQuery = NULL;
	if (SUCCEEDED(d3dDevice->CreateQuery(D3DQUERYTYPE_VERTEXSTATS, ppQuery)))
	{
		::MessageBox(hWnd, "Direct3Dランタイムがデバッグモードです。リテールモードに変更してください。", "実行時エラー", MB_OK);
		::DestroyWindow(hWnd);
		return 0;
	}

}
Example #3
0
bool InitResourceDX9(void)
{
	// 取得Direct3D 9裝置
	LPDIRECT3DDEVICE9 device = GutGetGraphicsDeviceDX9();
	// 設定視角轉換矩陣
	g_projection_matrix = GutMatrixPerspectiveRH_DirectX(90.0f, 1.0f, 0.1f, 100.0f);
	device->SetTransform(D3DTS_PROJECTION, (D3DMATRIX *) &g_projection_matrix);
	// 關閉打光
	device->SetRenderState(D3DRS_LIGHTING, FALSE);
	// 改變三角形正面的面向
	device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
	//
	device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &g_pOcclusionQuery[0]);
	device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &g_pOcclusionQuery[1]);

	return true;
}
Example #4
0
HRESULT HookIDirect3DDevice9::CreateQuery(LPVOID _this, D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery)
{
	LOG_API();
	return pD3Dev->CreateQuery(Type, ppQuery);
}