Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Sorry if this is a stupid question. What would it take to get DirectX on Linux?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • This topic is locked This topic is locked
25 replies to this topic

#1 Exodus111   Members   -  Reputation: 148

Like
0Likes
Like

Posted 31 October 2012 - 05:34 PM

Again sorry if this question is inane.

But I'm a gamer, the only reason I run Windows is because I have to to play Games on it.
If I could run windows games directly on a Linux OS, id go Ubuntu in a heartbeat.

The reason is ofc resources, Ive got a kickass computer, but I also play top of the line games at maximum settings, Id love to not have to run the massive Windows OS as well as the game I'm playing.

Which is why Wine, or any other form of box simulation makes no sense, I certainly don't want to run a Linux Os, an OS emulator, and a massive Windows OS under the game I'm playing.

So whats the deal? Why cant DirectX be made for Linux? I get that its illegal, but when has that stopped the open source community?

I take the Question to this forum to ask the experts, is there a technical reason why DirectX can NEVER be applied to another OS?
Is it simple impossible?

-Exo

Sponsor:

#2 Camilo   Members   -  Reputation: 189

Like
5Likes
Like

Posted 31 October 2012 - 07:17 PM

Wine is not an emulator.
That is, it doesn't emulate the bare hardware (the "box"), instead it reimplements the required windows libraries. So, in principle, it can be as fast as native Windows.. I don't know if DX in particular has been reimplemented or if the windows version is used on top of a more low-level interface.

I get that its illegal, but when has that stopped the open source community?


[citation needed] on that being illegal. IANAL, but I wouldn't see why. Also, most of the OSS community, and in particular the free software movement, base all their claims (think open licenses) on legal bases, so I think you have the wrong impression of them.

EDIT: I realized I wasn't being very helful above. If I were you I would try wine. Or the commercialy supported version of it, "CrossOver".

Edited by Camilo, 31 October 2012 - 07:19 PM.


#3 Asesh   Members   -  Reputation: 268

Like
1Likes
Like

Posted 31 October 2012 - 07:52 PM

Why cant DirectX be made for Linux?
That's because of Microsoft. Anyways, there are so many games out there that are still written in OpenGL. Even the final version of Steam will soon head to Linux :)

#4 Exodus111   Members   -  Reputation: 148

Like
0Likes
Like

Posted 31 October 2012 - 08:54 PM

Wine being as fast as Windows, would still mean id have to run windows, as well as running Ubuntu AND my game.
So while playing that is still one OS too many.

Everyone thought OpenGL would crush DirectX due to its open source nature, but ppl fail to realize the importance of the gaming community as a way to maintain OS monopoly, Microsoft didnt. Consider Games for Windows, this was way before Microsoft made any game, it was merely a marketing incentive for developers to keep making Windows games.

So am I to understand that the reason here is the legality, its proprietary software, Microsoft will sue, therefore its not done?
Is that It?
Or is there a more technical reason why its has not even been attempted since Windows 95?

-Exo

#5 mhagain   Crossbones+   -  Reputation: 8156

Like
6Likes
Like

Posted 31 October 2012 - 09:28 PM

OpenGL isn't open source - an OpenGL implementation can be quite as proprietary as D3D (vendor specific extensions can make it even more so).

All that DirectX is is an interface between your program and the graphics hardware. That means it needs at least two components - the DirectX runtime that provides the common interface, and a hardware-specific driver that understands the interface and understands how to control the hardware with it (simplified explanation). Some parts of it are Windows-specific, such as the ties to the windowing system when creating a D3D device, but assuming that they can be sensibly emulated (e.g. by stuffing a pointer to the appropriate struct into a HWND) there is no good purely technical reason why it couldn't be implemented on any OS. However doing so wouldn't just require someone to implement the runtime; it would also require contributions from the hardware vendors to provide a driver.

It goes like this (again, simplified):
- Program makes a D3D call.
- Runtime takes that call and converts it to a lower-level representation.
- Vendor-specific driver takes that lower-level representation and passes it on to the hardware.
- Hardware actually does the drawing.

Where things break down is in transition from the second to third step, and in the third step itself. That's where it gets into vendor-specific stuff, and that's where the open source community on it's own can do nothing.

Right now the WINE approach of implementing it on top of OpenGL seems a more sensible route, at least one that's more likely to actually produce a result, as it sidesteps the need for vendors to provide a driver (there already is one - the OpenGL driver).

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#6 xoofx   Members   -  Reputation: 887

Like
3Likes
Like

Posted 31 October 2012 - 09:46 PM

There was an attempt two years ago with Gallium "Direct3D 10/11 Is Now Natively Implemented On Linux!", but not sure they have been working on it since then...

Edited by xoofx, 31 October 2012 - 09:46 PM.


#7 Exodus111   Members   -  Reputation: 148

Like
0Likes
Like

Posted 31 October 2012 - 11:46 PM

it would also require contributions from the hardware vendors to provide a driver.


Couldn't it instead point to an OpenGL driver... no wait I see the issue with that...

Ok thanks a lot mr. mhagain, and the rest of u for not laughing in my face but providing me with an honest straight forward answer to this.
Posted Image

-Exo

#8 MJP   Moderators   -  Reputation: 11605

Like
2Likes
Like

Posted 31 October 2012 - 11:54 PM

The stuff that goes on between a D3D11 app and the GPU is actually pretty complicated. There's the D3D runtime provided by Microsoft, the user-mode and kernel-mode components of the driver, and a complex display driver model that forms the backbone of DXGI and D3D11. You'd have to somehow replace all of that if you wanted a D3D11 app to run on Linux, which is a monumental task if you're not doing it with the help of the hardware vendors. Intercepting D3D calls and translating them into OpenGL is a lot easier, but less efficient. But even then it's not always a simple mapping between the two API's.

#9 L. Spiro   Crossbones+   -  Reputation: 14028

Like
9Likes
Like

Posted 01 November 2012 - 12:06 AM

Even if you got DirectX to run on Linux, that is hardly enough to run the game(s).
Games on Windows take input via a window’s message pump typically, which you would also have to emulate.
Which means you also have to emulate Windows’ windowing system itself and the message queue etc.

You would have to emulate WinSocks for any network games.

The executable itself won’t run natively on Linux. You would have to manually unpack (execute) it and somehow get its threads to start running.
Every API function they use from the Windows SDK would have to be replaced/emulated.


Basically you wouldn’t have a choice but to use a Windows emulator or something like Wine, at which point you are still running the Windows operating system and won’t see any improvement in performance.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#10 SimonForsman   Crossbones+   -  Reputation: 6189

Like
6Likes
Like

Posted 01 November 2012 - 02:12 AM

Again sorry if this question is inane.

But I'm a gamer, the only reason I run Windows is because I have to to play Games on it.
If I could run windows games directly on a Linux OS, id go Ubuntu in a heartbeat.

The reason is ofc resources, Ive got a kickass computer, but I also play top of the line games at maximum settings, Id love to not have to run the massive Windows OS as well as the game I'm playing.

Which is why Wine, or any other form of box simulation makes no sense, I certainly don't want to run a Linux Os, an OS emulator, and a massive Windows OS under the game I'm playing.

So whats the deal? Why cant DirectX be made for Linux? I get that its illegal, but when has that stopped the open source community?

I take the Question to this forum to ask the experts, is there a technical reason why DirectX can NEVER be applied to another OS?
Is it simple impossible?

-Exo


1) Wine is able to outperform Windows in many cases(Allthough it also falls very short from time to time), its not an emulator, its a re-implementation of the Windows APIs and effectivly tries to do the same job as the DX and Win32 APIs do on Windows, for Windows compatibility it really is the best solution(since there are tons of Windows system libraries that has to be re-implemented for full compatibility and Windows is a moving target). The alternative would be to go down the path of ReactOS and also re-implement the kernel interfaces in order to run Windows drivers but then it wouldn't be Linux anymore.

2) OpenGL provides the same features and equivalent performance as D3D or in the case of D3D9, better performance(or lower batch overhead really), D3D is not necessary in order to make games for any platform. (OpenGL only really fell out of favor because the ARB were so darn inefficient that it took years for key features to become standardized effectivly forcing developers who wanted to use OpenGL in AAA games to write separate codepaths for each hardware vendor) (This situation has improved greatly in recent years).

3) If you want performance in Linux you shouldn't use Ubuntu, it is reasonably bloated and its binaries are not optimized for modern CPUs (Windows also suffers from this problem), You should build from source with a new gcc version and -march=native (This will make your binaries unusable on older CPUs but allows them to take advantage of all the new instructions your CPU offers), or atleast use a distribution with a lightweight desktop enviroment.

From a legal point of view there is nothing preventing a DirectX version for Linux, APIs are not covered by copyright (atleast not according to the Oracle vs Google case), from a practical point of view it just isn't worth it, hardware vendors have nothing to gain by writing D3D drivers for Linux, the opensource drivers are so far behind performancewise that you'd get far better performance by using Wine with the proprietary drivers than you would with opensource D3D drivers (unless the opensource D3D drivers for some magical reason became much better than the opensource OpenGL drivers)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#11 3DModelerMan   Members   -  Reputation: 1025

Like
0Likes
Like

Posted 01 November 2012 - 09:15 AM

Wine will run DirectX9. I don't think it goes any higher than that. And I'm not sure about hardware acceleration.

#12 Khatharr   Crossbones+   -  Reputation: 3031

Like
1Likes
Like

Posted 01 November 2012 - 09:51 PM

If you're targeting Linux I'd really recommend just porting to OpenGL. If you want portability then you gotta make sure your code is structured in a way that's portable. Abstract your rendering, input, audio, etc from your game.

I know it's a matter of opinion but I like OpenGL a lot more than DirectX. That being said I usually end up using DirectX anyway because I'm hoping to get a job making games targeting the Windows platform.

le sigh...
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#13 abcdef44   Banned   -  Reputation: 2

Like
0Likes
Like

Posted 02 November 2012 - 12:40 AM

With more desktop users of Unix and mobiles DirectX will lose ground to OpenGL.

@ 3DModelerMan: Sure it does accel. 3D. I run perfectly Rage on Wine/Ubuntu.-
@ xoofx: Interesting, I didn't know about that.
@ SimonForsman: The fastest desktop is currently Gnome classic without effects. In my test it even outperforms a terminal desktop that hardly uses any resources at all. And yes it's also faster than Windows 8, I get around +6FPS in X-Plane with a GTX 460. So you suggest Gentoo? Never used but heard that it compiles apps at install?

Edited by abcdef44, 02 November 2012 - 03:57 AM.


#14 jbadams   Senior Staff   -  Reputation: 19070

Like
4Likes
Like

Posted 02 November 2012 - 05:57 AM

With more desktop users of Unix and mobiles DirectX will lose ground to OpenGL.

We've been hearing that from the open-source community for years, and there have been small gains and losses over time but no real significant shift -- I'll believe it when I actually see it happen. Posted Image

#15 mhagain   Crossbones+   -  Reputation: 8156

Like
0Likes
Like

Posted 02 November 2012 - 08:53 AM

I'm not sure that I like the idea of a 3D API being co-opted in an OS war here. Truth is that is if > 90% of a target market are on the same platform then you don't actually need an open standards API at all; you can use something quite proprietary and still get a result. That's real freedom - freedom to choose what works best for your project and what actually helps you to get stuff done without being constrained by artificial limitations such as "will it be portable?"

I likewise don't believe that desktop Unix is ever going to happen. There's an awful habit of infighting that is deeply embedded in Unix culture, has bubbled over into open source communities (which seem to have become more about Unix than they are about open source) and results in a splintered, fragmented set of platforms, multiple forks, multiple different and incompatible ways of accomplishing the same end result, each striving towards their own particular vision of technical perfection (it's an interesting exercise to compare that with the evolution of GL extensions). That's not conducive to widespread uptake; you spend more time trying to nail down a moving target than you spend actually getting productive work done. It's ironic, and particularly telling, that the major success of Unix uptake (outside of specialist/server areas) has been in a locked-down environment where you get what you're given and have to learn to be happy with it.

Edited by mhagain, 02 November 2012 - 08:55 AM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#16 abcdef44   Banned   -  Reputation: 2

Like
-2Likes
Like

Posted 03 November 2012 - 05:13 AM

I've read a trustful statistics for Switzerland in a newspaper ~1-2 years ago which showed MS market share to have dropped to ~78%. If I remeber correctly this was only
for desktop and servers, not even including mobiles.
The're are also some online sites stating that Linux has a share of ~1%, hahaha now this must be outdated by ~10 years at least.

#17 Khatharr   Crossbones+   -  Reputation: 3031

Like
-4Likes
Like

Posted 03 November 2012 - 05:37 AM

M$ is losing popularity but I doubt it will be Linux that takes the place of Windows if M$ goes under. I love the GNU community to death, but it's a sandbox. End users want completed products. If M$ gives up the desktop OS struggle their place will be taken by some other company that stands on he shoulders of giants (steals GNU work) and charges enormous sums of cash for defective and/or corporate-interest driven products.

Oops, did I talk bad about someone?

Edited by Khatharr, 03 November 2012 - 05:44 AM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#18 SimonForsman   Crossbones+   -  Reputation: 6189

Like
0Likes
Like

Posted 03 November 2012 - 07:48 AM

I've read a trustful statistics for Switzerland in a newspaper ~1-2 years ago which showed MS market share to have dropped to ~78%. If I remeber correctly this was only
for desktop and servers, not even including mobiles.
The're are also some online sites stating that Linux has a share of ~1%, hahaha now this must be outdated by ~10 years at least.


online statistics tend to count web browser usage shares, not marketshare or number of installations. Since the vast majority of Linux devices today are in the embedded and server markets they simply don't show up in the browser statistics. (Nor does machines that happen to run any good adblock browser plugin that also blocks the stat trackers)

Edited by SimonForsman, 03 November 2012 - 07:49 AM.

I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#19 abcdef44   Banned   -  Reputation: 2

Like
0Likes
Like

Posted 03 November 2012 - 07:52 AM

Yes, I only remember they said Linux to be strong on servers and Mac increasing on Desktops.

#20 MJP   Moderators   -  Reputation: 11605

Like
3Likes
Like

Posted 03 November 2012 - 12:18 PM

M$ is losing popularity but I doubt it will be Linux that takes the place of Windows if M$ goes under. I love the GNU community to death, but it's a sandbox. End users want completed products. If M$ gives up the desktop OS struggle their place will be taken by some other company that stands on he shoulders of giants (steals GNU work) and charges enormous sums of cash for defective and/or corporate-interest driven products.


Normally this is the sort of forum where we can have an adult discussion about a Microsoft product without having to insert a dollar sign into their name. Perhaps you could help keep it that way? Pretty please?

Edited by MJP, 03 November 2012 - 12:18 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS