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