dx11: wrong texture returned to libretro in some cases
If a render to texture happens before presenting the current frame, another texture will be bound to shader slot #0 and will be returned to the libretro frontend. Issue #1616 and #1619
This commit is contained in:
parent
92555c68c6
commit
7907100b9c
|
@ -46,6 +46,8 @@ struct DX11Renderer : public Renderer
|
|||
frameRendered = false;
|
||||
#ifndef LIBRETRO
|
||||
imguiDriver->setFrameRendered();
|
||||
#else
|
||||
theDX11Context.present();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -132,6 +132,8 @@ ComPtr<ID3D11RenderTargetView>& DX11Context::getRenderTarget(int width, int heig
|
|||
|
||||
void DX11Context::presentFrame(ComPtr<ID3D11ShaderResourceView>& textureView, int width, int height)
|
||||
{
|
||||
ID3D11ShaderResourceView *nullSRView = nullptr;
|
||||
pDeviceContext->PSSetShaderResources(0, 1, &nullSRView);
|
||||
ComPtr<ID3D11RenderTargetView> renderTarget = getRenderTarget(width, height);
|
||||
pDeviceContext->OMSetRenderTargets(1, &renderTarget.get(), nullptr);
|
||||
|
||||
|
@ -160,7 +162,11 @@ void DX11Context::presentFrame(ComPtr<ID3D11ShaderResourceView>& textureView, in
|
|||
|
||||
ID3D11RenderTargetView *nullView = nullptr;
|
||||
pDeviceContext->OMSetRenderTargets(1, &nullView, nullptr);
|
||||
pDeviceContext->PSSetShaderResources(0, 1, &this->textureView.get());
|
||||
}
|
||||
|
||||
void DX11Context::present()
|
||||
{
|
||||
pDeviceContext->PSSetShaderResources(0, 1, &textureView.get());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,7 @@ class DX11Context : public GraphicsContext
|
|||
public:
|
||||
bool init(ID3D11Device *device, ID3D11DeviceContext *deviceContext, pD3DCompile D3DCompile, D3D_FEATURE_LEVEL featureLevel);
|
||||
void term() override;
|
||||
void present();
|
||||
|
||||
const ComPtr<ID3D11Device>& getDevice() const { return pDevice; }
|
||||
const ComPtr<ID3D11DeviceContext>& getDeviceContext() const { return pDeviceContext; }
|
||||
|
@ -88,6 +89,7 @@ private:
|
|||
int renderTargetHeight = 0;
|
||||
BlendStates blendStates;
|
||||
std::unique_ptr<Quad> quad;
|
||||
ComPtr<ID3D11RasterizerState> rasterizerState;
|
||||
|
||||
D3D_FEATURE_LEVEL featureLevel{};
|
||||
bool supportedTexFormats[5] {}; // indexed by TextureType enum
|
||||
|
|
Loading…
Reference in New Issue