作者waquey ()
站內GameDesign
標題[程式] 關於D3DTexture Release
時間Mon Aug 27 19:43:19 2012
想問一下
有沒有人有碰過D3D9 Texture Release時
有Access violation的問題
以下是大致code
IDirect3DTexture9 * pD3DTexture = NULL;
hr = m_pD3DDevice->CreateTexture(
width,height,0,0,D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT,&pD3DTexture,NULL);
中間就作些Lock Rect將system buffer copy進去texture
或用UpdateTexture來更新
最後再作pD3DTexture->Release();
就會在這裡顯示Access violation reading(pointer非0)
請問有可能是什麼原因呢?
因為若texture沒create成功 pointer應該也會是空的才對吧?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.163.84.235
→ azureblaze:文件好像沒說失敗pointer會怎樣,檢查一下return ? 08/27 21:09
→ azureblaze:失敗也可能選擇不寫入之類的 08/27 21:10
→ waquey:謝謝! return值是invalid call 08/28 09:32
→ funbook:你的"D3DTexture Release"是不是只能用C++寫,不能用C寫啊? 08/28 13:24
→ waquey:用C++寫的沒錯 08/30 19:04
→ kakue:DEFAULT_POOL 不能直接Lock哦!! 09/03 17:01