Permalink
Browse files

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

… vertex input layouts
  • Loading branch information...
hrydgard committed Nov 13, 2017
1 parent 43ae868 commit 4a09289056d435ecd030b2027a60895313da6196
Showing with 4 additions and 4 deletions.
  1. +1 −1 GPU/D3D11/DrawEngineD3D11.cpp
  2. +3 −3 GPU/D3D11/DrawEngineD3D11.h
@@ -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;
@@ -170,11 +170,11 @@ class DrawEngineD3D11 : public DrawEngineCommon {
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;
}

0 comments on commit 4a09289

Please sign in to comment.