purplemarshmallow / z64

Low level RDP plugin for zilmar spec N64 emulators
20 stars 8 forks source link

Very low FPS when lots of tile objects are on-screen #55

Open cxd4 opened 7 years ago

cxd4 commented 7 years ago

Ever since I got a "new" laptop (it's actually older but that was on purpose), I notice how much slower z64gl is on this mobile chipset integrated piece of Intel. Err I mean shit.

Really any game with plenty of 3-D triangles on the screen seems to be full speed all the same. The FPS just tanks massively when there are lots of texture objects and tiles being drawn and created. I think it's something under rglTiles exploiting Intel's inept graphics driver design for efficient texture creation and deletion calls. z64gl seems to call glCreateTexture and DeleteTexture a ton of times. Or maybe it's something else. I briefly tried to play around with breaking things on purpose to see what was slowing everything down but that ended up fooling myself. Was definitely full speed tho....

If there are any plans on the side or ideas for rewriting z64gl's 2-D tile and texture rendering code that would be great.

cxd4 commented 7 years ago

Should probably give examples ... um ...

Well Banjo-Tooie again. It starts out 100% speed during the intro. But when the 2-D texture tiles for the logo starts to draw and the game title bitmap text starts to show up in front of all the 3-D the FPS just tanks.

Mario as well. It's full speed until things like the HUD and the extra lives and star counter icons go on screen. Intel is doing something horribly wrong in their drivers with multiple calls to tile [de-]allocations.

purplemarshmallow commented 7 years ago

I can test the plugin on a laptop with Intel HD Graphics 3000. Most games run fullspeed here. Super Mario 64 runs very stable. Nothing unusual when the HUD shows up.

Can you give more system details? Maybe only older intel chipsets are affected

cxd4 commented 7 years ago

I don't know too much about the hardware but can read off the driver info:

GL_VENDOR    :  Intel Open Source Technology Center
GL_RENDERER  :  Mesa DRI Intel(R) 945GM 
GL_VERSION   :  2.1 Mesa 11.2.2

I've been searching for a way to install the proprietary drivers to see if that would help, but I only know how to get them for NVIDIA and AMD cards. I'm not really seeing a lot of Linux driver support on Intel's site. I'm assuming the 945GM part of the Mesa ID string means I have in fact a 945 GM Intel GPU?

Actually the FPS tanks worst of all to like 0.01 or something in Banjo-Tooie if I fire an egg up close that lights a baddy on fire, kick a shooter statue in Mayahem Temple using the golden goliath, slide or skid long distances, or really it seems do anything producing a lot of fog or smoke.

cxd4 commented 7 years ago

I wasn't specific with my Intel-bashing, but I have no doubt that only older Intel chipsets are affected (certainly at least to this degree). I'm sure newer ones work with z64gl just fine, but I'm not using a very new laptop. I'm not really surprised...I'd just like to see the drawbacks gone.

LegendOfDragoon commented 7 years ago

I believe the code is inefficient and just happens to affect older intel IGPs more. This is a serious issue on my laptop as well, although not as bad. SM64 runs fine for me, but other games like SD Hiryuu have terrible performance.

cxd4 commented 7 years ago

rglTiles texture deletion and allocation code looked very repetitive and inefficient.

This is why I broke it on purpose to optimize it by taking away all the constant tile freeing and recreation, which caused basically everything to run at full speed no sweat. It obviously caused them to crash, like Banjo-Tooie did. (The compiled plugin wasn't the same as the one built in the z64 repo on my disk so I had forgotten this was the case, and that it explained the crashing.)

cxd4 commented 7 years ago

Sorry just taking notes actually at this point.

Got a different computer with an NVIDIA card. Right now the free-software drivers have these properties for the GL context:

GL_VENDOR    :  nouveau
GL_RENDERER  :  Gallium 0.4 on NV4E
GL_VERSION   :  2.1 Mesa 11.2.2

It's much easier to install the proprietary non-free drivers with this NVIDIA video card system than the laptop with the Intel GPU in it. I'll test out how that goes.

cxd4 commented 7 years ago

with nouveau uninstalled:

GL_VENDOR    :  VMware, Inc.
GL_RENDERER  :  Gallium 0.4 on llvmpipe (LLVM 3.8, 128 bits)
GL_VERSION   :  3.0 Mesa 11.2.2
GL_EXTENSIONS:  
    GL_EXT_bgra
    GL_ARB_vertex_buffer_object
    GL_ARB_vertex_program
    GL_ARB_pixel_buffer_object
cxd4 commented 7 years ago

with nouveau replaced:

GL_VENDOR    :  NVIDIA Corporation
GL_RENDERER  :  GeForce 6150 LE/integrated/SSE2/3DNOW!
GL_VERSION   :  2.1.2 NVIDIA 304.135
GL_EXTENSIONS:  
    GL_EXT_bgra
    GL_ARB_vertex_buffer_object
    GL_ARB_vertex_program
    GL_ARB_pixel_buffer_object

Definitely performs "different", for better or worse. Tile stuff in z64gl is still slow here though.