|
// Copyright (c) Microsoft Corporation. All rights reserved.
#include "stdafx.h"
#include "D3D10ShaderReflection.h"
#include "D3D10ShaderReflectionConstantBuffer.h"
using namespace Microsoft::WindowsAPICodePack::DirectX::Direct3D10;
using namespace msclr::interop;
ShaderReflectionConstantBuffer^ ShaderReflection::GetConstantBufferByIndex(UInt32 index)
{
ID3D10ShaderReflectionConstantBuffer* returnValue = GetInterface<ID3D10ShaderReflection>()->GetConstantBufferByIndex(static_cast<UINT>(index));
return returnValue == NULL ? nullptr : gcnew ShaderReflectionConstantBuffer(returnValue);
}
ShaderReflectionConstantBuffer^ ShaderReflection::GetConstantBufferByName(String^ name)
{
IntPtr ptr = Marshal::StringToHGlobalAnsi(name);
try
{
ID3D10ShaderReflectionConstantBuffer * returnValue = GetInterface<ID3D10ShaderReflection>()->GetConstantBufferByName(static_cast<char*>(ptr.ToPointer()));
return returnValue ? gcnew ShaderReflectionConstantBuffer(returnValue) : nullptr;
}
finally
{
Marshal::FreeHGlobal(ptr);
}
}
ShaderDescription ShaderReflection::Description::get()
{
D3D10_SHADER_DESC desc = {0};
CommonUtils::VerifyResult(GetInterface<ID3D10ShaderReflection>()->GetDesc(&desc));
return ShaderDescription(desc);
}
SignatureParameterDescription ShaderReflection::GetInputParameterDescription(UInt32 parameterIndex)
{
D3D10_SIGNATURE_PARAMETER_DESC desc = {0};
CommonUtils::VerifyResult(GetInterface<ID3D10ShaderReflection>()->GetInputParameterDesc(parameterIndex, &desc));
return SignatureParameterDescription(desc);
}
SignatureParameterDescription ShaderReflection::GetOutputParameterDescription(UInt32 parameterIndex)
{
D3D10_SIGNATURE_PARAMETER_DESC desc = {0};
CommonUtils::VerifyResult(GetInterface<ID3D10ShaderReflection>()->GetOutputParameterDesc(parameterIndex, &desc));
return SignatureParameterDescription(desc);
}
ShaderInputBindDescription ShaderReflection::GetResourceBindingDescription(UInt32 resourceIndex)
{
D3D10_SHADER_INPUT_BIND_DESC desc = {0};
CommonUtils::VerifyResult(GetInterface<ID3D10ShaderReflection>()->GetResourceBindingDesc(
resourceIndex, &desc));
return ShaderInputBindDescription(desc);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
John graduated from the University of South Australia in 1997 with a Bachelor of Electronic Engineering Degree, and since then he has worked on hardware and software in many fields including Aerospace, Defence, and Medical giving him over 10 of years experience in C++ and C# programming. In 2009 John Started his own contracting company doing business between Taiwan and Australia.