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 #include "dawn_native/opengl/ComputePipelineGL.h" 16 17 #include "dawn_native/opengl/DeviceGL.h" 18 19 namespace dawn_native { namespace opengl { 20 21 // static CreateUninitialized(Device * device,const ComputePipelineDescriptor * descriptor)22 Ref<ComputePipeline> ComputePipeline::CreateUninitialized( 23 Device* device, 24 const ComputePipelineDescriptor* descriptor) { 25 return AcquireRef(new ComputePipeline(device, descriptor)); 26 } 27 28 ComputePipeline::~ComputePipeline() = default; 29 DestroyImpl()30 void ComputePipeline::DestroyImpl() { 31 ComputePipelineBase::DestroyImpl(); 32 DeleteProgram(ToBackend(GetDevice())->gl); 33 } 34 Initialize()35 MaybeError ComputePipeline::Initialize() { 36 DAWN_TRY( 37 InitializeBase(ToBackend(GetDevice())->gl, ToBackend(GetLayout()), GetAllStages())); 38 return {}; 39 } 40 ApplyNow()41 void ComputePipeline::ApplyNow() { 42 PipelineGL::ApplyNow(ToBackend(GetDevice())->gl); 43 } 44 45 }} // namespace dawn_native::opengl 46