Loading...

Home > Problem With > Problem With Direct3D Surface.LockRectangle & GraphicsStream

Problem With Direct3D Surface.LockRectangle & GraphicsStream

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. I am facing a problem while trying to render from a viewer to a bitmap. Back to top #14 Headkaze Members 607 Like 0Likes Like Posted 09 July 2008 - 08:37 PM There is hardly any difference between C# and VB.NET. If yes, do let me know how to tackle this one ? check over here

Regarding the declaration: It's in C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\Microsoft.DirectX.Direct3D.dll, class Microsoft.DirectX.Direct3D.Surface, Method LockRectangleInternal (the only overload with 2 args). When this method is called, the rect parameter is a reference to a Rectangle structure that describes the rectangle on the surface to access directly. I am using the Surface object where in I do a lockRectangle. Because it's not in the description.[Edited by - ed209 on July 9, 2008 3:42:46 PM] Back to top #12 Headkaze Members 607 Like 0Likes Like Posted 09 July 2008 https://forums.techguy.org/threads/problem-with-direct3d-surface-lockrectangle-graphicsstream.626953/

If you dump the whole assembly and search for lines containing pinned and * you'll find more cases. Join our site today to ask your question. But it still freezes when I use lpitch. No, create an account now.

  1. Back to top #15 ed209 Members 122 Like 0Likes Like Posted 09 July 2008 - 08:58 PM Well I'm just looking for something that won't freeze everytime I try
  2. Last post 9/25/2007 3:52 AM by piddy07. 0 replies. 9/25/2007 3:52 AM piddy07 (0) Posts 1 Problems with Surface.LockRectangle....
  3. Marked as answer by Armin Zingler Thursday, December 12, 2013 10:50 PM Thursday, December 12, 2013 10:20 PM Reply | Quote Moderator All replies 0 Sign in to vote Hello, What
  4. Wednesday, December 28, 2005 9:10 PM 0 Sign in to vote FYI: I use the above code for Texture.FromBitmap and (and a similar solution for Texture.FromStream), which works as long as

Thursday, December 12, 2013 5:03 PM Reply | Quote Moderator 0 Sign in to vote Mike, that's a plausible explanation. In contrast unmanaged pointers (*) are never tracked.That pretty much means that it would be impossible for the GC to honor 'pinned' because it has not idea that the pointer exists. There's no conversion for graphicsStream to Uint(,).So, I would advise doing the following:Dim lPitch As Int32Dim oStream As Microsoft.DirectX.GraphicsStream = oTex.LockRectangle(0, System.Drawing.Rectangle.Empty, Microsoft.DirectX.Direct3D.LockFlags.Discard, lPitch)Dim lDataSize As Int32 = ((4 * lHeight) Tech Support Guy is completely free -- paid for by advertisers and donations.

It turned to be a garbage collection issue - probably. If you want to follow this bug, or add your validation or vote then you can find it here:http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=0dda86da-a83f-475d-8610-d3a08a14cc7f Wednesday, November 30, 2005 6:22 AM 0 Sign in to vote The The stream's InternalData property returns the passed pointer. If yes, do let me know how to tackle this one ?

I suppose it's technicallypossible to pin any object but since it doesn't make sense this isn't allowed. "the objectdoes contain primitive data. It's more a general question about pinning. SO hence to render the same again, I try to do an unlockRectangle() again... But its not an MDX problem directly, we are just seeing the effects.

Are you looking for the solution to your computer problem? https://social.msdn.microsoft.com/Forums/sqlserver/en-US/7b27ea02-5d85-4051-87b7-cc68610e7cb0/gc-and-pinned-objects?forum=clr Tuesday, November 22, 2005 4:00 PM 0 Sign in to vote After some furtherdiscussionover on gamedevRoKo has moved this one over to the debugger forum so subscribe to this thread if All rights reserved.Terms of Use|Trademarks|Privacy Statement|Site Feedback Technologies Windows Apps Internet of Things Holographic Microsoft Edge Hardware IT Center Microsoft Azure What is Azure Products Solutions Pricing Create a free account Yes, my password is: Forgot your password?

See Also Texture.UnlockRectangle Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? check my blog Dirty regions are automatically recorded when Texture.LockRectangle is called without Lock.NoDirtyUpdate or Lock.ReadOnly. If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Armin Edited by Armin Zingler Thursday, December 12, 2013 3:40 PM fmt Thursday, December 12, 2013 3:39 PM Reply | Quote 1 Sign in to vote I don't know if the

You're using bitmap.Width and bitmap.Height in a loop. For more information about usages, see Usage. Could someone please show me how this is done??? this content Saturday, November 26, 2005 5:53 AM All replies 0 Sign in to vote That's what I experienced too -> http://www.gamedev.net/community/forums/topic.asp?topic_id=357621It's only really slow, when you run with debugging.

Providing that no two rectangles overlap, two threads or processes can simultaneously lock multiple rectangles in a surface. The content you requested has been removed. All rights reserved.

Video memory textures cannot be locked, but must be modified by calling Device.UpdateSurface or Device.UpdateTexture.

I am facing a problem while trying to render from a viewer to a bitmap. Unmanaged pointers aren't reported to the garbage collector so pinning probably has no effect. There are exceptions for some proprietary driver pixel formats that Microsoft DirectX 9.0 does not recognize. BTW, Texture.FromStream has the same problem.-Jeremy Thursday, November 17, 2005 11:23 AM Answers 0 Sign in to vote After some furtherdiscussionover on gamedevRoKo has moved this one over to the debugger

Originally I thought the * is some kind of type so I checked with ildasm. "I was (also) wondering how to declare a native pinned pointer." Normally it should't be possible. Texture.LockRectangle Method () Locks a rectangle on a texture resource. happens at random.... have a peek at these guys Direct3D copy methods will fail if called on a locked surface.

The method in question that I call from my VB code contains this local declaration: valuetype TypeName* modreq([mscorlib]System.Runtime.CompilerServices.IsVolatile) pinned modreq([mscorlib]System.Runtime.CompilerServices.IsVolatile) V_3) And these lines assign the address of one of the Is it also possible that the object is not pinned because the pointer does not point to the start of the object? It causes an AccessViolationException because the pointer is zero. It has a paramater called pitch at the end which will output the pitch.Dim oStream As Microsoft.DirectX.GraphicsStream = oTex.LockRectangle(0, System.Drawing.Rectangle.Empty, Microsoft.DirectX.Direct3D.LockFlags.Discard, lPitch) <---- Back to top #13 ed209 Members 122

It's an Enum value, but that again is an Int32 which is a primitive type, so pinning should be possible." It also contain non primitive data which makes it non blittable. Cracking a nut with a sledge hammer maybe?hthJack


Jack Hoxley [ Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ] Back to top Back to While a surface is locked, its contents can be manipulated directly. Therefore, I'm surprised that the problem occurs at all.

and tell me why the data pointer in the GRaphicsStream is null and how to retry the surface.LockRectagle.. It is also possible to specify a Rectangle that covers only a portion of the surface. I'll just work in C# or C++. Unfortunatelly, the call gch = GCHandle.Alloc(Surface, GCHandleType.Pinned) leads to an exception saying "The object does not contain primitive data".