Export (0) Print
Expand All

ID3DX11ThreadPump interface

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

A thread pump executes tasks asynchronously. It is created by calling D3DX11CreateThreadPump. There are several APIs that take an optional thread pump as a parameter, such as D3DX11CreateTextureFromFile and D3DX11CompileFromFile; if you pass a thread pump interface into these APIs, the functions will execute asynchronously on a separate thread. Particularly on multiprocessor machines, a thread pump can load resources and process data without a noticeable decrease in performance.

Members

The ID3DX11ThreadPump interface inherits from the IUnknown interface. ID3DX11ThreadPump also has these types of members:

Methods

The ID3DX11ThreadPump interface has these methods.

MethodDescription
AddWorkItem

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Adds a work item to the thread pump.

GetQueueStatus

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Gets the number of items in each of the three queues inside the thread pump.

GetWorkItemCount

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Gets the number of work items in the thread pump.

ProcessDeviceWorkItems

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Sets work items to the device after they have finished loading and processing.

PurgeAllItems

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Clears all work items from the thread pump.

WaitForAllItems

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.

Waits for all work items in the thread pump to finish.

 

Remarks

Using a Thread Pump

The thread pump loads and processes data using the following three-step process:

  1. Load and decompress the data with a Data Loader. The data loader object has three methods that the thread pump will call internally as it is loading and decompressing the data: ID3DX11DataLoader::Load, ID3DX11DataLoader::Decompress, and ID3DX11DataLoader::Destroy. The specific functionality of these three APIs differs depending on the type of data being loaded and decompressed. The data loader interface can also be inherited and its APIs can be changed if one is loading a data file defined in one's own custom format.
  2. Process the data with a Data Processor. The data processor object has three methods that the thread pump will call internally as it is processing the data: ID3DX11DataProcessor::Process, ID3DX11DataProcessor::CreateDeviceObject, and ID3DX11DataProcessor::Destroy. The way it processes the data will be different depending on the type of data. For example, if the data is a texture stored as a JPEG, then ID3DX11DataProcessor::Process will do JPEG decompression to get the image's raw image bits. If the data is a shader, then ID3DX11DataProcessor::Process will compile the HLSL into bytecode. After the data has been processed a device object will be created for that data (with ID3DX11DataProcessor::CreateDeviceObject) and the object will be added to a queue of device objects. The data processor interface can also be inherited and its APIs can be changed if one is processing a data file defined in one's own custom format.
  3. Bind the device object to the device. This is done when one's application calls ID3DX11ThreadPump::ProcessDeviceWorkItems, which will bind a specified number of objects in the queue of device objects to the device.

The thread pump can be used to load data in one of two ways: by calling an API that takes a thread pump as a parameter, such as D3DX11CreateTextureFromFile and D3DX11CompileFromFile, or by calling ID3DX11ThreadPump::AddWorkItem. In the case of the APIs that take a thread pump, the data loader and data processor are created internally. In the case of AddWorkItem, the data loader and data processor must be created beforehand and are then passed into AddWorkItem. D3DX11 provides a set of APIs for creating data loaders and data processors that have functionality for loading and processing common data formats. For custom data formats, the data loader and data processor interfaces must be inherited and their methods must be redefined.

The thread pump object takes up a substantial amount of resources, so generally only one should be created per application.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

D3DX11core.h

Library

D3DX11.lib

See also

D3DX Interfaces

 

 

Community Additions

ADD
Show:
© 2014 Microsoft