OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d9 / TextureShader.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/direct3d9/TextureShader.cpp b/SlimDXc_Jun2010(VC++2008)/source/direct3d9/TextureShader.cpp
deleted file mode 100644 (file)
index a7bd979..0000000
+++ /dev/null
@@ -1,305 +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 "../stack_array.h"\r
-#include "../DataStream.h"\r
-#include "../ComObject.h"\r
-#include "../Utilities.h"\r
-\r
-#include "Direct3D9Exception.h"\r
-\r
-#include "Device.h"\r
-#include "D3DX.h"\r
-#include "Effect9.h"\r
-#include "ConstantTable.h"\r
-#include "TextureShader.h"\r
-\r
-using namespace System;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D9\r
-{\r
-       TextureShader::TextureShader( DataStream^ stream )\r
-       {\r
-               ID3DXTextureShader *result;\r
-\r
-               HRESULT hr = D3DXCreateTextureShader( reinterpret_cast<const DWORD*>( stream->PositionPointer ), &result );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       throw gcnew Direct3D9Exception( Result::Last );\r
-\r
-               Construct(result);\r
-       }\r
-\r
-       EffectHandle^ TextureShader::GetConstant(SlimDX::Direct3D9::EffectHandle ^handle, int index)\r
-       {\r
-               D3DXHANDLE parentHandle = handle != nullptr ? handle->InternalHandle : NULL;\r
-               D3DXHANDLE result = InternalPointer->GetConstant( parentHandle, index );\r
-               GC::KeepAlive( handle );\r
-               \r
-               if( result == NULL )\r
-                       return nullptr;\r
-               return gcnew EffectHandle( result );\r
-       }\r
-       \r
-       EffectHandle^ TextureShader::GetConstant(SlimDX::Direct3D9::EffectHandle ^handle, String^ name )\r
-       {\r
-               array<unsigned char>^ rawName = System::Text::ASCIIEncoding::ASCII->GetBytes( name );\r
-               pin_ptr<unsigned char> pinnedName = &rawName[0];\r
-               \r
-               D3DXHANDLE parentHandle = handle != nullptr ? handle->InternalHandle : NULL;\r
-               D3DXHANDLE result = InternalPointer->GetConstantByName( parentHandle, reinterpret_cast<const char*>( pinnedName ) );\r
-               GC::KeepAlive( handle );\r
-               \r
-               if( result == NULL )\r
-                       return nullptr;\r
-               return gcnew EffectHandle( result );\r
-       }\r
-       \r
-       EffectHandle^ TextureShader::GetConstantElement( EffectHandle^ handle, int index )\r
-       {\r
-               D3DXHANDLE parentHandle = handle != nullptr ? handle->InternalHandle : NULL;\r
-               D3DXHANDLE result = InternalPointer->GetConstantElement( parentHandle, index );\r
-               GC::KeepAlive( handle );\r
-               \r
-               if( result == NULL )\r
-                       return nullptr;\r
-               return gcnew EffectHandle( result );\r
-       }\r
-\r
-       ConstantDescription TextureShader::GetConstantDescription( EffectHandle^ handle )\r
-       {\r
-               D3DXCONSTANT_DESC nativeDesc;\r
-               ConstantDescription description;\r
-\r
-               D3DXHANDLE nativeHandle = handle != nullptr ? handle->InternalHandle : NULL;\r
-               unsigned int count = 1;\r
-\r
-               HRESULT hr = InternalPointer->GetConstantDesc( nativeHandle, &nativeDesc, &count );\r
-               GC::KeepAlive( handle );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       return description;\r
-\r
-               description.Initialize( nativeDesc );\r
-               return description;\r
-       }\r
-\r
-       array<ConstantDescription>^ TextureShader::GetConstantDescriptionArray( EffectHandle^ handle )\r
-       {\r
-               D3DXHANDLE nativeHandle = handle != nullptr ? handle->InternalHandle : NULL;\r
-               unsigned int count = 0;\r
-\r
-               HRESULT hr = InternalPointer->GetConstantDesc( nativeHandle, NULL, &count );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       return nullptr;\r
-\r
-               stack_array<D3DXCONSTANT_DESC> nativeDescArray = stackalloc( D3DXCONSTANT_DESC, count );\r
-               hr = InternalPointer->GetConstantDesc( nativeHandle, &nativeDescArray[0], &count );\r
-               GC::KeepAlive( handle );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       return nullptr;\r
-\r
-               array<ConstantDescription>^ descArray = gcnew array<ConstantDescription>( count );\r
-               for( unsigned int i = 0; i < count; ++i )\r
-               {\r
-                       descArray[i].Initialize( nativeDescArray[i] );\r
-               }\r
-\r
-               return descArray;\r
-       }\r
-\r
-       DataStream^ TextureShader::ConstantBuffer::get()\r
-       {\r
-               ID3DXBuffer *result = NULL;\r
-               HRESULT hr = InternalPointer->GetConstantBuffer( &result );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       return nullptr;\r
-\r
-               return gcnew DataStream( result );\r
-       }\r
-\r
-       DataStream^ TextureShader::FunctionStream::get()\r
-       {\r
-               ID3DXBuffer *result = NULL;\r
-               HRESULT hr = InternalPointer->GetFunction( &result );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       return nullptr;\r
-\r
-               return gcnew DataStream( result );\r
-       }\r
-\r
-       Result TextureShader::SetDefaults()\r
-       {\r
-               HRESULT hr = InternalPointer->SetDefaults();\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, bool value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetBool( handle, value );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ parameter, array<bool>^ values )\r
-       {\r
-               //implementing set for bool array is REALLY ANNOYING.\r
-               //Win32 uses BOOL, which is an int\r
-               array<BOOL>^ expandedArray = gcnew array<BOOL>( values->Length );\r
-               Array::Copy( values, expandedArray, values->Length );\r
-\r
-               D3DXHANDLE handle = parameter != nullptr ? parameter->InternalHandle : NULL;\r
-               pin_ptr<BOOL> pinnedValue = &expandedArray[0];\r
-               HRESULT hr = InternalPointer->SetBoolArray( handle, pinnedValue, values->Length );\r
-               GC::KeepAlive( parameter );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, int value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetInt( handle, value );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, array<int>^ values )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               pin_ptr<int> pinned_value = &values[0];\r
-               HRESULT hr = InternalPointer->SetIntArray( handle, pinned_value, values->Length );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, float value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetFloat( handle, value );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, array<float>^ values )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               pin_ptr<float> pinned_values = &values[0];\r
-               HRESULT hr = InternalPointer->SetFloatArray( handle, pinned_values, values->Length );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, Vector4 value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetVector( handle, reinterpret_cast<const D3DXVECTOR4*>( &value ) );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, array<Vector4>^ values )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               pin_ptr<Vector4> pinned_value = &values[0];\r
-               HRESULT hr = InternalPointer->SetVectorArray( handle, reinterpret_cast<const D3DXVECTOR4*>( pinned_value ), values->Length );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, Color4 value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetVector( handle, reinterpret_cast<const D3DXVECTOR4*>( &value ) );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, array<Color4>^ values )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               pin_ptr<Color4> pinned_value = &values[0];\r
-               HRESULT hr = InternalPointer->SetVectorArray( handle, reinterpret_cast<const D3DXVECTOR4*>( pinned_value ), values->Length );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, Matrix value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetMatrix( handle, reinterpret_cast<const D3DXMATRIX*>( &value ) );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValue( EffectHandle^ constant, array<Matrix>^ values )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               pin_ptr<Matrix> pinned_value = &values[0];\r
-               HRESULT hr = InternalPointer->SetMatrixArray( handle, reinterpret_cast<const D3DXMATRIX*>( pinned_value ), values->Length );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValueTranspose( EffectHandle^ constant, Matrix value )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               HRESULT hr = InternalPointer->SetMatrixTranspose( handle, reinterpret_cast<const D3DXMATRIX*>( &value ) );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       Result TextureShader::SetValueTranspose( EffectHandle^ constant, array<Matrix>^ values )\r
-       {\r
-               D3DXHANDLE handle = constant != nullptr ? constant->InternalHandle : NULL;\r
-               pin_ptr<Matrix> pinned_value = &values[0];\r
-               HRESULT hr = InternalPointer->SetMatrixTransposeArray( handle, reinterpret_cast<const D3DXMATRIX*>( pinned_value ), values->Length );\r
-               GC::KeepAlive( constant );\r
-               return RECORD_D3D9( hr );\r
-       }\r
-\r
-       ConstantTableDescription TextureShader::Description::get()\r
-       {\r
-               D3DXCONSTANTTABLE_DESC nativeDesc;\r
-               ConstantTableDescription description;\r
-\r
-               HRESULT hr = InternalPointer->GetDesc( &nativeDesc );\r
-               \r
-               if( RECORD_D3D9(hr).IsFailure )\r
-                       return description;\r
-\r
-               description.Creator = gcnew String( nativeDesc.Creator );\r
-               description.Version = gcnew Version( D3DSHADER_VERSION_MAJOR( nativeDesc.Version ), D3DSHADER_VERSION_MINOR( nativeDesc.Version ) );\r
-               description.Constants = nativeDesc.Constants;\r
-               return description;\r
-       }\r
-}\r
-}
\ No newline at end of file