Advertisement

CopyRects never works, D3D8, error in the DLL!

Started by August 27, 2008 07:41 PM
4 comments, last by prux 16 years, 1 month ago
good evening, Im very sad because its all works to others, and for me it doesnt :'( I created textures in VIDEO memory, and now I wanna get it. Lockrect forgotten, UpdateTexture forgotten, ah, CopyRects would work! would.... Im not going to copy all code but a snippet: Device.CreateImageSurface (512,1024, D3DFMT_X8R8G8B8, OUTsurface); Device.CreateImageSurface (512,1024, D3DFMT_X8R8G8B8, OUTsurface2); Device.CopyRects (OUTsurface, nil, 0, OUTsurface2, nil); and at CopyRects is trips over, unmercifully. The reason: "access violation at address 6DF2E696 in module d3d8.dll, read of address 00000054" What the hell going Im to do?! Its annoying... it newer works. The debug helps me neither. Or any other solution for reading from VIDEO memory (that texture was a RENDERTARGET so thats why it must be in VIDEO memory)
What language is this? CopyRects works, but I can't tell how you're accessing the device.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

Advertisement
Its delphi. Ive been using D7 and D3D8 SDK for 3 years and nothing has happend so far yet.

The device is D3DDEVTYPE_HAL but it also crashes with D3DDEVTYPE_REF too.
What is your version of dx headers? I've seen a lot of mistakes (such as var instead of pointer etc) in functions declarations in some translations.

Also you may find useful to switch to DXDebug and examine event log.
What language is this? It looks to me like you're passing an almost null pointer to D3D. It won't notice it's an error because the pointer isn't null, then it'll try to access it and it'll crash.

In C++ this could happen if you take the address of a member variable where the parent class was a null pointer.
Its 8.0 SDK. The declaration says:

function CopyRects(pSourceSurface: IDirect3DSurface8; pSourceRectsArray: PRect; cRects: LongWord; out pDestinationSurface: IDirect3DSurface8; pDestPointsArray: PPoint): HResult; stdcall;

Comparing it to C++ declaration, seems to be ok. To describe:


pSourceSurface
[in] Pointer to an IDirect3DSurface8 interface, representing the source surface. This is surely ok, this is how I pass textures to other functions
pSourceRectsArray
[in] Pointer to an array of RECT structures, representing the rectangles to be transferred. Each rectangle will be transferred to the destination surface, with its top-left pixel at the position identified by the corresponding element of pDestPointsArray. Specifying NULL for this parameter causes the entire surface to be copied I specified!
cRects
[in] Number of RECT structures contained in pSourceRectsArray.
pDestinationSurface. No matter what number I type here.
[in] Pointer to an IDirect3DSurface8 interface, representing the destination surface. See the first comment.
[in] Pointer to an array of POINT structures, identifying the top-left pixel position of each rectangle contained in pSourceRectsArray. If this parameter is NULL, the RECTs are copied to the same offset (same top/left location) as the source rectangle. This is how I did.

So I dont know... there is NOTHING to bust up... luckily, later I found an alternative solution by creating a lockable render surface.

This topic is closed to new replies.

Advertisement