mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Further D3D11 on mobile fixes
This commit is contained in:
parent
61c6d83b6e
commit
a04e24c300
@ -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_);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -22,12 +22,12 @@
|
||||
#include <d3d11.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user