-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactoring] Improve spline/bezier. #11425
Conversation
Whoa. Won't have time to look at this until the weekend but sounds promising :) |
Owhdusbduxbfzykqhxkabw WHAAAAAAAT? You have JUST REALLY said FPS improve over 15-25???????? I don't have words |
Nice overall, but hardware tesselation seems to still be buggy in "Juiced 2: Hot Import Nights" so this also breaks it when spline/bezier curves are set to low now. The game uses curves to draw road and since it's a racing game people with low end hardware might abuse setting the curves to low here. Anyway the glitch of hardware should be easily noticeable in this dump: And probably shouldn't be a blocking case for this PR since hardware tesselation is still buggy same way on master. Edit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of changes. Caching the curves seems to make sense, I wonder how much vectorization we get from MSVC and GCC now on Intel/ARM without the specializations...
Slightly concerned about the FF4 note on matUpdate. It'd be nice to collect some bezier/spline GE dumps to test things like #7525. I'll test more later.
-[Unknown]
GPU/GLES/GPU_GLES.cpp
Outdated
@@ -109,7 +109,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw) | |||
if (g_Config.bHardwareTessellation) { | |||
// Disable hardware tessellation if device is unsupported. | |||
bool hasTexelFetch = gl_extensions.GLES3 || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 3, 0)) || gl_extensions.EXT_gpu_shader4; | |||
if (!gstate_c.SupportsAll(GPU_SUPPORTS_INSTANCE_RENDERING | GPU_SUPPORTS_VERTEX_TEXTURE_FETCH | GPU_SUPPORTS_TEXTURE_FLOAT) || !hasTexelFetch) { | |||
if (!gstate_c.SupportsAll(GPU_SUPPORTS_VERTEX_TEXTURE_FETCH | GPU_SUPPORTS_TEXTURE_FLOAT) || !hasTexelFetch) { | |||
// TODO: Check unsupported device name list.(Above gpu features are supported but it has issues with weak gpu, memory, shader compiler etc...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is less relevant now?
-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
Well, I decided to disable instanced rendering because instanced tessellation to be very slow with B-Spline surface on weak GPU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so maybe this comment is less relevant (the device name list blacklist.)
-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, device name list...
Yeah, I believe so.
ambientStr = (matUpdate & 1) && hasColor ? "col" : "u_matambientalpha"; | ||
diffuseStr = (matUpdate & 2) && hasColor ? "col.rgb" : "u_matdiffuse"; | ||
specularStr = (matUpdate & 4) && hasColor ? "col.rgb" : "u_matspecular.rgb"; | ||
// TODO: Probably, should use hasColorTess but FF4 has a problem with drawing the background. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. hasColor
should always be true because we normalize the vertices. In theory, this should only affect diffuse and specular. For ambient, it should be the same either way, right?
-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. hasColor should always be true because we normalize the vertices.
Yes, so we don't need to check the flag hasColor
.
However, actually, I'm not really sure that is doing what.
Just wanted to say these performance improvements look very cool. But @marosis note that it only affects certain games / certain areas of games. Most of the FPS notes are using tests that render only spline/bezier. Don't expect it to make every game way faster - it's a very cool update that will make some games way faster, though, so it's still something to be excited about. -[Unknown] |
Yeah i know this, but will i get some performance improvements when my android don't have HW tesselation in settings? |
Thanks all. @LunaMoo I'm not sure what is the problem about hw tess. Also I don't know how can I get any information from the dump file. Thanks anyway to some tests. @marosis I'm sure you can get any effects when you play games in very heavy spline/bezier situation. |
To use a GE dump - just open it like a game. I usually drag them into the PPSSPP window. It will run all the same GE commands that the game sent for that frame, just over and over again each frame. Note that anything that was render-to-texture or any block transfers will now come from RAM, so it's not perfect, but it does get you most of the frame behavior. -[Unknown] |
Thanks @unknownbrackets ! |
Pls Onkel hrydgard will be this in 1.7.0? 😂😂😂😂😂 |
@xebra Hello , long time no see , i'll expect about this . How about HW Tesellation on GLES 2 and DX9 ? |
oh, Pursuit Force use a lot of bezier, Metal Gear Acid 2 use a lot of spline, and will get performance improvement. |
@zminhquanz Hi! I will try to implement for DX9 after this. Also, GLES2 is... I need more research on it. |
BTW, I have a question.
|
Well, the first flush is in case we have other prims/triangles/etc., which can't be combined with the bezier. The second one is to draw the actual bezier because it can't be combined with later drawing. -[Unknown] |
Really?
I think you said
is meaning last one. [Edit] |
Ah, you're right. We only need two, I think the one outside SubmitBezier was added when removing the always flush before flag. -[Unknown] |
Thanks! |
Pursuit Force on Android seems almost don't gain performance improvements. |
For Pursuit Force we might then want to try to combine draw calls even with beziers.. Should be possible, just need a little extra state tracking I guess.. |
I had try to combine beziers and splines drawcalls, it do not have any improvement. only drawcalls down a lot. |
Yeah, I was just thinking same thing but it seems not easy way for me. |
I guess GLES2 devices have old and weak GPU, so even if we can support GLES2 for HW tess, maybe it's slower than SW tess(CPU). |
I personally think these improvements are great, and GLES2 (using software) will already benefit a lot from them. I also think GLES2 might perform worse with hardware (even my old NVIDIA desktop GPU did, iirc.) I tested this with a couple games, but starting to need to keep a database of GE dumps with tags for things they do... I can't remember which games that I have use bezier/spline anymore. Anyway, seems great so far from what I've tried. -[Unknown] |
@unknownbrackets Thank you for testing these. Your opinion is helpful to me. Current HW tess on OpenGL is a little slower than Vulkan/DX11. It's probably because of using texture as tessellation data transfer. So, if we can use any generic buffer like TBO/UBO instead texture, maybe we can boost speed more. |
UBO is too small for this. |
@xebra if HW Tessellation on GLES 2 are too slow , you can make a check to enable SW Tessellation on these |
I think the option of hardware tesselation should be renamed to something like "hardware spline/bezier curves" or "generate spline/bezier curves on gpu", as seeing the above comment and similar confusion in the past on the forums, people still think this is some kind of graphic enhancement or a speedhack that they absolutely have to use. While actually it's not even as compatible as software curves yet and might reduce quality in affected games, performance might also be pretty terrible for example on amd gpu's or older gpu's in general compared to software curves:]. |
Agree that renaming it makes sense. Or removing it and autodetect whether to use it somehow... although that might be a bit unrealistic still. |
…ng weak GPU, so disabled it and simplify the shaders. Add changing the quality of HW tessellation.
…void huge width in FF4CC mist dragon morphing.
…ing half of the vertex buffer.
9e0a5ad
to
0d7a5cd
Compare
I tried fixing it. Thanks to the note @unknownbrackets . |
I'm happy with it too - let's go for it. |
@xebra what are those games that really benefit this Refactoring and even my android phone (Mali-450 MP) doesn't support HW Tesselation I can feel a little bit improvement in the performance? Just Asking :) |
Thank you for approval and merging. I'm happy that these were merged. @Emulatorer Only on games using Spline/Bezier. |
Thanks
…On Nov 5, 2018 8:56 PM, "xebra" ***@***.***> wrote:
Thank you for approval and merging. I'm happy that these were merged.
And, now I'm trying to fix the low-quality issue but it needs more time.
@Emulatorer <https://github.com/Emulatorer> Only on games using
Spline/Bezier.
I don't know what game is using these but I just testing with FF4, Loco
Roco, Pursuit Force, and some demos.
I think you should search in this issue/PR lists, and then you can get
some information about those.
Please don't get your hopes up about HW Tessellation because this is still
a highly experimental feature.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11425 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aj3I6gDL87kzEY2QuXFIYSj63Xw6RZngks5usDWZgaJpZM4W9BjP>
.
|
This is a little big rewrite of spline/bezier include many improvements, bug fixes and refactoring.
Performance improvements
Feature improvements
Before(spline/bezier is same geometory)
After(Bezier)
High quality(bezier)
After(Spline)
High quality(spline)
Bug fixes
Before
After
Refactoring
Known issue [Edit]
HW tess
SW tess
Future plan(TODO) [Edit]
I just wrote something that is remembered for now, so I may add the description later.
Sorry for the huge pull request.