+++ /dev/null
-/*\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 "stdafx.h"\r
-\r
-#include "D3DCompilerException.h"\r
-\r
-#include "ShaderReflectionDC.h"\r
-#include "ShaderBytecodeDC.h"\r
-\r
-using namespace System;\r
-\r
-namespace SlimDX\r
-{\r
-namespace D3DCompiler\r
-{\r
- ShaderReflection::ShaderReflection( ShaderBytecode^ byteCode )\r
- {\r
- ID3D11ShaderReflection* result = 0;\r
- HRESULT hr = D3DReflect( byteCode->InternalPointer->GetBufferPointer(), byteCode->InternalPointer->GetBufferSize(), IID_ID3D11ShaderReflection, reinterpret_cast<void**>( &result ) );\r
- if( RECORD_D3DC( hr ).IsFailure )\r
- throw gcnew D3DCompilerException( Result::Last );\r
-\r
- Construct( result );\r
-\r
- D3D11_SHADER_DESC desc;\r
- InternalPointer->GetDesc( &desc );\r
- description = gcnew ShaderDescription( desc );\r
- }\r
-\r
- ConstantBuffer^ ShaderReflection::GetConstantBuffer( int index )\r
- {\r
- return gcnew ConstantBuffer( InternalPointer->GetConstantBufferByIndex( index ) );\r
- }\r
-\r
- ConstantBuffer^ ShaderReflection::GetConstantBuffer( String^ name )\r
- {\r
- array<unsigned char>^ nameBytes = System::Text::ASCIIEncoding::ASCII->GetBytes( name );\r
- pin_ptr<unsigned char> pinnedName = &nameBytes[0];\r
-\r
- return gcnew ConstantBuffer( InternalPointer->GetConstantBufferByName( reinterpret_cast<LPCSTR>(pinnedName) ) );\r
- }\r
-\r
- ShaderParameterDescription ShaderReflection::GetInputParameterDescription( int index )\r
- {\r
- D3D11_SIGNATURE_PARAMETER_DESC desc;\r
-\r
- HRESULT hr = InternalPointer->GetInputParameterDesc( index, &desc );\r
- RECORD_D3DC( hr );\r
-\r
- return ShaderParameterDescription( desc );\r
- }\r
-\r
- ShaderParameterDescription ShaderReflection::GetOutputParameterDescription( int index )\r
- {\r
- D3D11_SIGNATURE_PARAMETER_DESC desc;\r
-\r
- HRESULT hr = InternalPointer->GetOutputParameterDesc( index, &desc );\r
- RECORD_D3DC( hr );\r
-\r
- return ShaderParameterDescription( desc );\r
- }\r
-\r
- ShaderParameterDescription ShaderReflection::GetPatchConstantParameterDescription( int index )\r
- {\r
- D3D11_SIGNATURE_PARAMETER_DESC desc;\r
-\r
- HRESULT hr = InternalPointer->GetPatchConstantParameterDesc( index, &desc );\r
- RECORD_D3DC( hr );\r
-\r
- return ShaderParameterDescription( desc );\r
- }\r
-\r
- InputBindingDescription ShaderReflection::GetResourceBindingDescription( int index )\r
- {\r
- D3D11_SHADER_INPUT_BIND_DESC desc;\r
-\r
- HRESULT hr = InternalPointer->GetResourceBindingDesc( index, &desc );\r
- RECORD_D3DC( hr );\r
-\r
- return InputBindingDescription( desc );\r
- }\r
-\r
- InputBindingDescription ShaderReflection::GetResourceBindingDescription( String^ name )\r
- {\r
- D3D11_SHADER_INPUT_BIND_DESC desc;\r
- array<unsigned char>^ nameBytes = System::Text::ASCIIEncoding::ASCII->GetBytes( name );\r
- pin_ptr<unsigned char> pinnedName = &nameBytes[0];\r
-\r
- HRESULT hr = InternalPointer->GetResourceBindingDescByName( reinterpret_cast<LPCSTR>(pinnedName), &desc );\r
- RECORD_D3DC( hr );\r
-\r
- return InputBindingDescription( desc );\r
- }\r
-\r
- Direct3D11::FeatureLevel ShaderReflection::MinimumFeatureLevel::get()\r
- {\r
- D3D_FEATURE_LEVEL fl;\r
- InternalPointer->GetMinFeatureLevel( &fl );\r
-\r
- return static_cast<Direct3D11::FeatureLevel>( fl );\r
- }\r
-\r
- InputPrimitive ShaderReflection::GeometryShaderInputPrimitive::get()\r
- {\r
- return static_cast<InputPrimitive>( InternalPointer->GetGSInputPrimitive() );\r
- }\r
- \r
- int ShaderReflection::BitwiseInstructionCount::get()\r
- {\r
- return InternalPointer->GetBitwiseInstructionCount();\r
- }\r
- \r
- int ShaderReflection::ConversionInstructionCount::get()\r
- {\r
- return InternalPointer->GetConversionInstructionCount();\r
- }\r
- \r
- int ShaderReflection::MoveInstructionCount::get()\r
- {\r
- return InternalPointer->GetMovInstructionCount();\r
- }\r
- \r
- int ShaderReflection::ConditionalMoveInstructionCount::get()\r
- {\r
- return InternalPointer->GetMovcInstructionCount() ;\r
- }\r
- \r
- int ShaderReflection::InterfaceSlotCount::get()\r
- {\r
- return InternalPointer->GetNumInterfaceSlots();\r
- }\r
- \r
- bool ShaderReflection::IsSampleFrequencyShader::get()\r
- {\r
- return InternalPointer->IsSampleFrequencyShader() > 0;\r
- }\r
-}\r
-}
\ No newline at end of file