Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3DBackend: Don't recompute ID3D11InputLayout for different shaders. #223

Merged
merged 1 commit into from Apr 11, 2014

Conversation

magumagu
Copy link
Contributor

Rebuilding the layout isn't free, so cache it instead. My measurements show approximately a 5% performance improvement on a fifoplayer testcase on an Intel HD4000.

I'm not very familiar with the D3D backend, so I'm not sure if this fix is correct, or if there's a better approach.

@@ -130,16 +140,20 @@ void D3DVertexFormat::SetupVertexPointers()
if (m_vs_bytecode != DX11::VertexShaderCache::GetActiveShaderBytecode())

This comment was marked as off-topic.

@magumagu magumagu changed the title D3DBackend: Cache ID3D11InputLayout for shader. D3DBackend: Don't recompute ID3D11InputLayout for different shaders. Mar 28, 2014
@magumagu
Copy link
Contributor Author

Redid the fix: we don't actually need the map. We can just use the same ID3D11InputLayout for each shader. (CreateInputLayout only checks the signature, and that should be the same for every shader using the same vertex format.)

@delroth
Copy link
Member

delroth commented Mar 30, 2014

@neobrain could you review this?

// CreateInputLayout requires a shader input, but it only looks at the
// signature of the shader, so we don't need to recompute it if the shader
// changes.
auto vs_bytecode = DX11::VertexShaderCache::GetActiveShaderBytecode();

This comment was marked as off-topic.

@neobrain
Copy link
Member

@magumagu Did you check if the d3d11 debug runtime is okay with this change?

CreateInputLayout requires a shader as an input, but it only cares about
the signature; we don't need to recompute it for different shaders with
the same inputs.
@magumagu
Copy link
Contributor Author

Updated patch changes the use of auto.

Debug runtime seems fine with the change.

neobrain added a commit that referenced this pull request Apr 11, 2014
D3DBackend: Don't recompute ID3D11InputLayout for different shaders.
@neobrain neobrain merged commit 7563e8c into dolphin-emu:master Apr 11, 2014
@magumagu magumagu deleted the d3d-cache-input-layout branch April 11, 2014 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants