Jump to content
  • Advertisement
Sign in to follow this  
matt77hias

C++/WinRT

Recommended Posts

What are the benefits of switching from unmanaged C++ to C++/WinRT? Is it just a "more modern" C++ API or are their functionality and/or performance changes as well?

 

Edited by matt77hias

Share this post


Link to post
Share on other sites
Advertisement

I odn't know about the API at all, but RT means "real-time", you can schedule and run hard real-time tasks on the machine, where 'hard real-time' means it's some sort of disaster if you don't meet the deadline.

Don't think you need that in a game :)

 

Share this post


Link to post
Share on other sites
4 minutes ago, Endurion said:

WinRT is the new Windows Runtime. It's a base for UWP apps.

Do the same restrictions with regard to the swap chain configuration as for UWP hold?

Given that I do not intend of creating UWP applications, does it make sense to use WinRT?

Share this post


Link to post
Share on other sites

I haven't used WinRT myself, so I can't answer those questions sorry.

I guess since WinRT is rather the groundwork around everything else the same restrictions for UWP and the swap chain apply there as well.


From the looks it can also be used to make non UWP apps/games.

Share this post


Link to post
Share on other sites
5 hours ago, matt77hias said:

What are the benefits of switching from C++/CX to C++/WinRT? Is it just a "more modern" C++ API or are their functionality and/or performance changes as well?

 

 

4 hours ago, matt77hias said:

Given that I do not intend of creating UWP applications, does it make sense to use WinRT?

It's hard to answer that without knowing what your goals are.

Share this post


Link to post
Share on other sites

I think the main benefit of using C++/WinRT is you don't have to rely on non-standard language feature/extension (CX). That means you can share the code with some other platform, use the existing code with UWP app, and any C++ developer can write UWP apps without having to learn CX which is not available in other platform.

That said, I haven't tried C++/WinRT yet (although I have a UWP app). 

Share this post


Link to post
Share on other sites
9 hours ago, ChaosEngine said:

It's hard to answer that without knowing what your goals are.

Basically, I like to switch without any performance decreases or functionality limitations.

The statement:

Quote

The With C++/WinRT, you can author and consume Windows Runtime APIs using any standards-compliant C++17 compiler.

also indicates greater flexibility with regard to other C++ compilers. 

MSDN provides some simple guidelines to perform the switch, but these seem to be true small to suffice.

14 hours ago, matt77hias said:

C++/CX

Currently, I do not use C++/CX, but just unmanaged C++.

But Wikipedia mentions:

Quote

C++/WinRT is now Microsoft's recommended replacement for both the Windows Runtime C++ Template Library (WRL), and for C++/CX.

So this holds for both unmanaged C++ and the weird looking C++/CX (e.g., added ^ syntax elements).

Share this post


Link to post
Share on other sites

C++/WinRT is more a replacement for the older Windows APIs in Windows.h, hence "any standards-compliant C++17 compiler" rather than one with special managed extensions. Language integration is done by sticking with plain C calls (like PInvoke) or COM "do the vtable and other c++ features this way" (which I don't think the C++ language specifies but OK...). They do seem to be trying to hide the COM though in the header classes.

https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt

Quote

C++/WinRT is an entirely standard modern C++17 language projection for Windows Runtime (WinRT) APIs, implemented as a header-file-based library, and designed to provide you with first-class access to the modern Windows API.

...

Language projections

The Windows Runtime is based on Component Object Model (COM) APIs, and it's designed to be accessed through language projections. A projection hides the COM details, and provides a more natural programming experience for a given language.

 

 

 

15 hours ago, Endurion said:

Based on their explanation it seems to boast better performance.

I don't see any performance claim on that linked Microsoft page (https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/) in regards to normal C++, only that C++ is faster than "any other language option for the Windows Runtime" (C#, etc.)?

The only performance gain maybe is if the newer API's made some improvements (less calls, avoid extra buffer copies, std::string/etc. integration) or complete replacements (not sure if there are any. Not seen any plan to replace Direct3D, XAudio2, or even force people off Vulkan etc. in favour of some new WinRT low level API).

 

EDIT: Pretty sure it actually is just another COM API.

Edited by SyncViews
Added quotes. It is just COM.

Share this post


Link to post
Share on other sites
24 minutes ago, SyncViews said:

EDIT: Pretty sure it actually is just another COM API.

At first glance, the WRL to WinRT mapping seems just like a bijection. But I have nothing against another COM facade.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!