本文整理汇总了C++中TRefCountPtr::GetConstantDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ TRefCountPtr::GetConstantDesc方法的具体用法?C++ TRefCountPtr::GetConstantDesc怎么用?C++ TRefCountPtr::GetConstantDesc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRefCountPtr
的用法示例。
在下文中一共展示了TRefCountPtr::GetConstantDesc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Environment
static UBOOL D3D9CompileShaderWrapper(
const TCHAR* ShaderFilename,
const TCHAR* FunctionName,
const TCHAR* ShaderProfile,
DWORD CompileFlags,
const FShaderCompilerEnvironment& InEnvironment,
const vector<D3DXMACRO>& Macros,
FShaderCompilerOutput& Output,
vector<FD3D9ConstantDesc>& Constants,
FString& DisassemblyString,
FString& ErrorString
)
{
const FString& SourceFile = LoadShaderSourceFile(ShaderFilename);
TRefCountPtr<ID3DXBuffer> Shader;
TRefCountPtr<ID3DXBuffer> Errors;
FD3DIncludeEnvironment Environment(InEnvironment);
TRefCountPtr<ID3DXConstantTable> ConstantTable;
FTCHARToANSI AnsiSourceFile(SourceFile.c_str());
HRESULT Result = D3DXCompileShader(
AnsiSourceFile,
SourceFile.size(),
&Macros[0],
&Environment,
TCHAR_TO_ANSI(FunctionName),
TCHAR_TO_ANSI(ShaderProfile),
CompileFlags,
Shader.GetInitReference(),
Errors.GetInitReference(),
ConstantTable.GetInitReference());
if( FAILED(Result) )
{
ErrorString = TEXT("Compile Failed without warnings!");
void* ErrorBuffer = Errors ? Errors->GetBufferPointer() : NULL;
if( ErrorBuffer )
{
FANSIToTCHAR Convert((ANSICHAR*)ErrorBuffer);
ErrorString = Convert;
}
}
else
{
// get the ShaderCode
INT NumShaderBytes = Shader->GetBufferSize();
Output.ShaderCode.resize(NumShaderBytes);
appMemcpy(&Output.ShaderCode[0], Shader->GetBufferPointer(), NumShaderBytes);
// collect the constant table
D3DXCONSTANTTABLE_DESC ConstantTableDesc;
VERIFYD3DRESULT(ConstantTable->GetDesc(&ConstantTableDesc));
for(UINT ConstantIndex = 0; ConstantIndex < ConstantTableDesc.Constants; ++ConstantIndex)
{
D3DXHANDLE ConstantHandle = ConstantTable->GetConstant(NULL, ConstantIndex);
D3DXCONSTANT_DESC ConstantDesc;
UINT NumConstants = 1;
VERIFYD3DRESULT(ConstantTable->GetConstantDesc(ConstantHandle, &ConstantDesc, &NumConstants));
FD3D9ConstantDesc NamedConstantDesc;
appStrcpyANSI(NamedConstantDesc.Name, ConstantDesc.Name);
NamedConstantDesc.bIsSampler = ConstantDesc.RegisterSet == D3DXRS_SAMPLER;
NamedConstantDesc.RegisterIndex = ConstantDesc.RegisterIndex;
NamedConstantDesc.RegisterCount = ConstantDesc.RegisterCount;
Constants.push_back(NamedConstantDesc);
}
// disassemble a shader
TRefCountPtr<ID3DXBuffer> DisassemblyBuffer;
VERIFYD3DRESULT(D3DXDisassembleShader((const DWORD*)Shader->GetBufferPointer(), FALSE, NULL, DisassemblyBuffer.GetInitReference()));
DisassemblyString = ANSI_TO_TCHAR((ANSICHAR*)DisassemblyBuffer->GetBufferPointer());
}
return TRUE;
}