ComputePipeline.cpp (1103B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "ComputePipeline.h" 7 8 #include "Device.h" 9 #include "mozilla/dom/WebGPUBinding.h" 10 11 namespace mozilla::webgpu { 12 13 GPU_IMPL_CYCLE_COLLECTION(ComputePipeline, mParent) 14 GPU_IMPL_JS_WRAP(ComputePipeline) 15 16 ComputePipeline::ComputePipeline(Device* const aParent, RawId aId) 17 : ObjectBase(aParent->GetChild(), aId, 18 ffi::wgpu_client_drop_compute_pipeline), 19 ChildOf(aParent) {} 20 21 ComputePipeline::~ComputePipeline() = default; 22 23 already_AddRefed<BindGroupLayout> ComputePipeline::GetBindGroupLayout( 24 uint32_t aIndex) const { 25 const RawId bglId = ffi::wgpu_client_compute_pipeline_get_bind_group_layout( 26 GetClient(), mParent->GetId(), GetId(), aIndex); 27 28 RefPtr<BindGroupLayout> object = new BindGroupLayout(mParent, bglId); 29 return object.forget(); 30 } 31 32 } // namespace mozilla::webgpu