From fd02a3e9d461bdbfd13a69f30675a163a8f157c4 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 7 Jun 2017 17:38:52 +0100 Subject: [PATCH] Check the most likely resources first (buffer -> tex2d -> 3d -> 1d) * This is a slight win by avoiding checking all the shader pools --- renderdoc/driver/d3d11/d3d11_resources.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_resources.cpp b/renderdoc/driver/d3d11/d3d11_resources.cpp index 730799984..91d6d3402 100644 --- a/renderdoc/driver/d3d11/d3d11_resources.cpp +++ b/renderdoc/driver/d3d11/d3d11_resources.cpp @@ -303,6 +303,15 @@ ResourceId GetIDForResource(ID3D11DeviceChild *ptr) if(ptr == NULL) return ResourceId(); + if(WrappedID3D11Buffer::IsAlloc(ptr)) + return ((WrappedID3D11Buffer *)ptr)->GetResourceID(); + if(WrappedID3D11Texture2D1::IsAlloc(ptr)) + return ((WrappedID3D11Texture2D1 *)ptr)->GetResourceID(); + if(WrappedID3D11Texture3D1::IsAlloc(ptr)) + return ((WrappedID3D11Texture3D1 *)ptr)->GetResourceID(); + if(WrappedID3D11Texture1D::IsAlloc(ptr)) + return ((WrappedID3D11Texture1D *)ptr)->GetResourceID(); + if(WrappedID3D11InputLayout::IsAlloc(ptr)) return ((WrappedID3D11InputLayout *)ptr)->GetResourceID(); @@ -319,16 +328,6 @@ ResourceId GetIDForResource(ID3D11DeviceChild *ptr) if(WrappedID3D11Shader::IsAlloc(ptr)) return ((WrappedID3D11Shader *)ptr)->GetResourceID(); - if(WrappedID3D11Buffer::IsAlloc(ptr)) - return ((WrappedID3D11Buffer *)ptr)->GetResourceID(); - - if(WrappedID3D11Texture1D::IsAlloc(ptr)) - return ((WrappedID3D11Texture1D *)ptr)->GetResourceID(); - if(WrappedID3D11Texture2D1::IsAlloc(ptr)) - return ((WrappedID3D11Texture2D1 *)ptr)->GetResourceID(); - if(WrappedID3D11Texture3D1::IsAlloc(ptr)) - return ((WrappedID3D11Texture3D1 *)ptr)->GetResourceID(); - if(WrappedID3D11RasterizerState2::IsAlloc(ptr)) return ((WrappedID3D11RasterizerState2 *)ptr)->GetResourceID(); if(WrappedID3D11BlendState1::IsAlloc(ptr))