blob: 4d0f0f2d201456ef8faf03e8d21911d59f1e3388 [file] [log] [blame]
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ShaderModuleMock.h"
namespace dawn_native {
ResultOrError<Ref<ShaderModuleMock>> ShaderModuleMock::Create(DeviceBase* device,
const char* source) {
ShaderModuleMock* mock = new ShaderModuleMock(device);
ShaderModuleWGSLDescriptor wgslDesc;
wgslDesc.source = source;
ShaderModuleDescriptor desc;
desc.nextInChain = &wgslDesc;
ShaderModuleParseResult parseResult;
DAWN_TRY(ValidateShaderModuleDescriptor(device, &desc, &parseResult, nullptr));
DAWN_TRY(mock->InitializeBase(&parseResult));
return AcquireRef(mock);
}
} // namespace dawn_native