mirror of https://github.com/PCSX2/pcsx2.git
gsdx-d3d11: Port RenderOsd function from opengl to support osd on d3d11
This commit is contained in:
parent
83d293d41c
commit
5e75a66f82
|
@ -411,6 +411,9 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||||
SetExclusive(!theApp.GetConfigB("windowed"));
|
SetExclusive(!theApp.GetConfigB("windowed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GSVector2i tex_font = m_osd.get_texture_font_size();
|
||||||
|
m_font = CreateSurface(GSTexture::Texture, tex_font.x, tex_font.y, false, DXGI_FORMAT_R8_UNORM);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,6 +811,47 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
||||||
PSSetShaderResources(NULL, NULL);
|
PSSetShaderResources(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSDevice11::RenderOsd(GSTexture* dt)
|
||||||
|
{
|
||||||
|
BeginScene();
|
||||||
|
|
||||||
|
// om
|
||||||
|
OMSetDepthStencilState(m_convert.dss, 0);
|
||||||
|
OMSetBlendState(m_merge.bs, 0);
|
||||||
|
OMSetRenderTargets(dt, NULL);
|
||||||
|
|
||||||
|
if(m_osd.m_texture_dirty) {
|
||||||
|
m_osd.upload_texture_atlas(m_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ps
|
||||||
|
PSSetShaderResource(0, m_font);
|
||||||
|
PSSetSamplerState(m_convert.pt, NULL);
|
||||||
|
PSSetShader(m_convert.ps[ShaderConvert_OSD], NULL);
|
||||||
|
|
||||||
|
// ia
|
||||||
|
IASetInputLayout(m_convert.il);
|
||||||
|
IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
|
|
||||||
|
// Note scaling could also be done in shader (require gl3/dx10)
|
||||||
|
size_t count = m_osd.Size();
|
||||||
|
void* dst = NULL;
|
||||||
|
|
||||||
|
IAMapVertexBuffer(&dst, sizeof(GSVertexPT1), count);
|
||||||
|
count = m_osd.GeneratePrimitives((GSVertexPT1*)dst, count);
|
||||||
|
IAUnmapVertexBuffer();
|
||||||
|
|
||||||
|
// vs
|
||||||
|
VSSetShader(m_convert.vs, NULL);
|
||||||
|
|
||||||
|
// gs
|
||||||
|
GSSetShader(NULL, NULL);
|
||||||
|
|
||||||
|
DrawPrimitive();
|
||||||
|
|
||||||
|
EndScene();
|
||||||
|
}
|
||||||
|
|
||||||
void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
||||||
{
|
{
|
||||||
bool slbg = PMODE.SLBG;
|
bool slbg = PMODE.SLBG;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class GSDevice11 : public GSDeviceDX
|
||||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
||||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
||||||
void DoExternalFX(GSTexture* sTex, GSTexture* dTex);
|
void DoExternalFX(GSTexture* sTex, GSTexture* dTex);
|
||||||
|
void RenderOsd(GSTexture* dt);
|
||||||
void InitExternalFX();
|
void InitExternalFX();
|
||||||
void InitFXAA(); // Bug workaround! Stack corruption? Heap corruption? No idea
|
void InitFXAA(); // Bug workaround! Stack corruption? Heap corruption? No idea
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public: // TODO
|
||||||
{
|
{
|
||||||
CComPtr<ID3D11InputLayout> il;
|
CComPtr<ID3D11InputLayout> il;
|
||||||
CComPtr<ID3D11VertexShader> vs;
|
CComPtr<ID3D11VertexShader> vs;
|
||||||
CComPtr<ID3D11PixelShader> ps[18];
|
CComPtr<ID3D11PixelShader> ps[ShaderConvert_Count];
|
||||||
CComPtr<ID3D11SamplerState> ln;
|
CComPtr<ID3D11SamplerState> ln;
|
||||||
CComPtr<ID3D11SamplerState> pt;
|
CComPtr<ID3D11SamplerState> pt;
|
||||||
CComPtr<ID3D11DepthStencilState> dss;
|
CComPtr<ID3D11DepthStencilState> dss;
|
||||||
|
@ -159,6 +159,8 @@ public: // TODO
|
||||||
GSConstantBuffer m_gs_cb_cache;
|
GSConstantBuffer m_gs_cb_cache;
|
||||||
PSConstantBuffer m_ps_cb_cache;
|
PSConstantBuffer m_ps_cb_cache;
|
||||||
|
|
||||||
|
GSTexture* m_font;
|
||||||
|
|
||||||
bool CreateTextureFX();
|
bool CreateTextureFX();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue