mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
rsx/decompilers: Avoid std::endl like the plague. It adds extra processing overhead
This commit is contained in:
parent
d7662e54cc
commit
a69f19a9ab
6 changed files with 244 additions and 244 deletions
|
|
@ -29,8 +29,8 @@ std::string VKFragmentDecompilerThread::compareFunction(COMPARE f, const std::st
|
|||
|
||||
void VKFragmentDecompilerThread::insertHeader(std::stringstream & OS)
|
||||
{
|
||||
OS << "#version 420" << std::endl;
|
||||
OS << "#extension GL_ARB_separate_shader_objects: enable" << std::endl << std::endl;
|
||||
OS << "#version 420\n";
|
||||
OS << "#extension GL_ARB_separate_shader_objects: enable\n\n";
|
||||
}
|
||||
|
||||
void VKFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
||||
|
|
@ -60,7 +60,7 @@ void VKFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
|||
if (var_name == "fogc")
|
||||
var_name = "fog_c";
|
||||
|
||||
OS << "layout(location=" << reg.reg_location << ") in " << PT.type << " " << var_name << ";" << std::endl;
|
||||
OS << "layout(location=" << reg.reg_location << ") in " << PT.type << " " << var_name << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,13 +70,13 @@ void VKFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
|||
if (m_prog.front_color_diffuse_output && m_prog.back_color_diffuse_output)
|
||||
{
|
||||
const vk::varying_register_t ® = vk::get_varying_register("front_diff_color");
|
||||
OS << "layout(location=" << reg.reg_location << ") in vec4 front_diff_color;" << std::endl;
|
||||
OS << "layout(location=" << reg.reg_location << ") in vec4 front_diff_color;\n";
|
||||
}
|
||||
|
||||
if (m_prog.front_color_specular_output && m_prog.back_color_specular_output)
|
||||
{
|
||||
const vk::varying_register_t ® = vk::get_varying_register("front_spec_color");
|
||||
OS << "layout(location=" << reg.reg_location << ") in vec4 front_spec_color;" << std::endl;
|
||||
OS << "layout(location=" << reg.reg_location << ") in vec4 front_spec_color;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ void VKFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
|
|||
for (int i = 0; i < sizeof(table) / sizeof(*table); ++i)
|
||||
{
|
||||
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", table[i].second))
|
||||
OS << "layout(location=" << std::to_string(output_index++) << ") " << "out vec4 " << table[i].first << ";" << std::endl;
|
||||
OS << "layout(location=" << std::to_string(output_index++) << ") " << "out vec4 " << table[i].first << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,12 +142,12 @@ void VKFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
|||
|
||||
inputs.push_back(in);
|
||||
|
||||
OS << "layout(set=0, binding=" << 19 + location++ << ") uniform " << samplerType << " " << PI.name << ";" << std::endl;
|
||||
OS << "layout(set=0, binding=" << 19 + location++ << ") uniform " << samplerType << " " << PI.name << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
OS << "layout(std140, set = 0, binding = 2) uniform FragmentConstantsBuffer" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << "layout(std140, set = 0, binding = 2) uniform FragmentConstantsBuffer\n";
|
||||
OS << "{\n";
|
||||
|
||||
for (const ParamType& PT : m_parr.params[PF_PARAM_UNIFORM])
|
||||
{
|
||||
|
|
@ -158,15 +158,15 @@ void VKFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
|||
continue;
|
||||
|
||||
for (const ParamItem& PI : PT.items)
|
||||
OS << " " << PT.type << " " << PI.name << ";" << std::endl;
|
||||
OS << " " << PT.type << " " << PI.name << ";\n";
|
||||
}
|
||||
|
||||
OS << " float fog_param0;" << std::endl;
|
||||
OS << " float fog_param1;" << std::endl;
|
||||
OS << " uint alpha_test;" << std::endl;
|
||||
OS << " float alpha_ref;" << std::endl;
|
||||
OS << " vec4 texture_parameters[16];" << std::endl;
|
||||
OS << "};" << std::endl;
|
||||
OS << " float fog_param0;\n";
|
||||
OS << " float fog_param1;\n";
|
||||
OS << " uint alpha_test;\n";
|
||||
OS << " float alpha_ref;\n";
|
||||
OS << " vec4 texture_parameters[16];\n";
|
||||
OS << "};\n";
|
||||
|
||||
vk::glsl::program_input in;
|
||||
in.location = 1;
|
||||
|
|
@ -250,8 +250,8 @@ void VKFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||
}
|
||||
}
|
||||
|
||||
OS << "void fs_main(" << parameters << ")" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << "void fs_main(" << parameters << ")\n";
|
||||
OS << "{\n";
|
||||
|
||||
for (const ParamType& PT : m_parr.params[PF_PARAM_NONE])
|
||||
{
|
||||
|
|
@ -264,7 +264,7 @@ void VKFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||
if (!PI.value.empty())
|
||||
OS << " = " << PI.value;
|
||||
|
||||
OS << ";" << std::endl;
|
||||
OS << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -395,10 +395,10 @@ void VKFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||
OS << make_comparison_test(m_prog.alpha_func, "bool(alpha_test) && ", first_output_name + ".a", "alpha_ref");
|
||||
}
|
||||
|
||||
OS << "}" << std::endl << std::endl;
|
||||
OS << "}\n\n";
|
||||
|
||||
OS << "void main()" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << "void main()\n";
|
||||
OS << "{\n";
|
||||
|
||||
std::string parameters = "";
|
||||
for (auto ®_name : output_values)
|
||||
|
|
@ -409,11 +409,11 @@ void VKFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||
parameters += ", ";
|
||||
|
||||
parameters += reg_name;
|
||||
OS << " vec4 " << reg_name << " = vec4(0.);" << std::endl;
|
||||
OS << " vec4 " << reg_name << " = vec4(0.);\n";
|
||||
}
|
||||
}
|
||||
|
||||
OS << std::endl << " fs_main(" + parameters + ");" << std::endl << std::endl;
|
||||
OS << "\n" << " fs_main(" + parameters + ");\n\n";
|
||||
|
||||
//Append the color output assignments
|
||||
OS << color_output_block;
|
||||
|
|
@ -426,7 +426,7 @@ void VKFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||
* but it writes depth in r1.z and not h2.z.
|
||||
* Maybe there's a different flag for depth ?
|
||||
*/
|
||||
//OS << ((m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) ? "\tgl_FragDepth = r1.z;\n" : "\tgl_FragDepth = h0.z;\n") << std::endl;
|
||||
//OS << ((m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) ? "\tgl_FragDepth = r1.z;\n" : "\tgl_FragDepth = h0.z;\n") << "\n";
|
||||
OS << " gl_FragDepth = r1.z;\n";
|
||||
}
|
||||
else
|
||||
|
|
@ -436,7 +436,7 @@ void VKFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||
}
|
||||
}
|
||||
|
||||
OS << "}" << std::endl;
|
||||
OS << "}\n";
|
||||
}
|
||||
|
||||
void VKFragmentDecompilerThread::Task()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue