1 // Copyright 2017 The Dawn Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef DAWNNATIVE_D3D12_COMPUTEPIPELINED3D12_H_ 16 #define DAWNNATIVE_D3D12_COMPUTEPIPELINED3D12_H_ 17 18 #include "dawn_native/ComputePipeline.h" 19 20 #include "dawn_native/d3d12/d3d12_platform.h" 21 22 namespace dawn_native { namespace d3d12 { 23 24 class Device; 25 26 class ComputePipeline final : public ComputePipelineBase { 27 public: 28 static Ref<ComputePipeline> CreateUninitialized( 29 Device* device, 30 const ComputePipelineDescriptor* descriptor); 31 static void InitializeAsync(Ref<ComputePipelineBase> computePipeline, 32 WGPUCreateComputePipelineAsyncCallback callback, 33 void* userdata); 34 ComputePipeline() = delete; 35 36 ID3D12PipelineState* GetPipelineState() const; 37 38 MaybeError Initialize() override; 39 40 // Dawn API 41 void SetLabelImpl() override; 42 43 bool UsesNumWorkgroups() const; 44 45 ComPtr<ID3D12CommandSignature> GetDispatchIndirectCommandSignature(); 46 47 private: 48 ~ComputePipeline() override; 49 50 void DestroyImpl() override; 51 52 using ComputePipelineBase::ComputePipelineBase; 53 ComPtr<ID3D12PipelineState> mPipelineState; 54 }; 55 56 }} // namespace dawn_native::d3d12 57 58 #endif // DAWNNATIVE_D3D12_COMPUTEPIPELINED3D12_H_ 59