Explorar el Código

Merge pull request #1795 from ReinUsesLisp/vc-cleanup

video_core: Minor style changes
bunnei hace 7 años
padre
commit
a6805e58ce

+ 1 - 14
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;
         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<const char*>(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();
     OpenGLState::ApplyDefaultState();
 
 
     // Create render framebuffer
     // Create render framebuffer
@@ -443,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
     // 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
     // used to enable multiple render targets. However, it is left unset on all games that I have
     // tested.
     // tested.
-    ASSERT_MSG(regs.rt_separate_frag_data == 0, "Unimplemented");
+    UNIMPLEMENTED_IF(regs.rt_separate_frag_data != 0);
 
 
     // Bind the framebuffer surfaces
     // Bind the framebuffer surfaces
     current_state.draw.draw_framebuffer = framebuffer.handle;
     current_state.draw.draw_framebuffer = framebuffer.handle;

+ 0 - 17
src/video_core/renderer_opengl/gl_rasterizer.h

@@ -60,20 +60,6 @@ public:
     bool AccelerateDrawBatch(bool is_indexed) override;
     bool AccelerateDrawBatch(bool is_indexed) override;
     void UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 size, int delta) 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.
     /// Maximum supported size that a constbuffer can have in bytes.
     static constexpr std::size_t MaxConstbufferSize = 0x10000;
     static constexpr std::size_t MaxConstbufferSize = 0x10000;
     static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0,
     static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0,
@@ -193,9 +179,6 @@ private:
     /// but are needed for correct emulation
     /// but are needed for correct emulation
     void CheckExtensions();
     void CheckExtensions();
 
 
-    bool has_ARB_direct_state_access = false;
-    bool has_ARB_multi_bind = false;
-
     OpenGLState state;
     OpenGLState state;
 
 
     RasterizerCacheOpenGL res_cache;
     RasterizerCacheOpenGL res_cache;

+ 2 - 1
src/video_core/renderer_opengl/gl_rasterizer_cache.cpp

@@ -709,9 +709,10 @@ void CachedSurface::LoadGLBuffer() {
         const auto texture_src_data_end{texture_src_data + params.size_in_bytes_gl};
         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);
         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),
         ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer[i], params.pixel_format, params.MipWidth(i),
                                            params.MipHeight(i), params.MipDepth(i));
                                            params.MipHeight(i), params.MipDepth(i));
+    }
 }
 }
 
 
 MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64));
 MICROPROFILE_DEFINE(OpenGL_SurfaceFlush, "OpenGL", "Surface Flush", MP_RGB(128, 192, 64));

+ 2 - 0
src/yuzu/main.cpp

@@ -518,6 +518,8 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
 QStringList GMainWindow::GetUnsupportedGLExtensions() {
 QStringList GMainWindow::GetUnsupportedGLExtensions() {
     QStringList unsupported_ext;
     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)
     if (!GLAD_GL_ARB_vertex_type_10f_11f_11f_rev)
         unsupported_ext.append("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)
     if (!GLAD_GL_ARB_texture_mirror_clamp_to_edge)

+ 2 - 0
src/yuzu_cmd/emu_window/emu_window_sdl2.cpp

@@ -111,6 +111,8 @@ void EmuWindow_SDL2::Fullscreen() {
 bool EmuWindow_SDL2::SupportsRequiredGLExtensions() {
 bool EmuWindow_SDL2::SupportsRequiredGLExtensions() {
     std::vector<std::string> unsupported_ext;
     std::vector<std::string> 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)
     if (!GLAD_GL_ARB_vertex_type_10f_11f_11f_rev)
         unsupported_ext.push_back("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)
     if (!GLAD_GL_ARB_texture_mirror_clamp_to_edge)