OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d9 / Query.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/direct3d9/Query.cpp b/SlimDXc_Jun2010(VC++2008)/source/direct3d9/Query.cpp
deleted file mode 100644 (file)
index 4dce4ce..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "stdafx.h"\r
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-#include <d3d9.h>\r
-#include <d3dx9.h>\r
-\r
-#include "../ComObject.h"\r
-\r
-#include "Direct3D9Exception.h"\r
-#include "Device.h"\r
-#include "Query.h"\r
-#include "BandwidthTimings.h"\r
-#include "CacheUtilization.h"\r
-#include "InterfaceTimings.h"\r
-#include "PipelineTimings.h"\r
-#include "ResourceManager.h"\r
-#include "ResourceStats.h"\r
-#include "StageTimings.h"\r
-#include "VCache.h"\r
-#include "VertexStats.h"\r
-\r
-using namespace System;\r
-using namespace System::Runtime::InteropServices;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D9\r
-{\r
-       Query::Query( SlimDX::Direct3D9::Device^ device, QueryType type )\r
-       {\r
-               IDirect3DQuery9* query;\r
-               HRESULT hr = device->InternalPointer->CreateQuery( static_cast<D3DQUERYTYPE>( type ), &query );\r
-               \r
-               if( RECORD_D3D9( hr ).IsFailure )\r
-                       throw gcnew Direct3D9Exception( "Failed to create Query." );\r
-\r
-               Construct(query);\r
-       }\r
-\r
-       int Query::DataSize::get()\r
-       {\r
-               return InternalPointer->GetDataSize();\r
-       }\r
-\r
-       QueryType Query::Type::get()\r
-       {\r
-               return static_cast<QueryType>( InternalPointer->GetType() );\r
-       }\r
-\r
-       SlimDX::Direct3D9::Device^ Query::Device::get()\r
-       {\r
-               IDirect3DDevice9* device;\r
-               HRESULT hr = InternalPointer->GetDevice( &device );\r
-               \r
-               if( RECORD_D3D9( hr ).IsFailure )\r
-                       return nullptr;\r
-\r
-               return SlimDX::Direct3D9::Device::FromPointer( device );\r
-       }\r
-\r
-       Result Query::Issue( SlimDX::Direct3D9::Issue flags )\r
-       {\r
-               HRESULT hr = InternalPointer->Issue( static_cast<DWORD>( flags ) );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       bool Query::CheckStatus( bool flush )\r
-       {\r
-               HRESULT hr = InternalPointer->GetData( NULL, 0, flush ? D3DGETDATA_FLUSH : 0 );\r
-               \r
-               switch( hr )\r
-               {\r
-               case S_OK:\r
-                       return true;\r
-               case S_FALSE:\r
-                       return false;\r
-                       \r
-               default:\r
-                       RECORD_D3D9( hr );\r
-                       return false;\r
-               }\r
-       }\r
-\r
-       generic<typename T>\r
-       T Query::GetData( bool flush )\r
-       {\r
-               HRESULT hr = S_OK;\r
-               QueryType type = Type;\r
-\r
-               switch( type )\r
-               {\r
-               case QueryType::BandwidthTimings:\r
-                       if( T::typeid != BandwidthTimings::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::CacheUtilization:\r
-                       if( T::typeid != CacheUtilization::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::Event:\r
-                       if( T::typeid != bool::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::InterfaceTimings:\r
-                       if( T::typeid != InterfaceTimings::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::Occlusion:\r
-                       if( T::typeid != Int32::typeid && T::typeid != UInt32::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::PipelineTimings:\r
-                       if( T::typeid != PipelineTimings::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::ResourceManager:\r
-                       if( T::typeid != ResourceManager::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::Timestamp:\r
-                       if( T::typeid != Int64::typeid && T::typeid != UInt64::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::TimestampDisjoint:\r
-                       if( T::typeid != bool::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::TimestampFreq:\r
-                       if( T::typeid != Int64::typeid && T::typeid != UInt64::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::VCache:\r
-                       if( T::typeid != VCache::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::VertexStats:\r
-                       if( T::typeid != VertexStats::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               case QueryType::VertexTimings:\r
-                       if( T::typeid != StageTimings::typeid )\r
-                               hr = D3DERR_INVALIDCALL;\r
-                       break;\r
-\r
-               }\r
-\r
-               RECORD_D3D9( hr );\r
-\r
-               DWORD flags = flush ? D3DGETDATA_FLUSH : 0;\r
-\r
-               //get the actual data now\r
-               if( type == QueryType::Event || type == QueryType::TimestampDisjoint )\r
-               {\r
-                       //need to marshal BOOL (int) to bool\r
-                       BOOL value = FALSE;\r
-                       hr = InternalPointer->GetData( &value, sizeof(BOOL), flags );\r
-                       RECORD_D3D9( hr );\r
-                       //we know that T is a bool, but the runtime does not\r
-                       return (T) (value > 0);\r
-               }\r
-               else\r
-               {\r
-                       T data;\r
-                       hr = InternalPointer->GetData( &data, static_cast<DWORD>( sizeof(T) ), flags );\r
-                       RECORD_D3D9( hr );\r
-                       return data;\r
-               }\r
-       }\r
-}\r
-}\r