ShaderModule.cpp (1112B)
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 "ShaderModule.h" 7 8 #include "CompilationInfo.h" 9 #include "Device.h" 10 #include "ipc/WebGPUChild.h" 11 #include "mozilla/dom/Promise.h" 12 #include "mozilla/dom/WebGPUBinding.h" 13 14 namespace mozilla::webgpu { 15 16 GPU_IMPL_CYCLE_COLLECTION(ShaderModule, mParent, mCompilationInfo) 17 GPU_IMPL_JS_WRAP(ShaderModule) 18 19 ShaderModule::ShaderModule(Device* const aParent, RawId aId, 20 const RefPtr<dom::Promise>& aCompilationInfo) 21 : ObjectBase(aParent->GetChild(), aId, ffi::wgpu_client_drop_shader_module), 22 ChildOf(aParent), 23 mCompilationInfo(aCompilationInfo) {} 24 25 ShaderModule::~ShaderModule() = default; 26 27 already_AddRefed<dom::Promise> ShaderModule::GetCompilationInfo( 28 ErrorResult& aRv) { 29 RefPtr<dom::Promise> tmp = mCompilationInfo; 30 return tmp.forget(); 31 } 32 33 } // namespace mozilla::webgpu