mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12: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,7 +29,7 @@ std::string GLFragmentDecompilerThread::compareFunction(COMPARE f, const std::st
|
|||
|
||||
void GLFragmentDecompilerThread::insertHeader(std::stringstream & OS)
|
||||
{
|
||||
OS << "#version 420" << std::endl;
|
||||
OS << "#version 420\n";
|
||||
}
|
||||
|
||||
void GLFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
||||
|
@ -57,7 +57,7 @@ void GLFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
|||
if (var_name == "fogc")
|
||||
var_name = "fog_c";
|
||||
|
||||
OS << "in " << PT.type << " " << var_name << ";" << std::endl;
|
||||
OS << "in " << PT.type << " " << var_name << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,12 +65,12 @@ void GLFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
|||
{
|
||||
if (m_prog.front_color_diffuse_output && m_prog.back_color_diffuse_output)
|
||||
{
|
||||
OS << "in vec4 front_diff_color;" << std::endl;
|
||||
OS << "in vec4 front_diff_color;\n";
|
||||
}
|
||||
|
||||
if (m_prog.front_color_specular_output && m_prog.back_color_specular_output)
|
||||
{
|
||||
OS << "in vec4 front_spec_color;" << std::endl;
|
||||
OS << "in vec4 front_spec_color;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void GLFragmentDecompilerThread::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 << "out vec4 " << table[i].first << ";" << std::endl;
|
||||
OS << "out vec4 " << table[i].first << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,13 +120,13 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
|||
}
|
||||
}
|
||||
|
||||
OS << "uniform " << samplerType << " " << PI.name << ";" << std::endl;
|
||||
OS << "uniform " << samplerType << " " << PI.name << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
OS << std::endl;
|
||||
OS << "layout(std140, binding = 2) uniform FragmentConstantsBuffer" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << "\n";
|
||||
OS << "layout(std140, binding = 2) uniform FragmentConstantsBuffer\n";
|
||||
OS << "{\n";
|
||||
|
||||
for (const ParamType& PT : m_parr.params[PF_PARAM_UNIFORM])
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
|||
continue;
|
||||
|
||||
for (const ParamItem& PI : PT.items)
|
||||
OS << " " << PT.type << " " << PI.name << ";" << std::endl;
|
||||
OS << " " << PT.type << " " << PI.name << ";\n";
|
||||
}
|
||||
|
||||
// Fragment state parameters
|
||||
|
@ -146,7 +146,7 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
|||
OS << " uint alpha_test;\n";
|
||||
OS << " float alpha_ref;\n";
|
||||
OS << " vec4 texture_parameters[16];\n"; //sampling: x,y scaling and (unused) offsets data
|
||||
OS << "};" << std::endl;
|
||||
OS << "};\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,8 +241,8 @@ void GLFragmentDecompilerThread::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])
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||
if (!PI.value.empty())
|
||||
OS << " = " << PI.value;
|
||||
|
||||
OS << ";" << std::endl;
|
||||
OS << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,10 +397,10 @@ void GLFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||
OS << make_comparison_test(m_prog.alpha_func, "alpha_test != 0 && ", 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)
|
||||
|
@ -411,11 +411,11 @@ void GLFragmentDecompilerThread::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;
|
||||
|
@ -428,7 +428,7 @@ void GLFragmentDecompilerThread::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
|
||||
|
@ -438,7 +438,7 @@ void GLFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||
}
|
||||
}
|
||||
|
||||
OS << "}" << std::endl;
|
||||
OS << "}\n";
|
||||
}
|
||||
|
||||
void GLFragmentDecompilerThread::Task()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue