Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Support building engine with multiple graphics API #2885

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Support building engine with multiple graphics API #2885

merged 1 commit into from
Apr 11, 2022

Conversation

1vanK
Copy link
Contributor

@1vanK 1vanK commented Apr 3, 2022

No description provided.

@1vanK 1vanK marked this pull request as draft April 3, 2022 13:23
@weitjong
Copy link
Contributor

weitjong commented Apr 10, 2022 via email

@1vanK 1vanK marked this pull request as ready for review April 11, 2022 11:30
@1vanK
Copy link
Contributor Author

1vanK commented Apr 11, 2022

Building:

cmake.exe repo -B build_vs -G "Visual Studio 17" -A x64^
 -D URHO3D_OPENGL=1 -D URHO3D_D3D9=1 -D URHO3D_D3D11=1^
 -D URHO3D_LIB_TYPE=STATIC -D URHO3D_STATIC_RUNTIME=0 -D URHO3D_HASH_DEBUG=0^
 -D URHO3D_ANGELSCRIPT=1 -D URHO3D_FORCE_AS_MAX_PORTABILITY=0 -D URHO3D_LUA=1 -D URHO3D_LUAJIT=1 -D URHO3D_GENERATEBINDINGS=0^
 -D URHO3D_SAMPLES=1 -D URHO3D_TOOLS=0 -D URHO3D_DOCS=0^
 -D URHO3D_NETWORK=1 -D URHO3D_DATABASE_SQLITE=1 -D URHO3D_TRACY_PROFILING=0 -D URHO3D_PHYSICS2D=1 -D URHO3D_URHO2D=1

Running:

18_CharacterDemo_d.exe -opengl
18_CharacterDemo_d.exe -d3d9
18_CharacterDemo_d.exe -d3d11

@1vanK 1vanK merged commit 70a8584 into urho3d:master Apr 11, 2022
@eugeneko
Copy link
Contributor

Just curious, what's the performance impact on Sample 20 (Debug and Release)?
Maybe I'll test that myself but I don't know when I will be able to.

@1vanK
Copy link
Contributor Author

1vanK commented Apr 12, 2022

I measured the difference in performance in 99_Benchmark_d.exe and noticed a slight drop in performance. I don't remember the specific numbers, it was something like a percent (10-20 fps with fps > 1500).

@eugeneko
Copy link
Contributor

Sample 20 with instancing off shows 15% performace degradation in both debug and release. Still not that much given the nature of the sample and conditions.

image

@1vanK
Copy link
Contributor Author

1vanK commented Apr 12, 2022

I will check it. As an optimization we can use function pointers instead of using if (gapi == x) then call func_x();

@eugeneko
Copy link
Contributor

Note that I have disabled instancing to measure draw command queuing itself (which was affected by PR).
With instancing on there are very few draw calls and probably no difference.

@1vanK
Copy link
Contributor Author

1vanK commented Apr 12, 2022

Can you test again (with latest commit, but i'm not sure if it matters), because

Old debug:
old_debug

New debug:
new_debug

Old release:
old_release

New release (fps better, it's just measurement error):
new_release

I just changed in example 20

void HugeObjectCount::SetupViewport()
{
    auto* renderer = GetSubsystem<Renderer>();

    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
    renderer->SetViewport(0, viewport);
    renderer->SetDynamicInstancing(false); // Added
}

Also I do not pay attention to Avg because it is too unstable, but only on the first column

@eugeneko
Copy link
Contributor

eugeneko commented Apr 12, 2022

Okay, I just tried it and got totally different numbers, maybe some weird shit in drivers on this PC. I tested OpenGL btw.
Anyway, I don't think this impact matters, as I said. Even 15% in artificial corner case is okay.

@1vanK
Copy link
Contributor Author

1vanK commented Apr 12, 2022

I tested OpenGL btw

The same. API is printed on bottom of Debug Hud

@1vanK
Copy link
Contributor Author

1vanK commented Apr 12, 2022

Mingw x64 release

Old:
old

New:
new

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants