diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 63a203e317..54fcfa4277 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -781,6 +781,11 @@ void FramebufferManagerCommon::DownloadFramebufferOnSwitch(VirtualFramebuffer *v } } +void FramebufferManagerCommon::SetViewport2D(int x, int y, int w, int h) { + Draw::Viewport vp{ (float)x, (float)y, (float)w, (float)h, 0.0f, 1.0f }; + draw_->SetViewports(1, &vp); +} + void FramebufferManagerCommon::CopyDisplayToOutput() { DownloadFramebufferOnSwitch(currentRenderVfb_); diff --git a/GPU/Common/FramebufferCommon.h b/GPU/Common/FramebufferCommon.h index a5c5324b73..3aa8b51878 100644 --- a/GPU/Common/FramebufferCommon.h +++ b/GPU/Common/FramebufferCommon.h @@ -272,7 +272,7 @@ public: virtual bool GetOutputFramebuffer(GPUDebugBuffer &buffer) = 0; protected: - virtual void SetViewport2D(int x, int y, int w, int h) = 0; + virtual void SetViewport2D(int x, int y, int w, int h); void CalculatePostShaderUniforms(int bufferWidth, int bufferHeight, int renderWidth, int renderHeight, PostShaderUniforms *uniforms); virtual void MakePixelTexture(const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) = 0; virtual void DrawActiveTexture(float x, float y, float w, float h, float destW, float destH, float u0, float v0, float u1, float v1, int uvRotation, bool linearFilter) = 0; diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index 2be0382f2d..245c511ed2 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -38,6 +38,7 @@ #include "GPU/Common/TransformCommon.h" #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/SoftwareTransformCommon.h" +#include "GPU/D3D11/FramebufferManagerD3D11.h" #include "GPU/D3D11/TextureCacheD3D11.h" #include "GPU/D3D11/DrawEngineD3D11.h" #include "GPU/D3D11/ShaderManagerD3D11.h" diff --git a/GPU/D3D11/FramebufferManagerD3D11.cpp b/GPU/D3D11/FramebufferManagerD3D11.cpp index 3b7a4eff5f..bc3af19710 100644 --- a/GPU/D3D11/FramebufferManagerD3D11.cpp +++ b/GPU/D3D11/FramebufferManagerD3D11.cpp @@ -371,11 +371,6 @@ void FramebufferManagerD3D11::MakePixelTexture(const u8 *srcPixels, GEBufferForm // D3DXSaveTextureToFile("game:\\cc.png", D3DXIFF_PNG, drawPixelsTex_, NULL); } -void FramebufferManagerD3D11::SetViewport2D(int x, int y, int w, int h) { - D3D11_VIEWPORT vp{ (float)x, (float)y, (float)w, (float)h, 0.0f, 1.0f }; - context_->RSSetViewports(1, &vp); -} - void FramebufferManagerD3D11::DrawActiveTexture(float x, float y, float w, float h, float destW, float destH, float u0, float v0, float u1, float v1, int uvRotation, bool linearFilter) { float coord[20] = { x,y,0, u0,v0, @@ -702,7 +697,7 @@ void FramebufferManagerD3D11::SimpleBlit( }; D3D11_MAPPED_SUBRESOURCE map; - context_->Map(quadBuffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); + ASSERT_SUCCESS(context_->Map(quadBuffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &map)); memcpy(map.pData, vtx, 4 * sizeof(Vtx)); context_->Unmap(quadBuffer_, 0); diff --git a/GPU/D3D11/FramebufferManagerD3D11.h b/GPU/D3D11/FramebufferManagerD3D11.h index 68694f9058..cac0c8157e 100644 --- a/GPU/D3D11/FramebufferManagerD3D11.h +++ b/GPU/D3D11/FramebufferManagerD3D11.h @@ -82,7 +82,6 @@ public: } protected: - void SetViewport2D(int x, int y, int w, int h) override; void DisableState() override; void ClearBuffer(bool keepState = false) override; void FlushBeforeCopy() override; diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 3e7cc45a54..0c500cebbf 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -517,7 +517,12 @@ void GPU_D3D11::CheckGPUFeatures() { features |= GPU_SUPPORTS_BLEND_MINMAX; features |= GPU_PREFER_CPU_DOWNLOAD; features |= GPU_SUPPORTS_ACCURATE_DEPTH; // Breaks text in PaRappa for some reason. + +#ifndef _M_ARM + // TODO: Do proper feature detection features |= GPU_SUPPORTS_ANISOTROPY; +#endif + features |= GPU_SUPPORTS_OES_TEXTURE_NPOT; features |= GPU_SUPPORTS_LARGE_VIEWPORTS; features |= GPU_SUPPORTS_DUALSOURCE_BLEND; diff --git a/GPU/D3D11/GPU_D3D11.h b/GPU/D3D11/GPU_D3D11.h index f78d78113a..d5eb5ea7ce 100644 --- a/GPU/D3D11/GPU_D3D11.h +++ b/GPU/D3D11/GPU_D3D11.h @@ -22,12 +22,12 @@ #include #include "GPU/GPUCommon.h" -#include "GPU/D3D11/FramebufferManagerD3D11.h" #include "GPU/D3D11/DrawEngineD3D11.h" #include "GPU/D3D11/TextureCacheD3D11.h" #include "GPU/D3D11/DepalettizeShaderD3D11.h" #include "GPU/Common/VertexDecoderCommon.h" +class FramebufferManagerD3D11; class ShaderManagerD3D11; class LinkedShaderD3D11; diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index fe0ebce418..6676415e7f 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -63,7 +63,7 @@ ID3D11SamplerState *SamplerCacheD3D11::GetOrCreateSampler(ID3D11Device *device, D3D11_SAMPLER_DESC samp{}; samp.AddressU = key.sClamp ? D3D11_TEXTURE_ADDRESS_CLAMP : D3D11_TEXTURE_ADDRESS_WRAP; samp.AddressV = key.tClamp ? D3D11_TEXTURE_ADDRESS_CLAMP : D3D11_TEXTURE_ADDRESS_WRAP; - samp.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; + samp.AddressW = samp.AddressU; // Mali benefits from all clamps being the same, and this one is irrelevant. if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) { samp.MaxAnisotropy = (float)(1 << g_Config.iAnisotropyLevel); } else { @@ -85,12 +85,21 @@ ID3D11SamplerState *SamplerCacheD3D11::GetOrCreateSampler(ID3D11Device *device, samp.Filter = D3D11_FILTER_ANISOTROPIC; else samp.Filter = filters[filterKey]; +#if PPSSPP_PLATFORM(UWP) && PPSSPP_ARCH(ARM) + // For some reason, can't set MaxLOD on mobile. + samp.MaxLOD = FLT_MAX; +#else samp.MaxLOD = key.maxLevel; - samp.MinLOD = 0.0f; +#endif + samp.MinLOD = -FLT_MAX; samp.MipLODBias = 0.0f; + samp.ComparisonFunc = D3D11_COMPARISON_NEVER; + for (int i = 0; i < 4; i++) { + samp.BorderColor[i] = 1.0f; + } ID3D11SamplerState *sampler; - device->CreateSamplerState(&samp, &sampler); + ASSERT_SUCCESS(device->CreateSamplerState(&samp, &sampler)); cache_[key] = sampler; return sampler; }