Program Listing for File shader-utilities.h

Return to documentation for file (include\shader-utilities\shader-utilities.h)

/******************************************************************************
© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.


 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once

#include "api-types/api-types.h"
#include "api-types/managed-structures.h"

#include <cstdint>
#include <sstream>
#include <string>
#include <vector>

namespace gpa {
namespace shader_utilities {

void EnableGLSLCompiler();

void DisableGLSLCompiler();

bool CompileFromSPIRV(
    api_types::ShaderLanguage sourceLanguage,
    std::vector<uint32_t> const* spirv,
    api_types::ManagedShaderSource& result);

void CompileToSPIRV(
    api_types::ShaderStageFlagBits stage,
    api_types::ShaderLanguage language,
    std::string const& shaderCode,
    std::vector<uint32_t>* spirv,
    std::string* infoLog,
    std::string* debugLog);

bool GetReadableSPIRVfromBinarySPIRV(void* spirv, size_t binarySize, std::string& readableSPIRV);

std::string GetGLSLFromSPIRV(std::vector<uint32_t> const& spirv);

bool GetBinarySPIRVfromReadableSPIRV(
    std::string const& readableSPIRV,
    std::vector<uint32_t>& spirv);

std::string ColorToOutputGLSL(
    std::string const& outputValueTypeStr,
    std::string const& ouptutValueComponentTypeStr,
    uint32_t outputValueComponentCount,
    api_types::Color const& color);

void CreateUnrolledOutputsGLSL(
    std::string const& outputValueTypeStr,
    std::string const& ouptutValueComponentTypeStr,
    uint32_t outputValueComponentCount,
    std::string const& outputValueName,
    std::string const& currentStr,
    api_types::Color const& color,
    size_t arraySizesCount,
    uint32_t* pArraySizes,
    std::stringstream& strStr);

}  // namespace shader_utilities
}  // namespace gpa