Skip to content

Commit e05d2a1

Browse files
committed
Totori support
1 parent 3d15b41 commit e05d2a1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

impl.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ class DeviceWrapper final : public ID3D11Device, IDXGIDevice1 {
870870
desc.Format = DXGI_FORMAT_R16_UNORM;
871871
pDesc = &desc;
872872
}
873-
if (config.msaaSamples && tdesc.Format == DXGI_FORMAT_B8G8R8A8_TYPELESS && !(isPowerOfTwo(tdesc.Width) && !isPowerOfTwo(tdesc.Height))) {
873+
if (config.msaaSamples && (tdesc.Format == DXGI_FORMAT_B8G8R8A8_TYPELESS || tdesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM) && !(isPowerOfTwo(tdesc.Width) && !isPowerOfTwo(tdesc.Height))) {
874874
// Not shadow texture
875875
MSAACandidateState state = MSAACandidateState::None;
876876
UINT size = sizeof(state);
@@ -1030,6 +1030,7 @@ class ContextWrapper final : public ID3D11DeviceContext {
10301030
LONG refcnt;
10311031
UINT numIndexedDraws = 0;
10321032
ID3D11DeviceContext* ctx;
1033+
ID3D11Resource* needsResolve;
10331034
ID3D11BlendState* alphaToCoverageBlend = nullptr;
10341035
ID3D11BlendState* requestedBlend = nullptr;
10351036
ID3D11PixelShader* requestedPS = nullptr;
@@ -1173,7 +1174,14 @@ class ContextWrapper final : public ID3D11DeviceContext {
11731174
void Flush() override { ctx->Flush(); }
11741175
D3D11_DEVICE_CONTEXT_TYPE GetType() override { return ctx->GetType(); }
11751176
UINT GetContextFlags() override { return ctx->GetContextFlags(); }
1176-
HRESULT FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList** ppCommandList) override { return ctx->FinishCommandList(RestoreDeferredContextState, ppCommandList); }
1177+
1178+
HRESULT FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList** ppCommandList) override {
1179+
if (needsResolve) {
1180+
resolveIfMSAA(ctx, needsResolve);
1181+
needsResolve = nullptr;
1182+
}
1183+
return ctx->FinishCommandList(RestoreDeferredContextState, ppCommandList);
1184+
}
11771185

11781186
void RSSetViewports(UINT NumViewports, const D3D11_VIEWPORT* pViewports) override
11791187
{
@@ -1555,6 +1563,7 @@ class ContextWrapper final : public ID3D11DeviceContext {
15551563
dev->Release();
15561564
// We're rendering to the texture so it's now dirty
15571565
base->SetPrivateData(IID_MSAACandidate, sizeof(state), &MSAACandidateStateDirty);
1566+
needsResolve = base;
15581567
}
15591568
base->Release();
15601569
}

0 commit comments

Comments
 (0)