Jump to content
  • Advertisement

fanwenjie

Member
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About fanwenjie

  • Rank
    Newbie

Personal Information

  • Interests
    Programming
  1. fanwenjie

    Querying the depth buffer

    I hack the struct of IDirect3DSurface9 and disassembly it,Find that if the Lockable bit is 0, LockRect will return failed!. You can lock all format of Surface by setting Lockable bit to 1! typedef struct { LPVOID lpVtbl; PHANDLE pSharedHandle; D3DFORMAT TextureFormat; D3DRESOURCETYPE Type; struct { DWORD Flag0 : 26; DWORD Lockable : 1; DWORD Flag1 : 5; } CPUAccessFlags; DWORD Unknown; D3DMULTISAMPLE_TYPE MultiSampleType; DWORD MultiSampleQuality; UINT Width; UINT Height; D3DPOOL Pool; D3DFORMAT Format; }Direct3DSurface9; void GrabZStencilSurface(IDirect3DDevice9 *pDevice) { IDirect3DSurface9 *pZStencilSurface = NULL; pDevice->GetDepthStencilSurface(&pZStencilSurface); ((Direct3DSurface9 *)pZStencilSurface)->CPUAccessFlags.Lockable = 1; D3DLOCKED_RECT lockRect = { 0 }; pZStencilSurface->LockRect(&lockRect, NULL, D3DLOCK_READONLY); void *pData = lockRect.pBits; //TODO: Grab Depth Stencil Data pZStencilSurface->UnlockRect(); pZStencilSurface->Release(); }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!