(slang) slang_process.cpp: stage_mask texture semantic doesn't apply to

the size uniforms.
This commit is contained in:
aliaspider 2018-02-01 17:48:27 +01:00
parent 0aa1164a6f
commit d0b997a414

View File

@ -165,6 +165,9 @@ static bool slang_process_reflection(
while (uniform_map->data) while (uniform_map->data)
{ {
slang_semantic_meta& src = sl_reflection.semantics[uniform_map->semantic]; slang_semantic_meta& src = sl_reflection.semantics[uniform_map->semantic];
if (src.push_constant || src.uniform)
{
uniform_sem_t uniform = { uniform_map->data, uniform_map->id, uniform_sem_t uniform = { uniform_map->data, uniform_map->id,
src.num_components * (unsigned)sizeof(float) }; src.num_components * (unsigned)sizeof(float) };
@ -176,18 +179,22 @@ static bool slang_process_reflection(
uniform.offset = src.push_constant_offset; uniform.offset = src.push_constant_offset;
uniforms[SLANG_CBUFFER_PC].push_back(uniform); uniforms[SLANG_CBUFFER_PC].push_back(uniform);
} }
else if (src.uniform) else
{ {
uniform.offset = src.ubo_offset; uniform.offset = src.ubo_offset;
uniforms[SLANG_CBUFFER_UBO].push_back(uniform); uniforms[SLANG_CBUFFER_UBO].push_back(uniform);
} }
}
uniform_map++; uniform_map++;
} }
/* TODO: this is emitting more uniforms than actally needed for this pass */
for (int i = 0; i < sl_reflection.semantic_float_parameters.size(); i++) for (int i = 0; i < sl_reflection.semantic_float_parameters.size(); i++)
{ {
slang_semantic_meta& src = sl_reflection.semantic_float_parameters[i]; slang_semantic_meta& src = sl_reflection.semantic_float_parameters[i];
if (src.push_constant || src.uniform)
{
uniform_sem_t uniform = { &shader_info->parameters[i].current, uniform_sem_t uniform = { &shader_info->parameters[i].current,
"shader_info->parameter[i].current", sizeof(float) }; "shader_info->parameter[i].current", sizeof(float) };
@ -199,12 +206,13 @@ static bool slang_process_reflection(
uniform.offset = src.push_constant_offset; uniform.offset = src.push_constant_offset;
uniforms[SLANG_CBUFFER_PC].push_back(uniform); uniforms[SLANG_CBUFFER_PC].push_back(uniform);
} }
else if (src.uniform) else
{ {
uniform.offset = src.ubo_offset; uniform.offset = src.ubo_offset;
uniforms[SLANG_CBUFFER_UBO].push_back(uniform); uniforms[SLANG_CBUFFER_UBO].push_back(uniform);
} }
} }
}
texture_map_t* texture_map = semantics_map->texture_map; texture_map_t* texture_map = semantics_map->texture_map;
@ -226,7 +234,10 @@ static bool slang_process_reflection(
strncpy(texture.id, id.c_str(), sizeof(texture.id)); strncpy(texture.id, id.c_str(), sizeof(texture.id));
textures.push_back(texture); textures.push_back(texture);
}
if (src.push_constant || src.uniform)
{
uniform_sem_t uniform = { texture_map->size_data, texture_map->size_id, uniform_sem_t uniform = { texture_map->size_data, texture_map->size_id,
4 * sizeof(float) }; 4 * sizeof(float) };
@ -240,13 +251,14 @@ static bool slang_process_reflection(
uniform.offset = src.push_constant_offset; uniform.offset = src.push_constant_offset;
uniforms[SLANG_CBUFFER_PC].push_back(uniform); uniforms[SLANG_CBUFFER_PC].push_back(uniform);
} }
else if (src.uniform) else
{ {
uniform.offset = src.ubo_offset; uniform.offset = src.ubo_offset;
uniforms[SLANG_CBUFFER_UBO].push_back(uniform); uniforms[SLANG_CBUFFER_UBO].push_back(uniform);
} }
} }
} }
texture_map++; texture_map++;
} }