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_COMPUTEPIPELINE_H_ 16 #define DAWNNATIVE_COMPUTEPIPELINE_H_ 17 18 #include "common/NonCopyable.h" 19 #include "dawn_native/Forward.h" 20 #include "dawn_native/Pipeline.h" 21 22 namespace dawn_native { 23 24 class DeviceBase; 25 struct EntryPointMetadata; 26 27 MaybeError ValidateComputePipelineDescriptor(DeviceBase* device, 28 const ComputePipelineDescriptor* descriptor); 29 30 class ComputePipelineBase : public PipelineBase { 31 public: 32 ComputePipelineBase(DeviceBase* device, const ComputePipelineDescriptor* descriptor); 33 ~ComputePipelineBase() override; 34 35 static ComputePipelineBase* MakeError(DeviceBase* device); 36 37 ObjectType GetType() const override; 38 39 // Functors necessary for the unordered_set<ComputePipelineBase*>-based cache. 40 struct EqualityFunc { 41 bool operator()(const ComputePipelineBase* a, const ComputePipelineBase* b) const; 42 }; 43 44 protected: 45 // Constructor used only for mocking and testing. 46 ComputePipelineBase(DeviceBase* device); 47 void DestroyImpl() override; 48 49 private: 50 ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag); 51 }; 52 53 } // namespace dawn_native 54 55 #endif // DAWNNATIVE_COMPUTEPIPELINE_H_ 56