Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ACTUALY create a sample-able zbuffer snapshot
  • Loading branch information
Redotix committed Jun 24, 2024
commit 96aacafda499c38b5f7313bfd3e2c8fab49a37cb
3 changes: 1 addition & 2 deletions src/Layers/xrRender/HW.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class CHW
ID3D11RenderTargetView* pBaseRT; // combine with DX9 pBaseRT via typedef
ID3D11DepthStencilView* pBaseZB;

D3D_TEXTURE2D_DESC* pBaseZBTexDesc;
D3D_DEPTH_STENCIL_VIEW_DESC* pBaseZBDesc;
ID3D11Texture2D* pBaseTEXZB;

CHWCaps Caps;

Expand Down
14 changes: 0 additions & 14 deletions src/Layers/xrRender/r__dsgraph_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,20 +531,6 @@ void R_dsgraph_structure::r_dsgraph_render_hud(bool NoPS)
Device.mFullTransform.mul(Device.mProject, Device.mView);
RCache.set_xform_project(Device.mProject);

ID3D11Texture2D* pRt_tempzbTexture = nullptr;
HW.pDevice->CreateTexture2D(HW.pBaseZBTexDesc, nullptr, &pRt_tempzbTexture);
RImplementation.Target->rt_tempzb->pSurface = pRt_tempzbTexture;

ID3D11Resource* pResource = nullptr;
ID3D11Texture2D* pTexture2D = nullptr;

HW.pBaseZB->GetResource(&pResource);

pResource->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&pTexture2D);

HW.pContext->CopyResource(pTexture2D, RImplementation.Target->rt_tempzb->pTexture->surface_get());

pResource->Release();

// Rendering
rmNear();
Expand Down
7 changes: 3 additions & 4 deletions src/Layers/xrRenderDX10/dx10HW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ void CHW::UpdateViews()
R_CHK(R);

//Create texture resource
ID3D11Texture2D* pBaseTEXZB;
D3D_TEXTURE2D_DESC texDesc;
texDesc.Width = sd.BufferDesc.Width;
texDesc.Height = sd.BufferDesc.Height;
Expand All @@ -1045,20 +1044,20 @@ void CHW::UpdateViews()
texDesc.SampleDesc.Count = 1;
texDesc.SampleDesc.Quality = 0;
texDesc.Usage = D3D_USAGE_DEFAULT;
texDesc.BindFlags = D3D_BIND_DEPTH_STENCIL | D3D_BIND_SHADER_RESOURCE | D3D_BIND_RENDER_TARGET;
texDesc.BindFlags = D3D_BIND_DEPTH_STENCIL | D3D_BIND_SHADER_RESOURCE;
texDesc.CPUAccessFlags = 0;
texDesc.MiscFlags = 0;

//Create DSV
D3D_DEPTH_STENCIL_VIEW_DESC dsvDesc;
#if defined(USE_DX11) //dirty hack so it doesnt crash DX10
#if defined(USE_DX11)
dsvDesc.Flags = 0;
#endif
dsvDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
dsvDesc.ViewDimension = D3D_DSV_DIMENSION_TEXTURE2D;
dsvDesc.Texture2D.MipSlice = 0;

R_CHK(pDevice->CreateTexture2D(&texDesc, NULL, &pBaseTEXZB));
R_CHK(pDevice->CreateDepthStencilView(pBaseTEXZB, &dsvDesc, &pBaseZB));
R_CHK(pDevice->CreateDepthStencilView(pBaseTEXZB, &dsvDesc, &pBaseZB));
}
#endif
4 changes: 4 additions & 0 deletions src/Layers/xrRenderPC_R4/r4_R_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ void CRender::Render()
RCache.set_Z(TRUE);
}

ID3D11Resource* zbuffer_res;
HW.pBaseZB->GetResource(&zbuffer_res); //get the resource
HW.pContext->CopyResource(RImplementation.Target->rt_tempzb->pSurface, zbuffer_res);

// level
Target->phase_scene_begin();
r_dsgraph_render_hud();
Expand Down