This commit is contained in:
twinaphex 2020-03-03 11:08:16 +01:00
parent d5f7839d12
commit 6232e0abd3
3 changed files with 5 additions and 8 deletions

View File

@ -361,7 +361,7 @@ SlangProcess::SlangProcess()
}
}
bool glslang::compile_spirv(const char *src, Stage stage,
bool glslang::compile_spirv(const string &source, Stage stage,
std::vector<uint32_t> *spirv)
{
string msg;
@ -395,6 +395,7 @@ bool glslang::compile_spirv(const char *src, Stage stage,
}
TShader shader(language);
const char *src = source.c_str();
shader.setStrings(&src, 1);
EShMessages messages = static_cast<EShMessages>(EShMsgDefault | EShMsgVulkanRules | EShMsgSpvRules);

View File

@ -17,7 +17,7 @@ namespace glslang
StageCompute
};
bool compile_spirv(const char *src, Stage stage, std::vector<uint32_t> *spirv);
bool compile_spirv(const std::string &source, Stage stage, std::vector<uint32_t> *spirv);
}
#endif

View File

@ -215,7 +215,6 @@ bool glslang_parse_meta(const struct string_list *lines, glslang_meta *meta)
bool glslang_compile_shader(const char *shader_path, glslang_output *output)
{
#if defined(HAVE_GLSLANG)
const char *v_src, *f_src;
struct string_list *lines = string_list_new();
if (!lines)
@ -229,17 +228,14 @@ bool glslang_compile_shader(const char *shader_path, glslang_output *output)
if (!glslang_parse_meta(lines, &output->meta))
goto error;
v_src = build_stage_source(lines, "vertex").c_str();
f_src = build_stage_source(lines, "fragment").c_str();
if (!glslang::compile_spirv(v_src,
if (!glslang::compile_spirv(build_stage_source(lines, "vertex"),
glslang::StageVertex, &output->vertex))
{
RARCH_ERR("Failed to compile vertex shader stage.\n");
goto error;
}
if (!glslang::compile_spirv(f_src,
if (!glslang::compile_spirv(build_stage_source(lines, "fragment"),
glslang::StageFragment, &output->fragment))
{
RARCH_ERR("Failed to compile fragment shader stage.\n");