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 "dawn_native/Pipeline.h" 19 20 namespace dawn_native { 21 22 class DeviceBase; 23 struct EntryPointMetadata; 24 25 MaybeError ValidateComputePipelineDescriptor(DeviceBase* device, 26 const ComputePipelineDescriptor* descriptor); 27 28 class ComputePipelineBase : public PipelineBase { 29 public: 30 ComputePipelineBase(DeviceBase* device, const ComputePipelineDescriptor* descriptor); 31 ~ComputePipelineBase() override; 32 33 static ComputePipelineBase* MakeError(DeviceBase* device); 34 35 const EntryPointMetadata& GetMetadata() const; 36 37 // Functors necessary for the unordered_set<ComputePipelineBase*>-based cache. 38 struct HashFunc { 39 size_t operator()(const ComputePipelineBase* pipeline) const; 40 }; 41 struct EqualityFunc { 42 bool operator()(const ComputePipelineBase* a, const ComputePipelineBase* b) const; 43 }; 44 45 private: 46 ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag); 47 }; 48 49 } // namespace dawn_native 50 51 #endif // DAWNNATIVE_COMPUTEPIPELINE_H_ 52