Game Development Reference
In-Depth Information
ppConstantTable —Returns a pointer to an ID3DXConstant-
Table that contains the constant table data for this shader
Here is an example call of D3DXCompileShaderFromFile :
//
// Compile shader
//
ID3DXConstantTable* TransformConstantTable = 0;
ID3DXBuffer* shader = 0;
ID3DXBuffer* errorBuffer = 0;
hr = D3DXCompileShaderFromFile(
"transform.txt",
// shader filename
0,
0,
"Main",
// entry point function name
"vs_2_0",
// shader version to compile to
D3DXSHADER_DEBUG,
// debug compile
&shader,
&errorBuffer,
&TransformConstantTable);
// output any error messages
if( errorBuffer )
{
::MessageBox(0, (char*)errorBuffer->GetBufferPointer(), 0, 0);
d3d::Release<ID3DXBuffer*>(errorBuffer);
}
if(FAILED(hr))
{
::MessageBox(0, "D3DXCreateEffectFromFile() - FAILED", 0, 0);
return false;
}
16.3 Variable Types
Note: In addition to the types that are described in the following
sections, HLSL also has some built-in object types (e.g., texture object).
However, since these object types are primarily used only in the effects
framework, we defer a discussion of them until Chapter 19.
16.3.1 Scalar Types
HLSL supports the following scalar types:
bool —True or false value. Note that HLSL provides the true and
false keywords.
int —32-bit signed integer
half —16-bit floating-point number
Search WWH ::




Custom Search