mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 06:55:09 +00:00
gl: cleanup; fix program linkage on mesa using GL_ARB_explicit_uniform_location, also make use of ARB_multidraw
This commit is contained in:
parent
061824a7ec
commit
07c83f6e44
6 changed files with 130 additions and 103 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include "GLCommonDecompiler.h"
|
||||
#include "../GCM.h"
|
||||
|
||||
|
||||
std::string GLFragmentDecompilerThread::getFloatTypeName(size_t elementCount)
|
||||
{
|
||||
return glsl::getFloatTypeNameImpl(elementCount);
|
||||
|
|
@ -14,7 +15,7 @@ std::string GLFragmentDecompilerThread::getFloatTypeName(size_t elementCount)
|
|||
|
||||
std::string GLFragmentDecompilerThread::getFunction(FUNCTION f)
|
||||
{
|
||||
return getFunctionImpl(f);
|
||||
return gl::getFunctionImpl(f);
|
||||
}
|
||||
|
||||
std::string GLFragmentDecompilerThread::saturate(const std::string & code)
|
||||
|
|
@ -35,6 +36,7 @@ void GLFragmentDecompilerThread::insertHeader(std::stringstream & OS)
|
|||
void GLFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
||||
{
|
||||
bool two_sided_enabled = m_prog.front_back_color_enabled && (m_prog.back_color_diffuse_output || m_prog.back_color_specular_output);
|
||||
std::vector<std::string> inputs_to_declare;
|
||||
|
||||
for (const ParamType& PT : m_parr.params[PF_PARAM_IN])
|
||||
{
|
||||
|
|
@ -57,7 +59,7 @@ void GLFragmentDecompilerThread::insertIntputs(std::stringstream & OS)
|
|||
if (var_name == "fogc")
|
||||
var_name = "fog_c";
|
||||
|
||||
OS << "in " << PT.type << " " << var_name << ";\n";
|
||||
inputs_to_declare.push_back(var_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,14 +67,19 @@ 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;\n";
|
||||
inputs_to_declare.push_back("front_diff_color");
|
||||
}
|
||||
|
||||
if (m_prog.front_color_specular_output && m_prog.back_color_specular_output)
|
||||
{
|
||||
OS << "in vec4 front_spec_color;\n";
|
||||
inputs_to_declare.push_back("front_spec_color");
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &name: inputs_to_declare)
|
||||
{
|
||||
OS << "layout(location=" << gl::get_varying_register_location(name) << ") in vec4 " << name << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
void GLFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
|
||||
|
|
@ -225,7 +232,6 @@ void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||
}
|
||||
}
|
||||
|
||||
OS << "//FP_HASH=" << fmt::format("%llX", program_hash_util::fragment_program_hash()(m_prog)) << "\n";
|
||||
OS << "void fs_main(" << parameters << ")\n";
|
||||
OS << "{\n";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue