• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

SOLVED How much PROCESSING can a surface be weighed?

FoxyOfJungle

Kazan Games
I ask this because I want to know if a surface is heavier (on hardware issues) than a normal sprite? Is using 10 surfaces heavier than using 10 sprites? (taking into account that inside the surface it only has functions such as draw_rectangle)? 🤔

Thanks!
 

obscene

Member
Each surface will cause a texture swap and break the vertex batch, which is differently from sprites which can be organized onto texture groups and be drawn in bulk. It's definitely slower. But don't let that hold you back unless you are making something for a phone.
 

Yal

🐧 *penguin noises*
GMC Elder
I ask this because I want to know if a surface is heavier (on hardware issues) than a normal sprite? Is using 10 surfaces heavier than using 10 sprites? (taking into account that inside the surface it only has functions such as draw_rectangle)? 🤔

Thanks!
Surfaces are placed on their own texture page, so the more surfaces you use, the more page swaps you're gonna have. The memory they use it just a blob of raw VRAM, so they don't use any more or less memory than a sprite (though you get multiple sprites on the same texture page since they're packed together, so static sprites are faster than sprites drawn to surfaces if you have a lot of them).
 

GMWolf

aka fel666
Whilst it's true that sprites created in the resource tree will get out on the same texture, that's not true of sprites created from surfaces.

If you have a surface and you want to draw it, just draw it. Converting it to a sprite has few benefits.
(The only two I can think of is guaranteed persistence, and slightly better memory layout then a surface, so slightly better perf)
 

FoxyOfJungle

Kazan Games
Whilst it's true that sprites created in the resource tree will get out on the same texture, that's not true of sprites created from surfaces.

If you have a surface and you want to draw it, just draw it. Converting it to a sprite has few benefits.
(The only two I can think of is guaranteed persistence, and slightly better memory layout then a surface, so slightly better perf)
It's because my intention would be to use surfaces to make animated buttons, so I was wondering if it would be too heavy...
like the buttons that we have on Windows and Android for example, that when clicking, a circle expands.
 

Gradius

Member
One thing to note is that any kind of full screen drawing is fairly slow on even modest mobile devices (unless that has changed in GMS2) in general, so should be avoided. That precludes a lot of surface uses. Even the application_surface is better disabled in those instances.
 

FoxyOfJungle

Kazan Games
One thing to note is that any kind of full screen drawing is fairly slow on even modest mobile devices (unless that has changed in GMS2) in general, so should be avoided. That precludes a lot of surface uses. Even the application_surface is better disabled in those instances.
I'm making a desktop software, so the question arose, I really realize that when I use a lot of climbing things, it makes it slow. Thank you!
 

GMWolf

aka fel666
No but seriously how do you plan on using surfaces to draw animated buttons?
I can't figure out what you would even draw to the surface in the first place!
 

FoxyOfJungle

Kazan Games
@GMWolf This is an example:



(Yes I know, it's a sprite and not the draw_circle function, but it's just an example)

Is that kind of button I wonder if it's heavy to do that.
 

GMWolf

aka fel666
You could also use shaders, or vertex buffers, or draw rectangle with gradients...
Surfaces are definitely not the right tool for the job here.
 
Top