move glBindBuffer and glBindVertexArray out of VertexManager
Signed-off-by: Ryan Houdek <Sonicadvance1@gmail.com>
This commit is contained in:
parent
09274e2483
commit
79a7ce4827
|
@ -201,7 +201,11 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
|||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+4);
|
||||
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
// EFB framebuffer is currently bound, make sure to clear its alpha value to 1.f
|
||||
glViewport(0, 0, m_targetWidth, m_targetHeight);
|
||||
glScissor(0, 0, m_targetWidth, m_targetHeight);
|
||||
|
@ -356,6 +360,9 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
|||
};
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, 2*4*3*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
s_cached_sourcerc = sourcerc;
|
||||
s_cached_drawrc = drawrc;
|
||||
|
@ -363,6 +370,9 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
|||
|
||||
glBindVertexArray(s_VAO);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindVertexArray(0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
|
|
@ -187,9 +187,6 @@ void GLVertexFormat::SetupVertexPointers() {
|
|||
#ifdef USE_JIT
|
||||
((void (*)())(void*)m_compiledCode)();
|
||||
#else
|
||||
// TODO: use this :-)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, vtx_decl.stride, VertexManager::s_pBaseBufferPointer);
|
||||
if (vtx_decl.num_normals >= 1) {
|
||||
|
@ -224,13 +221,13 @@ void GLVertexFormat::SetupVertexPointers() {
|
|||
}
|
||||
#endif
|
||||
|
||||
// if (s_prevcomponents != m_components)
|
||||
if (s_prevcomponents != m_components)
|
||||
{
|
||||
// vertices
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
// matrices
|
||||
// if ((m_components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX))
|
||||
if ((m_components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX))
|
||||
{
|
||||
if (m_components & VB_HAS_POSMTXIDX)
|
||||
glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB);
|
||||
|
@ -239,14 +236,14 @@ void GLVertexFormat::SetupVertexPointers() {
|
|||
}
|
||||
|
||||
// normals
|
||||
// if ((m_components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0))
|
||||
if ((m_components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0))
|
||||
{
|
||||
if (m_components & VB_HAS_NRM0)
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
else
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
}
|
||||
// if ((m_components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1))
|
||||
if ((m_components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1))
|
||||
{
|
||||
if (m_components & VB_HAS_NRM1) {
|
||||
glEnableVertexAttribArray(SHADER_NORM1_ATTRIB);
|
||||
|
@ -261,7 +258,7 @@ void GLVertexFormat::SetupVertexPointers() {
|
|||
// color
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
// if ((m_components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i)))
|
||||
if ((m_components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i)))
|
||||
{
|
||||
if (m_components & (VB_HAS_COL0 << i))
|
||||
glEnableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY);
|
||||
|
@ -273,7 +270,7 @@ void GLVertexFormat::SetupVertexPointers() {
|
|||
// tex
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
// if ((m_components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)))
|
||||
if ((m_components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)))
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE0 + i);
|
||||
if (m_components & (VB_HAS_UV0 << i))
|
||||
|
|
|
@ -182,6 +182,10 @@ RasterFont::RasterFont()
|
|||
glUniform4f(uniform_color_id, 1, 1, 1, 1);
|
||||
cached_color = -1;
|
||||
glUseProgram(0);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
RasterFont::~RasterFont()
|
||||
|
@ -280,5 +284,9 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
|
|||
glBindTexture(GL_TEXTURE_RECTANGLE, texture);
|
||||
glDrawArrays(GL_TRIANGLES, 0, usage/4);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
|
|
@ -503,6 +503,10 @@ Renderer::Renderer()
|
|||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+5);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glStencilFunc(GL_ALWAYS, 0, 0);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
|
@ -696,6 +700,10 @@ void Renderer::DrawDebugInfo()
|
|||
|
||||
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
||||
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
// Restore Line Size
|
||||
glLineWidth(lSize);
|
||||
|
@ -1268,12 +1276,19 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
s_cached_targetRc = targetRc;
|
||||
}
|
||||
|
||||
glBindVertexArray(s_Swap_VAO[applyShader]);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindVertexArray(0);
|
||||
|
||||
if(applyShader)
|
||||
PixelShaderCache::DisableShader();
|
||||
}
|
||||
|
|
|
@ -357,11 +357,17 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||
glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
vbo_it->second.targetSource = targetSource;
|
||||
}
|
||||
|
||||
glBindVertexArray(vbo_it->second.vao);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindVertexArray(0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
|
|
|
@ -175,7 +175,9 @@ void Init()
|
|||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL+2);
|
||||
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glGenRenderbuffersEXT(1, &s_dstRenderBuffer);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||
|
@ -269,12 +271,18 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
|
|||
glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO );
|
||||
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
s_cached_sourceRc = sourceRc;
|
||||
}
|
||||
|
||||
glBindVertexArray( s_encode_VAO );
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindVertexArray(0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// .. and then read back the results.
|
||||
|
@ -446,13 +454,19 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
|||
glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO );
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*4*4, vertices, GL_STREAM_DRAW);
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
s_cached_srcHeight = srcHeight;
|
||||
s_cached_srcWidth = srcWidth;
|
||||
}
|
||||
|
||||
glBindVertexArray( s_decode_VAO );
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
|
||||
// TODO: this after merging with graphic_update
|
||||
glBindVertexArray(0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// reset state
|
||||
|
|
Loading…
Reference in New Issue