gsdx debug: auto GL_POP

Nicer and exception safe

V2: miss definition of vs/ps
This commit is contained in:
Gregory Hainaut 2016-05-05 17:42:22 +02:00
parent 37c7fa7663
commit d58b71688b
8 changed files with 142 additions and 193 deletions

View File

@ -121,8 +121,6 @@ void GSDevice::Present(const GSVector4i& r, int shader)
}
Flip();
GL_POP();
}
void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader)

View File

@ -133,8 +133,6 @@ GSDeviceOGL::~GSDeviceOGL()
// Must be done after the destruction of all shader/program objects
delete m_shader;
m_shader = NULL;
GL_POP();
}
GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int fmt)
@ -157,7 +155,6 @@ GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int fmt
break;
}
GL_POP();
return t;
}
@ -197,163 +194,165 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
// ****************************************************************
// Various object
// ****************************************************************
GL_PUSH("GSDeviceOGL::Various");
{
GL_PUSH("GSDeviceOGL::Various");
m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0));
m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0));
glGenFramebuffers(1, &m_fbo);
// Always write to the first buffer
OMSetFBO(m_fbo);
GLenum target[1] = {GL_COLOR_ATTACHMENT0};
glDrawBuffers(1, target);
OMSetFBO(0);
glGenFramebuffers(1, &m_fbo);
// Always write to the first buffer
OMSetFBO(m_fbo);
GLenum target[1] = {GL_COLOR_ATTACHMENT0};
glDrawBuffers(1, target);
OMSetFBO(0);
glGenFramebuffers(1, &m_fbo_read);
// Always read from the first buffer
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo_read);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
GL_POP();
glGenFramebuffers(1, &m_fbo_read);
// Always read from the first buffer
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo_read);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
}
// ****************************************************************
// Vertex buffer state
// ****************************************************************
GL_PUSH("GSDeviceOGL::Vertex Buffer");
ASSERT(sizeof(GSVertexPT1) == sizeof(GSVertex));
GSInputLayoutOGL il_convert[] =
{
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(0) } ,
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(16) } ,
{4 , GL_UNSIGNED_BYTE , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(8) } ,
{1 , GL_FLOAT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(12) } ,
{2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(16) } ,
{1 , GL_UNSIGNED_INT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(20) } ,
{2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(24) } ,
{4 , GL_UNSIGNED_BYTE , GL_TRUE , sizeof(GSVertex) , (const GLvoid*)(28) } , // Only 1 byte is useful but hardware unit only support 4B
};
m_va = new GSVertexBufferStateOGL(il_convert, countof(il_convert));
GL_PUSH("GSDeviceOGL::Vertex Buffer");
ASSERT(sizeof(GSVertexPT1) == sizeof(GSVertex));
GSInputLayoutOGL il_convert[] =
{
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(0) } ,
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(16) } ,
{4 , GL_UNSIGNED_BYTE , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(8) } ,
{1 , GL_FLOAT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(12) } ,
{2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(16) } ,
{1 , GL_UNSIGNED_INT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(20) } ,
{2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(24) } ,
{4 , GL_UNSIGNED_BYTE , GL_TRUE , sizeof(GSVertex) , (const GLvoid*)(28) } , // Only 1 byte is useful but hardware unit only support 4B
};
m_va = new GSVertexBufferStateOGL(il_convert, countof(il_convert));
}
GL_POP();
// ****************************************************************
// Pre Generate the different sampler object
// ****************************************************************
GL_PUSH("GSDeviceOGL::Sampler");
{
GL_PUSH("GSDeviceOGL::Sampler");
for (uint32 key = 0; key < countof(m_ps_ss); key++) {
m_ps_ss[key] = CreateSampler(PSSamplerSelector(key));
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;
cb.ScalingFactor = GSVector4i(theApp.GetConfig("upscale_multiplier", 1));
m_convert.cb->upload(&cb);
GLuint vs = m_shader->Compile("convert.glsl", "vs_main", GL_VERTEX_SHADER, convert_glsl);
GLuint vs = 0;
GLuint ps = 0;
{
GL_PUSH("GSDeviceOGL::Convert");
m_convert.vs = vs;
for(size_t i = 0; i < countof(m_convert.ps); i++) {
ps = m_shader->Compile("convert.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, convert_glsl);
m_convert.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
m_convert.cb = new GSUniformBufferOGL(g_convert_index, sizeof(ConvertConstantBuffer));
// Upload once and forget about it
ConvertConstantBuffer cb;
cb.ScalingFactor = GSVector4i(theApp.GetConfig("upscale_multiplier", 1));
m_convert.cb->upload(&cb);
vs = m_shader->Compile("convert.glsl", "vs_main", GL_VERTEX_SHADER, convert_glsl);
m_convert.vs = vs;
for(size_t i = 0; i < countof(m_convert.ps); i++) {
ps = m_shader->Compile("convert.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, convert_glsl);
m_convert.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
}
PSSamplerSelector point;
m_convert.pt = GetSamplerID(point);
PSSamplerSelector bilinear;
bilinear.ltf = true;
m_convert.ln = GetSamplerID(bilinear);
m_convert.dss = new GSDepthStencilOGL();
m_convert.dss_write = new GSDepthStencilOGL();
m_convert.dss_write->EnableDepth();
m_convert.dss_write->SetDepth(GL_ALWAYS, true);
}
PSSamplerSelector point;
m_convert.pt = GetSamplerID(point);
PSSamplerSelector bilinear;
bilinear.ltf = true;
m_convert.ln = GetSamplerID(bilinear);
m_convert.dss = new GSDepthStencilOGL();
m_convert.dss_write = new GSDepthStencilOGL();
m_convert.dss_write->EnableDepth();
m_convert.dss_write->SetDepth(GL_ALWAYS, true);
GL_POP();
// ****************************************************************
// merge
// ****************************************************************
GL_PUSH("GSDeviceOGL::Merge");
{
GL_PUSH("GSDeviceOGL::Merge");
m_merge_obj.cb = new GSUniformBufferOGL(g_merge_cb_index, sizeof(MergeConstantBuffer));
m_merge_obj.cb = new GSUniformBufferOGL(g_merge_cb_index, sizeof(MergeConstantBuffer));
for(size_t i = 0; i < countof(m_merge_obj.ps); i++) {
ps = m_shader->Compile("merge.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, merge_glsl);
m_merge_obj.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
for(size_t i = 0; i < countof(m_merge_obj.ps); i++) {
ps = m_shader->Compile("merge.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, merge_glsl);
m_merge_obj.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
}
}
GL_POP();
// ****************************************************************
// interlace
// ****************************************************************
GL_PUSH("GSDeviceOGL::Interlace");
{
GL_PUSH("GSDeviceOGL::Interlace");
m_interlace.cb = new GSUniformBufferOGL(g_interlace_cb_index, sizeof(InterlaceConstantBuffer));
m_interlace.cb = new GSUniformBufferOGL(g_interlace_cb_index, sizeof(InterlaceConstantBuffer));
for(size_t i = 0; i < countof(m_interlace.ps); i++) {
ps = m_shader->Compile("interlace.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, interlace_glsl);
m_interlace.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
for(size_t i = 0; i < countof(m_interlace.ps); i++) {
ps = m_shader->Compile("interlace.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, interlace_glsl);
m_interlace.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
}
}
GL_POP();
// ****************************************************************
// Shade boost
// ****************************************************************
GL_PUSH("GSDeviceOGL::Shadeboost");
{
GL_PUSH("GSDeviceOGL::Shadeboost");
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
std::string shade_macro = format("#define SB_SATURATION %d.0\n", ShadeBoost_Saturation)
+ format("#define SB_BRIGHTNESS %d.0\n", ShadeBoost_Brightness)
+ format("#define SB_CONTRAST %d.0\n", ShadeBoost_Contrast);
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
std::string shade_macro = format("#define SB_SATURATION %d.0\n", ShadeBoost_Saturation)
+ format("#define SB_BRIGHTNESS %d.0\n", ShadeBoost_Brightness)
+ format("#define SB_CONTRAST %d.0\n", ShadeBoost_Contrast);
ps = m_shader->Compile("shadeboost.glsl", "ps_main", GL_FRAGMENT_SHADER, shadeboost_glsl, shade_macro);
m_shadeboost.ps = m_shader->LinkPipeline(vs, 0, ps);
GL_POP();
ps = m_shader->Compile("shadeboost.glsl", "ps_main", GL_FRAGMENT_SHADER, shadeboost_glsl, shade_macro);
m_shadeboost.ps = m_shader->LinkPipeline(vs, 0, ps);
}
// ****************************************************************
// rasterization configuration
// ****************************************************************
GL_PUSH("GSDeviceOGL::Rasterization");
{
GL_PUSH("GSDeviceOGL::Rasterization");
#ifdef ONLY_LINES
glLineWidth(5.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glLineWidth(5.0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
#else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#endif
glDisable(GL_CULL_FACE);
glEnable(GL_SCISSOR_TEST);
glDisable(GL_MULTISAMPLE);
glDisable(GL_DITHER); // Honestly I don't know!
GL_POP();
glDisable(GL_CULL_FACE);
glEnable(GL_SCISSOR_TEST);
glDisable(GL_MULTISAMPLE);
glDisable(GL_DITHER); // Honestly I don't know!
}
// ****************************************************************
// DATE
// ****************************************************************
GL_PUSH("GSDeviceOGL::Date");
{
GL_PUSH("GSDeviceOGL::Date");
m_date.dss = new GSDepthStencilOGL();
m_date.dss->EnableStencil();
m_date.dss->SetStencil(GL_ALWAYS, GL_REPLACE);
GL_POP();
m_date.dss = new GSDepthStencilOGL();
m_date.dss->EnableStencil();
m_date.dss->SetStencil(GL_ALWAYS, GL_REPLACE);
}
// ****************************************************************
// Use DX coordinate convention
@ -370,28 +369,21 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
// ****************************************************************
// HW renderer shader
// ****************************************************************
GL_PUSH("GSDeviceOGL::CreateTextureFX");
CreateTextureFX();
GL_POP();
// ****************************************************************
// Pbo Pool allocation
// ****************************************************************
GL_PUSH("GSDeviceOGL::PBO");
{
GL_PUSH("GSDeviceOGL::PBO");
// Mesa seems to use it to compute the row length. In our case, we are
// tightly packed so don't bother with this parameter and set it to the
// minimum alignment (1 byte)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// Mesa seems to use it to compute the row length. In our case, we are
// tightly packed so don't bother with this parameter and set it to the
// minimum alignment (1 byte)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
PboPool::Init();
GL_POP();
// Done !
GL_POP();
PboPool::Init();
}
// ****************************************************************
// Finish window setup and backbuffer
@ -414,6 +406,8 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
void GSDeviceOGL::CreateTextureFX()
{
GL_PUSH("GSDeviceOGL::CreateTextureFX");
m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));
@ -423,27 +417,27 @@ 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");
{
GL_PUSH("Compile GS");
for (uint32 key = 0; key < countof(m_gs); key++) {
GSSelector sel(key);
if (sel.point == sel.sprite)
m_gs[key] = 0;
else
m_gs[key] = CompileGS(GSSelector(key));
for (uint32 key = 0; key < countof(m_gs); key++) {
GSSelector sel(key);
if (sel.point == sel.sprite)
m_gs[key] = 0;
else
m_gs[key] = CompileGS(GSSelector(key));
}
}
GL_POP();
{
GL_PUSH("Compile VS");
GL_PUSH("Compile VS");
for (uint32 key = 0; key < countof(m_vs); key++) {
VSSelector sel(key);
m_vs[key] = CompileVS(sel);
for (uint32 key = 0; key < countof(m_vs); key++) {
VSSelector sel(key);
m_vs[key] = CompileVS(sel);
}
}
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.
@ -556,8 +550,6 @@ void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c)
glEnable(GL_SCISSOR_TEST);
T->WasCleaned();
GL_POP();
}
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
@ -598,8 +590,6 @@ void GSDeviceOGL::ClearRenderTarget_i(GSTexture* t, int32 c)
if (GLState::blend) {
glEnable(GL_BLEND);
}
GL_POP();
}
void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
@ -623,8 +613,6 @@ void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
glDepthMask(false);
}
glEnable(GL_SCISSOR_TEST);
GL_POP();
}
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
@ -642,8 +630,6 @@ void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
GLint color = c;
glClearBufferiv(GL_STENCIL, 0, &color);
GL_POP();
}
GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel)
@ -683,7 +669,6 @@ GLuint GSDeviceOGL::CreateSampler(bool bilinear, bool tau, bool tav, bool aniso)
if (GLLoader::found_GL_EXT_texture_filter_anisotropic && anisotropy && aniso)
glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)anisotropy);
GL_POP();
return sampler;
}
@ -1036,8 +1021,6 @@ void GSDeviceOGL::CopyRectConv(GSTexture* sTex, GSTexture* dTex, const GSVector4
glCopyTextureSubImage2D(did, GL_TEX_LEVEL_0, r.x, r.y, r.x, r.y, r.width(), r.height());
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
GL_POP();
}
// Copy a sub part of a texture into another
@ -1057,8 +1040,6 @@ void GSDeviceOGL::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r
did, GL_TEXTURE_2D,
0, 0, 0, 0,
r.width(), r.height(), 1);
GL_POP();
}
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
@ -1172,8 +1153,6 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
// ************************************
EndScene();
GL_POP();
}
void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
@ -1196,8 +1175,6 @@ void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex,
StretchRect(sTex[0], sRect[0], dTex, dRect[0], m_merge_obj.ps[mmod ? 1 : 0], m_MERGE_BLEND);
}
GL_POP();
}
void GSDeviceOGL::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset)
@ -1220,8 +1197,6 @@ void GSDeviceOGL::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
m_interlace.cb->upload(&cb);
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], linear);
GL_POP();
}
void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
@ -1248,8 +1223,6 @@ void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
GSVector4 dRect(0, 0, s.x, s.y);
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, true);
GL_POP();
}
void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
@ -1302,8 +1275,6 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
m_shaderfx.cb->upload(&cb);
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, true);
GL_POP();
}
void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
@ -1318,8 +1289,6 @@ void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
GSVector4 dRect(0, 0, s.x, s.y);
StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, true);
GL_POP();
}
void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
@ -1360,8 +1329,6 @@ void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* ver
}
EndScene();
GL_POP();
}
void GSDeviceOGL::EndScene()
@ -1576,7 +1543,6 @@ void GSDeviceOGL::SetupCB(const VSConstantBuffer* vs_cb, const PSConstantBuffer*
if(m_ps_cb_cache.Update(ps_cb)) {
m_ps_cb->upload(ps_cb);
}
GL_POP();
}
void GSDeviceOGL::SetupPipeline(const VSSelector& vsel, const GSSelector& gsel, const PSSelector& psel)

View File

@ -293,8 +293,6 @@ bool GSRenderer::Merge(int field)
}
}
GL_POP();
return true;
}

View File

@ -383,7 +383,6 @@ void GSRendererHW::Draw()
m_channel_shuffle = draw_sprite_tex && (m_context->TEX0.PSM == PSM_PSMT8) && single_page;
if (m_channel_shuffle) {
GL_CACHE("Channel shuffle effect detected SKIP");
GL_POP();
s_n += 3; // Keep it sync with SW renderer
return;
}
@ -425,7 +424,6 @@ void GSRendererHW::Draw()
if(!(rt || no_rt) || !(ds || no_ds))
{
GL_POP();
ASSERT(0);
return;
}
@ -455,7 +453,6 @@ void GSRendererHW::Draw()
tex = tex_psm.depth ? m_tc->LookupDepthSource(context->TEX0, env.TEXA, r) : m_tc->LookupSource(context->TEX0, env.TEXA, r);
if(!tex) {
GL_POP();
return;
}
@ -554,14 +551,12 @@ void GSRendererHW::Draw()
{
s_n += 1; // keep counter sync
GL_INS("Warning skipping a draw call (%d)", s_n);
GL_POP();
return;
}
if (!OI_BlitFMV(rt, tex, r)) {
s_n += 1; // keep counter sync
GL_INS("Warning skipping a draw call (%d)", s_n);
GL_POP();
return;
}
@ -716,8 +711,6 @@ void GSRendererHW::Draw()
m_tc->Read(rt, r);
#endif
GL_POP();
}
// hacks
@ -949,8 +942,6 @@ bool GSRendererHW::OI_BlitFMV(GSTextureCache::Target* _rt, GSTextureCache::Sourc
m_tc->InvalidateVideoMemSubTarget(_rt);
GL_POP();
return false; // skip current draw
}

View File

@ -124,6 +124,8 @@ void GSRendererOGL::EmulateGS()
void GSRendererOGL::SetupIA()
{
GL_PUSH("IA");
GSDeviceOGL* dev = (GSDeviceOGL*)m_dev;
if (!GLLoader::found_geometry_shader)
@ -615,8 +617,6 @@ void GSRendererOGL::SendDraw(bool require_barrier)
glTextureBarrier();
dev->DrawIndexedPrimitive(p, count);
}
GL_POP();
} else {
// FIXME: Investigate: a dynamic check to pack as many primitives as possibles
// I'm nearly sure GSdx already have this kind of code (maybe we can adapt GSDirtyRect)
@ -630,8 +630,6 @@ void GSRendererOGL::SendDraw(bool require_barrier)
glTextureBarrier();
dev->DrawIndexedPrimitive(p, nb_vertex);
}
GL_POP();
}
}
@ -1098,9 +1096,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
const GSVector4& hacked_scissor = m_channel_shuffle ? GSVector4(0, 0, 1024, 1024) : m_context->scissor.in;
GSVector4i scissor = GSVector4i(GSVector4(rtscale).xyxy() * hacked_scissor).rintersect(GSVector4i(rtsize).zwxy());
GL_PUSH("IA");
SetupIA();
GL_POP();
dev->OMSetColorMaskState(om_csel);
dev->SetupOM(om_dssel);
@ -1134,8 +1130,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// Be sure that first pass is finished !
dev->Barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
GL_POP();
}
if (ps_sel.hdr) {
@ -1211,6 +1205,4 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
dev->Recycle(hdr_rt);
}
GL_POP();
}

View File

@ -125,8 +125,6 @@ void GSTextureCacheOGL::Read(Target* t, const GSVector4i& r)
// FIXME invalidate data
m_renderer->m_dev->Recycle(offscreen);
}
GL_POP();
}
void GSTextureCacheOGL::Read(Source* t, const GSVector4i& r)

View File

@ -343,8 +343,6 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
PboPool::EndTransfer();
#endif
GL_POP();
return true;
}
@ -379,7 +377,7 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r)
return true;
} else if (m_type == GSTexture::Texture || m_type == GSTexture::RenderTarget) {
GL_PUSH("Upload Texture %d", m_texture_id); // POP is in Unmap
GL_PUSH_("Upload Texture %d", m_texture_id); // POP is in Unmap
m_clean = false;

View File

@ -435,11 +435,19 @@ extern void vmfree(void* ptr, size_t size);
#endif
#if defined(ENABLE_OGL_DEBUG)
#define GL_PUSH(...) do glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0);
struct GLAutoPop {
~GLAutoPop() {
glPopDebugGroup();
}
};
#define GL_PUSH_(...) do glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0);
#define GL_PUSH(...) do glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0); GLAutoPop gl_auto_pop;
#define GL_POP() do glPopDebugGroup(); while(0);
#define GL_INS(...) GL_INSERT(GL_DEBUG_TYPE_ERROR, 0xDEAD, GL_DEBUG_SEVERITY_MEDIUM, __VA_ARGS__)
#define GL_PERF(...) GL_INSERT(GL_DEBUG_TYPE_PERFORMANCE, 0xFEE1, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__)
#else
#define GL_PUSH_(...) (0);
#define GL_PUSH(...) (0);
#define GL_POP() (0);
#define GL_INS(...) (0);