mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 02:08:49 +12:00
Merge pull request #1089 from vlj/gl
Store Vertex/Fragment program in a hashtable and do not rebuilt FP if a constant changes
This commit is contained in:
commit
2a6f11b390
14 changed files with 477 additions and 273 deletions
|
@ -105,10 +105,10 @@ std::string GLFragmentDecompilerThread::AddConst()
|
|||
auto data = vm::ptr<u32>::make(m_addr + m_size + 4 * sizeof(u32));
|
||||
|
||||
m_offset = 2 * 4 * sizeof(u32);
|
||||
u32 x = GetData(data[0]);
|
||||
u32 y = GetData(data[1]);
|
||||
u32 z = GetData(data[2]);
|
||||
u32 w = GetData(data[3]);
|
||||
u32 x = 0;//GetData(data[0]);
|
||||
u32 y = 0;//GetData(data[1]);
|
||||
u32 z = 0;//GetData(data[2]);
|
||||
u32 w = 0;//GetData(data[3]);
|
||||
return m_parr.AddParam(PARAM_UNIFORM, "vec4", name,
|
||||
std::string("vec4(") + std::to_string((float&)x) + ", " + std::to_string((float&)y)
|
||||
+ ", " + std::to_string((float&)z) + ", " + std::to_string((float&)w) + ")");
|
||||
|
@ -613,7 +613,7 @@ void GLFragmentDecompilerThread::Task()
|
|||
m_code_level = 1;
|
||||
m_shader = BuildCode();
|
||||
main.clear();
|
||||
m_parr.params.clear();
|
||||
// m_parr.params.clear();
|
||||
}
|
||||
|
||||
GLFragmentProgram::GLFragmentProgram()
|
||||
|
@ -673,7 +673,7 @@ void GLFragmentProgram::DecompileAsync(RSXFragmentProgram& prog)
|
|||
|
||||
void GLFragmentProgram::Compile()
|
||||
{
|
||||
if (id)
|
||||
if (id)
|
||||
{
|
||||
glDeleteShader(id);
|
||||
}
|
||||
|
@ -707,6 +707,15 @@ void GLFragmentProgram::Compile()
|
|||
LOG_NOTICE(RSX, shader.c_str()); // Log the text of the shader that failed to compile
|
||||
Emu.Pause(); // Pause the emulator, we can't really continue from here
|
||||
}
|
||||
for (const GLParamType& PT : parr.params)
|
||||
{
|
||||
if (PT.flag != PARAM_UNIFORM) continue;
|
||||
for (const GLParamItem PI : PT.items)
|
||||
{
|
||||
size_t offset = atoi(PI.name.c_str() + 2);
|
||||
FragmentConstantOffsetCache.push_back(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GLFragmentProgram::Delete()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue