Merge pull request #295 from raven02/patch-32

Fragment decompiler changes to async mode
This commit is contained in:
B1ackDaemon 2014-06-01 16:16:08 +03:00
commit fea95d264f
4 changed files with 26 additions and 20 deletions

View file

@ -155,7 +155,7 @@ public:
/** /**
* Asynchronously decompile a fragment shader located in the PS3's Memory. * Asynchronously decompile a fragment shader located in the PS3's Memory.
* When this function is called you must call Wait before GetShaderText() will return valid data. * When this function is called you must call Wait() before GetShaderText() will return valid data.
* @param prog RSXShaderProgram specifying the location and size of the shader in memory * @param prog RSXShaderProgram specifying the location and size of the shader in memory
*/ */
void DecompileAsync(RSXShaderProgram& prog); void DecompileAsync(RSXShaderProgram& prog);

View file

@ -396,7 +396,8 @@ bool GLGSRender::LoadProgram()
if(m_fp_buf_num == -1) if(m_fp_buf_num == -1)
{ {
ConLog.Warning("FP not found in buffer!"); ConLog.Warning("FP not found in buffer!");
m_shader_prog.Decompile(*m_cur_shader_prog); m_shader_prog.DecompileAsync(*m_cur_shader_prog);
m_shader_prog.Wait();
m_shader_prog.Compile(); m_shader_prog.Compile();
checkForGlError("m_shader_prog.Compile"); checkForGlError("m_shader_prog.Compile");
@ -407,7 +408,7 @@ bool GLGSRender::LoadProgram()
if(m_vp_buf_num == -1) if(m_vp_buf_num == -1)
{ {
ConLog.Warning("VP not found in buffer!"); ConLog.Warning("VP not found in buffer!");
m_vertex_prog.Decompile(*m_cur_vertex_prog); m_vertex_prog.DecompileAsync(*m_cur_vertex_prog);
m_vertex_prog.Wait(); m_vertex_prog.Wait();
m_vertex_prog.Compile(); m_vertex_prog.Compile();
checkForGlError("m_vertex_prog.Compile"); checkForGlError("m_vertex_prog.Compile");

View file

@ -466,11 +466,21 @@ GLVertexProgram::~GLVertexProgram()
Delete(); Delete();
} }
void GLVertexProgram::Wait()
{
if(m_decompiler_thread && m_decompiler_thread->IsAlive())
{
m_decompiler_thread->Join();
}
}
void GLVertexProgram::Decompile(RSXVertexProgram& prog) void GLVertexProgram::Decompile(RSXVertexProgram& prog)
{ {
#if 0 GLVertexDecompilerThread(prog.data, shader, parr);
GLVertexDecompilerThread(data, shader, parr).Entry(); }
#else
void GLVertexProgram::DecompileAsync(RSXVertexProgram& prog)
{
if (m_decompiler_thread) if (m_decompiler_thread)
{ {
Wait(); Wait();
@ -485,7 +495,6 @@ void GLVertexProgram::Decompile(RSXVertexProgram& prog)
m_decompiler_thread = new GLVertexDecompilerThread(prog.data, shader, parr); m_decompiler_thread = new GLVertexDecompilerThread(prog.data, shader, parr);
m_decompiler_thread->Start(); m_decompiler_thread->Start();
#endif
} }
void GLVertexProgram::Compile() void GLVertexProgram::Compile()

View file

@ -172,10 +172,9 @@ struct GLVertexDecompilerThread : public ThreadBase
virtual void Task(); virtual void Task();
}; };
struct GLVertexProgram class GLVertexProgram
{ {
GLVertexDecompilerThread* m_decompiler_thread; public:
GLVertexProgram(); GLVertexProgram();
~GLVertexProgram(); ~GLVertexProgram();
@ -183,15 +182,12 @@ struct GLVertexProgram
u32 id; u32 id;
std::string shader; std::string shader;
void Wait()
{
if(m_decompiler_thread && m_decompiler_thread->IsAlive())
{
m_decompiler_thread->Join();
}
}
void Decompile(RSXVertexProgram& prog); void Decompile(RSXVertexProgram& prog);
void DecompileAsync(RSXVertexProgram& prog);
void Wait();
void Compile(); void Compile();
private:
GLVertexDecompilerThread* m_decompiler_thread;
void Delete(); void Delete();
}; };