gsdx-debug: add more push/pop debug group on the init

This commit is contained in:
Gregory Hainaut 2015-10-24 14:09:21 +02:00
parent 9ba949c2d9
commit 5cbd0cf42a
2 changed files with 51 additions and 4 deletions

View File

@ -214,6 +214,8 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
// ****************************************************************
// Various object
// ****************************************************************
GL_PUSH("GSDeviceOGL::Various");
m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0));
glGenFramebuffers(1, &m_fbo);
@ -229,9 +231,13 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
GL_POP();
// ****************************************************************
// Vertex buffer state
// ****************************************************************
GL_PUSH("GSDeviceOGL::Vertex Buffer");
ASSERT(sizeof(GSVertexPT1) == sizeof(GSVertex));
GSInputLayoutOGL il_convert[] =
{
@ -246,16 +252,23 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
};
m_va = new GSVertexBufferStateOGL(sizeof(GSVertexPT1), il_convert, countof(il_convert));
GL_POP();
// ****************************************************************
// Pre Generate the different sampler object
// ****************************************************************
GL_PUSH("GSDeviceOGL::Sampler");
for (uint32 key = 0; key < countof(m_ps_ss); key++) {
m_ps_ss[key] = CreateSampler(PSSamplerSelector(key));
}
GL_POP();
// ****************************************************************
// convert
// ****************************************************************
GL_PUSH("GSDeviceOGL::Convert");
m_convert.cb = new GSUniformBufferOGL(g_convert_index, sizeof(ConvertConstantBuffer));
// Upload once and forget about it
ConvertConstantBuffer cb;
@ -278,24 +291,37 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
m_convert.dss_write->EnableDepth();
m_convert.dss_write->SetDepth(GL_ALWAYS, true);
GL_POP();
// ****************************************************************
// merge
// ****************************************************************
GL_PUSH("GSDeviceOGL::Merge");
m_merge_obj.cb = new GSUniformBufferOGL(g_merge_cb_index, sizeof(MergeConstantBuffer));
for(size_t i = 0; i < countof(m_merge_obj.ps); i++)
m_merge_obj.ps[i] = m_shader->Compile("merge.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, merge_glsl);
GL_POP();
// ****************************************************************
// interlace
// ****************************************************************
GL_PUSH("GSDeviceOGL::Interlace");
m_interlace.cb = new GSUniformBufferOGL(g_interlace_cb_index, sizeof(InterlaceConstantBuffer));
for(size_t i = 0; i < countof(m_interlace.ps); i++)
m_interlace.ps[i] = m_shader->Compile("interlace.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, interlace_glsl);
GL_POP();
// ****************************************************************
// Shade boost
// ****************************************************************
GL_PUSH("GSDeviceOGL::Shadeboost");
m_shadeboost.cb = new GSUniformBufferOGL(g_shadeboost_cb_index, sizeof(ShadeBoostConstantBuffer));
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
@ -307,9 +333,13 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
m_shadeboost.ps = m_shader->Compile("shadeboost.glsl", "ps_main", GL_FRAGMENT_SHADER, shadeboost_glsl, shade_macro);
GL_POP();
// ****************************************************************
// rasterization configuration
// ****************************************************************
GL_PUSH("GSDeviceOGL::Rasterization");
#ifdef ONLY_LINES
glLineWidth(5.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@ -321,14 +351,18 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
glDisable(GL_MULTISAMPLE);
glDisable(GL_DITHER); // Honestly I don't know!
GL_POP();
// ****************************************************************
// DATE
// ****************************************************************
GL_PUSH("GSDeviceOGL::Date");
m_date.dss = new GSDepthStencilOGL();
m_date.dss->EnableStencil();
m_date.dss->SetStencil(GL_ALWAYS, GL_REPLACE);
GL_POP();
// ****************************************************************
// Use DX coordinate convention
// ****************************************************************
@ -347,15 +381,24 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
// ****************************************************************
// HW renderer shader
// ****************************************************************
GL_PUSH("GSDeviceOGL::CreateTextureFX");
CreateTextureFX();
GL_POP();
// ****************************************************************
// Pbo Pool allocation
// ****************************************************************
GL_PUSH("GSDeviceOGL::PBO");
PboPool::Init();
GL_POP();
// Done !
GL_POP();
// ****************************************************************
// Finish window setup and backbuffer
// ****************************************************************

View File

@ -29,8 +29,6 @@ static const uint32 g_gs_cb_index = 22;
void GSDeviceOGL::CreateTextureFX()
{
GL_PUSH("CreateTextureFX");
m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));
@ -40,6 +38,8 @@ void GSDeviceOGL::CreateTextureFX()
// Pre compile all Geometry & Vertex Shader
// It might cost a seconds at startup but it would reduce benchmark pollution
GL_PUSH("Compile GS");
for (uint32 key = 0; key < countof(m_gs); key++) {
GSSelector sel(key);
if (sel.point == sel.sprite)
@ -48,6 +48,10 @@ void GSDeviceOGL::CreateTextureFX()
m_gs[key] = CompileGS(GSSelector(key));
}
GL_POP();
GL_PUSH("Compile VS");
for (uint32 key = 0; key < countof(m_vs); key++) {
// wildhack is only useful if both TME and FST are enabled.
VSSelector sel(key);
@ -57,6 +61,8 @@ void GSDeviceOGL::CreateTextureFX()
m_vs[key] = CompileVS(sel, !GLLoader::found_GL_ARB_clip_control);
}
GL_POP();
// Enable all bits for stencil operations. Technically 1 bit is
// enough but buffer is polluted with noise. Clear will be limited
// to the mask.
@ -67,8 +73,6 @@ void GSDeviceOGL::CreateTextureFX()
// Help to debug FS in apitrace
m_apitrace = CompilePS(PSSelector());
GL_POP();
}
GSDepthStencilOGL* GSDeviceOGL::CreateDepthStencil(OMDepthStencilSelector dssel)