Port Direct3D?
Port Direct3D?
Would it be possible to port Direct3D to my OS?
I could port OpenGL, then make all the D3D functions as wrappers that call corresponding OpenGL functions.
Now that would annoy Microsoft.
I could port OpenGL, then make all the D3D functions as wrappers that call corresponding OpenGL functions.
Now that would annoy Microsoft.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Port Direct3D?
ReactX works that way.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Port Direct3D?
Oh nice... I must check out ReactOS.Love4Boobies wrote:ReactX works that way.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Port Direct3D?
Question is, why would you want that? If graphics is all about speed, putting layer on top of layer of wrappers isn't going to make it faster.
Learn to read.
Re: Port Direct3D?
The problem is not porting the interface, but having appropriate drivers underneath it. Of course, you could port MESA for having a software rasterizer at least, but well…BMW wrote:Would it be possible to port Direct3D to my OS?
I could port OpenGL, then make all the D3D functions as wrappers that call corresponding OpenGL functions.
Now that would annoy Microsoft.
If you do manage to have acceptable OpenGL support, you could also try to port wine.
Re: Port Direct3D?
Exactly. The reason I would want to port Direct3D is for compatibility, not speed.dozniak wrote:Question is, why would you want that? If graphics is all about speed, putting layer on top of layer of wrappers isn't going to make it faster.
My little brother suggested that I make an OS with just one program running - his favourite game (which uses Direct3D) so he could get better performance, so I was wondering whether that would be possible.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Port Direct3D?
Certainly it would be. Easiest way would be modifying Windows to boot directly into the desired program.BMW wrote:My little brother suggested that I make an OS with just one program running - his favourite game (which uses Direct3D) so he could get better performance, so I was wondering whether that would be possible.
If you want to write your own OS for that, well, it is possible, but you'd require at least the same level of driver support as Windows. Which is theoretically possible, but practically impossible, obviously.
Also, it'd be practically useless, since you'd barely gain any performance. Especially since most modern games are GPU-bound, which is a resource they can use basically exclusively (same goes for CPU, but for GPU it might be even more obvious).
Re: Port Direct3D?
If he disables all the trojans he downloaded from the web sites, together with the antivirus that keeps them at bay, performance might noticeably increase without ever writing a new operating system.BMW wrote:My little brother suggested that I make an OS with just one program running - his favourite game (which uses Direct3D) so he could get better performance, so I was wondering whether that would be possible.
Learn to read.
- Kazinsal
- Member
- Posts: 559
- Joined: Wed Jul 13, 2011 7:38 pm
- Libera.chat IRC: Kazinsal
- Location: Vancouver
- Contact:
Re: Port Direct3D?
An even better and much more efficient way to increase performance is acquiring better hardware.dozniak wrote:If he disables all the trojans he downloaded from the web sites, together with the antivirus that keeps them at bay, performance might noticeably increase without ever writing a new operating system.BMW wrote:My little brother suggested that I make an OS with just one program running - his favourite game (which uses Direct3D) so he could get better performance, so I was wondering whether that would be possible.
Re: Port Direct3D?
If im not mistaken, theres a command line trick/glitch in safe mode to do this.XanClic wrote:Certainly it would be. Easiest way would be modifying Windows to boot directly into the desired program.BMW wrote:My little brother suggested that I make an OS with just one program running - his favourite game (which uses Direct3D) so he could get better performance, so I was wondering whether that would be possible.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
If you're new, check this out.
-
- Member
- Posts: 283
- Joined: Mon Jan 03, 2011 6:58 pm
Re: Port Direct3D?
Its actually easy than that, just open regedit and navigate to HKLM>Software>Microsoft>Windows NT>CurrentVersion>Winlogon and replace explorer.exe with whatever you want.m12 wrote:If im not mistaken, theres a command line trick/glitch in safe mode to do this.XanClic wrote:Certainly it would be. Easiest way would be modifying Windows to boot directly into the desired program.BMW wrote:My little brother suggested that I make an OS with just one program running - his favourite game (which uses Direct3D) so he could get better performance, so I was wondering whether that would be possible.
Or for a temporary solution, just open task manager, kill explorer and then File->New task to run only what you want.
- Monk
EDIT: The above is for Windows 7, tho it should be almost identical on other versions of windows.
Re: Port Direct3D?
Yeah... That's about it with my brother... no clue whatsoever. Installs anything and everything to try and get what he wants. Then asks me why there are all these gay toolbars in his browser.dozniak wrote: If he disables all the trojans he downloaded from the web sites, together with the antivirus that keeps them at bay, performance might noticeably increase without ever writing a new operating system.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Port Direct3D?
Sounds like my brother on my Google Account.BMW wrote:Yeah... That's about it with my brother... no clue whatsoever. Installs anything and everything to try and get what he wants. Then asks me why there are all these gay toolbars in his browser.dozniak wrote: If he disables all the trojans he downloaded from the web sites, together with the antivirus that keeps them at bay, performance might noticeably increase without ever writing a new operating system.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
If you're new, check this out.
- AndrewAPrice
- Member
- Posts: 2300
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: Port Direct3D?
Yes.. Kind of..BMW wrote:Would it be possible to port Direct3D to my OS?
I could port OpenGL, then make all the D3D functions as wrappers that call corresponding OpenGL functions.
Now that would annoy Microsoft.
Porting Direct3D to OpenGL:
It is possible. It's not as simple as simply wrapping functions though. 10 years ago, most Direct3D applications used what was called the Fixed Function Pipeline - you pass in textures, vertices, indices, configure the operators and lighting - call Draw() and away you go. Wrapping these Direct3D calls with OpenGL is trivial.
However, Direct3D 8.1 (2001) introduced shaders. Shaders are small programs that are executed on the GPU. At first, they were limited to pixel shaders (executed per pixel) and vertex shaders (executed per vertex) - you could run calculations on the GPU much faster than the CPU, and customize it with your own lighting, blending, or transformation algorithms. This is know as the Programmable Pipeline.
Shaders were optional in Direct3D 8.x and 9.x - there was still the Fixed Function Pipeline to fall back up, but within 5 years of their introduction they became near universal in most graphics applications, because of the flexibility and speed they provided. Direct3D 10 (2006) dropped support for the Fixed Function Pipeline completely. Everything was done in shaders. Over the years, new shader types have been introduced (geometry shaders, multiple types of tessellation shaders, computation shaders.)
Most of these shaders are written in a C-style language (HLSL for Direct3D and GLSL for OpenGL) and are compiled down to byte code representation that's specific to the API, and uploaded to the GPU (does the GPU execute this directly or the driver JITs it? I don't know.)
The problem is that Direct3D's shader byte code is incompatible with the byte code used by OpenGL. Many Direct3D to OpenGL wrappers either don't support the Programmable Pipeline/shaders - hence they allow you to play games from the early 2000s but fail with modern titles, or they spend a lot of time working on code that translates the bytecode from one representation to another. It's a large feat.
Emulating Direct3D
It's fully possible to emulate Direct3D. There are many drop in "d3d9.dll" solutions that will software emulate Direct3D. You still have the shader problem - some emulate the shader bytecode, commercial solutions may attempt to JIT the bytecode to machine language.
If you do want to write your own software wrapper for Direct3D I recommend you emulate Direct3D 10. Why? It's very barebones. They stripped all of the legacy fixed function stuff right out.. There is no need to deal with legacy lighting, blending, animation, transformation code out. It's all done in shaders now. For you, that means you just need to write a bytecode interpreter, some trivial code to load different types of data structures, and away you go.
Last edited by AndrewAPrice on Tue Aug 06, 2013 12:55 pm, edited 6 times in total.
My OS is Perception.
Re: Port Direct3D?
I would probably have a look at Wine, as it contains a DirectX implementation upon OpenGL.