mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: LINUX-ONLY
* Enable interlace feature. (note I'm well aware that interlace crashes with SDL) * remove useless callback debug function * handle the y axis differently. Move vertex to follow right-hand system (render everything in reverse) then flip the y-axis for the screen rendering git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl@4987 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
be53385e9f
commit
fbb224837d
|
@ -57,9 +57,9 @@ GSDeviceOGL::GSDeviceOGL()
|
|||
: m_free_window(false)
|
||||
, m_window(NULL)
|
||||
, m_vb(0)
|
||||
, m_pipeline(0)
|
||||
, m_fbo(0)
|
||||
, m_sr_vb_offset(0)
|
||||
, m_pipeline(0)
|
||||
, m_srv_changed(false)
|
||||
, m_ss_changed(false)
|
||||
{
|
||||
|
@ -164,7 +164,6 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
|||
|
||||
// FIXME disable it when code is ready
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
glDebugMessageCallbackARB(&GSDeviceOGL::DebugCallback, NULL);
|
||||
|
||||
m_window = wnd;
|
||||
|
||||
|
@ -265,8 +264,6 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
|||
// merge
|
||||
// ****************************************************************
|
||||
m_merge.cb = new GSUniformBufferOGL(1, sizeof(MergeConstantBuffer));
|
||||
//m_merge.cb->index = 1;
|
||||
//m_merge.cb->byte_size = sizeof(MergeConstantBuffer);
|
||||
glGenBuffers(1, &m_merge.cb->buffer);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, m_merge.cb->buffer);
|
||||
glBufferData(GL_UNIFORM_BUFFER, m_merge.cb->byte_size, NULL, GL_DYNAMIC_DRAW);
|
||||
|
@ -287,8 +284,6 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
|||
// interlace
|
||||
// ****************************************************************
|
||||
m_interlace.cb = new GSUniformBufferOGL(2, sizeof(InterlaceConstantBuffer));
|
||||
//m_interlace.cb->index = 2;
|
||||
//m_interlace.cb->byte_size = sizeof(InterlaceConstantBuffer);
|
||||
glGenBuffers(1, &m_interlace.cb->buffer);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, m_interlace.cb->buffer);
|
||||
glBufferData(GL_UNIFORM_BUFFER, m_interlace.cb->byte_size, NULL, GL_DYNAMIC_DRAW);
|
||||
|
@ -694,17 +689,29 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
|||
// ia
|
||||
// ************************************
|
||||
|
||||
|
||||
float left = dr.x * 2 / ds.x - 1.0f;
|
||||
float top = 1.0f - dr.y * 2 / ds.y;
|
||||
float right = dr.z * 2 / ds.x - 1.0f;
|
||||
float bottom = 1.0f - dr.w * 2 / ds.y;
|
||||
|
||||
// Flip y axis only when we render in the backbuffer
|
||||
// By default everything is render in the wrong order (ie dx).
|
||||
// 1/ consistency between several pass rendering (interlace)
|
||||
// 2/ in case some GSdx code expect thing in dx order.
|
||||
// Only flipping the backbuffer is transparent (I hope)...
|
||||
GSVector4 flip_sr = sr;
|
||||
if (dt == m_backbuffer) {
|
||||
flip_sr.y = 1.0f - sr.y;
|
||||
flip_sr.w = 1.0f - sr.w;
|
||||
}
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
{
|
||||
{GSVector4(left, top, 0.5f, 1.0f), GSVector2(sr.x, sr.y)},
|
||||
{GSVector4(right, top, 0.5f, 1.0f), GSVector2(sr.z, sr.y)},
|
||||
{GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sr.x, sr.w)},
|
||||
{GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sr.z, sr.w)},
|
||||
{GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(flip_sr.x, flip_sr.y)},
|
||||
{GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(flip_sr.z, flip_sr.y)},
|
||||
{GSVector4(left, top, 0.5f, 1.0f), GSVector2(flip_sr.x, flip_sr.w)},
|
||||
{GSVector4(right, top, 0.5f, 1.0f), GSVector2(flip_sr.z, flip_sr.w)},
|
||||
};
|
||||
|
||||
IASetVertexArrray(m_convert.va);
|
||||
|
@ -767,9 +774,7 @@ void GSDeviceOGL::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVect
|
|||
glBindBuffer(GL_UNIFORM_BUFFER, m_merge.cb->buffer);
|
||||
}
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, m_merge.cb->byte_size, &c.v);
|
||||
#if 0
|
||||
m_ctx->UpdateSubresource(m_merge.cb, 0, NULL, &c, 0, 0);
|
||||
#endif
|
||||
|
||||
StretchRect(st[0], sr[0], dt, dr[0], m_merge.ps[mmod ? 1 : 0], m_merge.cb, m_merge.bs, true);
|
||||
}
|
||||
}
|
||||
|
@ -791,9 +796,6 @@ void GSDeviceOGL::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool lin
|
|||
glBindBuffer(GL_UNIFORM_BUFFER, m_interlace.cb->buffer);
|
||||
}
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, m_interlace.cb->byte_size, &cb);
|
||||
#if 0
|
||||
m_ctx->UpdateSubresource(m_interlace.cb, 0, NULL, &cb, 0, 0);
|
||||
#endif
|
||||
|
||||
StretchRect(st, sr, dt, dr, m_interlace.ps[shader], m_interlace.cb, linear);
|
||||
}
|
||||
|
@ -1002,7 +1004,7 @@ void GSDeviceOGL::PSSetShader(GLuint ps, GSUniformBufferOGL* ps_cb)
|
|||
}
|
||||
#endif
|
||||
|
||||
if(m_state.ps_cb != ps_cb)
|
||||
if(m_state.ps_cb != ps_cb && ps_cb != NULL)
|
||||
{
|
||||
m_state.ps_cb = ps_cb;
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, ps_cb->index, ps_cb->buffer);
|
||||
|
@ -1208,12 +1210,6 @@ void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const st
|
|||
free(log);
|
||||
}
|
||||
|
||||
void GSDeviceOGL::DebugCallback(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char* message, void* userParam)
|
||||
{
|
||||
DebugOutputToFile(source, type, id, severity, message);
|
||||
}
|
||||
|
||||
|
||||
void GSDeviceOGL::CheckDebugLog()
|
||||
{
|
||||
unsigned int count = 64; // max. num. of messages that will be read from the log
|
||||
|
|
|
@ -110,8 +110,8 @@ class GSDeviceOGL : public GSDevice
|
|||
uint32 m_sr_vb_offset;
|
||||
|
||||
struct {
|
||||
GLuint ps[2]; // program object
|
||||
GSUniformBufferOGL* cb; // uniform buffer object
|
||||
GLuint ps[2]; // program object
|
||||
GSUniformBufferOGL* cb; // uniform buffer object
|
||||
GSBlendStateOGL* bs;
|
||||
} m_merge;
|
||||
|
||||
|
@ -242,7 +242,6 @@ class GSDeviceOGL : public GSDevice
|
|||
GSDeviceOGL();
|
||||
virtual ~GSDeviceOGL();
|
||||
|
||||
static void DebugCallback(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char* message, void* userParam);
|
||||
void CheckDebugLog();
|
||||
static void DebugOutputToFile(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, const char* message);
|
||||
|
||||
|
|
|
@ -174,12 +174,8 @@ bool RunLinuxDialog()
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// I'll put the right variable names in later.
|
||||
// Crash, for some interlace options
|
||||
if (gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)) != -1)
|
||||
theApp.SetConfig( "interlace", (int)gtk_combo_box_get_active(GTK_COMBO_BOX(interlace_combo_box)) );
|
||||
#endif
|
||||
|
||||
|
||||
theApp.SetConfig("swthreads", atoi((char*)gtk_entry_get_text(GTK_ENTRY(swthreads_text))) );
|
||||
|
|
|
@ -42,12 +42,12 @@ layout(location = 0) out vec4 SV_Target0;
|
|||
|
||||
layout(binding = 0) uniform sampler2D TextureSampler;
|
||||
|
||||
vec4 sample_c(vec2 uv)
|
||||
vec4 sample_c()
|
||||
{
|
||||
return texture(TextureSampler, uv);
|
||||
return texture(TextureSampler, vec2(TEXCOORD0.x,TEXCOORD0.y) );
|
||||
}
|
||||
|
||||
vec4 ps_crt(vec2 uv, uint i)
|
||||
vec4 ps_crt(uint i)
|
||||
{
|
||||
vec4 mask[4] =
|
||||
{
|
||||
|
@ -57,17 +57,17 @@ vec4 ps_crt(vec2 uv, uint i)
|
|||
vec4(1, 1, 1, 0)
|
||||
};
|
||||
|
||||
return sample_c(uv) * clamp((mask[i] + 0.5f), 0.0f, 1.0f);
|
||||
return sample_c() * clamp((mask[i] + 0.5f), 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void ps_main0()
|
||||
{
|
||||
SV_Target0 = sample_c(TEXCOORD0);
|
||||
SV_Target0 = sample_c();
|
||||
}
|
||||
|
||||
void ps_main7()
|
||||
{
|
||||
vec4 c = sample_c(TEXCOORD0);
|
||||
vec4 c = sample_c();
|
||||
|
||||
c.a = dot(c.rgb, vec3(0.299, 0.587, 0.114));
|
||||
|
||||
|
@ -76,11 +76,9 @@ void ps_main7()
|
|||
|
||||
void ps_main5() // triangular
|
||||
{
|
||||
//uint4 p = (uint4)input.p;
|
||||
highp uvec4 p = uvec4(SV_Position);
|
||||
|
||||
// output.c = ps_crt(input, ((p.x + (p.y & 1) * 3) >> 1) % 3);
|
||||
vec4 c = ps_crt(TEXCOORD0, ((p.x + ((p.y >> 1) & 1) * 3) >> 1) % 3);
|
||||
vec4 c = ps_crt(((p.x + ((p.y >> 1u) & 1u) * 3u) >> 1u) % 3u);
|
||||
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
@ -89,7 +87,7 @@ void ps_main6() // diagonal
|
|||
{
|
||||
uvec4 p = uvec4(SV_Position);
|
||||
|
||||
vec4 c = ps_crt(TEXCOORD0, (p.x + (p.y % 3)) % 3);
|
||||
vec4 c = ps_crt((p.x + (p.y % 3)) % 3);
|
||||
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
@ -110,7 +108,7 @@ void ps_main4()
|
|||
|
||||
//void ps_main1()
|
||||
//{
|
||||
// vec4 c = sample_c(TEXCOORD);
|
||||
// vec4 c = sample_c();
|
||||
//
|
||||
// c.a *= 256.0f / 127; // hm, 0.5 won't give us 1.0 if we just multiply with 2
|
||||
//
|
||||
|
|
|
@ -6,7 +6,7 @@ layout(location = 1) in vec2 TEXCOORD0;
|
|||
|
||||
layout(location = 0) out vec4 SV_Target0;
|
||||
|
||||
layout(std140, binding = 1) uniform cb0
|
||||
layout(std140, binding = 2) uniform cb0
|
||||
{
|
||||
vec2 ZrH;
|
||||
float hH;
|
||||
|
|
|
@ -15,17 +15,14 @@ layout(binding = 0) uniform sampler2D TextureSampler;
|
|||
|
||||
void ps_main0()
|
||||
{
|
||||
|
||||
vec4 c = texture(TextureSampler, vec2(TEXCOORD0.x, 1.0 -TEXCOORD0.y));
|
||||
//vec4 c = texture(TextureSampler, TEXCOORD0);
|
||||
vec4 c = texture(TextureSampler, TEXCOORD0);
|
||||
c.a = min(c.a * 2, 1.0);
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
||||
void ps_main1()
|
||||
{
|
||||
vec4 c = texture(TextureSampler, vec2(TEXCOORD0.x, 1.0 -TEXCOORD0.y));
|
||||
//vec4 c = texture(TextureSampler, TEXCOORD0);
|
||||
vec4 c = texture(TextureSampler, TEXCOORD0);
|
||||
c.a = BGColor.a;
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue