mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: avoid to send constant to the GPU
It was a waste of bandwith
This commit is contained in:
parent
4362cc0e9a
commit
0d45e6d70e
|
@ -181,10 +181,10 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
|||
// ****************************************************************
|
||||
GSInputLayoutOGL il_convert[2] =
|
||||
{
|
||||
{0, 4, GL_FLOAT, GL_FALSE, sizeof(GSVertexPT1), (const GLvoid*)offsetof(struct GSVertexPT1, p) },
|
||||
{1, 2, GL_FLOAT, GL_FALSE, sizeof(GSVertexPT1), (const GLvoid*)offsetof(struct GSVertexPT1, t) },
|
||||
{0, 2, GL_FLOAT, GL_FALSE, sizeof(GSVertexPxyT1), (const GLvoid*)offsetof(struct GSVertexPxyT1, p) },
|
||||
{1, 2, GL_FLOAT, GL_FALSE, sizeof(GSVertexPxyT1), (const GLvoid*)offsetof(struct GSVertexPxyT1, t) },
|
||||
};
|
||||
m_vb_sr = new GSVertexBufferStateOGL(sizeof(GSVertexPT1), il_convert, countof(il_convert));
|
||||
m_vb_sr = new GSVertexBufferStateOGL(sizeof(GSVertexPxyT1), il_convert, countof(il_convert));
|
||||
|
||||
// ****************************************************************
|
||||
// Texture unit state
|
||||
|
@ -825,12 +825,12 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
|||
flip_sr.w = sr.y;
|
||||
}
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
GSVertexPxyT1 vertices[] =
|
||||
{
|
||||
{GSVector4(left, top, 0.5f, 1.0f), GSVector2(flip_sr.x, flip_sr.y)},
|
||||
{GSVector4(right, top, 0.5f, 1.0f), GSVector2(flip_sr.z, flip_sr.y)},
|
||||
{GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(flip_sr.x, flip_sr.w)},
|
||||
{GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(flip_sr.z, flip_sr.w)},
|
||||
{GSVector2(left , top ) , GSVector2(flip_sr.x , flip_sr.y)} ,
|
||||
{GSVector2(right , top ) , GSVector2(flip_sr.z , flip_sr.y)} ,
|
||||
{GSVector2(left , bottom) , GSVector2(flip_sr.x , flip_sr.w)} ,
|
||||
{GSVector2(right , bottom) , GSVector2(flip_sr.z , flip_sr.w)} ,
|
||||
};
|
||||
|
||||
IASetVertexState(m_vb_sr);
|
||||
|
@ -930,7 +930,7 @@ void GSDeviceOGL::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
|||
StretchRect(st, sr, dt, dr, m_shadeboost.ps, true);
|
||||
}
|
||||
|
||||
void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
||||
void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPxyT1* vertices, bool datm)
|
||||
{
|
||||
#ifdef ENABLE_OGL_STENCIL_DEBUG
|
||||
const GSVector2i& size = rt->GetSize();
|
||||
|
|
|
@ -599,7 +599,7 @@ class GSDeviceOGL : public GSDevice
|
|||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, GLuint ps, bool linear = true);
|
||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear = true);
|
||||
|
||||
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm);
|
||||
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPxyT1* vertices, bool datm);
|
||||
|
||||
void EndScene();
|
||||
|
||||
|
|
|
@ -239,12 +239,12 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy()) * s.xyxy()).sat(o.zzyy());
|
||||
GSVector4 dst = src * 2.0f + o.xxxx();
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
GSVertexPxyT1 vertices[] =
|
||||
{
|
||||
{GSVector4(dst.x, dst.y, 0.5f, 1.0f), GSVector2(src.x, src.y)},
|
||||
{GSVector4(dst.z, dst.y, 0.5f, 1.0f), GSVector2(src.z, src.y)},
|
||||
{GSVector4(dst.x, dst.w, 0.5f, 1.0f), GSVector2(src.x, src.w)},
|
||||
{GSVector4(dst.z, dst.w, 0.5f, 1.0f), GSVector2(src.z, src.w)},
|
||||
{GSVector2(dst.x, dst.y), GSVector2(src.x, src.y)},
|
||||
{GSVector2(dst.z, dst.y), GSVector2(src.z, src.y)},
|
||||
{GSVector2(dst.x, dst.w), GSVector2(src.x, src.w)},
|
||||
{GSVector2(dst.z, dst.w), GSVector2(src.z, src.w)},
|
||||
};
|
||||
|
||||
dev->SetupDATE(rt, ds, vertices, m_context->TEST.DATM);
|
||||
|
|
|
@ -52,6 +52,15 @@ struct GSVertexP
|
|||
GSVector4 p;
|
||||
};
|
||||
|
||||
// Align 16 because the structure only contains 16B. Otherwise
|
||||
// sizeof(GSVertexPxyT1) == 32 which defeat the purpose to save bandwidth vs
|
||||
// GSVertexPT1
|
||||
__aligned(struct, 16) GSVertexPxyT1
|
||||
{
|
||||
GSVector2 p;
|
||||
GSVector2 t;
|
||||
};
|
||||
|
||||
__aligned(struct, 32) GSVertexPT1
|
||||
{
|
||||
GSVector4 p;
|
||||
|
|
|
@ -17,7 +17,7 @@ out gl_PerVertex {
|
|||
};
|
||||
#endif
|
||||
|
||||
layout(location = 0) in vec4 POSITION;
|
||||
layout(location = 0) in vec2 POSITION;
|
||||
layout(location = 1) in vec2 TEXCOORD0;
|
||||
|
||||
// FIXME set the interpolation (don't know what dx do)
|
||||
|
@ -55,9 +55,9 @@ layout(location = 1) out vec2 SHADERt;
|
|||
|
||||
void vs_main()
|
||||
{
|
||||
VSout_p = POSITION;
|
||||
VSout_p = vec4(POSITION, 0.5f, 1.0f);
|
||||
VSout_t = TEXCOORD0;
|
||||
gl_Position = POSITION; // NOTE I don't know if it is possible to merge POSITION_OUT and gl_Position
|
||||
gl_Position = vec4(POSITION, 0.5f, 1.0f); // NOTE I don't know if it is possible to merge POSITION_OUT and gl_Position
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,7 @@ static const char* convert_glsl =
|
|||
"};\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"layout(location = 0) in vec4 POSITION;\n"
|
||||
"layout(location = 0) in vec2 POSITION;\n"
|
||||
"layout(location = 1) in vec2 TEXCOORD0;\n"
|
||||
"\n"
|
||||
"// FIXME set the interpolation (don't know what dx do)\n"
|
||||
|
@ -80,9 +80,9 @@ static const char* convert_glsl =
|
|||
"\n"
|
||||
"void vs_main()\n"
|
||||
"{\n"
|
||||
" VSout_p = POSITION;\n"
|
||||
" VSout_p = vec4(POSITION, 0.5f, 1.0f);\n"
|
||||
" VSout_t = TEXCOORD0;\n"
|
||||
" gl_Position = POSITION; // NOTE I don't know if it is possible to merge POSITION_OUT and gl_Position\n"
|
||||
" gl_Position = vec4(POSITION, 0.5f, 1.0f); // NOTE I don't know if it is possible to merge POSITION_OUT and gl_Position\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"#endif\n"
|
||||
|
|
Loading…
Reference in New Issue