3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
28 #include "Direct3D10Exception.h"
\r
30 #include "EffectPass.h"
\r
31 #include "EffectPassDescription.h"
\r
32 #include "EffectPassShaderDescription.h"
\r
33 #include "EffectVariable.h"
\r
35 using namespace System;
\r
36 using namespace System::Globalization;
\r
40 namespace Direct3D10
\r
42 EffectPass::EffectPass( ID3D10EffectPass* pointer )
\r
45 throw gcnew ArgumentNullException( "pointer" );
\r
47 m_Pointer = pointer;
\r
50 EffectPass::EffectPass( IntPtr pointer )
\r
52 if( pointer == IntPtr::Zero )
\r
53 throw gcnew ArgumentNullException( "pointer" );
\r
55 m_Pointer = reinterpret_cast<ID3D10EffectPass*>( pointer.ToPointer() );
\r
58 EffectPassDescription EffectPass::Description::get()
\r
60 D3D10_PASS_DESC nativeDescription;
\r
61 if ( RECORD_D3D10( m_Pointer->GetDesc( &nativeDescription ) ).IsFailure )
\r
62 return EffectPassDescription();
\r
64 return EffectPassDescription( nativeDescription );
\r
67 bool EffectPass::IsValid::get()
\r
69 return m_Pointer->IsValid() ? true : false;
\r
72 EffectPassShaderDescription EffectPass::GeometryShaderDescription::get()
\r
74 D3D10_PASS_SHADER_DESC description;
\r
76 if( RECORD_D3D10( m_Pointer->GetGeometryShaderDesc( &description ) ).IsFailure )
\r
77 return EffectPassShaderDescription();
\r
79 return EffectPassShaderDescription( description );
\r
82 EffectPassShaderDescription EffectPass::VertexShaderDescription::get()
\r
84 D3D10_PASS_SHADER_DESC description;
\r
86 if( RECORD_D3D10( m_Pointer->GetVertexShaderDesc( &description ) ).IsFailure )
\r
87 return EffectPassShaderDescription();
\r
89 return EffectPassShaderDescription( description );
\r
92 EffectPassShaderDescription EffectPass::PixelShaderDescription::get()
\r
94 D3D10_PASS_SHADER_DESC description;
\r
96 if( RECORD_D3D10( m_Pointer->GetPixelShaderDesc( &description ) ).IsFailure )
\r
97 return EffectPassShaderDescription();
\r
99 return EffectPassShaderDescription( description );
\r
102 EffectVariable^ EffectPass::GetAnnotationByIndex( int index )
\r
104 ID3D10EffectVariable* variable = m_Pointer->GetAnnotationByIndex( index );
\r
105 if( variable == 0 )
\r
107 return gcnew EffectVariable( variable );
\r
110 EffectVariable^ EffectPass::GetAnnotationByName( String^ name )
\r
112 array<unsigned char>^ nameBytes = System::Text::ASCIIEncoding::ASCII->GetBytes( name );
\r
113 pin_ptr<unsigned char> pinnedName = &nameBytes[ 0 ];
\r
114 ID3D10EffectVariable* variable = m_Pointer->GetAnnotationByName( reinterpret_cast<LPCSTR>( pinnedName ) );
\r
115 if( variable == 0 )
\r
117 return gcnew EffectVariable( variable );
\r
120 Result EffectPass::Apply()
\r
122 return RECORD_D3D10( m_Pointer->Apply( 0 ) );
\r