FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DirectX 9.0c D bindings

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
lgguy



Joined: 06 Aug 2004
Posts: 4

PostPosted: Fri Aug 06, 2004 7:45 pm    Post subject: DirectX 9.0c D bindings Reply with quote

I am in the process of creating D modules compatible with the latest version of the DirectX SDK (the Summer 2004 update). I have already finished the Direct3D module (except for returned error codes) and am starting on D3DX. I would like to share my work with the community and have people contribute fixes. Several other people on this board have talked about doing their own conversions for things like OpenAL, etc (which I was planning on doing next). Should we combine our efforts and make it all part of Derelict, make a new project, or just post our modules in the new Bindings project? It just seems that people are duplicating their efforts in converting header files.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Aug 08, 2004 11:05 am    Post subject: Reply with quote

I'll happily integrate bindings into Derelict, provided that any dynamic libraries are loaded explicitly. That's how the bindings in Derelict differ from the others. I'm not just porting fucntion declarations and implicitly linking. I'm creating function pointers by hand and implementing functions to manually load dynamic libraries at runtime.

Regarding D3DX, that's not possible to bind to D AFAIK. Unless there's a tool to convert a static libratry to a format which can the Digital Mars linker accepts (which I haven't heard of).
Back to top
View user's profile Send private message Send e-mail
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sun Aug 08, 2004 1:31 pm    Post subject: Reply with quote

Does Direct3D use plain DLL's or COM? Either way D should be able to interoperate (but I think plain DLL's would be much easier).

aldacron wrote:
Regarding D3DX, that's not possible to bind to D AFAIK. Unless there's a tool to convert a static libratry to a format which can the Digital Mars linker accepts (which I haven't heard of).
If you mean that DMD won't work with the same .lib files that MSVC++ or Borland uses, you're absolutely right. But we can create our own. It isn't always easy, but some of these DMD-compatible .libs have already been created. This issue come up a couple of times:I'd be surprised is Direct3D is an exceptional case (unless it's not based on "normal" DLL's).

But since you're not using .lib files with Derelict, I guess my post is off-topic. Embarassed
Back to top
View user's profile Send private message AIM Address
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sun Aug 08, 2004 1:45 pm    Post subject: Re: DirectX 9.0c D bindings Reply with quote

lgguy wrote:
I would like to share my work with the community and have people contribute fixes.
Great!

lgguy wrote:
Should we combine our efforts and make it all part of Derelict, make a new project, or just post our modules in the new Bindings project? It just seems that people are duplicating their efforts in converting header files.
There is some duplication of effort, but some of it might be that people continue to download the DedicateD ports from the early days of D. Then they update them for today's DMD and upload the results somewhere.

The creator of DedicateD quit using D a couple years ago, but the pages haven't been updated. The files are still useful, but they have to be adjusted to get them compiled.
Back to top
View user's profile Send private message AIM Address
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Mon Aug 09, 2004 5:47 am    Post subject: Reply with quote

jcc7 wrote:
Does Direct3D use plain DLL's or COM? Either way D should be able to interoperate (but I think plain DLL's would be much easier).


D3D uses both. From the DLL, there's only one function you need to import: D3DCreateEx. That creates a D3D interface which acts as a factory for all other D3D objects. Every DiectX component has a similar setup, with the exception of DirectMusic. D3DCreateEx and its relatives in DDraw, DSound and DInput are just convenience wrappers for the usual COM steps (CoInitialize, CoCreateInstance, object->Initialize).

aldacron wrote:
Regarding D3DX, that's not possible to bind to D AFAIK. Unless there's a tool to convert a static libratry to a format which can the Digital Mars linker accepts (which I haven't heard of).
If you mean that DMD won't work with the same .lib files that MSVC++ or Borland uses, you're absolutely right. But we can create our own. It isn't always easy, but some of these DMD-compatible .libs have already been created. This issue come up a couple of times:I'd be surprised is Direct3D is an exceptional case (unless it's not based on "normal" DLL's).
[/quote]

The problem is not with D3D, but with D3DX. It's a utility library built on top of D3D which handles common tasks. For example, there's a texture loader, transformation operations for both right-handed and left-handed coordinate systems, etc... It's a *static* library - there is no DLL. A tool like implib won't work on it. D3DX is not required to use D3D, but it makes quite a few things simpler. I've debated if I should leave it out of Derelict entirely once I get to the D3D bindings, or if I should implement a replacement in D. The problem is, D3DX in its current form is highly optimized. I won't even pretend to believe I can match it for performance. I might be willing to give it a shot though, unless someone can figure out a way to link static VC++ libs with D apps.
Back to top
View user's profile Send private message Send e-mail
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Mon Aug 09, 2004 11:57 am    Post subject: Reply with quote

aldacron wrote:
The problem is not with D3D, but with D3DX. It's a utility library built on top of D3D which handles common tasks. For example, there's a texture loader, transformation operations for both right-handed and left-handed coordinate systems, etc... It's a *static* library - there is no DLL. A tool like implib won't work on it. D3DX is not required to use D3D, but it makes quite a few things simpler.
I didn't realize it was this complicated. I did a little Googling and I found some stuff that might be helpful.

From D:17619: "Wow, with that tool they can port api's over way faster than I can by hand! I'm extremely pleased to find the D3D9 interfaces fully ported over... they even got D3DX!". The website, he's referring to in written in Japanese, so I can't immediately see if D3DX is there, but I'm hopeful.

Also, I found some pages where people using Borland's compiler mentioned that the Microsoft .libs are unusable by them, but they have created their own versions. D3DX 9.0 for Borland is here.

I think there's a solution, but I don't know how hard it'd be or if anyone's tried it yet.
Back to top
View user's profile Send private message AIM Address
lgguy



Joined: 06 Aug 2004
Posts: 4

PostPosted: Mon Aug 09, 2004 3:18 pm    Post subject: Reply with quote

Sorry for not replying to everyone earlier, I got sick over the weekend. I just got an svn account so I will post what I have so far to the bindings project later today. As of right now, my code does not load the DLLs explicitly, but I would not be opposed to changing that (or accepting a patch that does that).

Yeah, I know about the whole COFF/OMF static library issue. However, I thought that someone out there started a project to use the Open Watcom linker and bintools with D. If I remember right, that linker can link both COFF and OMF libraries. If it can't, that might be another project that the community should think about. I have an excellent book by John R. Levine called Linkers & Loaders that details both the COFF and OMF object formats. I don't know why one couldn't write a linker to handle both COFF and OMF libraries so that we could directly use the libs that come with the Platform SDK.

Another possible solution to the above problem was suggested to me by a Borland tech support rep. I have never tried it so I don't know if it would work but... Basically, he suggested linking the static library with a DEF file that would create a DLL with the symbols exported. Then you create an import library with IMPLIB and go from there.

One more question for everybody, how do you all feel about license issues? I was going to use the LGPL so that the bindings can be used in open and proprietary apps but fixes and changes must be re-released to the community. Anyone have strong opinions one way or the other?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Tue Aug 10, 2004 4:14 am    Post subject: Reply with quote

lgguy wrote:

One more question for everybody, how do you all feel about license issues? I was going to use the LGPL so that the bindings can be used in open and proprietary apps but fixes and changes must be re-released to the community. Anyone have strong opinions one way or the other?


What I'm doing with Derelict is releasing each package under the same license as the library it binds. For D3D, I would have attached no license to it. I'm not a fan of GPL or LGPL at all, but prefer LGPL if I must choose. If I were to start a new project from scratch then I would opt for a BSD-style or ZLib license. I think forcing someone to open source their changes is just impractical for most cases.

For a D3D binding, I see no reason at all why it should be under LGPL (or any license really). After all, we're talking about bindings to a DLL and a translation of a few interfaces to D. I just fail to see any benefit from an LGPL license. Furthermore, the D code itself cannot be dynamically linked unless you compile the binding as a DLL. So where does that leave the user? In the case of SDL, I've released the bindings under the LGPL with the understanding that the license applies to the SDL DLL itself, and that the .d files are acting as headers (even though they are statically linked). D3D is not LGPL, so what does it mean if the bindings are? I'd say just forget a license and make it public domain.
Back to top
View user's profile Send private message Send e-mail
lgguy



Joined: 06 Aug 2004
Posts: 4

PostPosted: Fri Aug 13, 2004 12:04 am    Post subject: Reply with quote

Sorry about the delay, I have been busy with the end of the semester and my Subversion login was not working initially. Anyway, I put my preliminary module for D3D in the Bindings project. I also posted more detail on that board.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group