1// 2// Copyright 2019 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6// ShaderMtl.mm: 7// Implements the class methods for ShaderMtl. 8// 9 10#include "libANGLE/renderer/metal/ShaderMtl.h" 11 12#include "common/debug.h" 13#include "libANGLE/Context.h" 14#include "libANGLE/renderer/metal/ContextMtl.h" 15 16namespace rx 17{ 18 19ShaderMtl::ShaderMtl(const gl::ShaderState &data) : ShaderImpl(data) {} 20 21ShaderMtl::~ShaderMtl() {} 22 23std::shared_ptr<WaitableCompileEvent> ShaderMtl::compile(const gl::Context *context, 24 gl::ShCompilerInstance *compilerInstance, 25 ShCompileOptions options) 26{ 27 ShCompileOptions compileOptions = SH_INITIALIZE_UNINITIALIZED_LOCALS; 28 29 bool isWebGL = context->getExtensions().webglCompatibility; 30 if (isWebGL && mData.getShaderType() != gl::ShaderType::Compute) 31 { 32 compileOptions |= SH_INIT_OUTPUT_VARIABLES; 33 } 34 35 compileOptions |= SH_CLAMP_POINT_SIZE; 36 37 return compileImpl(context, compilerInstance, mData.getSource(), compileOptions | options); 38} 39 40std::string ShaderMtl::getDebugInfo() const 41{ 42 return mData.getTranslatedSource(); 43} 44 45} // namespace rx 46