Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Spritebatch Draw Initial delay for some textures


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 renman29   Members   -  Reputation: 375

Like
0Likes
Like

Posted 07 May 2014 - 01:11 AM

I notice that for one of my 4096x4096 textures, when I do this:

 

spriteBatch.Draw(tex, pos, splat.src_rect, col, 0f, origin, scale/1.4f, SpriteEffects.None, 0f);

 

there is a very noticeable delay(little more than 1 second) for the initial draw. After which it draws fine.

 

It is important to note that all other 4096x4096 textures drawn this way have no initial delay until this one is used( I think it's like the 4th or 5th texture this size).

If I comment out the line, no delay will happen. //

I'm under the impression that for some reason, something under the hood isn't initialized or in video ram until the first draw.

I know it's not a terribly big deal, but it is kind of an annoying glitch tongue.png

 

Any theories about what might be happening or any ideas on how I could get around this? blink.png



Sponsor:

#2 renman29   Members   -  Reputation: 375

Like
0Likes
Like

Posted 07 May 2014 - 01:36 AM

Ok well I kind of found a disturbing and inappropriate temporary workaround for the problem using a private do_once Boolean like so:

 

if (do_once == false) { spriteBatch.Draw(tex, Vector2.Zero, new Rectangle(0, 0, 1, 1), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); do_once = true; }

 

//LOL. I really hope there's a better solution...



#3 phil_t   Crossbones+   -  Reputation: 3948

Like
1Likes
Like

Posted 07 May 2014 - 10:17 AM

What happens if you switch the order that you use your large textures? That will tell you if it's something specifically wrong with this texture, or whether you're just stressing your GPU memory.

 

Five 4096x4096 textures take up 320MB of memory (or more if mip-mapped). How much memory does your video card have?

 

What happens if you use DXT compression for your large textures?



#4 renman29   Members   -  Reputation: 375

Like
0Likes
Like

Posted 07 May 2014 - 04:42 PM

Ah excellent ideas smile.png

The texture seems ok so stressing out the gpu seems to be  the case. Card has 1 Gig (although I'm also loading a lot of other fairly large textures so I'm probably getting close to the 500Mb mark).

Tried switching to DXT for the huge textures (or any large textures for backgrounds which I thought should be a bit lossy anyway) -- IT WORKED!

Quality is still very good! smile.png

If I could hug you right now I would. biggrin.png






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS