(shader_slang.cpp) Simplify usage of functions that are only

ever used as C-strings
This commit is contained in:
twinaphex 2020-02-01 07:04:27 +01:00
parent ca83be1db4
commit d89fb0e7c4

View File

@ -214,10 +214,10 @@ static bool slang_process_reflection(
uniform_sem_t uniform = { map->uniforms[semantic],
src.num_components
* (unsigned)sizeof(float) };
string uniform_id = get_semantic_name(
sl_reflection, (slang_semantic)semantic, 0);
const char *uniform_id = get_semantic_name(
sl_reflection, (slang_semantic)semantic, 0).c_str();
strlcpy(uniform.id, uniform_id.c_str(), sizeof(uniform.id));
strlcpy(uniform.id, uniform_id, sizeof(uniform.id));
if (src.push_constant)
{
@ -241,9 +241,9 @@ static bool slang_process_reflection(
uniform_sem_t uniform = {
&shader_info->parameters[i].current, sizeof(float) };
string uniform_id = get_semantic_name(
sl_reflection, SLANG_SEMANTIC_FLOAT_PARAMETER, i);
strlcpy(uniform.id, uniform_id.c_str(), sizeof(uniform.id));
const char *uniform_id = get_semantic_name(
sl_reflection, SLANG_SEMANTIC_FLOAT_PARAMETER, i).c_str();
strlcpy(uniform.id, uniform_id, sizeof(uniform.id));
if (src.push_constant)
{
@ -309,12 +309,12 @@ static bool slang_process_reflection(
4 * sizeof(float)
};
string uniform_id =
const char *uniform_id =
get_size_semantic_name(
sl_reflection,
(slang_texture_semantic)semantic, index);
(slang_texture_semantic)semantic, index).c_str();
strlcpy(uniform.id, uniform_id.c_str(), sizeof(uniform.id));
strlcpy(uniform.id, uniform_id, sizeof(uniform.id));
if (src.push_constant)
{