Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/misc/glsl_to_spirv.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ namespace Anvil
EShLanguage get_glslang_shader_stage () const;
#else
bool bake_spirv_blob_by_spawning_glslang_process(const std::string& in_glsl_filename_with_path,
const std::string& in_spirv_filename_with_path);
const std::string& in_spirv_filename_with_path) const;
#endif

/* Private members */
Expand Down
10 changes: 8 additions & 2 deletions src/misc/glsl_to_spirv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,19 @@ bool Anvil::GLSLShaderToSPIRVGenerator::bake_spirv_blob() const
result = bake_spirv_blob_by_calling_glslang(m_glsl_source_code.c_str() );
}
}

#else
{
/* We need to point glslangvalidator at a location where it can stash the SPIR-V blob. */
result = bake_spirv_blob_by_spawning_glslang_process(glsl_filename_with_path,
"temp.spv");
}

end:
#endif



return result;
}

Expand Down Expand Up @@ -722,12 +727,13 @@ bool Anvil::GLSLShaderToSPIRVGenerator::bake_spirv_blob() const
* @return true if successful, false otherwise.
**/
bool Anvil::GLSLShaderToSPIRVGenerator::bake_spirv_blob_by_spawning_glslang_process(const std::string& in_glsl_filename_with_path,
const std::string& in_spirv_filename_with_path)
const std::string& in_spirv_filename_with_path) const
{
auto callback_arg = OnGLSLToSPIRVConversionAboutToBeStartedCallbackArgument(this);
std::string glslangvalidator_params;
bool result = false;
size_t spirv_file_size = 0;
char* spirv_blob_ptr = nullptr;

callback(GLSL_SHADER_TO_SPIRV_GENERATOR_CALLBACK_ID_CONVERSION_ABOUT_TO_START,
&callback_arg);
Expand Down Expand Up @@ -818,7 +824,7 @@ bool Anvil::GLSLShaderToSPIRVGenerator::bake_spirv_blob() const
#endif

/* Now, read the SPIR-V file contents */
char* spirv_blob_ptr = nullptr;


Anvil::IO::read_file(in_spirv_filename_with_path.c_str(),
false, /* is_text_file */
Expand Down