diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 884b9db544..f937ed60b4 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -1129,11 +1129,6 @@ void Renderer::SetInterlacingMode() // TODO } -u32 Renderer::GetMaxTextureSize() -{ - return DX11::D3D::GetMaxTextureSize(); -} - u16 Renderer::BBoxRead(int index) { // Here we get the min/max value of the truncated position of the upscaled framebuffer. diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index ffb35fc7e7..0202f7fdff 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -62,8 +62,6 @@ public: bool CheckForResize(); - u32 GetMaxTextureSize() override; - private: void BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D* src_texture, u32 src_width, u32 src_height, float Gamma); diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 1fe55046ed..a093a05ca5 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -61,6 +61,7 @@ void VideoBackend::InitBackendInfo() } g_Config.backend_info.api_type = APIType::D3D; + g_Config.backend_info.MaxTextureSize = DX11::D3D::GetMaxTextureSize(); g_Config.backend_info.bSupportsExclusiveFullscreen = true; g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsPrimitiveRestart = true; diff --git a/Source/Core/VideoBackends/D3D12/D3DBase.h b/Source/Core/VideoBackends/D3D12/D3DBase.h index 89cd02738d..3690603693 100644 --- a/Source/Core/VideoBackends/D3D12/D3DBase.h +++ b/Source/Core/VideoBackends/D3D12/D3DBase.h @@ -121,8 +121,6 @@ const std::string PixelShaderVersionString(); const std::string GeometryShaderVersionString(); const std::string VertexShaderVersionString(); -unsigned int GetMaxTextureSize(); - HRESULT SetFullscreenState(bool enable_fullscreen); bool GetFullscreenState(); diff --git a/Source/Core/VideoBackends/D3D12/Render.cpp b/Source/Core/VideoBackends/D3D12/Render.cpp index 572660a06f..e5ca00bd7e 100644 --- a/Source/Core/VideoBackends/D3D12/Render.cpp +++ b/Source/Core/VideoBackends/D3D12/Render.cpp @@ -1159,11 +1159,6 @@ void Renderer::SetInterlacingMode() // EXISTINGD3D11TODO } -u32 Renderer::GetMaxTextureSize() -{ - return DX12::D3D::GetMaxTextureSize(); -} - u16 Renderer::BBoxRead(int index) { // Here we get the min/max value of the truncated position of the upscaled framebuffer. diff --git a/Source/Core/VideoBackends/D3D12/Render.h b/Source/Core/VideoBackends/D3D12/Render.h index 90471f7e6b..2b8f1cbaf2 100644 --- a/Source/Core/VideoBackends/D3D12/Render.h +++ b/Source/Core/VideoBackends/D3D12/Render.h @@ -61,8 +61,6 @@ public: bool CheckForResize(); - u32 GetMaxTextureSize() override; - static D3D12_BLEND_DESC GetResetBlendDesc(); static D3D12_DEPTH_STENCIL_DESC GetResetDepthStencilDesc(); static D3D12_RASTERIZER_DESC GetResetRasterizerDesc(); diff --git a/Source/Core/VideoBackends/D3D12/main.cpp b/Source/Core/VideoBackends/D3D12/main.cpp index 7c31537d8a..bae916e0f8 100644 --- a/Source/Core/VideoBackends/D3D12/main.cpp +++ b/Source/Core/VideoBackends/D3D12/main.cpp @@ -64,6 +64,7 @@ void VideoBackend::InitBackendInfo() } g_Config.backend_info.api_type = APIType::D3D; + g_Config.backend_info.MaxTextureSize = D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION; g_Config.backend_info.bSupportsExclusiveFullscreen = false; g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsPrimitiveRestart = true; diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp index 1e3117088e..1fe0914a91 100644 --- a/Source/Core/VideoBackends/Null/NullBackend.cpp +++ b/Source/Core/VideoBackends/Null/NullBackend.cpp @@ -24,6 +24,7 @@ namespace Null void VideoBackend::InitBackendInfo() { g_Config.backend_info.api_type = APIType::Nothing; + g_Config.backend_info.MaxTextureSize = 16384; g_Config.backend_info.bSupportsExclusiveFullscreen = true; g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsPrimitiveRestart = true; diff --git a/Source/Core/VideoBackends/Null/Render.h b/Source/Core/VideoBackends/Null/Render.h index 9e303281a1..2187f147c0 100644 --- a/Source/Core/VideoBackends/Null/Render.h +++ b/Source/Core/VideoBackends/Null/Render.h @@ -19,7 +19,6 @@ public: void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) override {} u16 BBoxRead(int index) override { return 0; } void BBoxWrite(int index, u16 value) override {} - u32 GetMaxTextureSize() override { return 16 * 1024; } TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 1c03c30226..621c21c539 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -51,8 +51,6 @@ void VideoConfig::UpdateProjectionHack() ::UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); } -static int s_max_texture_size = 0; - namespace OGL { VideoConfig g_ogl_config; @@ -334,49 +332,12 @@ Renderer::Renderer() { bool bSuccess = true; - // Init extension support. - if (!GLExtensions::Init()) - { - // OpenGL 2.0 is required for all shader based drawings. There is no way to get this by - // extensions - PanicAlert("GPU: OGL ERROR: Does your video card support OpenGL 2.0?"); - bSuccess = false; - } - g_ogl_config.gl_vendor = (const char*)glGetString(GL_VENDOR); g_ogl_config.gl_renderer = (const char*)glGetString(GL_RENDERER); g_ogl_config.gl_version = (const char*)glGetString(GL_VERSION); InitDriverInfo(); - if (GLExtensions::Version() < 300) - { - // integer vertex attributes require a gl3 only function - PanicAlert("GPU: OGL ERROR: Need OpenGL version 3.\n" - "GPU: Does your video card support OpenGL 3?"); - bSuccess = false; - } - - // check for the max vertex attributes - GLint numvertexattribs = 0; - glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs); - if (numvertexattribs < 16) - { - PanicAlert("GPU: OGL ERROR: Number of attributes %d not enough.\n" - "GPU: Does your video card support OpenGL 2.x?", - numvertexattribs); - bSuccess = false; - } - - // check the max texture width and height - GLint max_texture_size; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*)&max_texture_size); - if (max_texture_size < 1024) - { - PanicAlert("GL_MAX_TEXTURE_SIZE too small at %i - must be at least 1024.", max_texture_size); - bSuccess = false; - } - if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) { if (!GLExtensions::Supports("GL_ARB_framebuffer_object")) @@ -657,10 +618,6 @@ Renderer::Renderer() return; } - glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples); - if (g_ogl_config.max_samples < 1 || !g_ogl_config.bSupportsMSAA) - g_ogl_config.max_samples = 1; - g_Config.VerifyValidity(); UpdateActiveConfig(); @@ -1778,19 +1735,6 @@ void Renderer::SetInterlacingMode() { // TODO } -} - -namespace OGL -{ -u32 Renderer::GetMaxTextureSize() -{ - // Right now nvidia seems to do something very weird if we try to cache GL_MAX_TEXTURE_SIZE in - // init. This is a workaround that lets - // us keep the perf improvement that caching it gives us. - if (s_max_texture_size == 0) - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s_max_texture_size); - return static_cast(s_max_texture_size); -} void Renderer::ChangeSurface(void* new_surface_handle) { diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index 095ddcd1ea..e3c2ba13c3 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -103,8 +103,6 @@ public: void ReinterpretPixelData(unsigned int convtype) override; - u32 GetMaxTextureSize() override; - void ChangeSurface(void* new_surface_handle) override; private: diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h index 17b542801d..c78c94c4c1 100644 --- a/Source/Core/VideoBackends/OGL/VideoBackend.h +++ b/Source/Core/VideoBackends/OGL/VideoBackend.h @@ -23,5 +23,9 @@ class VideoBackend : public VideoBackendBase void InitBackendInfo() override; unsigned int PeekMessages() override; + +private: + bool InitializeGLExtensions(); + bool FillBackendInfo(); }; } diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 7b070aac5b..3be16a6cbf 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -42,6 +42,7 @@ Make AA apply instantly during gameplay if possible #include "Common/FileSearch.h" #include "Common/GL/GLInterfaceBase.h" #include "Common/GL/GLUtil.h" +#include "Common/MsgHandler.h" #include "VideoBackends/OGL/BoundingBox.h" #include "VideoBackends/OGL/PerfQuery.h" @@ -96,6 +97,7 @@ static std::vector GetShaders(const std::string& sub_dir = "") void VideoBackend::InitBackendInfo() { g_Config.backend_info.api_type = APIType::OpenGL; + g_Config.backend_info.MaxTextureSize = 16384; g_Config.backend_info.bSupportsExclusiveFullscreen = false; g_Config.backend_info.bSupportsOversizedViewports = true; g_Config.backend_info.bSupportsGeometryShaders = true; @@ -123,6 +125,59 @@ void VideoBackend::InitBackendInfo() g_Config.backend_info.AnaglyphShaders = GetShaders(ANAGLYPH_DIR DIR_SEP); } +bool VideoBackend::InitializeGLExtensions() +{ + // Init extension support. + if (!GLExtensions::Init()) + { + // OpenGL 2.0 is required for all shader based drawings. There is no way to get this by + // extensions + PanicAlert("GPU: OGL ERROR: Does your video card support OpenGL 2.0?"); + return false; + } + + if (GLExtensions::Version() < 300) + { + // integer vertex attributes require a gl3 only function + PanicAlert("GPU: OGL ERROR: Need OpenGL version 3.\n" + "GPU: Does your video card support OpenGL 3?"); + return false; + } + + return true; +} + +bool VideoBackend::FillBackendInfo() +{ + // check for the max vertex attributes + GLint numvertexattribs = 0; + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs); + if (numvertexattribs < 16) + { + PanicAlert("GPU: OGL ERROR: Number of attributes %d not enough.\n" + "GPU: Does your video card support OpenGL 2.x?", + numvertexattribs); + return false; + } + + // check the max texture width and height + GLint max_texture_size = 0; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); + g_Config.backend_info.MaxTextureSize = static_cast(max_texture_size); + if (max_texture_size < 1024) + { + PanicAlert("GL_MAX_TEXTURE_SIZE too small at %i - must be at least 1024.", max_texture_size); + return false; + } + + glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples); + if (g_ogl_config.max_samples < 1 || !g_ogl_config.bSupportsMSAA) + g_ogl_config.max_samples = 1; + + // TODO: Move the remaining fields from the Renderer constructor here. + return true; +} + bool VideoBackend::Initialize(void* window_handle) { InitBackendInfo(); @@ -141,6 +196,12 @@ bool VideoBackend::Initialize(void* window_handle) void VideoBackend::Video_Prepare() { GLInterface->MakeCurrent(); + if (!InitializeGLExtensions() || !FillBackendInfo()) + { + // TODO: Handle this better. We'll likely end up crashing anyway, but this method doesn't + // return anything, so we can't inform the caller that startup failed. + return; + } g_renderer = std::make_unique(); diff --git a/Source/Core/VideoBackends/Software/SWRenderer.h b/Source/Core/VideoBackends/Software/SWRenderer.h index ab75c761d8..ac96725253 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.h +++ b/Source/Core/VideoBackends/Software/SWRenderer.h @@ -31,7 +31,6 @@ public: u16 BBoxRead(int index) override; void BBoxWrite(int index, u16 value) override; - u32 GetMaxTextureSize() override { return 16 * 1024; }; TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index adbe5046b6..96ebdd8adb 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -124,6 +124,7 @@ std::string VideoSoftware::GetDisplayName() const void VideoSoftware::InitBackendInfo() { g_Config.backend_info.api_type = APIType::Nothing; + g_Config.backend_info.MaxTextureSize = 16384; g_Config.backend_info.bSupports3DVision = false; g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsEarlyZ = true; diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h index 34a3202b4f..49c261348c 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.h +++ b/Source/Core/VideoBackends/Vulkan/Renderer.h @@ -41,7 +41,6 @@ public: void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points) override; u16 BBoxRead(int index) override; void BBoxWrite(int index, u16 value) override; - u32 GetMaxTextureSize() override { return 16 * 1024; } TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; void SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, const EFBRectangle& rc, diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 7dc809e6b2..1487e09afc 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -257,8 +257,10 @@ void VulkanContext::PopulateBackendInfoAdapters(VideoConfig* config, const GPULi } void VulkanContext::PopulateBackendInfoFeatures(VideoConfig* config, VkPhysicalDevice gpu, + const VkPhysicalDeviceProperties& properties, const VkPhysicalDeviceFeatures& features) { + config->backend_info.MaxTextureSize = properties.limits.maxImageDimension2D; config->backend_info.bSupportsDualSourceBlend = (features.dualSrcBlend == VK_TRUE); config->backend_info.bSupportsGeometryShaders = (features.geometryShader == VK_TRUE); config->backend_info.bSupportsGSInstancing = (features.geometryShader == VK_TRUE); diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.h b/Source/Core/VideoBackends/Vulkan/VulkanContext.h index e7c8f27ff1..538573fc0a 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.h +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.h @@ -35,6 +35,7 @@ public: static void PopulateBackendInfo(VideoConfig* config); static void PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list); static void PopulateBackendInfoFeatures(VideoConfig* config, VkPhysicalDevice gpu, + const VkPhysicalDeviceProperties& properties, const VkPhysicalDeviceFeatures& features); static void PopulateBackendInfoMultisampleModes(VideoConfig* config, VkPhysicalDevice gpu, const VkPhysicalDeviceProperties& properties); diff --git a/Source/Core/VideoBackends/Vulkan/main.cpp b/Source/Core/VideoBackends/Vulkan/main.cpp index 8b610f517f..6eaaa09b4c 100644 --- a/Source/Core/VideoBackends/Vulkan/main.cpp +++ b/Source/Core/VideoBackends/Vulkan/main.cpp @@ -52,7 +52,7 @@ void VideoBackend::InitBackendInfo() vkGetPhysicalDeviceProperties(gpu, &properties); VkPhysicalDeviceFeatures features; vkGetPhysicalDeviceFeatures(gpu, &features); - VulkanContext::PopulateBackendInfoFeatures(&g_Config, gpu, features); + VulkanContext::PopulateBackendInfoFeatures(&g_Config, gpu, properties, features); VulkanContext::PopulateBackendInfoMultisampleModes(&g_Config, gpu, properties); } } @@ -178,6 +178,7 @@ bool VideoBackend::Initialize(void* window_handle) // Since VulkanContext maintains a copy of the device features and properties, we can use this // to initialize the backend information, so that we don't need to enumerate everything again. VulkanContext::PopulateBackendInfoFeatures(&g_Config, g_vulkan_context->GetPhysicalDevice(), + g_vulkan_context->GetDeviceProperties(), g_vulkan_context->GetDeviceFeatures()); VulkanContext::PopulateBackendInfoMultisampleModes( &g_Config, g_vulkan_context->GetPhysicalDevice(), g_vulkan_context->GetDeviceProperties()); diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/FramebufferManagerBase.cpp index 0fc65a5443..dd2cc88735 100644 --- a/Source/Core/VideoCommon/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/FramebufferManagerBase.cpp @@ -248,20 +248,18 @@ void FramebufferManagerBase::ReplaceVirtualXFB() } } -int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x) +int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x, const TargetRectangle& target_rectangle) { if (g_ActiveConfig.RealXFBEnabled()) return x; - return x * static_cast(g_renderer->GetTargetRectangle().GetWidth()) / - static_cast(FramebufferManagerBase::LastXfbWidth()); + return x * target_rectangle.GetWidth() / s_last_xfb_width; } -int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y) +int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, const TargetRectangle& target_rectangle) { if (g_ActiveConfig.RealXFBEnabled()) return y; - return y * static_cast(g_renderer->GetTargetRectangle().GetHeight()) / - static_cast(FramebufferManagerBase::LastXfbHeight()); + return y * target_rectangle.GetHeight() / s_last_xfb_height; } diff --git a/Source/Core/VideoCommon/FramebufferManagerBase.h b/Source/Core/VideoCommon/FramebufferManagerBase.h index 47426b2e01..c780a3fa21 100644 --- a/Source/Core/VideoCommon/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/FramebufferManagerBase.h @@ -57,8 +57,8 @@ public: static void SetLastXfbHeight(unsigned int height) { s_last_xfb_height = height; } static unsigned int LastXfbWidth() { return s_last_xfb_width; } static unsigned int LastXfbHeight() { return s_last_xfb_height; } - static int ScaleToVirtualXfbWidth(int x); - static int ScaleToVirtualXfbHeight(int y); + static int ScaleToVirtualXfbWidth(int x, const TargetRectangle& target_rectangle); + static int ScaleToVirtualXfbHeight(int y, const TargetRectangle& target_rectangle); static unsigned int GetEFBLayers() { return m_EFBLayers; } virtual std::pair GetTargetSize() const = 0; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 7e598e2373..1c99e51950 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -84,8 +84,8 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height) FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT); UpdateActiveConfig(); - CalculateTargetSize(); UpdateDrawRectangle(); + CalculateTargetSize(); OSDChoice = 0; OSDTime = 0; @@ -127,7 +127,7 @@ int Renderer::EFBToScaledX(int x) switch (g_ActiveConfig.iEFBScale) { case SCALE_AUTO: // fractional - return FramebufferManagerBase::ScaleToVirtualXfbWidth(x); + return FramebufferManagerBase::ScaleToVirtualXfbWidth(x, m_target_rectangle); default: return x * (int)m_efb_scale_numeratorX / (int)m_efb_scale_denominatorX; @@ -139,7 +139,7 @@ int Renderer::EFBToScaledY(int y) switch (g_ActiveConfig.iEFBScale) { case SCALE_AUTO: // fractional - return FramebufferManagerBase::ScaleToVirtualXfbHeight(y); + return FramebufferManagerBase::ScaleToVirtualXfbHeight(y, m_target_rectangle); default: return y * (int)m_efb_scale_numeratorY / (int)m_efb_scale_denominatorY; @@ -173,8 +173,8 @@ bool Renderer::CalculateTargetSize() { case SCALE_AUTO: case SCALE_AUTO_INTEGRAL: - newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH); - newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT); + newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, m_target_rectangle); + newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, m_target_rectangle); if (m_last_efb_scale == SCALE_AUTO_INTEGRAL) { @@ -217,7 +217,7 @@ bool Renderer::CalculateTargetSize() m_efb_scale_numeratorX = m_efb_scale_numeratorY = m_last_efb_scale - 3; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1; - const u32 max_size = GetMaxTextureSize(); + const u32 max_size = g_ActiveConfig.backend_info.MaxTextureSize; if (max_size < EFB_WIDTH * m_efb_scale_numeratorX / m_efb_scale_denominatorX) { m_efb_scale_numeratorX = m_efb_scale_numeratorY = (max_size / EFB_WIDTH); diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 79c174e28c..b1291adf0d 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -137,9 +137,6 @@ public: PEControl::PixelFormat GetPrevPixelFormat() { return m_prev_efb_format; } void StorePixelFormat(PEControl::PixelFormat new_format) { m_prev_efb_format = new_format; } PostProcessingShaderImplementation* GetPostProcessor() { return m_post_processor.get(); } - // Max height/width - virtual u32 GetMaxTextureSize() = 0; - // Final surface changing // This is called when the surface is resized (WX) or the window changes (Android). virtual void ChangeSurface(void* new_surface_handle) {} @@ -168,7 +165,7 @@ protected: int m_backbuffer_width = 0; int m_backbuffer_height = 0; int m_last_efb_scale = 0; - TargetRectangle m_target_rectangle; + TargetRectangle m_target_rectangle = {}; bool m_xfb_written = false; FPSCounter m_fps_counter; diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index b1dbee5407..2f9b374dd6 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -242,7 +242,7 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntryBas return; } - u32 max = g_renderer->GetMaxTextureSize(); + const u32 max = g_ActiveConfig.backend_info.MaxTextureSize; if (max < new_width || max < new_height) { ERROR_LOG(VIDEO, "Texture too big, width = %d, height = %d", new_width, new_height); diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 1f3d3d10ea..2db2494a05 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -37,6 +37,7 @@ VideoConfig::VideoConfig() // disable all features by default backend_info.api_type = APIType::Nothing; + backend_info.MaxTextureSize = 16384; backend_info.bSupportsExclusiveFullscreen = false; backend_info.bSupportsMultithreading = false; backend_info.bSupportsInternalResolutionFrameDumps = false; diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index dfab8bbcc3..ec79e6de48 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -173,6 +173,8 @@ struct VideoConfig final // TODO: merge AdapterName and Adapters array std::string AdapterName; // for OpenGL + u32 MaxTextureSize; + bool bSupportsExclusiveFullscreen; bool bSupportsDualSourceBlend; bool bSupportsPrimitiveRestart;