ID3DXEffect::SetRawValue method

Set a contiguous range of shader constants with a memory copy.

Syntax

HRESULT SetRawValue(
  [in] D3DXHANDLE Handle,
  [in] void       *pData,
  [in] DWORD      OffsetInBytes,
  [in] DWORD      Bytes
);

Parameters

Handle [in]

Type: D3DXHANDLE

Handle to the value to set, or the name of the value passed in as a string. Passing in a handle is more efficient. See Handles (Direct3D 9).

pData [in]

Type: void*

Pointer to a buffer containing the data to be set. SetRawValue checks for valid memory, but does not do any checking for valid data.

OffsetInBytes [in]

Type: DWORD

Number of bytes between the beginning of the effect data and the beginning of the effect constants you are going to set.

Bytes [in]

Type: DWORD

The size of the buffer to be set, in bytes.

Return value

Type: HRESULT

If the method succeeds, the return value is S_OK. If the method fails, the return value can be one of the following:E_INVALIDCALL.

Remarks

SetRawValue is a very fast way to set effect constants since it performs a memory copy without performing validation or any data conversion (like converting a row-major matrix to a column-major matrix). Use SetRawValue to set a series of contiguous effect constants. For instance, you could set an array of twenty matrices with 20 calls to ID3DXBaseEffect::SetMatrix or by using a single SetRawValue.

All values are expected to be either matrix4x4s or float4s and all matrices are expected to be in column-major order. Int or float values are cast into a float4; therefore, it is highly recommended that you use SetRawValue with only float4 or matrix4x4 data.

Requirements

Requirement Value
Header
D3DX9Effect.h
Library
D3dx9.lib

See also

ID3DXEffect