Expand Minimize

D3DHAL_DRAWPRIMITIVES2DATA structure

The D3DHAL_DRAWPRIMITIVES2DATA structure contains the information required by the D3dDrawPrimitives2 function to render primitives.

Syntax


typedef struct _D3DHAL_DRAWPRIMITIVES2DATA {
  ULONG_PTR                 dwhContext;
  DWORD                     dwFlags;
  DWORD                     dwVertexType;
  LPDDRAWI_DDRAWSURFACE_LCL lpDDCommands;
  DWORD                     dwCommandOffset;
  DWORD                     dwCommandLength;
  union {
    LPDDRAWI_DDRAWSURFACE_LCL lpDDVertex;
    LPVOID                    lpVertices;
  };
  DWORD                     dwVertexOffset;
  DWORD                     dwVertexLength;
  DWORD                     dwReqVertexBufSize;
  DWORD                     dwReqCommandBufSize;
  LPDWORD                   lpdwRStates;
  union {
    DWORD   dwVertexSize;
    HRESULT ddrval;
  };
  DWORD                     dwErrorOffset;
} D3DHAL_DRAWPRIMITIVES2DATA, *LPD3DHAL_DRAWPRIMITIVES2DATA;

Members

dwhContext

Specifies the context handle of the Direct3D device.

dwFlags

Specifies flags that provide additional instructions to the driver or provide information from the driver. This member can be a bitwise OR of the following values:

ValueMeaning

D3DHALDP2_EXECUTEBUFFER

The command and vertex buffers were created in system memory. The driver should update the state array that lpdwRStates points to. This flag is set by Direct3D only.

D3DHALDP2_REQCOMMANDBUFSIZE

The driver must be able to increase the current command buffer by at least the size specified in dwReqCommandBufSize. Drivers that do not support multibuffering of command buffers can ignore this flag. This flag is set by Direct3D only.

D3DHALDP2_REQVERTEXBUFSIZE

The driver must be able to allocate a vertex buffer of at least the size specified in dwReqCommandBufSize. Drivers that do not support multibuffering of vertex buffers can ignore this flag. This flag is set by Direct3D only.

D3DHALDP2_SWAPCOMMANDBUFFER

The driver can swap the buffer that lpDDCommands points to with a new command buffer and return immediately, asynchronously processing the original buffer while Direct3D fills the new command buffer. Drivers that do not support multibuffering of command buffers can ignore this flag. This flag is set by Direct3D only.

D3DHALDP2_SWAPVERTEXBUFFER

The driver can swap the buffer that lpDDVertex or lpVertices points to with a new vertex buffer and return immediately, asynchronously processing the original buffer while Direct3D fills the new vertex buffer. Drivers that do not support multibuffering of vertex buffers can ignore this flag. This flag is set by Direct3D only.

D3DHALDP2_USERMEMVERTICES

The lpVertices member is valid so the driver should obtain the vertex data from the user-allocated memory that lpVertices points to. This flag is set by Direct3D only.

D3DHALDP2_VIDMEMCOMMANDBUF

The command buffer allocated by the driver as a swap buffer is not in system memory. This flag can be set by drivers that support multibuffering of command buffers.

D3DHALDP2_VIDMEMVERTEXBUF

The vertex buffer allocated by the driver as a swap buffer is not in system memory. This flag can be set by drivers that support multibuffering of vertex buffers.

 

dwVertexType

Identifies the FVF of the data in the vertex buffer; that is, dwVertexType specifies which per-vertex data fields are present in the vertex buffer that lpDDVertex or lpVertices points to. This member can be a bitwise OR of the values in the following table. Only one of the D3DFVF_TEXx flags is set.

ValueMeaning

D3DFVF_DIFFUSE

Each vertex has a diffuse color.

D3DFVF_SPECULAR

Each vertex has a specular color.

D3DFVF_TEX0

No texture coordinates are provided with the vertex data.

D3DFVF_TEX1

Each vertex has one set of texture coordinates.

D3DFVF_TEX2

Each vertex has two sets of texture coordinates.

D3DFVF_TEX3

Each vertex has three sets of texture coordinates.

D3DFVF_TEX4

Each vertex has four sets of texture coordinates.

D3DFVF_TEX5

Each vertex has five sets of texture coordinates.

D3DFVF_TEX6

Each vertex has six sets of texture coordinates.

D3DFVF_TEX7

Each vertex has seven sets of texture coordinates.

D3DFVF_TEX8

Each vertex has eight sets of texture coordinates.

D3DFVF_XYZRHW

Each vertex has x, y, z, and w coordinates. This flag is always set.

 

lpDDCommands
DirectX 8.1 and earlier versions only.
Points to the DD_SURFACE_LOCAL structure that identifies the DirectDraw surface containing the command data. The fpVidMem member of the embedded DD_SURFACE_GLOBAL structure points to the buffer that contains state change and primitive drawing commands for the driver to process. Specifically, this buffer contains one or more D3DHAL_DP2COMMAND structures, each followed by a D3DHAL_DP2Xxx structure whose exact type is identified by D3DHAL_DP2COMMAND's bCommand member.
DirectX 9.0 and later versions only.
In addition to the command-buffer functionality of DirectX 8.1 and earlier, this member can point to a response buffer that the driver returns. Specifically, this response buffer contains one or more D3DHAL_DP2RESPONSE structures, each followed by either D3DHAL_DP2RESPONSEQUERY structures or zero if the response token in the bCommand of D3DHAL_DP2RESPONSE is D3DDP2OP_RESPONSECONTINUE.
dwCommandOffset
DirectX 8.1 and earlier versions only.
Specifies the number of bytes into the surface that lpDDCommands points to and where the command data starts.
DirectX 9.0 and later versions only.
In addition to the command-offset functionality of DirectX 8.1 and earlier, can specify where the response data starts.
dwCommandLength

Specifies the number of bytes of valid command data in the surface that lpDDCommands points to starting at dwCommandOffset.

lpDDVertex

Points to the DD_SURFACE_LOCAL structure that identifies the DirectDraw surface containing the vertex data when the D3DHALDP2_USERMEMVERTICES flag is not set in dwFlags. Forms a union with lpVertices.

lpVertices

Points to a user-mode memory block containing vertex data when the D3DHALDP2_USERMEMVERTICES flag is set in dwFlags.

dwVertexOffset

Specifies the number of bytes into the surface pointed to by lpDDVertex or lpVertices where the vertex data starts.

dwVertexLength

Specifies the number of vertices for which valid data exists in the surface pointed to by lpDDVertex or lpVertices. This valid data starts at dwVertexOffset.

dwReqVertexBufSize

Specifies the minimum number of bytes that the driver must allocate for the swap vertex buffer. This member is valid only when the D3DHALDP2_REQVERTEXBUFSIZE flag is set. Drivers that do not support multibuffering of vertex buffers should ignore this member.

dwReqCommandBufSize

Specifies the minimum number of bytes that the driver must increase the swap command buffer by. This member is valid only when the D3DHALDP2_REQCOMMANDBUFSIZE flag is set. Drivers that do not support multibuffering of command buffers should ignore this member.

lpdwRStates

Points to a render state array that the driver should update when it parses render state commands from the command buffer. The driver should update this array only when the D3DHALDP2_EXECUTEBUFFER flag is set in dwFlags. The driver should use the D3DRENDERSTATETYPE enumerated types to update the appropriate element of the render state array.

dwVertexSize

Specifies the size of each vertex, in bytes. This member forms a union with ddrval.

ddrval

Specifies the location where the driver writes the return value of D3dDrawPrimitives2. D3D_OK indicates success. Otherwise, the driver should return the appropriate D3DERR_Xxx error code. For more information, see Return Codes for Direct3D Driver Callbacks.

ValueMeaning

D3D_OK

The operation completed successfully.

D3DERR_COMMAND_UNPARSED

The driver requires the Direct3D runtime to parse the execute buffer.

 

dwErrorOffset
DirectX 8.1 and earlier versions only.
Specifies the location where the driver writes the offset into the surface that lpDDCommands points to where the first unhandled D3DHAL_DP2COMMAND can be found. The driver must set this value when it returns an error condition in ddrval.
DirectX 9.0 and later versions only.
In addition to the error-offset functionality of DirectX 8.1 and earlier, the driver can specify the total size, in bytes, of the outgoing response buffer or zero if the response buffer is empty of responses. This member specifies response-buffer information only when the ddrval member is set to D3D_OK for successful completion. If this member is nonzero, it indicates that previously submitted queries using the D3DDP2OP_ISSUEQUERY operation completed and that responses to those queries are specified in D3DHAL_DP2RESPONSE and D3DHAL_DP2RESPONSEQUERY structures and available in the outgoing response buffer. Each D3DHAL_DP2RESPONSEQUERY is followed by the following data related to the query:
BOOL for D3DQUERYTYPE_EVENT
DWORD for D3DQUERYTYPE_OCCLUSION
D3DDEVINFO_VCACHE structure for D3DQUERYTYPE_VCACHE
The runtime parses the response buffer and updates its internal data structures.
If this member is zero and the ddrval member is set to D3D_OK, the runtime does not bother to check for responses to queries.

Remarks

Note that the dwVertexOffset member specifies values in bytes; the dwVertexLength member specifies values in vertices.

To calculate the valid data, in bytes, that exists in the surface at lpDDVertex or lpVertices, multiply the value in dwVertexLength by the value in dwVertexSize.

Requirements

Header

D3dhal.h (include D3dhal.h)

See also

D3dDrawPrimitives2
D3DHAL_DP2COMMAND
D3DRENDERSTATETYPE
DD_SURFACE_GLOBAL
DD_SURFACE_LOCAL

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft