[程式] 關於D3DTexture Release

看板GameDesign (遊戲設計)作者時間13年前 (2012/08/27 19:43), 編輯推噓1(106)
留言7則, 4人參與, 最新討論串1/1
想問一下 有沒有人有碰過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

08/27 21:09, , 1F
文件好像沒說失敗pointer會怎樣,檢查一下return ?
08/27 21:09, 1F

08/27 21:10, , 2F
失敗也可能選擇不寫入之類的
08/27 21:10, 2F

08/28 09:32, , 3F
謝謝! return值是invalid call
08/28 09:32, 3F

08/28 13:24, , 4F
你的"D3DTexture Release"是不是只能用C++寫,不能用C寫啊?
08/28 13:24, 4F

08/30 19:04, , 5F
用C++寫的沒錯
08/30 19:04, 5F

09/03 17:01, , 6F
DEFAULT_POOL 不能直接Lock哦!!
09/03 17:01, 6F

09/03 17:16, , 7F
http://ppt.cc/0CNP 看看下面 Remarks :)
09/03 17:16, 7F
文章代碼(AID): #1GErrR0K (GameDesign)
文章代碼(AID): #1GErrR0K (GameDesign)