diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-09-21 11:23:02 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-09-21 11:23:02 +0100 |
commit | f004530b30a63c08a16d82536858600446b2abf5 (patch) | |
tree | 8a0cdfb5549186b0bbc9b5f7fa85ba4c02418dfc /retrace | |
parent | a1f9532e4157df2dc8d3e9c8100120f80117dcd4 (diff) |
d3d10state: Dump D3D10 texture formats.
Port 86bd499afd662d5320a675f5da97656c742299c4 to D3D10.
Diffstat (limited to 'retrace')
-rw-r--r-- | retrace/d3d10state_images.cpp | 49 | ||||
-rw-r--r-- | retrace/d3dstate.hpp | 3 |
2 files changed, 42 insertions, 10 deletions
diff --git a/retrace/d3d10state_images.cpp b/retrace/d3d10state_images.cpp index e876b51d..b6dc3eac 100644 --- a/retrace/d3d10state_images.cpp +++ b/retrace/d3d10state_images.cpp @@ -36,6 +36,7 @@ #include "com_ptr.hpp" #include "d3d10imports.hpp" #include "d3dstate.hpp" +#include "d3d10state.hpp" #include "dxgistate.hpp" @@ -337,6 +338,12 @@ getSubResourceImage(ID3D10Device *pDevice, StagingDesc.Width, StagingDesc.Height); unmapResource(pStagingResource, 0); + + if (image) { + image->label = getObjectName(pResource); + std::cerr << image->label << "\n"; + } + no_map: return image; } @@ -411,8 +418,11 @@ dumpShaderResourceViewImage(StateWriter &writer, _snprintf(label, sizeof label, "%s_RESOURCE_%u_ARRAY_%u_LEVEL_%u", shader, stage, ArraySlice, MipSlice); + StateWriter::ImageDesc imgDesc; + imgDesc.depth = 1; + imgDesc.format = getDXGIFormatName(Desc.Format); writer.beginMember(label); - writer.writeImage(image); + writer.writeImage(image, imgDesc); writer.endMember(); // *_RESOURCE_* delete image; } @@ -423,7 +433,8 @@ dumpShaderResourceViewImage(StateWriter &writer, static image::Image * getRenderTargetViewImage(ID3D10Device *pDevice, - ID3D10RenderTargetView *pRenderTargetView) + ID3D10RenderTargetView *pRenderTargetView, + DXGI_FORMAT *dxgiFormat) { if (!pRenderTargetView) { return NULL; @@ -436,6 +447,10 @@ getRenderTargetViewImage(ID3D10Device *pDevice, D3D10_RENDER_TARGET_VIEW_DESC Desc; pRenderTargetView->GetDesc(&Desc); + if (dxgiFormat) { + *dxgiFormat = Desc.Format; + } + // TODO: Take the slice in consideration UINT MipSlice; switch (Desc.ViewDimension) { @@ -475,7 +490,8 @@ getRenderTargetViewImage(ID3D10Device *pDevice, static image::Image * getDepthStencilViewImage(ID3D10Device *pDevice, - ID3D10DepthStencilView *pDepthStencilView) + ID3D10DepthStencilView *pDepthStencilView, + DXGI_FORMAT *dxgiFormat) { if (!pDepthStencilView) { return NULL; @@ -488,6 +504,10 @@ getDepthStencilViewImage(ID3D10Device *pDevice, D3D10_DEPTH_STENCIL_VIEW_DESC Desc; pDepthStencilView->GetDesc(&Desc); + if (dxgiFormat) { + *dxgiFormat = Desc.Format; + } + // TODO: Take the slice in consideration UINT MipSlice; switch (Desc.ViewDimension) { @@ -559,13 +579,14 @@ dumpTextures(StateWriter &writer, ID3D10Device *pDevice) image::Image * -getRenderTargetImage(ID3D10Device *pDevice) { +getRenderTargetImage(ID3D10Device *pDevice, + DXGI_FORMAT *dxgiFormat) { com_ptr<ID3D10RenderTargetView> pRenderTargetView; pDevice->OMGetRenderTargets(1, &pRenderTargetView, NULL); image::Image *image = NULL; if (pRenderTargetView) { - image = getRenderTargetViewImage(pDevice, pRenderTargetView); + image = getRenderTargetViewImage(pDevice, pRenderTargetView, dxgiFormat); } return image; @@ -589,12 +610,17 @@ dumpFramebuffer(StateWriter &writer, ID3D10Device *pDevice) } image::Image *image; - image = getRenderTargetViewImage(pDevice, pRenderTargetViews[i]); + DXGI_FORMAT dxgiFormat; + image = getRenderTargetViewImage(pDevice, pRenderTargetViews[i], + &dxgiFormat); if (image) { char label[64]; _snprintf(label, sizeof label, "RENDER_TARGET_%u", i); + StateWriter::ImageDesc imgDesc; + imgDesc.depth = 1; + imgDesc.format = getDXGIFormatName(dxgiFormat); writer.beginMember(label); - writer.writeImage(image); + writer.writeImage(image, imgDesc); writer.endMember(); // RENDER_TARGET_* delete image; } @@ -604,10 +630,15 @@ dumpFramebuffer(StateWriter &writer, ID3D10Device *pDevice) if (pDepthStencilView) { image::Image *image; - image = getDepthStencilViewImage(pDevice, pDepthStencilView); + DXGI_FORMAT dxgiFormat; + image = getDepthStencilViewImage(pDevice, pDepthStencilView, + &dxgiFormat); if (image) { + StateWriter::ImageDesc imgDesc; + imgDesc.depth = 1; + imgDesc.format = getDXGIFormatName(dxgiFormat); writer.beginMember("DEPTH_STENCIL"); - writer.writeImage(image); + writer.writeImage(image, imgDesc); writer.endMember(); delete image; } diff --git a/retrace/d3dstate.hpp b/retrace/d3dstate.hpp index c06b2fdd..fe911d80 100644 --- a/retrace/d3dstate.hpp +++ b/retrace/d3dstate.hpp @@ -129,7 +129,8 @@ dumpDevice(StateWriter &writer, IDXGISwapChain *pSwapChain); */ image::Image * -getRenderTargetImage(ID3D10Device *pDevice); +getRenderTargetImage(ID3D10Device *pDevice, + DXGI_FORMAT *dxgiFormat = 0); void dumpTextures(StateWriter &writer, ID3D10Device *pDevice); |