From 2b0b98928868f188d2413ebfb592287a42d4f0bf Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 16 Nov 2016 18:08:01 +0100 Subject: [PATCH] Add utility functions for fetching pre-filled pipeline descriptors --- renderdoc/driver/d3d12/d3d12_resources.h | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_resources.h b/renderdoc/driver/d3d12/d3d12_resources.h index 15e23ce15..1802fb936 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.h +++ b/renderdoc/driver/d3d12/d3d12_resources.h @@ -453,6 +453,53 @@ public: bool IsGraphics() { return graphics != NULL; } bool IsCompute() { return compute != NULL; } + D3D12_COMPUTE_PIPELINE_STATE_DESC GetComputeDesc() + { + D3D12_COMPUTE_PIPELINE_STATE_DESC ret = *compute; + + ret.CS = ((ShaderEntry *)compute->CS.pShaderBytecode)->GetDesc(); + + return ret; + } + + D3D12_GRAPHICS_PIPELINE_STATE_DESC GetGraphicsDesc() + { + D3D12_GRAPHICS_PIPELINE_STATE_DESC ret = *graphics; + + ShaderEntry *vs = (ShaderEntry *)graphics->VS.pShaderBytecode; + ShaderEntry *hs = (ShaderEntry *)graphics->HS.pShaderBytecode; + ShaderEntry *ds = (ShaderEntry *)graphics->DS.pShaderBytecode; + ShaderEntry *gs = (ShaderEntry *)graphics->GS.pShaderBytecode; + ShaderEntry *ps = (ShaderEntry *)graphics->PS.pShaderBytecode; + + if(vs) + ret.VS = vs->GetDesc(); + else + RDCEraseEl(ret.VS); + + if(hs) + ret.HS = hs->GetDesc(); + else + RDCEraseEl(ret.HS); + + if(ds) + ret.DS = ds->GetDesc(); + else + RDCEraseEl(ret.DS); + + if(gs) + ret.GS = gs->GetDesc(); + else + RDCEraseEl(ret.GS); + + if(ps) + ret.PS = ps->GetDesc(); + else + RDCEraseEl(ret.PS); + + return ret; + } + struct DXBCKey { DXBCKey(const D3D12_SHADER_BYTECODE &byteCode)