Exemplo n.º 1
0
 // Compiles the given source GLSL and returns a SPIR-V binary module
 // compilation result.
 // Like the first CompileGlslToSpv method but uses default options.
 SpvCompilationResult CompileGlslToSpv(const char* source_text,
                                       size_t source_text_size,
                                       shaderc_shader_kind shader_kind,
                                       const char* input_file_name) const {
     shaderc_compilation_result_t compilation_result =
         shaderc_compile_into_spv(compiler_, source_text, source_text_size,
                                  shader_kind, input_file_name, "main", nullptr);
     return SpvCompilationResult(compilation_result);
 }
Exemplo n.º 2
0
 // Compiles the given source GLSL and returns a SPIR-V binary module
 // compilation result.
 // The source_text parameter must be a valid pointer.
 // The source_text_size parameter must be the length of the source text.
 // The shader_kind parameter either forces the compilation to be done with a
 // specified shader kind, or hint the compiler how to determine the exact
 // shader kind. If the shader kind is set to shaderc_glslc_infer_from_source,
 // the compiler will try to deduce the shader kind from the source string and
 // a failure in this proess will generate an error. Currently only #pragma
 // annotation is supported. If the shader kind is set to one of the default
 // shader kinds, the compiler will fall back to the specified default shader
 // kind in case it failed to deduce the shader kind from the source string.
 // The input_file_name is a null-termintated string. It is used as a tag to
 // identify the source string in cases like emitting error messages. It
 // doesn't have to be a 'file name'.
 // The entry_point_name parameter is a null-terminated string specifying
 // the entry point name for HLSL compilation.  For GLSL compilation, the
 // entry point name is assumed to be "main".
 // The compilation is passed any options specified in the CompileOptions
 // parameter.
 // It is valid for the returned CompilationResult object to outlive this
 // compiler object.
 // Note when the options_ has disassembly mode or preprocessing only mode set
 // on, the returned CompilationResult will hold a text string, instead of a
 // SPIR-V binary generated with default options.
 SpvCompilationResult CompileGlslToSpv(const char* source_text,
                                       size_t source_text_size,
                                       shaderc_shader_kind shader_kind,
                                       const char* input_file_name,
                                       const char* entry_point_name,
                                       const CompileOptions& options) const {
   shaderc_compilation_result_t compilation_result = shaderc_compile_into_spv(
       compiler_, source_text, source_text_size, shader_kind, input_file_name,
       entry_point_name, options.options_);
   return SpvCompilationResult(compilation_result);
 }
Exemplo n.º 3
0
 // Assembles the given SPIR-V assembly and returns a SPIR-V binary module
 // compilation result.
 // Like the first AssembleToSpv method but the source is provided as a
 // std::string.
 SpvCompilationResult AssembleToSpv(const std::string& source_assembly) const {
     return SpvCompilationResult(shaderc_assemble_into_spv(
                                     compiler_, source_assembly.data(), source_assembly.size()));
 }
Exemplo n.º 4
0
 // Assembles the given SPIR-V assembly and returns a SPIR-V binary module
 // compilation result.
 // The assembly should follow the syntax defined in the SPIRV-Tools project
 // (https://github.com/KhronosGroup/SPIRV-Tools/blob/master/syntax.md).
 // It is valid for the returned CompilationResult object to outlive this
 // compiler object.
 SpvCompilationResult AssembleToSpv(const char* source_assembly,
                                    size_t source_assembly_size) const {
     return SpvCompilationResult(shaderc_assemble_into_spv(
                                     compiler_, source_assembly, source_assembly_size));
 }
Exemplo n.º 5
0
 // Assembles the given SPIR-V assembly and returns a SPIR-V binary module
 // compilation result.
 // The assembly should follow the syntax defined in the SPIRV-Tools project
 // (https://github.com/KhronosGroup/SPIRV-Tools/blob/master/syntax.md).
 // It is valid for the returned CompilationResult object to outlive this
 // compiler object.
 // The assembling will pick options suitable for assembling specified in the
 // CompileOptions parameter.
 SpvCompilationResult AssembleToSpv(const char* source_assembly,
                                    size_t source_assembly_size,
                                    const CompileOptions& options) const {
   return SpvCompilationResult(shaderc_assemble_into_spv(
       compiler_, source_assembly, source_assembly_size, options.options_));
 }