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

Problem With Direct3D Surface.LockRectangle & GraphicsStream

Unmanaged pointers aren't reported to the garbage collector so pinning probably has no effect. Thanks again. It's an Enum value, but that again is an Int32 which is a primitive type, so pinning should be possible. English English 中文 한국어 日本語 Hi, VisitorSign In home getting startedmembershiphow it worksfaqnews my dashboard projectsreportsmy businessprepaid codes community community resourcesforumsevents and promotionsgames catalogreview Xbox gamesplaytest Xbox games education education cataloggame http://macland.net/problem-with/problem-with-cs-1-6.php

Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? Reply Quote Hello All,I am pretty new to Direct3D.. The method call returns the pitch value in the pitch parameter. and does not occur always..

Thank you Friday, February 24, 2006 3:22 PM Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. Yours is not as bad as it could be, cause you call bitmap.Width only bitmap.Height times. Staff Online Now Cookiegal Administrator TerryNet Moderator valis Moderator Advertisement Tech Support Guy Home Forums > Software & Hardware > Games > Home Forums Forums Quick Links Search Forums Recent Posts Back to top #3 ed209 Members 122 Like 0Likes Like Posted 07 July 2008 - 07:39 PM uint[,] data = (uint[,])texture.LockRectangle(0, LockFlags.None, _size.Width, _size.Height);for (int i=0; i < _size.Width;

You cannot reply to this topic 15 replies to this topic #1 ed209 Members 122 Like 0Likes Like Posted 07 July 2008 - 07:14 PM I swear to god Is my assumption wrong? 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. I know it's old and not supported, but I'm not going to replace it soon.

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 When access to the surface memory is finished, the Surface.UnlockRectangle method should be called to unlock it. Join over 733,556 other people just like you! https://social.msdn.microsoft.com/Forums/en-US/967fef3f-9801-4a78-bdb9-3b2a7bf723ba/performance-problem-with-texturefrombitmap?forum=gametechnologiesdirectx101 Stay logged in Sign up now!

And the registry key doesn't exist.  Who ever posted must have read it wrong. I tried to solve it by pinning the Surface myself before calling Surface.LockRectangle. The exception was the cause of making the investigation. Thanks.Armin Thursday, December 12, 2013 8:43 PM Reply | Quote 0 Sign in to vote "Is it also possible that the object is not pinned because the pointer does not point

  1. 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.
  2. Dim textdetails As SurfaceDescription textdetails = pirateship.GetLevelDescription(0) Dim rect As New Rectangle rect.Width = textdetails.Width rect.Height = textdetails.Height Dim gs As GraphicsStream Dim data(,) As System.UInt32 = CType(pirateship.LockRectangle(0, rect, LockFlags.None), System.UInt32(,))
  3. 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
  4. Non blittable objects cannot be pinned, their layout wouldn't make sense to native code.
  5. 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
  6. I use UInt because thats what the C# code used.

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). piddy, Sep 21, 2007 #1 This thread has been Locked and is not open to further replies. Providing that no two rectangles overlap, two threads or processes can simultaneously lock multiple rectangles in a surface. Limit the application's activity while a surface is locked.

Be sure to copy to unlocked surfaces. check my blog I'm facing a strange exception that occurs randomly and that I've narrowed down in the past two days using Windbg. Monday, November 21, 2005 7:25 PM 0 Sign in to vote Look at the linked thread at gamedev. The problem is: Even though IDirect3DSurface9::LockRect never fails and always stores a valid pointer (which is never Zero), the pointer passed to the GraphicsStream constructor is sometimes zero.

Another important thing is that the bitmap be converted to 32 bits before using this function, and I've noticed that Bitmap.Clone() doesn't always do the conversion properly. Page 1 of 1 (1 posts) Previous Discussion Next Discussion Need Help?Terms of UsePrivacy & CookiesCode of Conduct © 2017 Microsoft Corporation All rights reserved Developer Network Developer Network Developer :CreateViewProfileText: Width vs. this content Privacy statement  © 2017 Microsoft.

Thursday, December 12, 2013 11:10 PM Reply | Quote Moderator 0 Sign in to vote By "a different way" I meant not using that assembly anymore. :)Armin Friday, December 13, 2013 You’ll be auto redirected in 1 second. In C# you get a pinned & when you use something like "fixed (Point *p = &someObject.point) ..." and you get a non pinned * when you use something like Point

Depending on which Surface.LockRectangle method overload is called, the method returns either a GraphicsStream object or an Array that describes the locked region.

Resources Home Articles GameDev.net Forums Beginners Community Blogs GDNet+ Membership Image of the Day Members Industry Job Advertising Freelancer Ads Asset Marketplace GameDev.net Products About GameDev.net About Us Terms of Service It would be nice to see this function optimized in future releases of the SDK. Always examine the pitch information returned by the Surface.LockRectangle method. or how do I get a valid data pointer again ?

Thursday, December 12, 2013 9:13 PM Reply | Quote Moderator 0 Sign in to vote That makes sense. If yes, do let me know how to tackle this one ? Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content. have a peek at these guys Therefore, I'm surprised that the problem occurs at all.

Back to top #2 Craig_jb Members 181 Like 0Likes Like Posted 07 July 2008 - 07:18 PM As a vb.net programmer you should be able to understand the c# Problem with Direct3D Surface.LockRectangle & GraphicsStream Discussion in 'Games' started by piddy, Sep 21, 2007. It turned to be a garbage collection issue - probably. That means, an object is moved by the GC while an unmanged function is writing to one of the fields of the object.

I am using the Surface object where in I do a lockRectangle. Username or email: Forum Password I've forgotten my password Remember me This is not recommended for shared computers Sign in anonymously Don't add me to the active users list Privacy Policy 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 If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.Would you like to participate?

For more information, see Width vs. And moreover the exception runs in a loop .. That was not the case in VS2003 though. As it's a 3rd party assembly, I can look at it's IL code only.

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. In the old managed C++ syntax that code should look something like: LOCK_RECT __pin *rc = &m_lockRect; Lock(rc); But if I try to compile such code with a current version of Non blittable objects cannot be pinned, their layout wouldn't make sense to native code. We appreciate your feedback.

Tech Support Guy is completely free -- paid for by advertisers and donations. It does throw an exception. I found out this is only the case if the Surface object has been relocated and IDirect3DSurface9::LockRect wrote the data to the old memory location of the Surface object. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.Would you like to participate?

happens at random....