DirectCompute

Uses your system voice; voice and rate in settings.

Snapshot

≈ 2 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Microsoft DirectCompute is an application programming interface (API) that allows executing compute kernels on GPUs. It is supported on Microsoft's Windows Vista, Windows 7 and later versions. DirectCompute is part of the Microsoft DirectX collection of APIs, and was initially released with the Direct3D 11 API but runs on graphics processing units that support either Direct3D 10 or Direct3D 11. The DirectCompute API is implemented on-top of OpenCL OpenGL and CUDA.

Microsoft DirectCompute is an application programming interface (API) that allows executing compute kernels on GPUs. It is supported on Microsoft's Windows Vista, Windows 7 and later versions. DirectCompute is part of the Microsoft DirectX collection of APIs, and was initially released with the Direct3D 11 API but runs on graphics processing units that support either Direct3D 10 or Direct3D 11. The DirectCompute API is implemented on-top of OpenCL OpenGL and CUDA. // Set the root signature CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC root_signature_desc{ 1, root_parameters, 0, nullptr }; // Serialize the root signature Microsoft::WRL::ComPtr root_signature_blob{nullptr}; Microsoft::WRL::ComPtr error_blob{nullptr}; D3DX12SerializeVersionedRootSignature( &root_signature_desc, D3D_ROOT_SIGNATURE_VERSION_1_1, root_signature_blob.GetAddressOf(), error_blob.GetAddressOf() ); // Create the root signature Microsoft::WRL::ComPtr root_signature{nullptr}; device->CreateRootSignature( 0, root_signature_blob->GetBufferPointer(), root_signature_blob->GetBufferSize(), IID_PPV_ARGS(root_signature.GetAddressOf()) ); // Read the compute shader Windows::WRL::ComPtr compute_shader{nullptr}; D3DReadFileToBlob(L"C:/path/to/compute/shader", compute_shader.GetAddressOf()); // Create the compute pipeline state object (PSO) struct PipelineStateStream { CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE root_signature; CD3DX12_PIPELINE_STATE_STREAM_CS compute_shader; } pipeline_state_stream; // Setting the root signature and the compute shader to the PSO pipeline_state_stream.root_signature = root_signature.Get(); pipeline_state_stream.compute_shader = CD3DX12_SHADER_BYTECODE{compute_shader.Get()}; D3D12_PIPELINE_STATE_STREAM_DESC pipeline_state_stream_desc{ sizeof(PipelineStateStream), &pipeline_state_stream }; // Create pipeline state device->CreatePipelineState( &pipeline_state_stream_desc, IID_PPV_ARGS(pipeline_state_stream.GetAddressOf()) ); After the initialization of the compute pipeline, every frame, the pipeline state must be set, the compute root signature must be set, and the dispatch is run. command_list->SetPipelineState(pipeline_state); command_list->SetComputeRootSignature(root_signature); command_list->Dispatch(groups_x, groups_y, groups_z); ==See also== OpenCL CUDA C++ AMP Graphics Processing Unit ==Further reading== Compute Shaders in D3D12 ==References== ==External links== Compute Shader Overview DirectCompute Lecture Series Advanced DirectX 11: DirectCompute by Example GTC On-Demand

Text derived from https://en.wikipedia.org/w/index.php?oldid=1366524861 under CC BY-SA 4.0; modifications have been made.