mirror of https://github.com/PCSX2/pcsx2.git
GSdx: Slightly more sensible input layout handling. No functional change.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2753 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
9984259f1f
commit
c09114e08b
|
@ -24,6 +24,12 @@
|
|||
#include "GSDeviceDX.h"
|
||||
#include "GSTexture10.h"
|
||||
|
||||
struct GSVertexShader10
|
||||
{
|
||||
CComPtr<ID3D10VertexShader> vs;
|
||||
CComPtr<ID3D10InputLayout> il;
|
||||
};
|
||||
|
||||
class GSDevice10 : public GSDeviceDX
|
||||
{
|
||||
GSTexture* Create(int type, int w, int h, bool msaa, int format);
|
||||
|
@ -96,8 +102,7 @@ public: // TODO
|
|||
|
||||
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1 (&iaVertices)[4], bool datm);
|
||||
|
||||
CComPtr<ID3D10InputLayout> m_il;
|
||||
hash_map<uint32, CComPtr<ID3D10VertexShader> > m_vs;
|
||||
hash_map<uint32, GSVertexShader10 > m_vs;
|
||||
CComPtr<ID3D10Buffer> m_vs_cb;
|
||||
hash_map<uint32, CComPtr<ID3D10GeometryShader> > m_gs;
|
||||
hash_map<uint32, CComPtr<ID3D10PixelShader> > m_ps;
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
#include "GSDeviceDX.h"
|
||||
#include "GSTexture11.h"
|
||||
|
||||
struct GSVertexShader11
|
||||
{
|
||||
CComPtr<ID3D11VertexShader> vs;
|
||||
CComPtr<ID3D11InputLayout> il;
|
||||
};
|
||||
|
||||
class GSDevice11 : public GSDeviceDX
|
||||
{
|
||||
GSTexture* Create(int type, int w, int h, bool msaa, int format);
|
||||
|
@ -99,8 +105,7 @@ public: // TODO
|
|||
|
||||
// Shaders...
|
||||
|
||||
CComPtr<ID3D11InputLayout> m_il;
|
||||
hash_map<uint32, CComPtr<ID3D11VertexShader> > m_vs;
|
||||
hash_map<uint32, GSVertexShader11 > m_vs;
|
||||
CComPtr<ID3D11Buffer> m_vs_cb;
|
||||
hash_map<uint32, CComPtr<ID3D11GeometryShader> > m_gs;
|
||||
hash_map<uint32, CComPtr<ID3D11PixelShader> > m_ps;
|
||||
|
|
|
@ -59,6 +59,12 @@ struct Direct3DBlendState9
|
|||
UINT8 RenderTargetWriteMask;
|
||||
};
|
||||
|
||||
struct GSVertexShader9
|
||||
{
|
||||
CComPtr<IDirect3DVertexShader9> vs;
|
||||
CComPtr<IDirect3DVertexDeclaration9> il;
|
||||
};
|
||||
|
||||
class GSDevice9 : public GSDeviceDX
|
||||
{
|
||||
GSTexture* Create(int type, int w, int h, bool msaa, int format);
|
||||
|
@ -134,8 +140,7 @@ public: // TODO
|
|||
|
||||
// Shaders...
|
||||
|
||||
CComPtr<IDirect3DVertexDeclaration9> m_il;
|
||||
hash_map<uint32, CComPtr<IDirect3DVertexShader9> > m_vs;
|
||||
hash_map<uint32, GSVertexShader9 > m_vs;
|
||||
D3DXHANDLE m_vs_params;
|
||||
hash_map<uint32, CComPtr<IDirect3DPixelShader9> > m_ps;
|
||||
hash_map<uint32, Direct3DSamplerState9* > m_ps_ss;
|
||||
|
|
|
@ -79,13 +79,12 @@ bool GSDevice10::CreateTextureFX()
|
|||
void GSDevice10::SetupIA(const void* vertices, int count, int prim)
|
||||
{
|
||||
IASetVertexBuffer(vertices, sizeof(GSVertexHW10), count);
|
||||
IASetInputLayout(m_il);
|
||||
IASetPrimitiveTopology((D3D10_PRIMITIVE_TOPOLOGY)prim);
|
||||
}
|
||||
|
||||
void GSDevice10::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||
{
|
||||
hash_map<uint32, CComPtr<ID3D10VertexShader> >::const_iterator i = m_vs.find(sel);
|
||||
hash_map<uint32, GSVertexShader10 >::const_iterator i = m_vs.find(sel);
|
||||
|
||||
if(i == m_vs.end())
|
||||
{
|
||||
|
@ -113,15 +112,9 @@ void GSDevice10::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
{"COLOR", 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D10_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
CComPtr<ID3D10InputLayout> il;
|
||||
CComPtr<ID3D10VertexShader> vs;
|
||||
GSVertexShader10 vs;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs, layout, countof(layout), &il);
|
||||
|
||||
if(m_il == NULL)
|
||||
{
|
||||
m_il = il;
|
||||
}
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
@ -133,7 +126,8 @@ void GSDevice10::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
m_dev->UpdateSubresource(m_vs_cb, 0, NULL, cb, 0, 0);
|
||||
}
|
||||
|
||||
VSSetShader(i->second, m_vs_cb);
|
||||
VSSetShader(i->second.vs, m_vs_cb);
|
||||
IASetInputLayout(i->second.il);
|
||||
}
|
||||
|
||||
void GSDevice10::SetupGS(GSSelector sel)
|
||||
|
|
|
@ -81,13 +81,12 @@ bool GSDevice11::CreateTextureFX()
|
|||
void GSDevice11::SetupIA(const void* vertices, int count, int prim)
|
||||
{
|
||||
IASetVertexBuffer(vertices, sizeof(GSVertexHW11), count);
|
||||
IASetInputLayout(m_il);
|
||||
IASetPrimitiveTopology((D3D11_PRIMITIVE_TOPOLOGY)prim);
|
||||
}
|
||||
|
||||
void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||
{
|
||||
hash_map<uint32, CComPtr<ID3D11VertexShader> >::const_iterator i = m_vs.find(sel);
|
||||
hash_map<uint32, GSVertexShader11 >::const_iterator i = m_vs.find(sel);
|
||||
|
||||
if(i == m_vs.end())
|
||||
{
|
||||
|
@ -115,15 +114,9 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
{"COLOR", 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
CComPtr<ID3D11InputLayout> il;
|
||||
CComPtr<ID3D11VertexShader> vs;
|
||||
GSVertexShader11 vs;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs, layout, countof(layout), &il);
|
||||
|
||||
if(m_il == NULL)
|
||||
{
|
||||
m_il = il;
|
||||
}
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
@ -137,7 +130,8 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
ctx->UpdateSubresource(m_vs_cb, 0, NULL, cb, 0, 0);
|
||||
}
|
||||
|
||||
VSSetShader(i->second, m_vs_cb);
|
||||
VSSetShader(i->second.vs, m_vs_cb);
|
||||
IASetInputLayout(i->second.il);
|
||||
}
|
||||
|
||||
void GSDevice11::SetupGS(GSSelector sel)
|
||||
|
|
|
@ -64,13 +64,12 @@ GSTexture* GSDevice9::CreateMskFix(uint32 size, uint32 msk, uint32 fix)
|
|||
void GSDevice9::SetupIA(const void* vertices, int count, int prim)
|
||||
{
|
||||
IASetVertexBuffer(vertices, sizeof(GSVertexHW9), count);
|
||||
IASetInputLayout(m_il);
|
||||
IASetPrimitiveTopology((D3DPRIMITIVETYPE)prim);
|
||||
}
|
||||
|
||||
void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||
{
|
||||
hash_map< uint32, CComPtr<IDirect3DVertexShader9> >::const_iterator i = m_vs.find(sel);
|
||||
hash_map< uint32, GSVertexShader9 >::const_iterator i = m_vs.find(sel);
|
||||
|
||||
if(i == m_vs.end())
|
||||
{
|
||||
|
@ -99,22 +98,17 @@ void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
D3DDECL_END()
|
||||
};
|
||||
|
||||
CComPtr<IDirect3DVertexDeclaration9> il;
|
||||
CComPtr<IDirect3DVertexShader9> vs;
|
||||
GSVertexShader9 vs;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs, layout, countof(layout), &il);
|
||||
|
||||
if(m_il == NULL)
|
||||
{
|
||||
m_il = il;
|
||||
}
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
i = m_vs.find(sel);
|
||||
}
|
||||
|
||||
VSSetShader(i->second, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));
|
||||
VSSetShader(i->second.vs, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));
|
||||
IASetInputLayout(i->second.il);
|
||||
}
|
||||
|
||||
void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel)
|
||||
|
|
Loading…
Reference in New Issue