summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/renderer_opengl.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-01-06 05:53:27 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-06 20:49:24 +0100
commit35c095898bf51098d9b2a71447850f3e1b0fc350 (patch)
tree38775f691f339e341330211185bd9dc0cf766442 /src/video_core/renderer_opengl/renderer_opengl.cpp
parentgl_state: Drop uniform buffer state tracking (diff)
downloadyuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.tar
yuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.tar.gz
yuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.tar.bz2
yuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.tar.lz
yuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.tar.xz
yuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.tar.zst
yuzu-35c095898bf51098d9b2a71447850f3e1b0fc350.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 4947f06fd..c268c9686 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -245,19 +245,20 @@ void RendererOpenGL::InitOpenGLObjects() {
// Generate VAO
vertex_array.Create();
-
state.draw.vertex_array = vertex_array.handle;
- state.draw.vertex_buffer = vertex_buffer.handle;
- state.Apply();
// Attach vertex data to VAO
- glBufferData(GL_ARRAY_BUFFER, sizeof(ScreenRectVertex) * 4, nullptr, GL_STREAM_DRAW);
- glVertexAttribPointer(attrib_position, 2, GL_FLOAT, GL_FALSE, sizeof(ScreenRectVertex),
- (GLvoid*)offsetof(ScreenRectVertex, position));
- glVertexAttribPointer(attrib_tex_coord, 2, GL_FLOAT, GL_FALSE, sizeof(ScreenRectVertex),
- (GLvoid*)offsetof(ScreenRectVertex, tex_coord));
- glEnableVertexAttribArray(attrib_position);
- glEnableVertexAttribArray(attrib_tex_coord);
+ glNamedBufferData(vertex_buffer.handle, sizeof(ScreenRectVertex) * 4, nullptr, GL_STREAM_DRAW);
+ glVertexArrayAttribFormat(vertex_array.handle, attrib_position, 2, GL_FLOAT, GL_FALSE,
+ offsetof(ScreenRectVertex, position));
+ glVertexArrayAttribFormat(vertex_array.handle, attrib_tex_coord, 2, GL_FLOAT, GL_FALSE,
+ offsetof(ScreenRectVertex, tex_coord));
+ glVertexArrayAttribBinding(vertex_array.handle, attrib_position, 0);
+ glVertexArrayAttribBinding(vertex_array.handle, attrib_tex_coord, 0);
+ glEnableVertexArrayAttrib(vertex_array.handle, attrib_position);
+ glEnableVertexArrayAttrib(vertex_array.handle, attrib_tex_coord);
+ glVertexArrayVertexBuffer(vertex_array.handle, 0, vertex_buffer.handle, 0,
+ sizeof(ScreenRectVertex));
// Allocate textures for the screen
screen_info.texture.resource.Create();
@@ -369,14 +370,12 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
state.texture_units[0].texture = screen_info.display_texture;
state.texture_units[0].swizzle = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
// Workaround brigthness problems in SMO by enabling sRGB in the final output
- // if it has been used in the frame
- // Needed because of this bug in QT
- // QTBUG-50987
+ // if it has been used in the frame. Needed because of this bug in QT: QTBUG-50987
state.framebuffer_srgb.enabled = OpenGLState::GetsRGBUsed();
state.Apply();
- glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices.data());
+ glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), vertices.data());
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- // restore default state
+ // Restore default state
state.framebuffer_srgb.enabled = false;
state.texture_units[0].texture = 0;
state.Apply();