From 22c7c710b4cd35b2275b1dbbcaa400c1fbb4243d Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 24 Nov 2018 00:07:42 -0300 Subject: [PATCH 1/4] gl_rasterizer: Remove extension booleans --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 13 ------------- src/video_core/renderer_opengl/gl_rasterizer.h | 3 --- src/yuzu/main.cpp | 2 ++ src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 2 ++ 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a44bbfae8..f5c785467 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -88,19 +88,6 @@ RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, ScreenInfo state.texture_units[i].sampler = texture_samplers[i].sampler.handle; } - GLint ext_num; - glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num); - for (GLint i = 0; i < ext_num; i++) { - const std::string_view extension{ - reinterpret_cast(glGetStringi(GL_EXTENSIONS, i))}; - - if (extension == "GL_ARB_direct_state_access") { - has_ARB_direct_state_access = true; - } else if (extension == "GL_ARB_multi_bind") { - has_ARB_multi_bind = true; - } - } - OpenGLState::ApplyDefaultState(); // Create render framebuffer diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 7ec9746b1..f3a163f6b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -193,9 +193,6 @@ private: /// but are needed for correct emulation void CheckExtensions(); - bool has_ARB_direct_state_access = false; - bool has_ARB_multi_bind = false; - OpenGLState state; RasterizerCacheOpenGL res_cache; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 93bf117c8..d4010001d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -518,6 +518,8 @@ void GMainWindow::OnDisplayTitleBars(bool show) { QStringList GMainWindow::GetUnsupportedGLExtensions() { QStringList unsupported_ext; + if (!GLAD_GL_ARB_direct_state_access) + unsupported_ext.append("ARB_direct_state_access"); if (!GLAD_GL_ARB_vertex_type_10f_11f_11f_rev) unsupported_ext.append("ARB_vertex_type_10f_11f_11f_rev"); if (!GLAD_GL_ARB_texture_mirror_clamp_to_edge) diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 2d6f8cced..a557f2884 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -111,6 +111,8 @@ void EmuWindow_SDL2::Fullscreen() { bool EmuWindow_SDL2::SupportsRequiredGLExtensions() { std::vector unsupported_ext; + if (!GLAD_GL_ARB_direct_state_access) + unsupported_ext.push_back("ARB_direct_state_access"); if (!GLAD_GL_ARB_vertex_type_10f_11f_11f_rev) unsupported_ext.push_back("ARB_vertex_type_10f_11f_11f_rev"); if (!GLAD_GL_ARB_texture_mirror_clamp_to_edge) From 432a9872ed1439db7ecaf1c235c59ebb8617441b Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 24 Nov 2018 00:09:54 -0300 Subject: [PATCH 2/4] gl_rasterizer: Remove unused struct declarations --- src/video_core/renderer_opengl/gl_rasterizer.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index f3a163f6b..ed70d73ee 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -60,20 +60,6 @@ public: bool AccelerateDrawBatch(bool is_indexed) override; void UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 size, int delta) override; - /// OpenGL shader generated for a given Maxwell register state - struct MaxwellShader { - /// OpenGL shader resource - OGLProgram shader; - }; - - struct VertexShader { - OGLShader shader; - }; - - struct FragmentShader { - OGLShader shader; - }; - /// Maximum supported size that a constbuffer can have in bytes. static constexpr std::size_t MaxConstbufferSize = 0x10000; static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0, From 653d7a3f0db44c248d0450ade1cd50aaa94bd4d6 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 24 Nov 2018 20:01:57 -0300 Subject: [PATCH 3/4] gl_rasterizer_cache: Use brackets for two-line single-expresion blocks --- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index dde2f468d..95c29d06f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -841,9 +841,10 @@ void CachedSurface::LoadGLBuffer() { const auto texture_src_data_end{texture_src_data + params.size_in_bytes_gl}; gl_buffer[0].assign(texture_src_data, texture_src_data_end); } - for (u32 i = 0; i < params.max_mip_level; i++) + for (u32 i = 0; i < params.max_mip_level; i++) { ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer[i], params.pixel_format, params.MipWidth(i), params.MipHeight(i), params.MipDepth(i)); + } } MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64)); From 037449668e4d3f7921fc4bbbf4ace1d2526fb378 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 28 Nov 2018 21:26:22 -0300 Subject: [PATCH 4/4] gl_rasterizer: Signal UNIMPLEMENTED when rt_separate_frag_data is not zero --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f5c785467..70855fcfd 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -430,7 +430,7 @@ void RasterizerOpenGL::ConfigureFramebuffers(OpenGLState& current_state, bool us // TODO(bunnei): Figure out how the below register works. According to envytools, this should be // used to enable multiple render targets. However, it is left unset on all games that I have // tested. - ASSERT_MSG(regs.rt_separate_frag_data == 0, "Unimplemented"); + UNIMPLEMENTED_IF(regs.rt_separate_frag_data != 0); // Bind the framebuffer surfaces current_state.draw.draw_framebuffer = framebuffer.handle;