mirror of https://github.com/PCSX2/pcsx2.git
gsdx debug: auto GL_POP
Nicer and exception safe V2: miss definition of vs/ps
This commit is contained in:
parent
37c7fa7663
commit
d58b71688b
|
@ -121,8 +121,6 @@ void GSDevice::Present(const GSVector4i& r, int shader)
|
||||||
}
|
}
|
||||||
|
|
||||||
Flip();
|
Flip();
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader)
|
void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader)
|
||||||
|
|
|
@ -133,8 +133,6 @@ GSDeviceOGL::~GSDeviceOGL()
|
||||||
// Must be done after the destruction of all shader/program objects
|
// Must be done after the destruction of all shader/program objects
|
||||||
delete m_shader;
|
delete m_shader;
|
||||||
m_shader = NULL;
|
m_shader = NULL;
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int fmt)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,163 +194,165 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// Various object
|
// 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);
|
glGenFramebuffers(1, &m_fbo);
|
||||||
// Always write to the first buffer
|
// Always write to the first buffer
|
||||||
OMSetFBO(m_fbo);
|
OMSetFBO(m_fbo);
|
||||||
GLenum target[1] = {GL_COLOR_ATTACHMENT0};
|
GLenum target[1] = {GL_COLOR_ATTACHMENT0};
|
||||||
glDrawBuffers(1, target);
|
glDrawBuffers(1, target);
|
||||||
OMSetFBO(0);
|
OMSetFBO(0);
|
||||||
|
|
||||||
glGenFramebuffers(1, &m_fbo_read);
|
glGenFramebuffers(1, &m_fbo_read);
|
||||||
// Always read from the first buffer
|
// Always read from the first buffer
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo_read);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo_read);
|
||||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
}
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// Vertex buffer state
|
// 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) } ,
|
GL_PUSH("GSDeviceOGL::Vertex Buffer");
|
||||||
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(16) } ,
|
|
||||||
{4 , GL_UNSIGNED_BYTE , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(8) } ,
|
ASSERT(sizeof(GSVertexPT1) == sizeof(GSVertex));
|
||||||
{1 , GL_FLOAT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(12) } ,
|
GSInputLayoutOGL il_convert[] =
|
||||||
{2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(16) } ,
|
{
|
||||||
{1 , GL_UNSIGNED_INT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(20) } ,
|
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(0) } ,
|
||||||
{2 , GL_UNSIGNED_SHORT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(24) } ,
|
{2 , GL_FLOAT , GL_FALSE , sizeof(GSVertexPT1) , (const GLvoid*)(16) } ,
|
||||||
{4 , GL_UNSIGNED_BYTE , GL_TRUE , sizeof(GSVertex) , (const GLvoid*)(28) } , // Only 1 byte is useful but hardware unit only support 4B
|
{4 , GL_UNSIGNED_BYTE , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(8) } ,
|
||||||
};
|
{1 , GL_FLOAT , GL_FALSE , sizeof(GSVertex) , (const GLvoid*)(12) } ,
|
||||||
m_va = new GSVertexBufferStateOGL(il_convert, countof(il_convert));
|
{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
|
// Pre Generate the different sampler object
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GL_PUSH("GSDeviceOGL::Sampler");
|
{
|
||||||
|
GL_PUSH("GSDeviceOGL::Sampler");
|
||||||
|
|
||||||
for (uint32 key = 0; key < countof(m_ps_ss); key++) {
|
for (uint32 key = 0; key < countof(m_ps_ss); key++) {
|
||||||
m_ps_ss[key] = CreateSampler(PSSamplerSelector(key));
|
m_ps_ss[key] = CreateSampler(PSSamplerSelector(key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// convert
|
// convert
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GL_PUSH("GSDeviceOGL::Convert");
|
GLuint vs = 0;
|
||||||
|
|
||||||
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 ps = 0;
|
GLuint ps = 0;
|
||||||
|
{
|
||||||
|
GL_PUSH("GSDeviceOGL::Convert");
|
||||||
|
|
||||||
m_convert.vs = vs;
|
m_convert.cb = new GSUniformBufferOGL(g_convert_index, sizeof(ConvertConstantBuffer));
|
||||||
for(size_t i = 0; i < countof(m_convert.ps); i++) {
|
// Upload once and forget about it
|
||||||
ps = m_shader->Compile("convert.glsl", format("ps_main%d", i), GL_FRAGMENT_SHADER, convert_glsl);
|
ConvertConstantBuffer cb;
|
||||||
m_convert.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
|
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
|
// 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++) {
|
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);
|
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);
|
m_merge_obj.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// interlace
|
// 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++) {
|
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);
|
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);
|
m_interlace.ps[i] = m_shader->LinkPipeline(vs, 0, ps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// Shade boost
|
// Shade boost
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GL_PUSH("GSDeviceOGL::Shadeboost");
|
{
|
||||||
|
GL_PUSH("GSDeviceOGL::Shadeboost");
|
||||||
|
|
||||||
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
|
int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50);
|
||||||
int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
|
int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50);
|
||||||
int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
|
int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50);
|
||||||
std::string shade_macro = format("#define SB_SATURATION %d.0\n", ShadeBoost_Saturation)
|
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_BRIGHTNESS %d.0\n", ShadeBoost_Brightness)
|
||||||
+ format("#define SB_CONTRAST %d.0\n", ShadeBoost_Contrast);
|
+ format("#define SB_CONTRAST %d.0\n", ShadeBoost_Contrast);
|
||||||
|
|
||||||
ps = m_shader->Compile("shadeboost.glsl", "ps_main", GL_FRAGMENT_SHADER, shadeboost_glsl, shade_macro);
|
ps = m_shader->Compile("shadeboost.glsl", "ps_main", GL_FRAGMENT_SHADER, shadeboost_glsl, shade_macro);
|
||||||
m_shadeboost.ps = m_shader->LinkPipeline(vs, 0, ps);
|
m_shadeboost.ps = m_shader->LinkPipeline(vs, 0, ps);
|
||||||
|
}
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// rasterization configuration
|
// rasterization configuration
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GL_PUSH("GSDeviceOGL::Rasterization");
|
{
|
||||||
|
GL_PUSH("GSDeviceOGL::Rasterization");
|
||||||
|
|
||||||
#ifdef ONLY_LINES
|
#ifdef ONLY_LINES
|
||||||
glLineWidth(5.0);
|
glLineWidth(5.0);
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
#else
|
#else
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
#endif
|
#endif
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glDisable(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
glDisable(GL_DITHER); // Honestly I don't know!
|
glDisable(GL_DITHER); // Honestly I don't know!
|
||||||
|
}
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// DATE
|
// DATE
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GL_PUSH("GSDeviceOGL::Date");
|
{
|
||||||
|
GL_PUSH("GSDeviceOGL::Date");
|
||||||
|
|
||||||
m_date.dss = new GSDepthStencilOGL();
|
m_date.dss = new GSDepthStencilOGL();
|
||||||
m_date.dss->EnableStencil();
|
m_date.dss->EnableStencil();
|
||||||
m_date.dss->SetStencil(GL_ALWAYS, GL_REPLACE);
|
m_date.dss->SetStencil(GL_ALWAYS, GL_REPLACE);
|
||||||
|
}
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// Use DX coordinate convention
|
// Use DX coordinate convention
|
||||||
|
@ -370,28 +369,21 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// HW renderer shader
|
// HW renderer shader
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GL_PUSH("GSDeviceOGL::CreateTextureFX");
|
|
||||||
|
|
||||||
CreateTextureFX();
|
CreateTextureFX();
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// Pbo Pool allocation
|
// 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
|
// 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
|
// tightly packed so don't bother with this parameter and set it to the
|
||||||
// minimum alignment (1 byte)
|
// minimum alignment (1 byte)
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
PboPool::Init();
|
PboPool::Init();
|
||||||
|
}
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// Done !
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
// Finish window setup and backbuffer
|
// Finish window setup and backbuffer
|
||||||
|
@ -414,6 +406,8 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||||
|
|
||||||
void GSDeviceOGL::CreateTextureFX()
|
void GSDeviceOGL::CreateTextureFX()
|
||||||
{
|
{
|
||||||
|
GL_PUSH("GSDeviceOGL::CreateTextureFX");
|
||||||
|
|
||||||
m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
|
m_vs_cb = new GSUniformBufferOGL(g_vs_cb_index, sizeof(VSConstantBuffer));
|
||||||
m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));
|
m_ps_cb = new GSUniformBufferOGL(g_ps_cb_index, sizeof(PSConstantBuffer));
|
||||||
|
|
||||||
|
@ -423,27 +417,27 @@ void GSDeviceOGL::CreateTextureFX()
|
||||||
|
|
||||||
// Pre compile all Geometry & Vertex Shader
|
// Pre compile all Geometry & Vertex Shader
|
||||||
// It might cost a seconds at startup but it would reduce benchmark pollution
|
// 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++) {
|
for (uint32 key = 0; key < countof(m_gs); key++) {
|
||||||
GSSelector sel(key);
|
GSSelector sel(key);
|
||||||
if (sel.point == sel.sprite)
|
if (sel.point == sel.sprite)
|
||||||
m_gs[key] = 0;
|
m_gs[key] = 0;
|
||||||
else
|
else
|
||||||
m_gs[key] = CompileGS(GSSelector(key));
|
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);
|
||||||
for (uint32 key = 0; key < countof(m_vs); key++) {
|
m_vs[key] = CompileVS(sel);
|
||||||
VSSelector sel(key);
|
}
|
||||||
m_vs[key] = CompileVS(sel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
// Enable all bits for stencil operations. Technically 1 bit is
|
// Enable all bits for stencil operations. Technically 1 bit is
|
||||||
// enough but buffer is polluted with noise. Clear will be limited
|
// enough but buffer is polluted with noise. Clear will be limited
|
||||||
// to the mask.
|
// to the mask.
|
||||||
|
@ -556,8 +550,6 @@ void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c)
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
T->WasCleaned();
|
T->WasCleaned();
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
|
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
|
||||||
|
@ -598,8 +590,6 @@ void GSDeviceOGL::ClearRenderTarget_i(GSTexture* t, int32 c)
|
||||||
if (GLState::blend) {
|
if (GLState::blend) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
||||||
|
@ -623,8 +613,6 @@ void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
}
|
}
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
||||||
|
@ -642,8 +630,6 @@ void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
||||||
GLint color = c;
|
GLint color = c;
|
||||||
|
|
||||||
glClearBufferiv(GL_STENCIL, 0, &color);
|
glClearBufferiv(GL_STENCIL, 0, &color);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel)
|
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)
|
if (GLLoader::found_GL_EXT_texture_filter_anisotropic && anisotropy && aniso)
|
||||||
glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)anisotropy);
|
glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)anisotropy);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
return sampler;
|
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());
|
glCopyTextureSubImage2D(did, GL_TEX_LEVEL_0, r.x, r.y, r.x, r.y, r.width(), r.height());
|
||||||
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a sub part of a texture into another
|
// 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,
|
did, GL_TEXTURE_2D,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
r.width(), r.height(), 1);
|
r.width(), r.height(), 1);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
|
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();
|
EndScene();
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
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);
|
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)
|
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);
|
m_interlace.cb->upload(&cb);
|
||||||
|
|
||||||
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], linear);
|
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], linear);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
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);
|
GSVector4 dRect(0, 0, s.x, s.y);
|
||||||
|
|
||||||
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, true);
|
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, true);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
||||||
|
@ -1302,8 +1275,6 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
||||||
m_shaderfx.cb->upload(&cb);
|
m_shaderfx.cb->upload(&cb);
|
||||||
|
|
||||||
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, true);
|
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, true);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
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);
|
GSVector4 dRect(0, 0, s.x, s.y);
|
||||||
|
|
||||||
StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, true);
|
StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, true);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
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();
|
EndScene();
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::EndScene()
|
void GSDeviceOGL::EndScene()
|
||||||
|
@ -1576,7 +1543,6 @@ void GSDeviceOGL::SetupCB(const VSConstantBuffer* vs_cb, const PSConstantBuffer*
|
||||||
if(m_ps_cb_cache.Update(ps_cb)) {
|
if(m_ps_cb_cache.Update(ps_cb)) {
|
||||||
m_ps_cb->upload(ps_cb);
|
m_ps_cb->upload(ps_cb);
|
||||||
}
|
}
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::SetupPipeline(const VSSelector& vsel, const GSSelector& gsel, const PSSelector& psel)
|
void GSDeviceOGL::SetupPipeline(const VSSelector& vsel, const GSSelector& gsel, const PSSelector& psel)
|
||||||
|
|
|
@ -293,8 +293,6 @@ bool GSRenderer::Merge(int field)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,6 @@ void GSRendererHW::Draw()
|
||||||
m_channel_shuffle = draw_sprite_tex && (m_context->TEX0.PSM == PSM_PSMT8) && single_page;
|
m_channel_shuffle = draw_sprite_tex && (m_context->TEX0.PSM == PSM_PSMT8) && single_page;
|
||||||
if (m_channel_shuffle) {
|
if (m_channel_shuffle) {
|
||||||
GL_CACHE("Channel shuffle effect detected SKIP");
|
GL_CACHE("Channel shuffle effect detected SKIP");
|
||||||
GL_POP();
|
|
||||||
s_n += 3; // Keep it sync with SW renderer
|
s_n += 3; // Keep it sync with SW renderer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +424,6 @@ void GSRendererHW::Draw()
|
||||||
|
|
||||||
if(!(rt || no_rt) || !(ds || no_ds))
|
if(!(rt || no_rt) || !(ds || no_ds))
|
||||||
{
|
{
|
||||||
GL_POP();
|
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
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);
|
tex = tex_psm.depth ? m_tc->LookupDepthSource(context->TEX0, env.TEXA, r) : m_tc->LookupSource(context->TEX0, env.TEXA, r);
|
||||||
|
|
||||||
if(!tex) {
|
if(!tex) {
|
||||||
GL_POP();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,14 +551,12 @@ void GSRendererHW::Draw()
|
||||||
{
|
{
|
||||||
s_n += 1; // keep counter sync
|
s_n += 1; // keep counter sync
|
||||||
GL_INS("Warning skipping a draw call (%d)", s_n);
|
GL_INS("Warning skipping a draw call (%d)", s_n);
|
||||||
GL_POP();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OI_BlitFMV(rt, tex, r)) {
|
if (!OI_BlitFMV(rt, tex, r)) {
|
||||||
s_n += 1; // keep counter sync
|
s_n += 1; // keep counter sync
|
||||||
GL_INS("Warning skipping a draw call (%d)", s_n);
|
GL_INS("Warning skipping a draw call (%d)", s_n);
|
||||||
GL_POP();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,8 +711,6 @@ void GSRendererHW::Draw()
|
||||||
m_tc->Read(rt, r);
|
m_tc->Read(rt, r);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hacks
|
// hacks
|
||||||
|
@ -949,8 +942,6 @@ bool GSRendererHW::OI_BlitFMV(GSTextureCache::Target* _rt, GSTextureCache::Sourc
|
||||||
|
|
||||||
m_tc->InvalidateVideoMemSubTarget(_rt);
|
m_tc->InvalidateVideoMemSubTarget(_rt);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
return false; // skip current draw
|
return false; // skip current draw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,8 @@ void GSRendererOGL::EmulateGS()
|
||||||
|
|
||||||
void GSRendererOGL::SetupIA()
|
void GSRendererOGL::SetupIA()
|
||||||
{
|
{
|
||||||
|
GL_PUSH("IA");
|
||||||
|
|
||||||
GSDeviceOGL* dev = (GSDeviceOGL*)m_dev;
|
GSDeviceOGL* dev = (GSDeviceOGL*)m_dev;
|
||||||
|
|
||||||
if (!GLLoader::found_geometry_shader)
|
if (!GLLoader::found_geometry_shader)
|
||||||
|
@ -615,8 +617,6 @@ void GSRendererOGL::SendDraw(bool require_barrier)
|
||||||
glTextureBarrier();
|
glTextureBarrier();
|
||||||
dev->DrawIndexedPrimitive(p, count);
|
dev->DrawIndexedPrimitive(p, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
} else {
|
} else {
|
||||||
// FIXME: Investigate: a dynamic check to pack as many primitives as possibles
|
// 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)
|
// 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();
|
glTextureBarrier();
|
||||||
dev->DrawIndexedPrimitive(p, nb_vertex);
|
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;
|
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());
|
GSVector4i scissor = GSVector4i(GSVector4(rtscale).xyxy() * hacked_scissor).rintersect(GSVector4i(rtsize).zwxy());
|
||||||
|
|
||||||
GL_PUSH("IA");
|
|
||||||
SetupIA();
|
SetupIA();
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
dev->OMSetColorMaskState(om_csel);
|
dev->OMSetColorMaskState(om_csel);
|
||||||
dev->SetupOM(om_dssel);
|
dev->SetupOM(om_dssel);
|
||||||
|
@ -1134,8 +1130,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
|
|
||||||
// Be sure that first pass is finished !
|
// Be sure that first pass is finished !
|
||||||
dev->Barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
dev->Barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps_sel.hdr) {
|
if (ps_sel.hdr) {
|
||||||
|
@ -1211,6 +1205,4 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
|
|
||||||
dev->Recycle(hdr_rt);
|
dev->Recycle(hdr_rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,8 +125,6 @@ void GSTextureCacheOGL::Read(Target* t, const GSVector4i& r)
|
||||||
// FIXME invalidate data
|
// FIXME invalidate data
|
||||||
m_renderer->m_dev->Recycle(offscreen);
|
m_renderer->m_dev->Recycle(offscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSTextureCacheOGL::Read(Source* t, const GSVector4i& r)
|
void GSTextureCacheOGL::Read(Source* t, const GSVector4i& r)
|
||||||
|
|
|
@ -343,8 +343,6 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
|
||||||
PboPool::EndTransfer();
|
PboPool::EndTransfer();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GL_POP();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +377,7 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (m_type == GSTexture::Texture || m_type == GSTexture::RenderTarget) {
|
} 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;
|
m_clean = false;
|
||||||
|
|
||||||
|
|
|
@ -435,11 +435,19 @@ extern void vmfree(void* ptr, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_OGL_DEBUG)
|
#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_POP() do glPopDebugGroup(); while(0);
|
||||||
#define GL_INS(...) GL_INSERT(GL_DEBUG_TYPE_ERROR, 0xDEAD, GL_DEBUG_SEVERITY_MEDIUM, __VA_ARGS__)
|
#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__)
|
#define GL_PERF(...) GL_INSERT(GL_DEBUG_TYPE_PERFORMANCE, 0xFEE1, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
#define GL_PUSH_(...) (0);
|
||||||
#define GL_PUSH(...) (0);
|
#define GL_PUSH(...) (0);
|
||||||
#define GL_POP() (0);
|
#define GL_POP() (0);
|
||||||
#define GL_INS(...) (0);
|
#define GL_INS(...) (0);
|
||||||
|
|
Loading…
Reference in New Issue