D3D11: Similarly to the last vulkan commit, don't create lots of dupe vertex input layouts

This commit is contained in:
Henrik Rydgård 2017-11-13 12:26:52 +01:00
parent 43ae868562
commit 4a09289056
2 changed files with 4 additions and 4 deletions

View File

@ -188,7 +188,7 @@ static void VertexAttribSetup(D3D11_INPUT_ELEMENT_DESC * VertexElement, u8 fmt,
ID3D11InputLayout *DrawEngineD3D11::SetupDecFmtForDraw(D3D11VertexShader *vshader, const DecVtxFormat &decFmt, u32 pspFmt) {
// TODO: Instead of one for each vshader, we can reduce it to one for each type of shader
// that reads TEXCOORD or not, etc. Not sure if worth it.
InputLayoutKey key{ vshader, pspFmt };
InputLayoutKey key{ vshader, decFmt.id };
ID3D11InputLayout *inputLayout = inputLayoutMap_.Get(key);
if (inputLayout) {
return inputLayout;

View File

@ -170,11 +170,11 @@ private:
struct InputLayoutKey {
D3D11VertexShader *vshader;
u32 vertType;
u32 decFmtId;
bool operator <(const InputLayoutKey &other) const {
if (vertType < other.vertType)
if (decFmtId < other.decFmtId)
return true;
if (vertType > other.vertType)
if (decFmtId > other.decFmtId)
return false;
return vshader < other.vshader;
}