Path: blob/master/thirdparty/glslang/SPIRV/GlslangToSpv.h
9913 views
//1// Copyright (C) 2014 LunarG, Inc.2// Copyright (C) 2015-2018 Google, Inc.3//4// All rights reserved.5//6// Redistribution and use in source and binary forms, with or without7// modification, are permitted provided that the following conditions8// are met:9//10// Redistributions of source code must retain the above copyright11// notice, this list of conditions and the following disclaimer.12//13// Redistributions in binary form must reproduce the above14// copyright notice, this list of conditions and the following15// disclaimer in the documentation and/or other materials provided16// with the distribution.17//18// Neither the name of 3Dlabs Inc. Ltd. nor the names of its19// contributors may be used to endorse or promote products derived20// from this software without specific prior written permission.21//22// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS25// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE26// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,27// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,28// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;29// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER30// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN32// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE33// POSSIBILITY OF SUCH DAMAGE.3435#pragma once3637#include <string>38#include <vector>3940#include "Logger.h"4142namespace glslang {43class TIntermediate;4445struct SpvOptions {46bool generateDebugInfo {false};47bool stripDebugInfo {false};48bool disableOptimizer {true};49bool optimizeSize {false};50bool disassemble {false};51bool validate {false};52bool emitNonSemanticShaderDebugInfo {false};53bool emitNonSemanticShaderDebugSource{ false };54bool compileOnly{false};55};5657void GetSpirvVersion(std::string&);58int GetSpirvGeneratorVersion();59void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,60SpvOptions* options = nullptr);61void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,62spv::SpvBuildLogger* logger, SpvOptions* options = nullptr);63bool OutputSpvBin(const std::vector<unsigned int>& spirv, const char* baseName);64bool OutputSpvHex(const std::vector<unsigned int>& spirv, const char* baseName, const char* varName);6566}676869